|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcox.jmatt.java.MathTools.graphing.Constraint
public class Constraint
This class exists to provide assistance and convenience when specifying limits, conditions, or constraints. A Constraint
consists of a Requirement
and a value against which that requirement is applied. The Requirement is in the form of a Requirement enum
constant and the value is an Object.
A Constraint
instance can be converted to String by its toString()
method (of course!) but this class also contains a static method
to parse such a string back into an instance. The format is fairly straightforward but should not be modified or created manually! Nested Constraint
s
are possible, but the innermost MUST have a non-Constraint data Object. There is no toXML()
method since the Constraint
class does not
have a pre-defined and specific place in the structure of a graph. This means implementations are responsible for handling them as needed. That is where the
parseFromString()
method comes into play: it re-creates a Constraint
from its Stringified value.
Nested Class Summary | |
---|---|
static class |
Constraint.Requirement
This enum is provided as a switch() -able way to designate specific conditions and their targeted value. |
Constructor Summary | |
---|---|
Constraint()
Create a Constraint in which the Condition is UNKNOWN and the values are null. |
|
Constraint(Constraint.Requirement pCondition,
java.lang.Object pValue)
Create a Constraint in which the Condition and value are both specified. |
|
Constraint(java.lang.String pCondition,
java.lang.Object pValue)
Create a Constraint from a String representation and an Object. |
Method Summary | |
---|---|
static Constraint.Requirement |
findRequirementByName(java.lang.String pName)
This method provides a safe way to get a Requirement. |
Constraint.Requirement |
getRequirementByName(java.lang.String pName)
Instance version of findRequirementByName() . |
static Constraint.Requirement |
match(java.lang.String pCondition)
Match a Requirement to a String. |
Constraint.Requirement |
matchRequirement(java.lang.String pCondition)
Instance version of match() . |
static Constraint |
parseFromString(java.lang.String pData)
This method parses the toString() value from a Constraint and creates a new Constraint from it. |
Constraint.Requirement |
requirement()
Fetch the value of this Constraint's Requirement. |
java.lang.String |
toString()
Convert this Constraint to a String. |
java.lang.Object |
value()
Fetch a reference to the value Object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Constraint()
public Constraint(Constraint.Requirement pCondition, java.lang.Object pValue)
public Constraint(java.lang.String pCondition, java.lang.Object pValue)
Method Detail |
---|
public Constraint.Requirement requirement()
public java.lang.Object value()
public static Constraint.Requirement findRequirementByName(java.lang.String pName)
public Constraint.Requirement getRequirementByName(java.lang.String pName)
findRequirementByName()
.
public static Constraint.Requirement match(java.lang.String pCondition)
public Constraint.Requirement matchRequirement(java.lang.String pCondition)
match()
.
public java.lang.String toString()
Constraint
to a String. The format is straightforward but must not be altered if the parseFromString()
method might
be needed. No XML-escaping is done so this should be done manually if it might appear in an XML document or if the value Object's String might contain
XML-dangerous content.
toString
in class java.lang.Object
public static final Constraint parseFromString(java.lang.String pData)
This method parses the toString()
value from a Constraint
and creates a new Constraint
from it. It should not be
used for any other purpose! There is no instance version.
WARNING: This method is brittle! Use only as directed if at all!!
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |