drvgraph.j2d
Class Rule

java.lang.Object
  extended by java.awt.geom.RectangularShape
      extended by java.awt.geom.Ellipse2D
          extended by java.awt.geom.Ellipse2D.Float
              extended by drvgraph.j2d.Rule
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable

public class Rule
extends java.awt.geom.Ellipse2D.Float
implements java.lang.Comparable

Represents the rule.
Rules consist of a body and a head. The former represents the "IF" part of the rule and consists of one or more atomic formulae, while the latter represents the "THEN" part of the rule and consists of a single atomic formula.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Ellipse2D
java.awt.geom.Ellipse2D.Double, java.awt.geom.Ellipse2D.Float
 
Field Summary
static java.lang.String DEFEASIBLERULE
          Defeasible rule type.
static java.lang.String DEFEATER
          Defeater rule type.
static java.lang.String STRICTRULE
          Strict rule type.
 
Fields inherited from class java.awt.geom.Ellipse2D.Float
height, width, x, y
 
Constructor Summary
Rule()
          Constructs an empty strict rule with no name.
Rule(java.lang.String ruleId)
          Constructs a new strict rule with a given name (rule ID).
Rule(java.lang.String ruleId, java.lang.String ruleType)
          Constructs a new rule with a given name (rule ID) and a specified rule type.
 
Method Summary
 int compareTo(java.lang.Object another)
          Compares this rule with a given rule.
 java.lang.String getRuleId()
          Returns the rule ID.
 java.lang.String getRuleType()
          Returns the rule type.
 boolean isSelected()
          Checks if the rule is selected.
 void paint(java.awt.Graphics g)
          Draws the rule circle.
 void setRuleId(java.lang.String ruleId)
          Sets the rule ID.
 void setRuleType(java.lang.String ruleType)
          Sets the rule type.
 void setSelected(boolean b)
          Sets the "selected" status of the rule.
 
Methods inherited from class java.awt.geom.Ellipse2D.Float
getBounds2D, getHeight, getWidth, getX, getY, isEmpty, setFrame, setFrame
 
Methods inherited from class java.awt.geom.Ellipse2D
contains, contains, equals, getPathIterator, hashCode, intersects
 
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, getPathIterator, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STRICTRULE

public static final java.lang.String STRICTRULE
Strict rule type.

See Also:
Constant Field Values

DEFEASIBLERULE

public static final java.lang.String DEFEASIBLERULE
Defeasible rule type.

See Also:
Constant Field Values

DEFEATER

public static final java.lang.String DEFEATER
Defeater rule type.

See Also:
Constant Field Values
Constructor Detail

Rule

public Rule()
Constructs an empty strict rule with no name.


Rule

public Rule(java.lang.String ruleId)
Constructs a new strict rule with a given name (rule ID). Each rule is defined uniquely by its name; therefore no two or more rules with the same name should exist.

Parameters:
ruleId - the string representing the rule ID

Rule

public Rule(java.lang.String ruleId,
            java.lang.String ruleType)
Constructs a new rule with a given name (rule ID) and a specified rule type. Each rule is defined uniquely by its name; therefore no two or more rules with the same name should exist.

Parameters:
ruleType - the string representing the rule type
ruleId - the string representing the rule ID
Method Detail

setSelected

public void setSelected(boolean b)
Sets the "selected" status of the rule. Its value can either be "true" or "false".

Parameters:
b - the "selected" status flag (true|false)

isSelected

public boolean isSelected()
Checks if the rule is selected.

Returns:
the rule "selected" status

paint

public void paint(java.awt.Graphics g)
Draws the rule circle.

Parameters:
g - the Graphics component that draws the rule circle
See Also:
Graphics

compareTo

public int compareTo(java.lang.Object another)
              throws java.lang.ClassCastException
Compares this rule with a given rule.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
another - the rule to compare this rule to
Returns:
the comparison outcome: 0 if the two rules 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.

getRuleId

public java.lang.String getRuleId()
Returns the rule ID.

Returns:
the string representing the rule ID

setRuleId

public void setRuleId(java.lang.String ruleId)
Sets the rule ID.

Parameters:
ruleId - the rule ID value to set.

getRuleType

public java.lang.String getRuleType()
Returns the rule type.

Returns:
the string representing the rule type

setRuleType

public void setRuleType(java.lang.String ruleType)
Sets the rule type.

Parameters:
ruleType - the rule type to set.