g2d.identity
Class NamedThing
java.lang.Object
g2d.identity.NamedThing
- Direct Known Subclasses:
- Essence
public abstract class NamedThing
- extends java.lang.Object
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
Field Summary |
protected java.lang.String |
name
|
Constructor Summary |
NamedThing(java.lang.String name)
Construct a named thing. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
name
protected java.lang.String name
NamedThing
public NamedThing(java.lang.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 java.lang.String getName()
compareTo
public int compareTo(NamedThing nt)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object