Class DefaultVariableResolver
java.lang.Object
com.blackrook.rookscript.resolvers.variable.AbstractVariableResolver
com.blackrook.rookscript.resolvers.variable.DefaultVariableResolver
- All Implemented Interfaces:
ScriptVariableResolver
A single, scoped open variable set in which values can be set.
All variable names are CASE-INSENSITIVE.
The internals are written so that the storage uses few memory allocations/deletions.
None of the variables are read-only. This implementation is thread-safe.
- Author:
- Matthew Tropiano
-
Nested Class Summary
Nested classes/interfaces inherited from class com.blackrook.rookscript.resolvers.variable.AbstractVariableResolver
AbstractVariableResolver.Entry
-
Field Summary
Fields inherited from class com.blackrook.rookscript.resolvers.variable.AbstractVariableResolver
entries, entryCount
-
Constructor Summary
ConstructorDescriptionCreates a variable with a default size.DefaultVariableResolver
(int capacity) Creates a variable resolver with a default size. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears the scope.boolean
clearValue
(String name) Removes a value by variable name.Methods inherited from class com.blackrook.rookscript.resolvers.variable.AbstractVariableResolver
containsValue, get, getIndex, getValue, isEmpty, isReadOnly, removeIndex, setValue, size, toString
-
Field Details
-
DEFAULT_CAPACITY
public static final int DEFAULT_CAPACITYDefault capacity.- See Also:
-
-
Constructor Details
-
DefaultVariableResolver
public DefaultVariableResolver()Creates a variable with a default size.- See Also:
-
DefaultVariableResolver
public DefaultVariableResolver(int capacity) Creates a variable resolver with a default size.- Parameters:
capacity
- the initial capacity.
-
-
Method Details
-
clearValue
Removes a value by variable name. This should fail if the provided name corresponds to a read-only variable.- Parameters:
name
- the variable name.- Returns:
- true if the value existed and was removed, false otherwise.
- Throws:
IllegalArgumentException
- if the provided name refers to a value that is read-only.
-
clear
public void clear()Clears the scope.
-