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 protectedGraphEntityImpl(long id)Constructor.protectedGraphEntityImpl(GraphEntityImpl other, boolean deepCopy)Copy constructorprotectedGraphEntityImpl(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 GraphEntityImpldeepClone()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 longgenerateAndSetId(IdGroupingToken tokenId)generate id based on provided token and class and set it on this instanceprotected static longgenerateId(IdGroupingToken idGroupingToken, Class<? extends IdAble> clazz)Generate an id based on provided token and classlongrecreateManagedIds(IdGroupingToken tokenId)recreate the internal id(s) and set them including the Idable idabstract GraphEntityImplshallowClone()Create a shallow copy of this entityStringtoString()-
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:
recreateManagedIdsin 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:
shallowClonein interfaceGraphEntity- Specified by:
shallowClonein interfaceIdAble- Overrides:
shallowClonein 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:
deepClonein interfaceGraphEntity- Specified by:
deepClonein interfaceIdAble- Overrides:
deepClonein classExternalIdAbleImpl- Returns:
- deep copy of entity
-
-