cox.jmatt.java.MathTools.graphing.xml
Class AxisXML

java.lang.Object
  extended by cox.jmatt.java.MathTools.graphing.xml.RenderableXML
      extended by cox.jmatt.java.MathTools.graphing.xml.AxisXML
All Implemented Interfaces:
Axis, Renderable

public class AxisXML
extends RenderableXML
implements Axis

This class is the XML package's Axis implementation. When rendered, it generates an <Axis> tag with an optional ID attribute, name attribute, and type attribute, if these fields are defined. If no parameters are set the tag itself is empty: The scale and tick marks are represented as String attributes. If the Axis is created with its name specified, that becomes its name. The setType() method determines its type and the ID is supplied as the key when it is added to a GraphPaper.

All Object arguments are assumed to be String. This is enforced.


Field Summary
 
Fields inherited from class cox.jmatt.java.MathTools.graphing.xml.RenderableXML
myID, myName, myParams, myType
 
Constructor Summary
AxisXML()
          Standard constructor for an unnamed Axis.
AxisXML(java.lang.String pName)
          Constructor used to create a named Axis.
 
Method Summary
 java.lang.Object render(java.lang.Object pContext)
          Print this Axis as an XML tag.
 boolean setScale(java.lang.Object pScale)
          Set or clear the scale for this Axis.
 boolean setTickMarks(java.lang.Object pMarks)
          Set or clear the tick marks for this Axis.
 
Methods inherited from class cox.jmatt.java.MathTools.graphing.xml.RenderableXML
setID, setParameter, setType, testCondition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface cox.jmatt.java.MathTools.graphing.Renderable
setParameter, setType, testCondition
 

Constructor Detail

AxisXML

public AxisXML()
Standard constructor for an unnamed Axis.


AxisXML

public AxisXML(java.lang.String pName)
Constructor used to create a named Axis.

Method Detail

setScale

public boolean setScale(java.lang.Object pScale)
Set or clear the scale for this Axis. Setting null clears any previously-set value. This method returns true if its scale is not null, false if it is. If the scale is not defined it will not appear as an attribute when rendered.

Specified by:
setScale in interface Axis
Parameters:
pScale - The Object representing the scale used for this Axis.
Returns:
true if the pScale makes sense and is set, false otherwise.

setTickMarks

public boolean setTickMarks(java.lang.Object pMarks)
Set or clear the tick marks for this Axis. Setting null clears any previously-set value. This method returns true if pMarks is not null, false if it is. If this is not defined it will not appear as an attribute when rendered.

Specified by:
setTickMarks in interface Axis
Parameters:
pMarks - The Object representing the tick-mark configuration to be used for this Axis.
Returns:
true if pMarks makes sense, false otherwise.

render

public java.lang.Object render(java.lang.Object pContext)
Print this Axis as an XML tag. If name, type, scale, and tick marks are defined they appear as attributes with the same name (tick marks is tickMarks). If no parameters are set the tag is empty, otherwise it includes them as children. No context object is required or used. If ID is not defined it will be assigned automatically.

Specified by:
render in interface Renderable
Overrides:
render in class RenderableXML
Parameters:
pContext - The Context Object to be used for rendering.
Returns:
The graph-ready Object, requiring no further MathTools interaction.