Class DefaultVariableResolver

java.lang.Object
com.blackrook.rookscript.resolvers.variable.AbstractVariableResolver
com.blackrook.rookscript.resolvers.variable.DefaultVariableResolver
All Implemented Interfaces:
ScriptVariableResolver

public class DefaultVariableResolver extends AbstractVariableResolver
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
  • Field Details

    • DEFAULT_CAPACITY

      public static final int DEFAULT_CAPACITY
      Default 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

      public boolean clearValue(String name)
      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.