Class AbstractGraph.SimpleVertex
- java.lang.Object
-
- com.github.moaxcp.graphs.AbstractGraph.SimpleVertex
-
- All Implemented Interfaces:
Graph.Vertex<ID>
- Enclosing class:
- AbstractGraph<ID>
public class AbstractGraph.SimpleVertex extends Object implements Graph.Vertex<ID>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<Graph.Edge<ID>>
adjacentEdges()
Returns the set of all edges connecting to this vertex.Graph.Vertex<ID>
connectsFrom(ID s)
Ensures this vertex connects to the vertex with an 'id' property equal to the 'from' parameter.Graph.Vertex<ID>
connectsTo(ID to)
Ensures this vertex connects to the vertex with an 'id' property equal to the 'to' parameter.boolean
equals(Object o)
ID
getId()
returns identifier of vertex.Optional<Object>
getProperty(String name)
ReturnsOptional
of a property.int
hashCode()
Graph.Vertex<ID>
id(ID id)
sets identifier of this vertex.Set<Graph.Edge<ID>>
inEdges()
Returns the set of edges connecting to this vertex where 'to' is the 'id' of this vertexMap<String,Object>
inherited()
Returns an unmodifiable map of inherited propertiesMap<String,Object>
local()
Returns an unmodifiable map of local propertiesSet<Graph.Edge<ID>>
outEdges()
Returns the set of edges connecting to this vertex where 'from' is the 'id' of this vertexGraph.Vertex<ID>
property(String name, Object value)
Sets the value of a local property returning this vertex.Graph.Vertex<ID>
property(String name1, Object value1, String name2, Object value2)
Graph.Vertex<ID>
property(String name1, Object value1, String name2, Object value2, String name3, Object value3)
Graph.Vertex<ID>
property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4)
Graph.Vertex<ID>
property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5)
Graph.Vertex<ID>
property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5, String name6, Object value6)
Graph.Vertex<ID>
property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5, String name6, Object value6, String name7, Object value7)
Graph.Vertex<ID>
property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5, String name6, Object value6, String name7, Object value7, String name8, Object value8)
Graph.Vertex<ID>
property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5, String name6, Object value6, String name7, Object value7, String name8, Object value8, String name9, Object value9)
Graph.Vertex<ID>
property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5, String name6, Object value6, String name7, Object value7, String name8, Object value8, String name9, Object value9, String name10, Object value10)
Graph.Vertex<ID>
property(Map<String,Object> properties)
Graph.Vertex<ID>
removeProperty(String name)
Removes property from local properties returning this vertex.void
setId(ID id)
sets identifier of vertex.void
setProperty(String name, Object value)
Sets the value of a local property.
-
-
-
Method Detail
-
inherited
public Map<String,Object> inherited()
Description copied from interface:Graph.Vertex
Returns an unmodifiable map of inherited properties- Specified by:
inherited
in interfaceGraph.Vertex<ID>
- Returns:
- map of inherited properties
-
local
public Map<String,Object> local()
Description copied from interface:Graph.Vertex
Returns an unmodifiable map of local properties- Specified by:
local
in interfaceGraph.Vertex<ID>
- Returns:
- map of local properties
-
getId
public ID getId()
Description copied from interface:Graph.Vertex
returns identifier of vertex.- Specified by:
getId
in interfaceGraph.Vertex<ID>
- Returns:
- identifier of vertex
-
setId
public void setId(ID id)
Description copied from interface:Graph.Vertex
sets identifier of vertex.- Specified by:
setId
in interfaceGraph.Vertex<ID>
- Parameters:
id
- identifier of vertex
-
id
public Graph.Vertex<ID> id(ID id)
Description copied from interface:Graph.Vertex
sets identifier of this vertex. This vertex is returned.- Specified by:
id
in interfaceGraph.Vertex<ID>
- Parameters:
id
- identifier of vertex.- Returns:
- this vertex
-
getProperty
public Optional<Object> getProperty(String name)
Description copied from interface:Graph.Vertex
ReturnsOptional
of a property. If the property does not exist the returnedOptional
is empty.A property is resolved by first checking properties set on this vertex. If the local property does not exist vertexProperties in the graph are checked.
- Specified by:
getProperty
in interfaceGraph.Vertex<ID>
- Parameters:
name
- of property- Returns:
- optional of named property
-
setProperty
public void setProperty(String name, Object value)
Description copied from interface:Graph.Vertex
Sets the value of a local property.- Specified by:
setProperty
in interfaceGraph.Vertex<ID>
- Parameters:
name
- of propertyvalue
- of property
-
property
public Graph.Vertex<ID> property(String name, Object value)
Description copied from interface:Graph.Vertex
Sets the value of a local property returning this vertex.- Specified by:
property
in interfaceGraph.Vertex<ID>
- Parameters:
name
- of propertyvalue
- of property- Returns:
- this vertex
-
property
public Graph.Vertex<ID> property(String name1, Object value1, String name2, Object value2)
- Specified by:
property
in interfaceGraph.Vertex<ID>
-
property
public Graph.Vertex<ID> property(String name1, Object value1, String name2, Object value2, String name3, Object value3)
- Specified by:
property
in interfaceGraph.Vertex<ID>
-
property
public Graph.Vertex<ID> property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4)
- Specified by:
property
in interfaceGraph.Vertex<ID>
-
property
public Graph.Vertex<ID> property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5)
- Specified by:
property
in interfaceGraph.Vertex<ID>
-
property
public Graph.Vertex<ID> property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5, String name6, Object value6)
- Specified by:
property
in interfaceGraph.Vertex<ID>
-
property
public Graph.Vertex<ID> property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5, String name6, Object value6, String name7, Object value7)
- Specified by:
property
in interfaceGraph.Vertex<ID>
-
property
public Graph.Vertex<ID> property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5, String name6, Object value6, String name7, Object value7, String name8, Object value8)
- Specified by:
property
in interfaceGraph.Vertex<ID>
-
property
public Graph.Vertex<ID> property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5, String name6, Object value6, String name7, Object value7, String name8, Object value8, String name9, Object value9)
- Specified by:
property
in interfaceGraph.Vertex<ID>
-
property
public Graph.Vertex<ID> property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5, String name6, Object value6, String name7, Object value7, String name8, Object value8, String name9, Object value9, String name10, Object value10)
- Specified by:
property
in interfaceGraph.Vertex<ID>
-
property
public Graph.Vertex<ID> property(Map<String,Object> properties)
- Specified by:
property
in interfaceGraph.Vertex<ID>
-
removeProperty
public Graph.Vertex<ID> removeProperty(String name)
Description copied from interface:Graph.Vertex
Removes property from local properties returning this vertex.- Specified by:
removeProperty
in interfaceGraph.Vertex<ID>
- Parameters:
name
- of property- Returns:
- this vertex
-
connectsTo
public Graph.Vertex<ID> connectsTo(ID to)
Description copied from interface:Graph.Vertex
Ensures this vertex connects to the vertex with an 'id' property equal to the 'to' parameter. The edge or vertex is created if needed. This vertex is returned.If a vertex is created its 'id' property will be set to the 'to' parameter. If an edge is created the 'from' property is set to the 'id' of this vertex and the 'to' property is set to the 'id' of the 'to' vertex.
If this graph is undirected and contains an edge connecting this vertex with 'to' the edge will not be created. Undirected graphs ignore 'from'/'to' order in edges.
- Specified by:
connectsTo
in interfaceGraph.Vertex<ID>
- Parameters:
to
- vertex id- Returns:
- this vertex
-
connectsFrom
public Graph.Vertex<ID> connectsFrom(ID s)
Description copied from interface:Graph.Vertex
Ensures this vertex connects to the vertex with an 'id' property equal to the 'from' parameter. The edge or vertex is created if needed. This vertex is returned.If a vertex is created its 'id' property will be set to the 'from' parameter. If an edge is created the 'from' property is set to the 'id' of the 'from' vertex and the 'to' property is set to the 'id' of this vertex.
If this graph is undirected and contains an edge connecting this vertex with 'from' the edge will not be created. Undirected graphs ignore 'from'/'to' order in edges.
- Specified by:
connectsFrom
in interfaceGraph.Vertex<ID>
- Parameters:
s
- vertex id- Returns:
- this vertex
-
adjacentEdges
public Set<Graph.Edge<ID>> adjacentEdges()
Description copied from interface:Graph.Vertex
Returns the set of all edges connecting to this vertex.- Specified by:
adjacentEdges
in interfaceGraph.Vertex<ID>
- Returns:
- set of adjacent edges
-
inEdges
public Set<Graph.Edge<ID>> inEdges()
Description copied from interface:Graph.Vertex
Returns the set of edges connecting to this vertex where 'to' is the 'id' of this vertex- Specified by:
inEdges
in interfaceGraph.Vertex<ID>
- Returns:
- incoming edges
-
outEdges
public Set<Graph.Edge<ID>> outEdges()
Description copied from interface:Graph.Vertex
Returns the set of edges connecting to this vertex where 'from' is the 'id' of this vertex- Specified by:
outEdges
in interfaceGraph.Vertex<ID>
- Returns:
- outgoing edges
-
-