drvgraph.j2d
Class ClassPattern

java.lang.Object
  extended by java.awt.geom.RectangularShape
      extended by java.awt.geom.Rectangle2D
          extended by java.awt.Rectangle
              extended by drvgraph.j2d.ClassPattern
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable

public class ClassPattern
extends java.awt.Rectangle
implements java.lang.Comparable

Represents the class pattern. Class patterns express conditions on filtered subsets of instances of the specific class and are populated with one or more slot patterns.
Class patterns are associated with a class box and have a number of slot patterns, which are stored in a vector. Each slot pattern is stored in a separate line and is identified by the slot name.
Each class pattern is associated with four (4) points that represent:

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D
java.awt.geom.Rectangle2D.Double, java.awt.geom.Rectangle2D.Float
 
Field Summary
 
Fields inherited from class java.awt.Rectangle
height, width, x, y
 
Fields inherited from class java.awt.geom.Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
 
Constructor Summary
ClassPattern()
          Creates a class pattern with an empty vector of slot patterns.
ClassPattern(ClassBox cb, java.util.Vector<SlotPattern> sp)
          Creates a class pattern with a given associated class box and an initial vector of slot patterns.
ClassPattern(java.util.Vector<SlotPattern> sp)
          Creates a class pattern with a given initial vector of slot patterns.
 
Method Summary
 void addSlotPattern(SlotPattern sp)
          Adds the specified slot pattern to the end of the slot pattern vector, increasing its size by one.
 int compareTo(java.lang.Object anotherCp)
          Compares this class pattern with a given class pattern.
 ClassBox getClassBox()
          Returns the associated class box that contains the given class pattern.
 java.awt.Point getLeftPointNeg()
          Returns the negative "incoming" point of the class pattern.
 java.awt.Point getLeftPointPos()
          Returns the positive "incoming" point of the class pattern.
 java.awt.Point getRightPointNeg()
          Returns the negative "outgoing" point of the class pattern.
 java.awt.Point getRightPointPos()
          Returns the positive "outgoing" point of the class pattern.
 java.util.Vector<SlotPattern> getSlotPatterns()
          Returns the vector containing the slot patterns included in this class pattern.
 void paint(java.awt.Graphics g)
          Draws the class pattern.
 void removeSlotPattern(SlotPattern sp)
          Removes the specified slot pattern from the slot pattern vector, reducing its size by one.
 void setClassBox(ClassBox cb)
          Sets the associated class box that contains the given class pattern.
 void setLeftPointNeg(java.awt.Point leftPointNeg)
          Sets the negative "incoming" point of the class pattern.
 void setLeftPointPos(java.awt.Point leftPointPos)
          Sets the positive "incoming" point of the class pattern.
 void setRightPointNeg(java.awt.Point rightPointNeg)
          Sets the negative "outgoing" point of the class pattern.
 void setRightPointPos(java.awt.Point rightPointPos)
          Sets the positive "outgoing" point of the class pattern.
 void setSlotPatterns(java.util.Vector<SlotPattern> slotPatterns)
          Sets the slot pattern vector of this class pattern.
 
Methods inherited from class java.awt.Rectangle
add, add, add, contains, contains, contains, contains, createIntersection, createUnion, equals, getBounds, getBounds2D, getHeight, getLocation, getSize, getWidth, getX, getY, grow, inside, intersection, intersects, isEmpty, move, outcode, reshape, resize, setBounds, setBounds, setLocation, setLocation, setRect, setSize, setSize, toString, translate, union
 
Methods inherited from class java.awt.geom.Rectangle2D
add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union
 
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.Shape
contains, contains, contains, contains, getPathIterator, getPathIterator, intersects, intersects
 

Constructor Detail

ClassPattern

public ClassPattern()
Creates a class pattern with an empty vector of slot patterns.

See Also:
SlotPattern

ClassPattern

public ClassPattern(java.util.Vector<SlotPattern> sp)
Creates a class pattern with a given initial vector of slot patterns.

Parameters:
sp - the initial vector of slot patterns
See Also:
SlotPattern

ClassPattern

public ClassPattern(ClassBox cb,
                    java.util.Vector<SlotPattern> sp)
Creates a class pattern with a given associated class box and an initial vector of slot patterns.

Parameters:
cb - the associated class box
sp - the initial vector of slot patterns
See Also:
ClassBox, SlotPattern
Method Detail

getSlotPatterns

public java.util.Vector<SlotPattern> getSlotPatterns()
Returns the vector containing the slot patterns included in this class pattern.

Returns:
the slot pattern vector
See Also:
SlotPattern

setSlotPatterns

public void setSlotPatterns(java.util.Vector<SlotPattern> slotPatterns)
Sets the slot pattern vector of this class pattern.

Parameters:
slotPatterns - the slot pattern vector
See Also:
SlotPattern

addSlotPattern

public void addSlotPattern(SlotPattern sp)
Adds the specified slot pattern to the end of the slot pattern vector, increasing its size by one.

Parameters:
sp - the slot pattern to be added
See Also:
SlotPattern

removeSlotPattern

public void removeSlotPattern(SlotPattern sp)
Removes the specified slot pattern from the slot pattern vector, reducing its size by one. If the slot pattern is not included in the vector, then no changes take place.

Parameters:
sp - the slot pattern to be removed
See Also:
SlotPattern

getClassBox

public ClassBox getClassBox()
Returns the associated class box that contains the given class pattern.

Returns:
the associated class box
See Also:
ClassBox

setClassBox

public void setClassBox(ClassBox cb)
Sets the associated class box that contains the given class pattern.

Parameters:
cb - the associated class box
See Also:
ClassBox

paint

public void paint(java.awt.Graphics g)
Draws the class pattern. The number and size of the included slot patterns determines the final size of the class pattern.

Parameters:
g - the Graphics component that draws the class pattern
See Also:
Graphics, SlotPattern

compareTo

public int compareTo(java.lang.Object anotherCp)
              throws java.lang.ClassCastException
Compares this class pattern with a given class pattern.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
anotherCp - the class pattern to compare this class pattern to
Returns:
the comparison outcome: 0 if the two class patterns are identical, -1 otherwise
Throws:
java.lang.ClassCastException - A ClassCastException is thrown if the Object to compare this object to belongs to a different class.

getLeftPointPos

public java.awt.Point getLeftPointPos()
Returns the positive "incoming" point of the class pattern.

Returns:
the positive "incoming" point of the class pattern

setLeftPointPos

public void setLeftPointPos(java.awt.Point leftPointPos)
Sets the positive "incoming" point of the class pattern.

Parameters:
leftPointPos - the positive "incoming" point of the class pattern

getLeftPointNeg

public java.awt.Point getLeftPointNeg()
Returns the negative "incoming" point of the class pattern.

Returns:
the negative "incoming" point of the class pattern.

setLeftPointNeg

public void setLeftPointNeg(java.awt.Point leftPointNeg)
Sets the negative "incoming" point of the class pattern.

Parameters:
leftPointNeg - the negative "incoming" point of the class pattern

getRightPointPos

public java.awt.Point getRightPointPos()
Returns the positive "outgoing" point of the class pattern.

Returns:
the positive "outgoing" point of the class pattern

setRightPointPos

public void setRightPointPos(java.awt.Point rightPointPos)
Sets the positive "outgoing" point of the class pattern.

Parameters:
rightPointPos - the positive "outgoing" point of the class pattern.

getRightPointNeg

public java.awt.Point getRightPointNeg()
Returns the negative "outgoing" point of the class pattern.

Returns:
the negative "outgoing" point of the class pattern

setRightPointNeg

public void setRightPointNeg(java.awt.Point rightPointNeg)
Sets the negative "outgoing" point of the class pattern.

Parameters:
rightPointNeg - the negative "outgoing" point of the class pattern