org.acm.seguin.print.xml
Class State

java.lang.Object
  extended by org.acm.seguin.print.xml.State
Direct Known Subclasses:
AttributeState, AttributeValueState, QuoteAttributeValueState, TagState, TextState

public abstract class State
extends java.lang.Object

State pattern that is used to print the XML file

Author:
Chris Seguin

Field Summary
protected  java.awt.Color color
           
protected  java.awt.Font font
          the font
 
Constructor Summary
State()
          Constructor for the State object
 
Method Summary
abstract  java.awt.Font getFont()
          Gets the Font attribute of the State object
 int getFontSize()
          Gets the FontSize attribute of the State object
 java.awt.Graphics getGraphics()
          Gets the Graphics attribute of the State object
 int getX()
          Gets the X attribute of the State object
 int getY()
          Gets the Y attribute of the State object
protected  void initState(State next)
          Set the state for the next state
protected  void print(java.lang.StringBuffer buf)
          Prints the buffer
 State processLine(java.lang.String line)
          Processes a single line and returns the state that is in effect at the end of the line.
protected abstract  State processLine(java.lang.String line, int index, java.lang.StringBuffer buf)
          The actual worker method that processes the line.
 void setFontSize(int value)
          Sets the FontSize attribute of the State object
 void setGraphics(java.awt.Graphics value)
          Sets the Graphics attribute of the State object
 void setX(int value)
          Sets the X attribute of the State object
 void setY(int value)
          Sets the Y attribute of the State object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

font

protected java.awt.Font font
the font


color

protected java.awt.Color color
Constructor Detail

State

public State()
Constructor for the State object

Method Detail

setFontSize

public void setFontSize(int value)
Sets the FontSize attribute of the State object

Parameters:
value - The new FontSize value

setGraphics

public void setGraphics(java.awt.Graphics value)
Sets the Graphics attribute of the State object

Parameters:
value - The new Graphics value

setX

public void setX(int value)
Sets the X attribute of the State object

Parameters:
value - The new X value

setY

public void setY(int value)
Sets the Y attribute of the State object

Parameters:
value - The new Y value

getFontSize

public int getFontSize()
Gets the FontSize attribute of the State object

Returns:
The FontSize value

getFont

public abstract java.awt.Font getFont()
Gets the Font attribute of the State object

Returns:
The Font value

getGraphics

public java.awt.Graphics getGraphics()
Gets the Graphics attribute of the State object

Returns:
The Graphics value

getX

public int getX()
Gets the X attribute of the State object

Returns:
The X value

getY

public int getY()
Gets the Y attribute of the State object

Returns:
The Y value

processLine

public State processLine(java.lang.String line)
Processes a single line and returns the state that is in effect at the end of the line.

Parameters:
line - the line
Returns:
the state

processLine

protected abstract State processLine(java.lang.String line,
                                     int index,
                                     java.lang.StringBuffer buf)
The actual worker method that processes the line. This is what is defined by the various states

Parameters:
line - the line
index - the index of the character
buf - the buffer
Returns:
the state at the end of the line

initState

protected void initState(State next)
Set the state for the next state

Parameters:
next - the next state

print

protected void print(java.lang.StringBuffer buf)
Prints the buffer

Parameters:
buf - the buffer