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>
edges
Edges of this vertex.protected Map<String,Object>
inputProperties
generic input property storageprotected org.locationtech.jts.geom.Point
position
Position of the vertex-
Fields inherited from interface org.goplanit.utils.graph.Vertex
LOGGER, VERTEX_ID_CLASS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
VertexImpl(long id)
Constructor.protected
VertexImpl(VertexImpl<E> other, boolean deepCopy)
Copy constructor.protected
VertexImpl(IdGroupingToken groupId)
Constructorprotected
VertexImpl(IdGroupingToken groupId, Class<? extends Vertex> vertexIdClass)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.void
addInputProperty(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)Object
getInputProperty(String key)
collect a propertyorg.locationtech.jts.geom.Point
getPosition()
#Collect the geometry of the point location of this vertexvoid
removeAllEdges()
Remove al edges from vertexboolean
removeEdge(long edgeId)
Remove edgevoid
setPosition(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:
getPosition
in 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:
setPosition
in 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:
addInputProperty
in 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:
getInputProperty
in 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:
removeEdge
in 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:
removeAllEdges
in 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:
shallowClone
in interfaceGraphEntity
- Specified by:
shallowClone
in interfaceIdAble
- Specified by:
shallowClone
in interfaceVertex
- Specified by:
shallowClone
in 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:
deepClone
in interfaceGraphEntity
- Specified by:
deepClone
in interfaceIdAble
- Specified by:
deepClone
in interfaceVertex
- Specified by:
deepClone
in classGraphEntityImpl
- Returns:
- deep copy of entity
-
-