Class Edge
- java.lang.Object
-
- uk.gov.gchq.gaffer.data.element.Element
-
- uk.gov.gchq.gaffer.data.element.Edge
-
- All Implemented Interfaces:
Serializable,EdgeId,ElementId
- Direct Known Subclasses:
LazyEdge
public class Edge extends Element implements EdgeId
AnEdgein anElementcontaining a source, destination and a directed flag. The source and destination vertices can be any type ofObject. There is no requirement for these vertices to connect to anEntityvertex - for example you could have a 'graph' of just edges. Edges are designed so that multiple edges can share the same identifiers but are distinguished via their group.- See Also:
Edge.Builder, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEdge.Builder-
Nested classes/interfaces inherited from interface uk.gov.gchq.gaffer.data.element.id.EdgeId
EdgeId.MatchedVertex
-
Nested classes/interfaces inherited from interface uk.gov.gchq.gaffer.data.element.id.ElementId
ElementId.Matches
-
-
Field Summary
-
Fields inherited from class uk.gov.gchq.gaffer.data.element.Element
DEFAULT_GROUP
-
-
Constructor Summary
Constructors Constructor Description Edge(String group)Edge(String group, Object source, Object destination, boolean directed)Constructs an instance of Edge.Edge(String group, Object source, Object destination, boolean directed, EdgeId.MatchedVertex matchedVertex, Properties properties)Constructs an instance of Edge.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EdgeemptyClone()booleanequals(Object obj)Note this does not include the matchedVertex field.booleanequals(Edge edge)Note this does not include the matchedVertex field.ObjectgetDestination()Get the destination vertex.DirectedTypegetDirectedType()Get the directionality of the current edge.ObjectgetIdentifier(IdentifierType identifierType)EdgeId.MatchedVertexgetMatchedVertex()Get the vertex which is to be reported if a matched vertex is requested.ObjectgetSource()Get the source vertex.inthashCode()Note this does not include the matchedVertex field.booleanisDirected()voidsetIdentifiers(Object source, Object destination, boolean directed)Sets the identifiers for an Edge.voidsetIdentifiers(Object source, Object destination, boolean directed, EdgeId.MatchedVertex matchedVertex)Sets the identifiers for an Edge.voidsetIdentifiers(Object source, Object destination, DirectedType directedType)Sets the identifiers for an Edge.voidsetIdentifiers(Object source, Object destination, DirectedType directedType, EdgeId.MatchedVertex matchedVertex)Sets the identifiers for an Edge.EdgeshallowClone()StringtoString()-
Methods inherited from class uk.gov.gchq.gaffer.data.element.Element
copyProperties, getElement, getGroup, getProperties, getProperty, putProperty, removeProperty, shallowEquals, shallowEquals
-
Methods inherited from interface uk.gov.gchq.gaffer.data.element.id.EdgeId
getAdjacentMatchedVertexValue, getMatchedVertexValue, isEqual, isEqual, isRelated, isRelated, isUndirected
-
Methods inherited from interface uk.gov.gchq.gaffer.data.element.id.ElementId
getClassName, setClassName
-
-
-
-
Constructor Detail
-
Edge
public Edge(String group)
-
Edge
public Edge(String group, Object source, Object destination, boolean directed)
Constructs an instance of Edge.If the edge is undirected the the source and destination vertices may get swapped to ensure undirected edges are consistently constructed.
- Parameters:
group- the Edge groupsource- the source vertexdestination- the destination vertexdirected- true if the edge is directed
-
Edge
public Edge(String group, Object source, Object destination, boolean directed, EdgeId.MatchedVertex matchedVertex, Properties properties)
Constructs an instance of Edge.If the edge is undirected the the source and destination vertices may get swapped to ensure undirected edges are consistently constructed.
- Parameters:
group- the Edge groupsource- the source vertexdestination- the destination vertexdirected- true if the edge is directedmatchedVertex- used at query time to mark which vertex was matched.properties- the edge properties
-
-
Method Detail
-
getSource
public Object getSource()
Description copied from interface:EdgeIdGet the source vertex.
-
getDestination
public Object getDestination()
Description copied from interface:EdgeIdGet the destination vertex.- Specified by:
getDestinationin interfaceEdgeId- Returns:
- the object at the edge destination
-
getDirectedType
public DirectedType getDirectedType()
Description copied from interface:EdgeIdGet the directionality of the current edge.- Specified by:
getDirectedTypein interfaceEdgeId- Returns:
- the directed type
-
isDirected
public boolean isDirected()
- Specified by:
isDirectedin interfaceEdgeId- Returns:
- true if directed is DIRECTED, EITHER or null. Otherwise false.
-
getMatchedVertex
public EdgeId.MatchedVertex getMatchedVertex()
Description copied from interface:EdgeIdGet the vertex which is to be reported if a matched vertex is requested.- Specified by:
getMatchedVertexin interfaceEdgeId- Returns:
- the matched vertex
-
getIdentifier
public Object getIdentifier(IdentifierType identifierType)
- Specified by:
getIdentifierin classElement
-
setIdentifiers
public void setIdentifiers(Object source, Object destination, DirectedType directedType)
Sets the identifiers for an Edge.If the edge is undirected the the source and destination vertices may get swapped to ensure undirected edges are consistently constructed.
- Specified by:
setIdentifiersin interfaceEdgeId- Parameters:
source- the source vertexdestination- the destination vertexdirectedType- the edge directedType
-
setIdentifiers
public void setIdentifiers(Object source, Object destination, boolean directed)
Sets the identifiers for an Edge.If the edge is undirected the the source and destination vertices may get swapped to ensure undirected edges are consistently constructed.
- Parameters:
source- the source vertexdestination- the destination vertexdirected- true if the edge is directed
-
setIdentifiers
public void setIdentifiers(Object source, Object destination, DirectedType directedType, EdgeId.MatchedVertex matchedVertex)
Sets the identifiers for an Edge.If the edge is undirected the the source and destination vertices may get swapped to ensure undirected edges are consistently constructed.
- Specified by:
setIdentifiersin interfaceEdgeId- Parameters:
source- the source vertexdestination- the destination vertexdirectedType- the edge directedTypematchedVertex- the vertex that matched a query seed
-
setIdentifiers
public void setIdentifiers(Object source, Object destination, boolean directed, EdgeId.MatchedVertex matchedVertex)
Sets the identifiers for an Edge.If the edge is undirected the the source and destination vertices may get swapped to ensure undirected edges are consistently constructed.
- Parameters:
source- the source vertexdestination- the destination vertexdirected- true if the edge is directedmatchedVertex- the vertex that matched a query seed
-
hashCode
public int hashCode()
Note this does not include the matchedVertex field.
-
equals
public boolean equals(Object obj)
Note this does not include the matchedVertex field.
-
equals
public boolean equals(Edge edge)
Note this does not include the matchedVertex field.- Parameters:
edge- the reference Edge with which to compare.- Returns:
trueif this object is the same as the edge argument;falseotherwise.
-
emptyClone
public Edge emptyClone()
- Specified by:
emptyClonein classElement
-
shallowClone
public Edge shallowClone()
- Overrides:
shallowClonein classElement
-
-