Package org.goplanit.graph
Class GraphEntityImpl
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.graph.GraphEntityImpl
-
- All Implemented Interfaces:
Comparable<IdAble>
,GraphEntity
,ExternalIdAble
,IdAble
,ManagedId
- Direct Known Subclasses:
EdgeImpl
,EdgeSegmentImpl
,VertexImpl
public abstract class GraphEntityImpl extends ExternalIdAbleImpl implements GraphEntity
Base implementation for graph entity (edge, vertex, etc.)- Author:
- markr
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
GraphEntityImpl(long id)
Constructor.protected
GraphEntityImpl(GraphEntityImpl other, boolean deepCopy)
Copy constructorprotected
GraphEntityImpl(IdGroupingToken tokenId, Class<? extends GraphEntity> clazz)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract GraphEntityImpl
deepClone()
An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call.protected long
generateAndSetId(IdGroupingToken tokenId)
generate id based on provided token and class and set it on this instanceprotected static long
generateId(IdGroupingToken idGroupingToken, Class<? extends IdAble> clazz)
Generate an id based on provided token and classlong
recreateManagedIds(IdGroupingToken tokenId)
recreate the internal id(s) and set them including the Idable idabstract GraphEntityImpl
shallowClone()
Create a shallow copy of this entityString
toString()
-
Methods inherited from class org.goplanit.utils.id.ExternalIdAbleImpl
getExternalId, getXmlId, setExternalId, setXmlId
-
Methods inherited from class org.goplanit.utils.id.IdAbleImpl
equals, generateAndSetId, getId, hashCode, setId
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
appendExternalId, appendExternalId, getExternalId, getIdsAsString, getSplitExternalId, getSplitExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId, setXmlId
-
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, getId, idEquals, idHashCode
-
Methods inherited from interface org.goplanit.utils.id.ManagedId
getIdClass, resetChildManagedIdEntities
-
-
-
-
Constructor Detail
-
GraphEntityImpl
protected GraphEntityImpl(IdGroupingToken tokenId, Class<? extends GraphEntity> clazz)
Constructor- Parameters:
tokenId
- to useclazz
- to register for
-
GraphEntityImpl
protected GraphEntityImpl(long id)
Constructor. Note only to be used when entity is not reliant on an id generation procedure- Parameters:
id
- to use
-
GraphEntityImpl
protected GraphEntityImpl(GraphEntityImpl other, boolean deepCopy)
Copy constructor- Parameters:
other
- to copy fromdeepCopy
- when true, create a deep copy, shallow copy otherwise
-
-
Method Detail
-
generateAndSetId
protected long generateAndSetId(IdGroupingToken tokenId)
generate id based on provided token and class and set it on this instance- Parameters:
tokenId
- to use for id generation- Returns:
- created and set id
-
generateId
protected static long generateId(IdGroupingToken idGroupingToken, Class<? extends IdAble> clazz)
Generate an id based on provided token and class- Parameters:
idGroupingToken
- to useclazz
- to register for- Returns:
- generated id
-
recreateManagedIds
public long recreateManagedIds(IdGroupingToken tokenId)
recreate the internal id(s) and set them including the Idable id- Specified by:
recreateManagedIds
in interfaceManagedId
- Parameters:
tokenId
- to use (may be null in case managed id entity does not rely on token to recreate its managed id(s))- Returns:
- the updated internal id
-
shallowClone
public abstract GraphEntityImpl shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClone
in interfaceGraphEntity
- Specified by:
shallowClone
in interfaceIdAble
- Overrides:
shallowClone
in classExternalIdAbleImpl
- Returns:
- shallow copy of entity
-
deepClone
public abstract GraphEntityImpl deepClone()
An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call. To be used with caution if not called by managed id container related code- Specified by:
deepClone
in interfaceGraphEntity
- Specified by:
deepClone
in interfaceIdAble
- Overrides:
deepClone
in classExternalIdAbleImpl
- Returns:
- deep copy of entity
-
-