Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jpicedt.graphic.io.parser
Class Pool  view Pool download Pool.java

java.lang.Object
  extended byjpicedt.graphic.io.parser.Pool

public class Pool
extends java.lang.Object

Offers a means for expressions belonging to the parser-tree to share variables across the tree.


Nested Class Summary
static class Pool.Key
          Enforces use of strong typing for keys being put the map
 
Field Summary
static Pool.Key CURRENT_OBJ_ATTRIBUTES
          Key used to fetch the attribute set attached to the current element "currentObj"
 jpicedt.graphic.model.PicGroup currentGroup
          either the main drawing, or a subgroup ; each new parsed Element should be added to this group
 jpicedt.graphic.model.Element currentObj
          Convenience used to share information (e.g.
private  java.util.HashMap map
           
 java.lang.StringBuffer notParsed
          a string that stores commands that couldn't be parsed in the current context (e.g.
 java.util.Stack picGroupStack
          a fifo-like 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()
           
 
Method Summary
 java.lang.Object get(Pool.Key key)
          Return the value associated with the given key
 jpicedt.graphic.model.PicAttributeSet getAttributeSet(Pool.Key key)
          Convenience for retrieving a "PicAttributeSet" value ; can be used in conjunction with jpicedt.graphic.model.StyleConstants static methods to retrieve attributes values with less burden.
 double getDouble(Pool.Key key)
          Convenience for retrieving a "double" value
 double put(Pool.Key key, double d)
          Convenience for store a "double" value
 java.lang.Object put(Pool.Key key, java.lang.Object value)
          Associates the specified value with the given key in the pool
 void reinit()
           
 void setAttribute(Pool.Key key, jpicedt.graphic.model.PicAttributeName name, java.lang.Object value)
          Add a name/value attribute pair to the attribute set with the given key, i.e.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

currentGroup

public jpicedt.graphic.model.PicGroup currentGroup
either the main drawing, or a subgroup ; each new parsed Element should be added to this group


picGroupStack

public java.util.Stack picGroupStack
a fifo-like 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.


currentObj

public jpicedt.graphic.model.Element currentObj
Convenience used to share information (e.g. parameters, location, ...) across expressions acting on the same element. Generally, an InstanciationExpression reinits "currentObj" to an instance of an Element of the proper type, then ensuing expression modify this element's attributes and/or geometry.


notParsed

public java.lang.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)


CURRENT_OBJ_ATTRIBUTES

public static final Pool.Key CURRENT_OBJ_ATTRIBUTES
Key used to fetch the attribute set attached to the current element "currentObj"


map

private java.util.HashMap map
Constructor Detail

Pool

public Pool()
Method Detail

reinit

public void reinit()

put

public java.lang.Object put(Pool.Key key,
                            java.lang.Object value)
Associates the specified value with the given key in the pool


get

public java.lang.Object get(Pool.Key key)
Return the value associated with the given key


getDouble

public double getDouble(Pool.Key key)
Convenience for retrieving a "double" value


put

public double put(Pool.Key key,
                  double d)
Convenience for store a "double" value


getAttributeSet

public jpicedt.graphic.model.PicAttributeSet getAttributeSet(Pool.Key key)
Convenience for retrieving a "PicAttributeSet" value ; can be used in conjunction with jpicedt.graphic.model.StyleConstants static methods to retrieve attributes values with less burden.


setAttribute

public void setAttribute(Pool.Key key,
                         jpicedt.graphic.model.PicAttributeName name,
                         java.lang.Object value)
Add a name/value attribute pair to the attribute set with the given key, i.e. either CURRENT_OBJ_ATTRIBUTES for "currentObj", or any other key for a Pool's shared attribute set (e.g. PsTricks registers,...)


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).