public class TLspLabelID extends Object
Class used to uniquely identify a label. A label is specified by its layer, paint representation, domain object, and a sublabel ID.
The sublabel ID is an object that uniquely identifies a label within the set of all
labels of a domain object. It should be immutable, and properly implement equals()
and
hashCode()
. Typical sublabel IDs would be a String
or Integer
object. This object should never be null
.
This class implement the equals
and hashCode
implementations,
so it can for example be used as a key in hash maps.
Constructor and Description |
---|
TLspLabelID(ILspLayer aLayer,
TLspPaintRepresentation aPaintRepresentation,
Object aDomainObject,
Object aSubLabelID)
Create a new label identifier using the labels' domain object and sublabel ID
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
This implementation of equals uses an index to compare label identifiers.
|
Object |
getDomainObject()
Returns the domain object of this label.
|
ILspLayer |
getLayer()
Returns the layer this label belongs to.
|
TLspPaintRepresentation |
getPaintRepresentation()
Returns the paint representation this label is for.
|
Object |
getSubLabelID()
Returns the sublabel ID used to identify a label.
|
int |
hashCode()
This implementation of hashCode uses the sublabel ID to create a hash code
for this label identifier.
|
String |
toString() |
public TLspLabelID(ILspLayer aLayer, TLspPaintRepresentation aPaintRepresentation, Object aDomainObject, Object aSubLabelID)
aLayer
- the layer to which the domain object of the label belongs.aPaintRepresentation
- the paint representation stateaDomainObject
- the domain object to which the label belongs.aSubLabelID
- the Object that can be used to differentiate between
multiple labels of the same domain object.
This object can be used as a cache key, and shouldn't
contain references to e.g. domain objects, layers or views.
This object should never be null
.public ILspLayer getLayer()
public TLspPaintRepresentation getPaintRepresentation()
public Object getDomainObject()
public Object getSubLabelID()
Returns the sublabel ID used to identify a label. This sublabel ID is used to differentiate between multiple labels for the same domain object.
The sublabel ID is an object that uniquely identifies a label within the set of all
labels of a domain object. It should be immutable, and properly implement equals()
and
hashCode()
. Typical sublabel IDs would be a String
or Integer
object. This object should never be null
.
Note: This object can be used as a cache key, and should not contain references to for example domain objects, layers or views, as this could cause memory leaks.
public boolean equals(Object o)
==
) as the domain object
of the other label identifier.public int hashCode()
System.identityHashCode
) of the domain object and the layer.