Package org.planit.graph
Class VertexImpl
- java.lang.Object
-
- org.planit.graph.VertexImpl
-
- All Implemented Interfaces:
Serializable,Comparable<Idable>,Vertex,ExternalIdable,Idable
- Direct Known Subclasses:
DirectedVertexImpl
public class VertexImpl extends Object 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 Map<Long,Edge>edgesEdges of this vertexprotected StringexternalIdExternal identifier used in input filesprotected longidUnique internal identifierprotected Map<String,Object>inputPropertiesgeneric input property storageprotected org.locationtech.jts.geom.PointpositionPosition of the vertex
-
Constructor Summary
Constructors Modifier Constructor Description protectedVertexImpl(VertexImpl vertexImpl)Copy constructor (for now input properties are NOT copied, because a shallow copy of contents is dangerous).protectedVertexImpl(IdGroupingToken groupId)Constructor
-
Method Summary
All Methods Static 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 membersVertexImplclone()Clone the vertexprotected static longgenerateVertexId(IdGroupingToken groupId)generate unique node idCollection<Edge>getEdges()Returns a collection of Edge objectsSet<Edge>getEdges(Vertex otherVertex)colect the edge(s) based on the other vertexStringgetExternalId()get external id of the entitylonggetId()#collect id of the entityObjectgetInputProperty(String key)Get input property by its keyintgetNumberOfEdges()Number of entries in edge segmentsorg.locationtech.jts.geom.PointgetPosition()#Collect the geometry of the point location of this vertexStringgetXmlId()the id exposed to users as the "normal" id in the PLANit native xml formatbooleanremoveEdge(long edgeId)Remove edgebooleanremoveEdge(Edge edge)Remove edgevoidsetExternalId(String externalId)set the external idprotected voidsetId(Long id)Set id on vertexvoidsetPosition(org.locationtech.jts.geom.Point position)#Set the center point geometry for a vertexvoidsetXmlId(String xmlId)set the external idbooleanvalidate()validate the vertex regarding it connections to edges etc.-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.planit.utils.id.ExternalIdable
hasExternalId, hasXmlId
-
Methods inherited from interface org.planit.utils.id.Idable
compareTo, idEquals, idHashCode
-
Methods inherited from interface org.planit.utils.graph.Vertex
replace, transformPosition
-
-
-
-
Field Detail
-
id
protected long id
Unique internal identifier
-
externalId
protected String externalId
External identifier used in input files
-
position
protected org.locationtech.jts.geom.Point position
Position of the vertex
-
-
Constructor Detail
-
VertexImpl
protected VertexImpl(IdGroupingToken groupId)
Constructor- Parameters:
groupId- , contiguous id generation within this group for instances of this class
-
VertexImpl
protected VertexImpl(VertexImpl vertexImpl)
Copy constructor (for now input properties are NOT copied, because a shallow copy of contents is dangerous). Geometry is deep copied, edges are not because they are not owned by the vertex.- Parameters:
vertexImpl- to copy
-
-
Method Detail
-
generateVertexId
protected static long generateVertexId(IdGroupingToken groupId)
generate unique node id- Parameters:
groupId- , contiguous id generation within this group for instances of this class- Returns:
- nodeId
-
setId
protected void setId(Long id)
Set id on vertex- Parameters:
id- to set
-
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
-
getId
public long getId()
#collect id of the entity
-
getExternalId
public String getExternalId()
get external id of the entity- Specified by:
getExternalIdin interfaceExternalIdable- Returns:
- external id
-
setExternalId
public void setExternalId(String externalId)
set the external id- Specified by:
setExternalIdin interfaceExternalIdable- Parameters:
externalId- to set
-
getXmlId
public String getXmlId()
the id exposed to users as the "normal" id in the PLANit native xml format- Specified by:
getXmlIdin interfaceExternalIdable- Returns:
- xmlId
-
setXmlId
public void setXmlId(String xmlId)
set the external id- Specified by:
setXmlIdin interfaceExternalIdable- Parameters:
xmlId- to set
-
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)
Get input property by its key- Parameters:
key- the key of the input property- Returns:
- value the value of the input property
-
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(Edge edge)
Remove edge- Specified by:
removeEdgein interfaceVertex- Parameters:
edge- Edge to be removed- Returns:
- true when removed, false when not present (and not removed)
-
removeEdge
public boolean removeEdge(long edgeId)
Description copied from interface:VertexRemove edge- Specified by:
removeEdgein interfaceVertex- Parameters:
edgeId- Edge to be removed- Returns:
- true when removed, false when not present (and not removed)
-
getEdges
public Collection<Edge> getEdges()
Returns a collection of Edge objects
-
getNumberOfEdges
public int getNumberOfEdges()
Number of entries in edge segments- Specified by:
getNumberOfEdgesin interfaceVertex- Returns:
- the number of edges connected to this vertex
-
getEdges
public Set<Edge> getEdges(Vertex otherVertex)
colect the edge(s) based on the other vertex
-
clone
public VertexImpl clone()
Clone the vertex
-
-