|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.generic.constraint.ConstraintPool
All constraints that a ConstraintParser creates are pooled.
This means that parsing the same Constraint expressions more
than once will have the effect of the parser returning the same reference
for each distinct Constraint expression. This is a beneficial
mechanism if particular constraints get reused frequently and their references
are attached to a lot of different objects. In such a scenario, the memory
footprint is greatly minimized by the pooling feature implemented in this
class.
HashMap).
This resembles the flyweight pattern. Constraint support
the pooling functionality well, since their toString()
methods return canonical textual representations of the constraint.
| Method Summary | |
static void |
clear()
Clears the constraint pool by deleting all pooled items. |
static void |
dump()
Prints a dump of this pool to the standard-error output. |
static void |
dump(java.io.PrintStream stream)
Prints a dump of this pool to the specified PrintStream. |
static Constraint |
get(java.lang.String constraintDescription)
This method is called to get an instance of a pooled constraint |
static void |
pool(Constraint constraint)
This method is called to pool a constraint. |
static int |
size()
Returns the count of pooled constraints. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static final Constraint get(java.lang.String constraintDescription)
constraintDescription - the canonical description of the
constraint to return.
null.
public static final void pool(Constraint constraint)
constraint - the constraint to be pooled. It is not allowed to
specify null as an argument.
InvalidArgumentException - if null is given as an
argument.public static final void dump()
public static final void dump(java.io.PrintStream stream)
PrintStream.
stream - the PrintStream instance to use for output.public static final void clear()
public static final int size()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||