Class DefaultScopeResolver

java.lang.Object
com.blackrook.rookscript.resolvers.scope.DefaultScopeResolver
All Implemented Interfaces:
ScriptScopeResolver

public class DefaultScopeResolver extends Object implements ScriptScopeResolver
An 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
  • Constructor Details

    • DefaultScopeResolver

      public DefaultScopeResolver()
      Creates a new default scope resolver with no added scopes.
  • Method Details

    • addScope

      public void addScope(String name, ScriptVariableResolver resolver)
      Adds a scope to this scope resolver by name.
      Parameters:
      name - the name of the scope.
      resolver - the resolver to resolve by that name.
    • clear

      public void clear()
      Clears this scope resolver of all added scope mappings.
    • getScope

      public ScriptVariableResolver getScope(String name)
      Description copied from interface: ScriptScopeResolver
      Gets the corresponding scope for a scope name.
      Specified by:
      getScope in interface ScriptScopeResolver
      Parameters:
      name - the scope name.
      Returns:
      the corresponding scope, or null if no corresponding scope.
    • containsScope

      public boolean containsScope(String name)
      Description copied from interface: ScriptScopeResolver
      Checks if this contains a scope by its scope name.
      Specified by:
      containsScope in interface ScriptScopeResolver
      Parameters:
      name - the scope name.
      Returns:
      true if so, false if not.