org.pz.platypus
Class Command

java.lang.Object
  extended by org.pz.platypus.Command
All Implemented Interfaces:
ICommand
Direct Known Subclasses:
Command0, CommandR, CommandS, CommandV

public abstract class Command
extends java.lang.Object
implements ICommand

The basic abstract class for all commands

Author:
alb

Field Summary
protected  ParamType parameterType
          what kind of parameter does this command take, if any?
protected  java.lang.String root
          the command root
protected  java.lang.String rootSubstitute
          the substitute root, if this command is shorthand for another
protected  boolean validInCode
          is this command executed in a listing or code section?
 
Constructor Summary
Command()
           
 
Method Summary
 ParamType getParamType()
          what kind of argument, if any, does the command take?
 java.lang.String getRoot()
          get the root of the command.
 java.lang.String getRootSubstitute()
          get a substitute string for the root.
 boolean isAllowedInCode()
          Is this command processed or ignored in a code listing?
 int notExecutedInCodeSection(java.lang.String command, TokenList tl, Source source, GDD gdd)
          Handles the situation in which a command that is not supported in a listing or code section is encountered while in one.
 int process(char[] input, int parsePoint, TokenList tl, boolean inCode, Source source, GDD gdd)
          method for processing this command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.pz.platypus.interfaces.ICommand
process
 

Field Detail

parameterType

protected ParamType parameterType
what kind of parameter does this command take, if any?


root

protected java.lang.String root
the command root


rootSubstitute

protected java.lang.String rootSubstitute
the substitute root, if this command is shorthand for another


validInCode

protected boolean validInCode
is this command executed in a listing or code section?

Constructor Detail

Command

public Command()
Method Detail

getRoot

public java.lang.String getRoot()
get the root of the command. For example, [fsize: in [fsize:12pt]

Specified by:
getRoot in interface ICommand
Returns:
the root as a string

getRootSubstitute

public java.lang.String getRootSubstitute()
get a substitute string for the root. This is null except in cases where the command is shorthand for a longer command string.

Specified by:
getRootSubstitute in interface ICommand
Returns:
the actual command string for which the current command is shorthand

getParamType

public ParamType getParamType()
what kind of argument, if any, does the command take?

Specified by:
getParamType in interface ICommand
Returns:
ParamType for the command

isAllowedInCode

public boolean isAllowedInCode()
Is this command processed or ignored in a code listing?

Specified by:
isAllowedInCode in interface ICommand
Returns:
boolean indicating whether command is/is not processed in a code listing

process

public int process(char[] input,
                   int parsePoint,
                   TokenList tl,
                   boolean inCode,
                   Source source,
                   GDD gdd)
method for processing this command. Note this is processing is not the processing that will occur in the output (*that* is done by the output plugin). This is the processing needed (if any) to determine the tokens to generate for this command.

Parameters:
input - the input chars (fron the Platypus file)
parsePoint - the point in the input where the command begins
tl - TokenList to which the generated tokens are added
inCode - Are we currently in a code section?
source - the file# and line# of the current input
gdd - the GDD
Returns:
number of chars to skip to get past the command string in the input. If negative, means an error occurred.

notExecutedInCodeSection

public int notExecutedInCodeSection(java.lang.String command,
                                    TokenList tl,
                                    Source source,
                                    GDD gdd)
Handles the situation in which a command that is not supported in a listing or code section is encountered while in one.

Parameters:
tl - TokenList being created by the parser
source - the current file# and line#
gdd - Global Document Data
command - the command string as it appeared in the input text
Returns:
the number of characters to advance the parser


Copyright © 2008-10 Pacific Data Works LLC