Package org.goplanit.graph
Class VertexImpl<E extends Edge>
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.graph.GraphEntityImpl
-
- org.goplanit.graph.VertexImpl<E>
-
- All Implemented Interfaces:
Serializable,Comparable<IdAble>,GraphEntity,Vertex,ExternalIdAble,IdAble,ManagedId
- Direct Known Subclasses:
ConjugateVertexImpl,DirectedVertexImpl
public class VertexImpl<E extends Edge> extends GraphEntityImpl implements Vertex
Vertex representation connected to one or more entry and exit edges- Author:
- markr
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ArrayList<E>edgesEdges of this vertex.protected Map<String,Object>inputPropertiesgeneric input property storageprotected org.locationtech.jts.geom.PointpositionPosition of the vertex-
Fields inherited from interface org.goplanit.utils.graph.Vertex
LOGGER, VERTEX_ID_CLASS
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedVertexImpl(long id)Constructor.protectedVertexImpl(VertexImpl<E> other, boolean deepCopy)Copy constructor.protectedVertexImpl(IdGroupingToken groupId)ConstructorprotectedVertexImpl(IdGroupingToken groupId, Class<? extends Vertex> vertexIdClass)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddEdge(Edge edge)Add edge, do not invoke when parsing networks, this connection is auto-populated before the assignment starts based on the edge and its two vertices that have been registered.voidaddInputProperty(String key, Object value)Add a property from the original input that is not part of the readily available membersVertexImpl<E>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.Collection<? extends E>getEdges()Returns a collection of Edge objects (unmodifiable)ObjectgetInputProperty(String key)collect a propertyorg.locationtech.jts.geom.PointgetPosition()#Collect the geometry of the point location of this vertexvoidremoveAllEdges()Remove al edges from vertexbooleanremoveEdge(long edgeId)Remove edgevoidsetPosition(org.locationtech.jts.geom.Point position)#Set the center point geometry for a vertexVertexImpl<E>shallowClone()Create a shallow copy of this entity-
Methods inherited from class org.goplanit.graph.GraphEntityImpl
generateAndSetId, generateId, recreateManagedIds, 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
recreateManagedIds, resetChildManagedIdEntities
-
Methods inherited from interface org.goplanit.utils.graph.Vertex
addEdges, getEdges, getIdClass, getNumberOfEdges, hasPosition, isPositionEqual2D, isPositionEqual2D, removeEdge, removeEdges, replace, transformPosition, validate
-
-
-
-
Constructor Detail
-
VertexImpl
protected VertexImpl(IdGroupingToken groupId)
Constructor- Parameters:
groupId- , contiguous id generation within this group for instances of this class
-
VertexImpl
protected VertexImpl(IdGroupingToken groupId, Class<? extends Vertex> vertexIdClass)
Constructor- Parameters:
groupId- contiguous id generation within this group for instances of this classvertexIdClass- to use
-
VertexImpl
protected VertexImpl(long id)
Constructor. Only to be used when not reliant on contiguous id generation within enclosing container- Parameters:
id- to use
-
VertexImpl
protected VertexImpl(VertexImpl<E> other, boolean deepCopy)
Copy constructor.- Parameters:
other- to copydeepCopy- when true, create a deep copy, shallow copy otherwise
-
-
Method Detail
-
getPosition
public org.locationtech.jts.geom.Point getPosition()
#Collect the geometry of the point location of this vertex- Specified by:
getPositionin interfaceVertex- Returns:
- direct position reflecting point location
-
setPosition
public void setPosition(org.locationtech.jts.geom.Point position)
#Set the center point geometry for a vertex- Specified by:
setPositionin interfaceVertex- Parameters:
position- the center point for a vertex
-
addInputProperty
public void addInputProperty(String key, Object value)
Add a property from the original input that is not part of the readily available members- Specified by:
addInputPropertyin interfaceVertex- Parameters:
key- key (name) of the input propertyvalue- value of the input property
-
getInputProperty
public Object getInputProperty(String key)
collect a property- Specified by:
getInputPropertyin interfaceVertex- Parameters:
key- for the property- Returns:
- property itself
-
addEdge
public boolean addEdge(Edge edge)
Add edge, do not invoke when parsing networks, this connection is auto-populated before the assignment starts based on the edge and its two vertices that have been registered.
-
removeEdge
public boolean removeEdge(long edgeId)
Remove edge- Specified by:
removeEdgein interfaceVertex- Parameters:
edgeId- Edge to be removed- Returns:
- true when removed, false when not present (and not removed)
-
removeAllEdges
public void removeAllEdges()
Remove al edges from vertex- Specified by:
removeAllEdgesin interfaceVertex
-
getEdges
public Collection<? extends E> getEdges()
Returns a collection of Edge objects (unmodifiable)
-
shallowClone
public VertexImpl<E> shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClonein interfaceGraphEntity- Specified by:
shallowClonein interfaceIdAble- Specified by:
shallowClonein interfaceVertex- Specified by:
shallowClonein classGraphEntityImpl- Returns:
- shallow copy of entity
-
deepClone
public VertexImpl<E> 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- Specified by:
deepClonein interfaceVertex- Specified by:
deepClonein classGraphEntityImpl- Returns:
- deep copy of entity
-
-