Package com.github.moaxcp.graphs
Class AbstractGraph.SimpleEdge
- java.lang.Object
-
- com.github.moaxcp.graphs.AbstractGraph.SimpleEdge
-
- All Implemented Interfaces:
Graph.Edge<ID>
- Enclosing class:
- AbstractGraph<ID>
public class AbstractGraph.SimpleEdge extends Object implements Graph.Edge<ID>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<ID>
endpoints()
Returns ordered pair of endpoint ids.boolean
equals(Object o)
ID
from()
Returns vertex id of 'from' endpoint.Graph.Edge<ID>
from(ID from)
Sets vertex id of 'from' endpoint.Graph.Vertex<ID>
fromVertex()
Returns 'from' vertexID
getFrom()
Returns vertex id of 'from' endpoint.Optional<ID>
getId()
Returns optional identifier of this edge.Optional<Object>
getProperty(String name)
ReturnsOptional
of a property.ID
getTo()
Returns vertex id of 'to' endpoint.int
hashCode()
Graph.Edge<ID>
id(ID id)
Sets identifier of this edge.Map<String,Object>
inherited()
Returns an unmodifiable map of inherited propertiesboolean
isDirected()
Returns true if this edge is directed.Map<String,Object>
local()
Returns an unmodifiable map of local propertiesGraph.Edge<ID>
property(String name, Object value)
Sets the value of a local property returning this edge.Graph.Edge<ID>
property(String name1, Object value1, String name2, Object value2)
Sets the value of 2 local properties returning this edge.Graph.Edge<ID>
property(String name1, Object value1, String name2, Object value2, String name3, Object value3)
Graph.Edge<ID>
property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4)
Graph.Edge<ID>
property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5)
Graph.Edge<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.Edge<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.Edge<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.Edge<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.Edge<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.Edge<ID>
property(Map<String,Object> properties)
Graph.Edge<ID>
removeProperty(String name)
Removes property from local properties returning this edge.void
setFrom(ID from)
Sets vertex id of 'from' endpoint.void
setId(ID id)
Sets identifier of this edge.void
setProperty(String name, Object value)
Sets the value of a local property.void
setTo(ID to)
Sets vertex id of 'to' endpoint.ID
to()
Returns vertex id of 'to' endpoint.Graph.Edge<ID>
to(ID to)
Sets vertex id of 'to' endpoint.Graph.Vertex<ID>
toVertex()
Returns 'to' vertex
-
-
-
Method Detail
-
inherited
public Map<String,Object> inherited()
Description copied from interface:Graph.Edge
Returns an unmodifiable map of inherited properties- Specified by:
inherited
in interfaceGraph.Edge<ID>
- Returns:
- map of inherited properties
-
local
public Map<String,Object> local()
Description copied from interface:Graph.Edge
Returns an unmodifiable map of local properties- Specified by:
local
in interfaceGraph.Edge<ID>
- Returns:
- map of local properties
-
getId
public final Optional<ID> getId()
Description copied from interface:Graph.Edge
Returns optional identifier of this edge.- Specified by:
getId
in interfaceGraph.Edge<ID>
- Returns:
- optional identifier
-
setId
public void setId(ID id)
Description copied from interface:Graph.Edge
Sets identifier of this edge.- Specified by:
setId
in interfaceGraph.Edge<ID>
- Parameters:
id
- of edge
-
id
public final Graph.Edge<ID> id(ID id)
Description copied from interface:Graph.Edge
Sets identifier of this edge.- Specified by:
id
in interfaceGraph.Edge<ID>
- Parameters:
id
- of edge- Returns:
- this edge
-
getFrom
public final ID getFrom()
Description copied from interface:Graph.Edge
Returns vertex id of 'from' endpoint.- Specified by:
getFrom
in interfaceGraph.Edge<ID>
- Returns:
- id of 'from' endpoint
-
setFrom
public void setFrom(ID from)
Description copied from interface:Graph.Edge
Sets vertex id of 'from' endpoint. If vertex does not exist it is created.- Specified by:
setFrom
in interfaceGraph.Edge<ID>
- Parameters:
from
- endpoint
-
from
public Graph.Edge<ID> from(ID from)
Description copied from interface:Graph.Edge
Sets vertex id of 'from' endpoint. If vertex does not exist it is created.- Specified by:
from
in interfaceGraph.Edge<ID>
- Parameters:
from
- endpoint- Returns:
- this edge
-
from
public final ID from()
Description copied from interface:Graph.Edge
Returns vertex id of 'from' endpoint.- Specified by:
from
in interfaceGraph.Edge<ID>
- Returns:
- id of 'from' endpoint
-
getTo
public final ID getTo()
Description copied from interface:Graph.Edge
Returns vertex id of 'to' endpoint.- Specified by:
getTo
in interfaceGraph.Edge<ID>
- Returns:
- id of 'to' endpoint
-
setTo
public void setTo(ID to)
Description copied from interface:Graph.Edge
Sets vertex id of 'to' endpoint. If vertex does not exist it is created.- Specified by:
setTo
in interfaceGraph.Edge<ID>
- Parameters:
to
- endpoint
-
to
public final Graph.Edge<ID> to(ID to)
Description copied from interface:Graph.Edge
Sets vertex id of 'to' endpoint. If vertex does not exist it is created.- Specified by:
to
in interfaceGraph.Edge<ID>
- Parameters:
to
- endpoint- Returns:
- this edge
-
to
public final ID to()
Description copied from interface:Graph.Edge
Returns vertex id of 'to' endpoint.- Specified by:
to
in interfaceGraph.Edge<ID>
- Returns:
- id of 'to' endpoint
-
isDirected
public final boolean isDirected()
Description copied from interface:Graph.Edge
Returns true if this edge is directed. This edge is always directed if the parent graph is directed.- Specified by:
isDirected
in interfaceGraph.Edge<ID>
- Returns:
- true if this edge is directed
-
endpoints
public final List<ID> endpoints()
Description copied from interface:Graph.Edge
Returns ordered pair of endpoint ids. 'from' endpoint id is always first followed by 'to' endpoint id.- Specified by:
endpoints
in interfaceGraph.Edge<ID>
- Returns:
- order pair of endpoints
-
fromVertex
public final Graph.Vertex<ID> fromVertex()
Description copied from interface:Graph.Edge
Returns 'from' vertex- Specified by:
fromVertex
in interfaceGraph.Edge<ID>
- Returns:
- 'from' vertex
-
toVertex
public final Graph.Vertex<ID> toVertex()
Description copied from interface:Graph.Edge
Returns 'to' vertex- Specified by:
toVertex
in interfaceGraph.Edge<ID>
- Returns:
- 'to' vertex
-
getProperty
public Optional<Object> getProperty(String name)
Description copied from interface:Graph.Edge
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 edge. If the local property does not exist edgeProperties in the graph are checked.
- Specified by:
getProperty
in interfaceGraph.Edge<ID>
- Parameters:
name
- of property- Returns:
- optional of named property
-
setProperty
public void setProperty(String name, Object value)
Description copied from interface:Graph.Edge
Sets the value of a local property.- Specified by:
setProperty
in interfaceGraph.Edge<ID>
- Parameters:
name
- of propertyvalue
- of property
-
property
public Graph.Edge<ID> property(String name, Object value)
Description copied from interface:Graph.Edge
Sets the value of a local property returning this edge.- Specified by:
property
in interfaceGraph.Edge<ID>
- Parameters:
name
- of propertyvalue
- of property- Returns:
- this edge
-
property
public Graph.Edge<ID> property(String name1, Object value1, String name2, Object value2)
Description copied from interface:Graph.Edge
Sets the value of 2 local properties returning this edge. Properties are added in order.- Specified by:
property
in interfaceGraph.Edge<ID>
- Parameters:
name1
- of first propertyvalue1
- of first propertyname2
- of second propertyvalue2
- of second property- Returns:
- this edge
-
property
public Graph.Edge<ID> property(String name1, Object value1, String name2, Object value2, String name3, Object value3)
- Specified by:
property
in interfaceGraph.Edge<ID>
-
property
public Graph.Edge<ID> property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4)
- Specified by:
property
in interfaceGraph.Edge<ID>
-
property
public Graph.Edge<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.Edge<ID>
-
property
public Graph.Edge<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.Edge<ID>
-
property
public Graph.Edge<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.Edge<ID>
-
property
public Graph.Edge<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.Edge<ID>
-
property
public Graph.Edge<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.Edge<ID>
-
property
public Graph.Edge<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.Edge<ID>
-
property
public Graph.Edge<ID> property(Map<String,Object> properties)
- Specified by:
property
in interfaceGraph.Edge<ID>
-
removeProperty
public Graph.Edge<ID> removeProperty(String name)
Description copied from interface:Graph.Edge
Removes property from local properties returning this edge.- Specified by:
removeProperty
in interfaceGraph.Edge<ID>
- Parameters:
name
- of property- Returns:
- this edge
-
-