|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.lmu.ifi.dbs.elki.utilities.ConstantObject<D>
D
- Class self reference for Comparable
restrictionpublic abstract class ConstantObject<D extends ConstantObject<D>>
ConstantObject provides a parent class for constant objects, that are immutable and unique by class and name.
Field Summary | |
---|---|
private static Map<Class<?>,Map<String,ConstantObject<?>>> |
CONSTANT_OBJECTS_INDEX
Index of constant objects. |
private int |
hashCode
The cached hash code of this object. |
private String |
name
Holds the value of the property's name. |
Constructor Summary | |
---|---|
protected |
ConstantObject(String name)
Provides a ConstantObject of the given name. |
Method Summary | ||
---|---|---|
int |
compareTo(D o)
Two constant objects are generally compared by their name. |
|
boolean |
equals(Object o)
|
|
String |
getName()
Returns the name of the ConstantObject. |
|
int |
hashCode()
|
|
static
|
lookup(Class<D> type,
String name)
Provides a ConstantObject of specified class and name if it exists. |
|
protected Object |
readResolve()
Method for use by the serialization mechanism to ensure identity of ConstantObjects. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Map<Class<?>,Map<String,ConstantObject<?>>> CONSTANT_OBJECTS_INDEX
private final String name
private final int hashCode
Constructor Detail |
---|
protected ConstantObject(String name)
name
- name of the ConstantObjectMethod Detail |
---|
public String getName()
public static final <D extends ConstantObject<D>> D lookup(Class<D> type, String name)
D
- Type for compile time type checkingtype
- the type of the desired ConstantObjectname
- the name of the desired ConstantObject
protected Object readResolve()
public boolean equals(Object o)
equals
in class Object
Object.equals(Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
public int compareTo(D o)
this.getName().compareTo(o.getName()
.
compareTo
in interface Comparable<D extends ConstantObject<D>>
o
- Object to compare to.
Comparable.compareTo(java.lang.Object)
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |