Package com.github.moaxcp.graphs
Interface PropertyGraph.Edge<ID>
- Type Parameters:
ID
- type of identifier
- All Known Implementing Classes:
AbstractPropertyGraph.SimpleEdge
- Enclosing interface:
- PropertyGraph<ID>
public static interface PropertyGraph.Edge<ID>
An edge between two vertices in a graph. Edge direction depends on graph type. If the graph is directed
isDirected()
will return true.-
Method Summary
Modifier and TypeMethodDescriptionReturns ordered pair of endpoint ids.<T> Optional<T>
findProperty
(String name) ReturnsOptional
of a property.getId()
Returns optional identifier of this edge.default ID
Returns the opposite endpoint of this edge<T> T
getProperty
(String name) Returns a property.Returns vertex id of source endpoint.Returns vertex id of target endpoint.Sets identifier of this edge.Returns an unmodifiable map of inherited propertiesboolean
Returns true if this edge is directed.local()
Returns an unmodifiable map of local propertiesSets the value of a local property returning this edge.Sets the value of 2 local properties returning this edge.property
(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4) property
(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5) 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) 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) 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) 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) 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) remove()
Removes this edge from the graph.removeProperty
(String name) Removes property from local properties returning this edge.void
Sets identifier of this edge.void
setProperty
(String name, Object value) Sets the value of a local property.void
Sets vertex id of source endpoint.void
Sets vertex id of source endpoint.source()
Returns vertex id of source endpoint.Sets vertex id of source endpoint.Returns source vertextarget()
Returns vertex id of target endpoint.Sets vertex id of target endpoint.Returns target vertex
-
Method Details
-
getId
Returns optional identifier of this edge.- Returns:
- optional identifier
-
setId
Sets identifier of this edge.- Parameters:
id
- of edge- Throws:
NullPointerException
- if id is null
-
id
Sets identifier of this edge.- Parameters:
id
- of edge- Returns:
- this edge
- Throws:
NullPointerException
- if id is null
-
getSource
ID getSource()Returns vertex id of source endpoint.- Returns:
- id of source endpoint
-
setSource
Sets vertex id of source endpoint. If vertex does not exist it is created.- Parameters:
source
- endpoint- Throws:
NullPointerException
- if source is null
-
source
ID source()Returns vertex id of source endpoint.- Returns:
- id of source endpoint
-
source
Sets vertex id of source endpoint. If vertex does not exist it is created.- Parameters:
source
- endpoint- Returns:
- this edge
- Throws:
NullPointerException
- if source is null
-
getTarget
ID getTarget()Returns vertex id of target endpoint.- Returns:
- id of target endpoint
-
setTarget
Sets vertex id of source endpoint. If vertex does not exist it is created.- Parameters:
target
- endpoint- Throws:
NullPointerException
- if target is null
-
target
ID target()Returns vertex id of target endpoint.- Returns:
- id of target endpoint
-
target
Sets vertex id of target endpoint. If vertex does not exist it is created.- Parameters:
target
- endpoint- Returns:
- this edge
-
endpoints
Returns ordered pair of endpoint ids. source endpoint id is always first followed by target endpoint id.- Returns:
- order pair of endpoints
-
getOppositeEndpoint
Returns the opposite endpoint of this edge- Parameters:
id
- of one endpoint- Returns:
- Throws:
NullPointerException
- if id is nullIllegalArgumentException
- if id is not one of the endpoints of this edge
-
sourceVertex
PropertyGraph.Vertex<ID> sourceVertex()Returns source vertex- Returns:
- source vertex
-
targetVertex
PropertyGraph.Vertex<ID> targetVertex()Returns target vertex- Returns:
- target vertex
-
isDirected
boolean isDirected()Returns true if this edge is directed. This edge is always directed if the parent graph is directed.- Returns:
- true if this edge is directed
-
findProperty
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.
- Parameters:
name
- of property- Returns:
- optional of named property
- Throws:
NullPointerException
- if name is null
-
getProperty
Returns a property. If the property does not exist null is returned.A property is resolved by first checking properties set on this edge. If the local proeprty does not exist edgeProperties in the graph are checked.
- Type Parameters:
T
- return type of property- Parameters:
name
- of property- Returns:
- value of named property
- Throws:
NullPointerException
- if name is null
-
setProperty
Sets the value of a local property.- Parameters:
name
- of propertyvalue
- of property- Throws:
NullPointerException
- if name or value is null
-
property
Sets the value of a local property returning this edge.- Parameters:
name
- of propertyvalue
- of property- Returns:
- this edge
- Throws:
NullPointerException
- if name or value is null
-
property
Sets the value of 2 local properties returning this edge. Properties are added in order.- Parameters:
name1
- of first propertyvalue1
- of first propertyname2
- of second propertyvalue2
- of second property- Returns:
- this edge
- Throws:
NullPointerException
- if name or value is null for any of the properties
-
property
-
property
-
property
-
property
-
property
-
property
-
property
-
property
PropertyGraph.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) -
property
-
removeProperty
Removes property from local properties returning this edge.- Parameters:
name
- of property- Returns:
- this edge
- Throws:
NullPointerException
- if name is null
-
inherited
Returns an unmodifiable map of inherited properties- Returns:
- map of inherited properties
-
local
Returns an unmodifiable map of local properties- Returns:
- map of local properties
-
remove
PropertyGraph.Edge<ID> remove()Removes this edge from the graph.- Returns:
- this edge
-