cox.jmatt.java.MathTools.graphing
Interface Renderable

All Known Subinterfaces:
Axis, Graphable, GraphPaper, Polygon
All Known Implementing Classes:
AxisXML, GraphablePDK, GraphableXML, GraphPaperPDK, GraphPaperXML, NOAxis, NOGraphable, NOGraphPaper, NOPolygon, NORenderable, PolygonXML, RenderableImpl, RenderableXML

public interface Renderable

This is the base interface for anything that might appear on a (complete!) graph. It serves as the base interface for all other graph components but will not likely be included in its own right. This is an assumption, however, and not a fact!

NOTE: This class has no connection with any other Java class containing the word 'render'! It is used here in the sense of 'something rendered onto a sheet of graph paper.' That is, the usage context for 'render' is 'draw' or 'drawn.'

The Rendering Context

The Rendering Context Object is provided as a way for an application to pass last-second (or later) data to the rendering process. No specific definition is required, the Context is supplied as a way to pass configuration data or other such information to a graph as it is being rendered.

Implementations using a rendering context are responsibile for detailing what is needed and making it available to the classes requiring it. If the requirements are not strict, a GraphKeys object can be used.


Method Summary
 java.lang.Object render(java.lang.Object pContext)
          This method is the raison d'etre for the Renderable interface.
 boolean setParameter(java.lang.String pKey, java.lang.Object pValue)
          This method provides a very general way to configure any type of Renderable.
 boolean setType(java.lang.Object pType)
          Set the type of Renderable this is.
 boolean testCondition(java.lang.Object pCondition, java.lang.Object pValue)
          Test the Renderable to see whether or not a particular condition exists.
 

Method Detail

render

java.lang.Object render(java.lang.Object pContext)

This method is the raison d'etre for the Renderable interface. Calling render() finishes the graphing process. The Object returned is then ready for graphing. That is to say, it is ready to be fed into the external application that actually generates the graph; once this method is called MathTools' responsibility is finished. No further interaction with the returned Object is required!

Parameters:
pContext - The Context Object to be used for rendering.
Returns:
The graph-ready Object, requiring no further MathTools interaction.

setType

boolean setType(java.lang.Object pType)
Set the type of Renderable this is. The exact meaning of 'type' and how (or IF) it is used are implementation-dependent.

Parameters:
pType - The 'type' of Renderable being used.
Returns:
true if setting this renderable to pType makes sense, false otherwise.

setParameter

boolean setParameter(java.lang.String pKey,
                     java.lang.Object pValue)
This method provides a very general way to configure any type of Renderable. The only absolute restriction is that the name of the parameter being set is not empty or null. It is the responsibility of the implementation to define what parameters are settable in which components.

Parameters:
pKey - The name of the parameter being set. Must not be null or empty.
pValue - The value of the parameter to set.
Returns:
true if the parameter is set properly, false if it did not make sense or could not be set.

testCondition

boolean testCondition(java.lang.Object pCondition,
                      java.lang.Object pValue)
Test the Renderable to see whether or not a particular condition exists. Exactly what these conditions are and how they are used depend on the implementation; this method is defined to allow a uniform way to check them.

Parameters:
pCondition - The condition to test against the value.
pValue - The value against which the condition is to be checked.
Returns:
true if the test succeeds, false otherwise.