pla.data
Class NamedThing
java.lang.Object
pla.data.NamedThing
- All Implemented Interfaces:
- Comparable
- Direct Known Subclasses:
- Category, NodeThing, Setting
public abstract class NamedThing
- extends Object
- implements Comparable
Abstract class to define things that are distinguished
uniquely by their name. The name is set at construction
time and is used for testing of equality. The name must
be non-null and not empty (after trimming white-space),
otherwise runtime exceptions are thrown.
The named things are case-insensitive with respect to
equality and ordering.
- Author:
- linda
NamedThing
public NamedThing(String name)
- Construct a named thing. The given name must be non-null
and non-empty (after trimming), otherwise constructor throws
a
RuntimeException.
- Parameters:
name - String containing name
getName
public String getName()
compareTo
public int compareTo(Object o)
- Specified by:
compareTo in interface Comparable
toString
public String toString()
- Overrides:
toString in class Object
equals
public boolean equals(Object o)
- Overrides:
equals in class Object
hashCode
public int hashCode()
- Overrides:
hashCode in class Object