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
AnLazyEdgewraps anEdgeand 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 providedEdgeand using theElementValueLoaderto lazily load the element's identifiers and properties when requested.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object element)Note this does not include the matchedVertex field.ObjectgetDestination()Get the destination vertex.EdgegetElement()StringgetGroup()ObjectgetIdentifier(IdentifierType identifierType)EdgeId.MatchedVertexgetMatchedVertex()Get the vertex which is to be reported if a matched vertex is requested.LazyPropertiesgetProperties()ObjectgetProperty(String name)ObjectgetSource()Get the source vertex.inthashCode()Note this does not include the matchedVertex field.booleanisDirected()voidputIdentifier(IdentifierType name, Object value)voidputProperty(String name, Object value)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.-
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 providedEdgeand using theElementValueLoaderto 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:EdgeSets 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:
setIdentifiersin 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:
getPropertyin classElement
-
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- Overrides:
getDestinationin classEdge- Returns:
- the object at the edge destination
-
isDirected
public boolean isDirected()
- Specified by:
isDirectedin interfaceEdgeId- Overrides:
isDirectedin 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:EdgeSets 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- Overrides:
setIdentifiersin classEdge- Parameters:
source- the source vertexdestination- the destination vertexdirectedType- the edge directedType
-
putProperty
public void putProperty(String name, Object value)
- Overrides:
putPropertyin classElement
-
getElement
public Edge getElement()
- Overrides:
getElementin classElement
-
getProperties
public LazyProperties getProperties()
- Overrides:
getPropertiesin classElement
-
getIdentifier
public Object getIdentifier(IdentifierType identifierType)
- Overrides:
getIdentifierin classEdge
-
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- Overrides:
getMatchedVertexin classEdge- Returns:
- the matched vertex
-
equals
public boolean equals(Object element)
Description copied from class:EdgeNote this does not include the matchedVertex field.
-
-