Package com.github.moaxcp.graphs
Class AbstractGraph.SimpleEdge
- java.lang.Object
-
- com.github.moaxcp.graphs.AbstractGraph.SimpleEdge
-
- All Implemented Interfaces:
Graph.Edge<ID>
- Direct Known Subclasses:
AbstractEventGraph.EventEdge
- 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.booleanequals(Object o)IDfrom()Returns vertex id of 'from' endpoint.Graph.Edge<ID>from(ID from)Sets vertex id of 'from' endpoint.Graph.Vertex<ID>fromVertex()Returns 'from' vertexIDgetFrom()Returns vertex id of 'from' endpoint.Optional<ID>getId()Returns optional identifier of this edge.Optional<Object>getProperty(String name)Returns the value of a property.IDgetTo()Returns vertex id of 'to' endpoint.inthashCode()Graph.Edge<ID>id(ID id)Sets identifier of this edge.Map<String,Object>inherited()Returns inherited properties as an unmodifiableMap.booleanisDirected()Returns true if this edge is directed.Map<String,Object>local()Returns an unmodifiableMapof all properties set on this Element.SELFproperty(String name, Object value)Adds a local property to this element returning it.Graph.Edge<ID>removeProperty(String name)Removes local propertyvoidsetFrom(ID from)Sets vertex id of 'from' endpoint.voidsetId(ID id)Sets identifier of this edge.voidsetProperty(String name, Object value)Adds a local property to this element.voidsetTo(ID to)Sets vertex id of 'to' endpoint.IDto()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-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.moaxcp.graphs.Graph.Edge
getProperty, inherited, local, property
-
-
-
-
Method Detail
-
getId
public final Optional<ID> getId()
Description copied from interface:Graph.EdgeReturns optional identifier of this edge.- Specified by:
getIdin interfaceGraph.Edge<ID>- Returns:
- optional identifier
-
setId
public void setId(ID id)
Description copied from interface:Graph.EdgeSets identifier of this edge.- Specified by:
setIdin interfaceGraph.Edge<ID>- Parameters:
id- of edge
-
id
public final Graph.Edge<ID> id(ID id)
Description copied from interface:Graph.EdgeSets identifier of this edge.- Specified by:
idin interfaceGraph.Edge<ID>- Parameters:
id- of edge- Returns:
- this edge
-
getFrom
public final ID getFrom()
Description copied from interface:Graph.EdgeReturns vertex id of 'from' endpoint.- Specified by:
getFromin interfaceGraph.Edge<ID>- Returns:
- id of 'from' endpoint
-
setFrom
public void setFrom(ID from)
Description copied from interface:Graph.EdgeSets vertex id of 'from' endpoint. If vertex does not exist it is created.- Specified by:
setFromin interfaceGraph.Edge<ID>- Parameters:
from- endpoint
-
from
public Graph.Edge<ID> from(ID from)
Description copied from interface:Graph.EdgeSets vertex id of 'from' endpoint. If vertex does not exist it is created.- Specified by:
fromin interfaceGraph.Edge<ID>- Parameters:
from- endpoint- Returns:
- this edge
-
from
public final ID from()
Description copied from interface:Graph.EdgeReturns vertex id of 'from' endpoint.- Specified by:
fromin interfaceGraph.Edge<ID>- Returns:
- id of 'from' endpoint
-
getTo
public final ID getTo()
Description copied from interface:Graph.EdgeReturns vertex id of 'to' endpoint.- Specified by:
getToin interfaceGraph.Edge<ID>- Returns:
- id of 'to' endpoint
-
setTo
public void setTo(ID to)
Description copied from interface:Graph.EdgeSets vertex id of 'to' endpoint. If vertex does not exist it is created.- Specified by:
setToin interfaceGraph.Edge<ID>- Parameters:
to- endpoint
-
to
public final Graph.Edge<ID> to(ID to)
Description copied from interface:Graph.EdgeSets vertex id of 'to' endpoint. If vertex does not exist it is created.- Specified by:
toin interfaceGraph.Edge<ID>- Parameters:
to- endpoint- Returns:
- this edge
-
to
public final ID to()
Description copied from interface:Graph.EdgeReturns vertex id of 'to' endpoint.- Specified by:
toin interfaceGraph.Edge<ID>- Returns:
- id of 'to' endpoint
-
isDirected
public final boolean isDirected()
Description copied from interface:Graph.EdgeReturns true if this edge is directed. This edge is always directed if the parent graph is directed.- Specified by:
isDirectedin interfaceGraph.Edge<ID>- Returns:
- true if this edge is directed
-
endpoints
public final List<ID> endpoints()
Description copied from interface:Graph.EdgeReturns ordered pair of endpoint ids. 'from' endpoint id is always first followed by 'to' endpoint id.- Specified by:
endpointsin interfaceGraph.Edge<ID>- Returns:
- order pair of endpoints
-
fromVertex
public final Graph.Vertex<ID> fromVertex()
Description copied from interface:Graph.EdgeReturns 'from' vertex- Specified by:
fromVertexin interfaceGraph.Edge<ID>- Returns:
- 'from' vertex
-
toVertex
public final Graph.Vertex<ID> toVertex()
Description copied from interface:Graph.EdgeReturns 'to' vertex- Specified by:
toVertexin interfaceGraph.Edge<ID>- Returns:
- 'to' vertex
-
setProperty
public void setProperty(String name, Object value)
Adds a local property to this element.- Specified by:
setPropertyin interfaceGraph.Edge<ID>- Parameters:
name- of propertyvalue- of property
-
removeProperty
public Graph.Edge<ID> removeProperty(String name)
Removes local property- Specified by:
removePropertyin interfaceGraph.Edge<ID>- Parameters:
name- of property- Returns:
- this element
-
inherited
public final Map<String,Object> inherited()
Returns inherited properties as an unmodifiableMap.- Returns:
- inherited properties
-
local
public final Map<String,Object> local()
Returns an unmodifiableMapof all properties set on this Element.- Returns:
- all properties set on this element
-
getProperty
public final Optional<Object> getProperty(String name)
Returns the value of a property. If the property is local its value is returned before checking for an inherited property.- Parameters:
name- of property to return- Returns:
- value mapped to name
- Throws:
NullPointerException- if name is null
-
-