|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcox.jmatt.java.MathTools.graphing.RenderableImpl
public abstract class RenderableImpl
This abstract class provides a partial implementation of the Renderable
interface. It defines two constructors, one with no arguments and one
that takes a String. The second constructor sets a protected field (myName) that subclasses can use, if such is desirable. It also defines the setType()
method and provides a protected Object to hold its value. For subclasses that don't need condition testing, an empty testCondition()
method is
defined: it always returns false.
The setParameter()
method actually provides considerable power. It makes sure the String key used to store an Object is not null or blank,
and it provides an intuitive way to remove previously-set parameters. The return value is true if and only if: the key String is valid, a value was added
successfully, or one was removed successfully. It returns false if the key is null or empty, an add fails, or there was no existing mapping to remove.
This class does NOT define a render()
method since that method cannot have a sensible default.
Field Summary | |
---|---|
protected java.lang.String |
myName
This String is assigned from the one-argument constructor (String). |
protected java.util.Hashtable<java.lang.String,java.lang.Object> |
myParameters
This Hashtable holds parameter key-value pairs. |
protected java.lang.Object |
myType
This is the Object set via the setType() method. |
Constructor Summary | |
---|---|
RenderableImpl()
Create an unnamed instance. |
|
RenderableImpl(java.lang.String pName)
Create a named instance. |
Method Summary | |
---|---|
boolean |
setParameter(java.lang.String pKey,
java.lang.Object pValue)
This method applies some processing to its function. |
boolean |
setType(java.lang.Object pType)
Set the value of the 'myType' field. |
boolean |
testCondition(java.lang.Object pCondition,
java.lang.Object pValue)
This is an empty method. |
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 |
---|
render |
Field Detail |
---|
protected java.lang.String myName
protected java.lang.Object myType
setType()
method. No verification or filtering is done. The default value is null.
protected java.util.Hashtable<java.lang.String,java.lang.Object> myParameters
Hashtable
holds parameter key-value pairs. The setParameter()
method ensures no keys or values will be null. Upon creation
this field contains an empty table. Subclasses should NOT EVER assign it to be null, otherwise setParameter()
will begin throwing nasty
NullPointerExceptions!
Constructor Detail |
---|
public RenderableImpl()
public RenderableImpl(java.lang.String pName)
Method Detail |
---|
public boolean setType(java.lang.Object pType)
setType
in interface Renderable
pType
- The 'type' of Renderable being used.
public boolean testCondition(java.lang.Object pCondition, java.lang.Object pValue)
testCondition
in interface Renderable
pCondition
- The condition to test against the value.pValue
- The value against which the condition is to be checked.
public boolean setParameter(java.lang.String pKey, java.lang.Object pValue)
setParameter
in interface Renderable
pKey
- The name of the Object to add or remove. Must not be null or blank.pValue
- The Object to add or null to remove.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |