diva.sketch.parser2d
Class TerminalConstituent

java.lang.Object
  |
  +--diva.sketch.parser2d.TerminalConstituent

public class TerminalConstituent
extends java.lang.Object
implements Constituent

A default implementation for a terminal constituent. Users of the package might want to reimplement this for space/time efficiency if they already have the type/bounds values in some other data structure and don't want to make a copy...

Version:
$Revision: 1.1 $

Field Summary
(package private)  java.awt.geom.Rectangle2D _bounds
          Store the bounds.
(package private)  java.lang.String _type
          The type (LHS) of this constituent.
 
Constructor Summary
TerminalConstituent(java.lang.String type, java.awt.geom.Rectangle2D bounds)
          Construct a termina constituent with the given type and bounds.
 
Method Summary
 boolean equals(java.lang.Object o)
          A customized equals implementation to enable parser memoization.
 java.awt.geom.Rectangle2D getBounds()
          Return the 2D bounding box of the constituent.
 java.lang.String getType()
          Return the type of the constituent (its LHS)
 int hashCode()
          A customized hash code implementation to enable parser memoization.
 java.lang.String toString()
          Return a string with the type.
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_bounds

java.awt.geom.Rectangle2D _bounds
Store the bounds.

_type

java.lang.String _type
The type (LHS) of this constituent.
Constructor Detail

TerminalConstituent

public TerminalConstituent(java.lang.String type,
                           java.awt.geom.Rectangle2D bounds)
Construct a termina constituent with the given type and bounds.
Method Detail

equals

public boolean equals(java.lang.Object o)
A customized equals implementation to enable parser memoization.
Overrides:
equals in class java.lang.Object

getBounds

public java.awt.geom.Rectangle2D getBounds()
Return the 2D bounding box of the constituent.
Specified by:
getBounds in interface Constituent

getType

public java.lang.String getType()
Return the type of the constituent (its LHS)
Specified by:
getType in interface Constituent

hashCode

public int hashCode()
A customized hash code implementation to enable parser memoization.
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Return a string with the type.
Overrides:
toString in class java.lang.Object