cox.jmatt.java.MathTools.graphing.Graph
Class GraphablePDK
java.lang.Object
cox.jmatt.java.MathTools.graphing.noop.NORenderable
cox.jmatt.java.MathTools.graphing.Graph.GraphablePDK
- All Implemented Interfaces:
- Graphable, Renderable
public class GraphablePDK
- extends NORenderable
- implements Graphable
This class supplies the graph part of the package. To create one, set an expression under the appropriate key. Parametric graphs require two expressions and
have two separate keys for the job. If the graph should not extend the entire ranges set in GraphPaper, the extents can be set using the addLimit()
method. It extends NORenderable
since it requires no external functionality.
Method Summary |
boolean |
addExpression(java.lang.String pKey,
java.lang.Object pExpr)
Add an expression to the graph. |
boolean |
addLimit(java.lang.String pKey,
java.lang.Object pValue)
This method is used for the 'From', 'To', and 'Steps' settings for the graph. |
java.lang.Object |
render(java.lang.Object pContext)
This method requires a GraphKeysPDK as a context object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GraphablePDK
public GraphablePDK()
- The only constructor.
addLimit
public boolean addLimit(java.lang.String pKey,
java.lang.Object pValue)
- This method is used for the 'From', 'To', and 'Steps' settings for the graph. The pKey argument must be one of these words and the pValue argument a
Number
instance. If pValue is not a Number the method returns false instantly. If pKey is not recognized nothing is set and the method returns
true.
- Specified by:
addLimit
in interface Graphable
- Parameters:
pKey
- A String used to identify the limit being added. Not required.pValue
- An Object representing the limit to be enforced.
- Returns:
- true if the limit makes sense and is added successfully, false otherwise.
addExpression
public boolean addExpression(java.lang.String pKey,
java.lang.Object pExpr)
- Add an expression to the graph. The key argument MUST be one of
Graphable.STANDARD_GRAPH, POLAR_GRAPH, PARAMETRIC_X, or PARAMETRIC_Y
. The
'pExpr' argument MUST be a String. For STANDARD graphs it is an expression in the variable 'x'. For POLAR and PARAMETRIC graphs it must be an expression
in the variable 't'. IMPORTANT NOTE: PARAMETRIC graphs require both an X and Y expression in 't'. If the key or value is blank or null the method
returns false. If the key is not recognized the method returns false. If the method returns true, something was set.
- Specified by:
addExpression
in interface Graphable
- Parameters:
pKey
- A String identifying the expression to be added. Usage is optional.pExpr
- The Object representing the graph-generating entity.
- Returns:
- true if the operation succeeds, false otherwise.
render
public java.lang.Object render(java.lang.Object pContext)
- This method requires a
GraphKeysPDK
as a context object. If it does not receive one, the return value will be blank.
- Specified by:
render
in interface Renderable
- Overrides:
render
in class NORenderable
- Parameters:
pContext
- The Context Object to be used for rendering.
- Returns:
- The graph-ready Object, requiring no further MathTools interaction.