Class GValueManager
java.lang.Object
org.apache.tinkerpop.gremlin.process.traversal.GValueManager
- All Implemented Interfaces:
Serializable,Cloneable
The
GValueManager class is responsible for managing the state of GValue instances and their
associations with `Step` objects in a traversal. This class ensures that `GValue` instances are properly extracted
and stored in a registry, allowing for dynamic query optimizations and state management during traversal execution.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Creates a deep copy of this GValueManager with cloned GValue instances.Gets the set ofGValueobjects used in this traversal.Gets the set of pinned GValues used in this traversal.Gets the set of variable names used in this traversal which have been pinned to specific values.Gets the set of variable names used in this traversal which have not been pinned to specific values.Gets the set of variable names used in this traversal.booleanDetermines whether the manager has unpinned GValues.booleanDetermines whether the manager has step registrations.voidmergeInto(GValueManager other) Merges the internal registries of the currentGValueManagerinto anotherGValueManager.voidpinGValues(Collection<GValue<?>> gValues) Pin a collection ofGValueinstances from the internal registry.voidpinGValues(Set<String> names) Pin a collection ofGValueby name from the internal registry.booleanpinVariable(String name) Pins any GValue with the provided name.voidregister(Collection<GValue<?>> gValues) Registers a collection of GValues in the internal registry.voidRegisters a GValue in the internal registry if it represents a variable.voidupdateVariable(String name, Object value) Updates the value of a registered variable.
-
Constructor Details
-
GValueManager
public GValueManager()Creates a new empty GValueManager.
-
-
Method Details
-
mergeInto
Merges the internal registries of the currentGValueManagerinto anotherGValueManager. Transfers the state of thegValueRegistryandstepRegistryfrom the current instance to the specified target instance.- Parameters:
other- the targetGValueManagerinto which the current instance's registries will be merged
-
getVariableNames
Gets the set of variable names used in this traversal. -
getUnpinnedVariableNames
Gets the set of variable names used in this traversal which have not been pinned to specific values. -
getPinnedVariableNames
Gets the set of variable names used in this traversal which have been pinned to specific values. -
getGValues
Gets the set ofGValueobjects used in this traversal. -
getPinnedGValues
Gets the set of pinned GValues used in this traversal. -
hasVariables
public boolean hasVariables()Determines whether the manager has step registrations. -
hasUnpinnedVariables
public boolean hasUnpinnedVariables()Determines whether the manager has unpinned GValues. -
pinVariable
Pins any GValue with the provided name. This should be called anytime an optimization alters the Traversal based on the current value of a GValue. This indicates that the resulting traversal is only valid for the current value of this GValue, and is not generalizable to any parameter value.- Parameters:
name- the name of the GValue to be pinned- Returns:
- true if name was previously unpinned, false otherwise.
- Throws:
IllegalArgumentException- if no GValue of the given name is registered
-
clone
Creates a deep copy of this GValueManager with cloned GValue instances. -
pinGValues
-
pinGValues
-
register
Registers a GValue in the internal registry if it represents a variable. Non-variables are not registered.- Parameters:
gValue- the GValue to register- Throws:
IllegalArgumentException- if a different GValue with the same name is already registered
-
register
Registers a collection of GValues in the internal registry. Non-variables are not registered.- Parameters:
gValues- the collection of GValues to register
-
updateVariable
Updates the value of a registered variable.- Parameters:
name- the name of the variable to updatevalue- the new value for the variable- Throws:
IllegalArgumentException- if the variable is not registered or is already pinned
-