Class GValueManager
- java.lang.Object
- 
- org.apache.tinkerpop.gremlin.process.traversal.GValueManager
 
- 
- All Implemented Interfaces:
- Serializable,- Cloneable
 
 public final class GValueManager extends Object implements Serializable, Cloneable TheGValueManagerclass is responsible for managing the state ofGValueinstances 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:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description GValueManager()Creates a new empty GValueManager.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description GValueManagerclone()Creates a deep copy of this GValueManager with cloned GValue instances.Set<GValue<?>>getGValues()Gets the set ofGValueobjects used in this traversal.Set<GValue<?>>getPinnedGValues()Gets the set of pinned GValues used in this traversal.Set<String>getPinnedVariableNames()Gets the set of variable names used in this traversal which have been pinned to specific values.Set<String>getUnpinnedVariableNames()Gets the set of variable names used in this traversal which have not been pinned to specific values.Set<String>getVariableNames()Gets the set of variable names used in this traversal.booleanhasUnpinnedVariables()Determines whether the manager has unpinned GValues.booleanhasVariables()Determines 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.voidregister(GValue<?> gValue)Registers a GValue in the internal registry if it represents a variable.voidupdateVariable(String name, Object value)Updates the value of a registered variable.
 
- 
- 
- 
Method Detail- 
mergeIntopublic void mergeInto(GValueManager other) Merges the internal registries of the currentGValueManagerinto anotherGValueManager. Transfers the state of thegValueRegistryandstepRegistryfrom the current instance to the specified target instance.- Parameters:
- other- the target- GValueManagerinto which the current instance's registries will be merged
 
 - 
getVariableNamespublic Set<String> getVariableNames() Gets the set of variable names used in this traversal.
 - 
getUnpinnedVariableNamespublic Set<String> getUnpinnedVariableNames() Gets the set of variable names used in this traversal which have not been pinned to specific values.
 - 
getPinnedVariableNamespublic Set<String> getPinnedVariableNames() Gets the set of variable names used in this traversal which have been pinned to specific values.
 - 
getGValuespublic Set<GValue<?>> getGValues() Gets the set ofGValueobjects used in this traversal.
 - 
getPinnedGValuespublic Set<GValue<?>> getPinnedGValues() Gets the set of pinned GValues used in this traversal.
 - 
hasVariablespublic boolean hasVariables() Determines whether the manager has step registrations.
 - 
hasUnpinnedVariablespublic boolean hasUnpinnedVariables() Determines whether the manager has unpinned GValues.
 - 
pinVariablepublic boolean pinVariable(String name) 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
 
 - 
clonepublic GValueManager clone() Creates a deep copy of this GValueManager with cloned GValue instances.
 - 
pinGValuespublic void pinGValues(Collection<GValue<?>> gValues) 
 - 
registerpublic void register(GValue<?> gValue) 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
 
 - 
registerpublic void register(Collection<GValue<?>> gValues) Registers a collection of GValues in the internal registry. Non-variables are not registered.- Parameters:
- gValues- the collection of GValues to register
 
 - 
updateVariablepublic void updateVariable(String name, Object value) Updates the value of a registered variable.- Parameters:
- name- the name of the variable to update
- value- the new value for the variable
- Throws:
- IllegalArgumentException- if the variable is not registered or is already pinned
 
 
- 
 
-