Package uk.gov.gchq.gaffer.data.element
Class LazyEdge
- java.lang.Object
-
- uk.gov.gchq.gaffer.data.element.Element
-
- uk.gov.gchq.gaffer.data.element.Edge
-
- uk.gov.gchq.gaffer.data.element.LazyEdge
-
- All Implemented Interfaces:
Serializable
,EdgeId
,ElementId
public class LazyEdge extends Edge
AnLazyEdge
wraps anEdge
and lazily loads identifiers and properties when requested using a providedElementValueLoader
. This will avoid loading all of an edge's properties just for it to be filtered out by a filter function.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class uk.gov.gchq.gaffer.data.element.Edge
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 LazyEdge(Edge edge, ElementValueLoader valueLoader)
Constructs a by wrapping the providedEdge
and using theElementValueLoader
to lazily load the element's identifiers and properties when requested.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object element)
Note this does not include the matchedVertex field.Object
getDestination()
Get the destination vertex.Edge
getElement()
String
getGroup()
Object
getIdentifier(IdentifierType identifierType)
EdgeId.MatchedVertex
getMatchedVertex()
Get the vertex which is to be reported if a matched vertex is requested.LazyProperties
getProperties()
Object
getProperty(String name)
Object
getSource()
Get the source vertex.int
hashCode()
Note this does not include the matchedVertex field.boolean
isDirected()
void
putIdentifier(IdentifierType name, Object value)
void
putProperty(String name, Object value)
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.-
Methods inherited from class uk.gov.gchq.gaffer.data.element.Edge
emptyClone, equals, getDirectedType, setIdentifiers, setIdentifiers, shallowClone, toString
-
Methods inherited from class uk.gov.gchq.gaffer.data.element.Element
copyProperties, 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
-
LazyEdge
public LazyEdge(Edge edge, ElementValueLoader valueLoader)
Constructs a by wrapping the providedEdge
and using theElementValueLoader
to lazily load the element's identifiers and properties when requested.- Parameters:
edge
- the edge to wrap.valueLoader
- the element value loader to use to lazily load the element's identifiers and properties
-
-
Method Detail
-
setIdentifiers
public void setIdentifiers(Object source, Object destination, boolean directed, EdgeId.MatchedVertex matchedVertex)
Description copied from class:Edge
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.
- Overrides:
setIdentifiers
in classEdge
- Parameters:
source
- the source vertexdestination
- the destination vertexdirected
- true if the edge is directedmatchedVertex
- the vertex that matched a query seed
-
getProperty
public Object getProperty(String name)
- Overrides:
getProperty
in classElement
-
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
- Overrides:
getDestination
in classEdge
- Returns:
- the object at the edge destination
-
isDirected
public boolean isDirected()
- Specified by:
isDirected
in interfaceEdgeId
- Overrides:
isDirected
in classEdge
- Returns:
- true if directed is DIRECTED, EITHER or null. Otherwise false.
-
putIdentifier
public void putIdentifier(IdentifierType name, Object value)
-
setIdentifiers
public void setIdentifiers(Object source, Object destination, DirectedType directedType)
Description copied from class:Edge
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
- Overrides:
setIdentifiers
in classEdge
- Parameters:
source
- the source vertexdestination
- the destination vertexdirectedType
- the edge directedType
-
putProperty
public void putProperty(String name, Object value)
- Overrides:
putProperty
in classElement
-
getElement
public Edge getElement()
- Overrides:
getElement
in classElement
-
getProperties
public LazyProperties getProperties()
- Overrides:
getProperties
in classElement
-
getIdentifier
public Object getIdentifier(IdentifierType identifierType)
- Overrides:
getIdentifier
in classEdge
-
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
- Overrides:
getMatchedVertex
in classEdge
- Returns:
- the matched vertex
-
equals
public boolean equals(Object element)
Description copied from class:Edge
Note this does not include the matchedVertex field.
-
-