pla.data
Class Rule
java.lang.Object
pla.data.NamedThing
pla.data.NodeThing
pla.data.Rule
- All Implemented Interfaces:
- Comparable
public class Rule
- extends NodeThing
Encapsulating a rule.
Rule objects are ordered in a special way.
If the two comparing names do not both start with Integers, simply
use case insensitive String ordering. Otherwise, it orders the
Strings according to the numerical order of the Integers at the
beginning, e.g., "4" comes before "10".
- Author:
- linda
|
Constructor Summary |
Rule(Rule r)
Construct a Rule as a clone of a given one. |
Rule(String name,
int ID)
Construct a Rule. |
Rule(String name,
int ID,
String longName)
Construct a Rule with an associated long name. |
Rule
public Rule(String name,
int ID)
- Construct a Rule. The given name must be non-null
and non-empty (after trimming), otherwise constructor throws
a
RuntimeException. Uses the name also as the
long name since it cannot be null.
- Parameters:
name - String containing nameID - numerical ID (used for identification)
Rule
public Rule(String name,
int ID,
String longName)
- Construct a Rule with an associated long name.
The given name must be non-nulland non-empty (after trimming),
otherwise constructor throws a
RuntimeException.
- Parameters:
name - String containing nameID - numerical ID (used for identification)longName - String containing a long name
Rule
public Rule(Rule r)
- Construct a Rule as a clone of a given one.
- Parameters:
r - Rule to be cloned
compareTo
public int compareTo(Object o)
- Specified by:
compareTo in interface Comparable- Overrides:
compareTo in class NodeThing
equals
public boolean equals(Object o)
- Overrides:
equals in class NodeThing