|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jpicedt.format.input.util.Pool
public class Pool
Offers a means for expressions belonging to the parser-tree to share variables across the tree. In
addition to storing persistent data in some predefined public fields, this class also acts as a hashtable,
and may thus store key/value pairs of objects of any class (these may be PicAttributeSet
's,
etc…), which may be shared across the whole parser-tree.
Nested Class Summary | |
---|---|
static class |
Pool.Key<T>
Enforces use of strong typing for keys being pushed in the map . |
Field Summary | |
---|---|
static Pool.Key<PicAttributeSet> |
CURRENT_OBJ_ATTRIBUTES
Key used to fetch the attribute set attached to the current element "currentObj" |
PicGroup |
currentGroup
either the main drawing, or a subgroup ; each new parsed Element should be added to this group |
Element |
currentObj
Convenience used to share information (e.g. parameters, location, …) across expressions acting on the same element. |
StringBuffer |
notParsed
A string that stores commands that couldn't be parsed in the current context (e.g. in the text file to be parsed) so that we can keep track of these commands (e.g. to be able to include them again when it comes to saving the text file to disk) |
Stack<PicGroup> |
picGroupStack
A stack used to store the main drawing and its subgroups ; each time a "begin group" is encountered, the current PicGroup is pushed onto the stack, and a new PicGroup is instanciated, which then represents the current PicGroup ; the opposite operations are executed in the reverse order when a "end group" is found. |
Constructor Summary | |
---|---|
Pool()
Simply call reinit() |
Method Summary | ||
---|---|---|
|
get(Pool.Key<T> key)
Return the value associated with the given key |
|
PicAttributeSet |
getAttributeSet(Pool.Key<? extends PicAttributeSet> key)
Convenience for retrieving a "PicAttributeSet" value ; can be used in conjunction with static methods defined in jpicedt.graphic.model.StyleConstants to retrieve attributes values with less burden. |
|
|
put(Pool.Key<T> key,
T value)
Associates the specified value with the given key in the pool's hashmap |
|
void |
reinit()
Reset public fields values. |
|
|
setAttribute(Pool.Key<? extends PicAttributeSet> key,
PicAttributeName<T> name,
T value)
Add a name/value attribute pair to the attribute set with the given key, i.e. |
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public PicGroup currentGroup
public Stack<PicGroup> picGroupStack
public Element currentObj
public StringBuffer notParsed
public static final Pool.Key<PicAttributeSet> CURRENT_OBJ_ATTRIBUTES
get(jpicedt.format.input.util.Pool.Key)
Constructor Detail |
---|
public Pool()
Method Detail |
---|
public void reinit()
public <T> T put(Pool.Key<T> key, T value)
public <T> T get(Pool.Key<T> key)
public PicAttributeSet getAttributeSet(Pool.Key<? extends PicAttributeSet> key)
key
- if CURRENT_OBJ_ATTRIBUTES, retrieves the attribute set of the current Element in the pool ;
any other key is acceptable as long as it corresponds to a valid entry in the Pool's hashtable,
that is, it has been previously pushed in the Pool using put(key, value)
.public <T> void setAttribute(Pool.Key<? extends PicAttributeSet> key, PicAttributeName<T> name, T value)
public String toString()
toString
in class Object
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |