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
AnEdge
in anElement
containing 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 anEntity
vertex - 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 class
Edge.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 Edge
emptyClone()
boolean
equals(Object obj)
Note this does not include the matchedVertex field.boolean
equals(Edge edge)
Note this does not include the matchedVertex field.Object
getDestination()
Get the destination vertex.DirectedType
getDirectedType()
Get the directionality of the current edge.Object
getIdentifier(IdentifierType identifierType)
EdgeId.MatchedVertex
getMatchedVertex()
Get the vertex which is to be reported if a matched vertex is requested.Object
getSource()
Get the source vertex.int
hashCode()
Note this does not include the matchedVertex field.boolean
isDirected()
void
setIdentifiers(Object source, Object destination, boolean directed)
Sets the identifiers for an Edge.void
setIdentifiers(Object source, Object destination, boolean directed, EdgeId.MatchedVertex matchedVertex)
Sets the identifiers for an Edge.void
setIdentifiers(Object source, Object destination, DirectedType directedType)
Sets the identifiers for an Edge.void
setIdentifiers(Object source, Object destination, DirectedType directedType, EdgeId.MatchedVertex matchedVertex)
Sets the identifiers for an Edge.Edge
shallowClone()
String
toString()
-
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:EdgeId
Get the source vertex.
-
getDestination
public Object getDestination()
Description copied from interface:EdgeId
Get the destination vertex.- Specified by:
getDestination
in interfaceEdgeId
- Returns:
- the object at the edge destination
-
getDirectedType
public DirectedType getDirectedType()
Description copied from interface:EdgeId
Get the directionality of the current edge.- Specified by:
getDirectedType
in interfaceEdgeId
- Returns:
- the directed type
-
isDirected
public boolean isDirected()
- Specified by:
isDirected
in interfaceEdgeId
- Returns:
- true if directed is DIRECTED, EITHER or null. Otherwise false.
-
getMatchedVertex
public EdgeId.MatchedVertex getMatchedVertex()
Description copied from interface:EdgeId
Get the vertex which is to be reported if a matched vertex is requested.- Specified by:
getMatchedVertex
in interfaceEdgeId
- Returns:
- the matched vertex
-
getIdentifier
public Object getIdentifier(IdentifierType identifierType)
- Specified by:
getIdentifier
in 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:
setIdentifiers
in 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:
setIdentifiers
in 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:
true
if this object is the same as the edge argument;false
otherwise.
-
emptyClone
public Edge emptyClone()
- Specified by:
emptyClone
in classElement
-
shallowClone
public Edge shallowClone()
- Overrides:
shallowClone
in classElement
-
-