org.pz.platypus.commandTypes
Class FontFamily

java.lang.Object
  extended by org.pz.platypus.commandTypes.FontFamily
All Implemented Interfaces:
ICommand

public class FontFamily
extends java.lang.Object
implements ICommand

handles processing of the font family of commands

Author:
alb

Field Summary
private static CommandFamilyParser commandParser
           
private  ParamType parameterType
           
private  java.lang.String root
           
private  TokenType tokType
           
private  boolean validInCode
           
 
Constructor Summary
FontFamily()
           
 
Method Summary
(package private)  int findCommandClose(ParseContext context)
          Finds the rough end of a command.
 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.
 TokenType getTokenType()
           
(package private)  void insertOriginalLexeme(TokenList tl, java.lang.String origLexeme)
          In cases where the current token is an expanded form of a shorthand command, this routine replaces the lexeme in the processed token with the original shorthand that the user wrote.
 boolean isAllowedInCode()
          Is this command processed or ignored in a code listing?
 int process(GDD gdd, ParseContext context, TokenList tl, boolean inCode)
          Processes the command and returns the number of chars in the lexeme.
 int processSubstitute(ParseContext context, TokenList tl, boolean inCode, GDD gdd, java.lang.String subst)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

private java.lang.String root

parameterType

private ParamType parameterType

validInCode

private boolean validInCode

tokType

private TokenType tokType

commandParser

private static CommandFamilyParser commandParser
Constructor Detail

FontFamily

public FontFamily()
Method Detail

process

public int process(GDD gdd,
                   ParseContext context,
                   TokenList tl,
                   boolean inCode)
Processes the command and returns the number of chars in the lexeme.

Specified by:
process in interface ICommand
Parameters:
tl - TokenList to which the generated tokens are added
inCode - Are we currently in a code section?
gdd - the GDD
context - the parsing context
Returns:
number of chars to skip to get past the command string in the input. If negative, means an error occurred.

processSubstitute

public int processSubstitute(ParseContext context,
                             TokenList tl,
                             boolean inCode,
                             GDD gdd,
                             java.lang.String subst)

insertOriginalLexeme

void insertOriginalLexeme(TokenList tl,
                          java.lang.String origLexeme)
In cases where the current token is an expanded form of a shorthand command, this routine replaces the lexeme in the processed token with the original shorthand that the user wrote.

Parameters:
tl - token list
origLexeme - the original shorthand lexeme

findCommandClose

int findCommandClose(ParseContext context)
Finds the rough end of a command. Note: does not have to be the exact end, as long as it's not past the end of the command. The point is to write some portion of the command out as text, so this picks up the entire command in nearly all cases. In those where it doesn't, the remaining fragment will not be parsed as a command and so will later be written out by PlatypusParser as text as well, which is what we want.

Parameters:
context - the parsing context
Returns:
index of char in content where the command is thought to end

isAllowedInCode

public boolean isAllowedInCode()
Description copied from interface: ICommand
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

getParamType

public ParamType getParamType()
Description copied from interface: ICommand
what kind of argument, if any, does the command take?

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

getRoot

public java.lang.String getRoot()
Description copied from interface: ICommand
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()
Description copied from interface: ICommand
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

getTokenType

public TokenType getTokenType()


Copyright © 2008-10 Pacific Data Works LLC