Skip to content

StdScope

Package: com.hypixel.hytale.server.npc.util.expression

public class StdScope implements Scope

Standard implementation of Scope backed by a HashMap<String, Symbol> symbol table and an optional parent scope for hierarchical lookup. Provides methods to add constants, mutable variables, supplier-backed variables, and functions (both invariant and variant). Symbol lookup walks the parent chain when a name is not found locally.

ModifierTypeName
protectedScopeparent
protectedMap<String, Symbol>symbolTable
Signature
public StdScope(Scope parent)
ModifierReturn TypeSignature
@Nonnull public staticStdScopecopyOf(@Nonnull StdScope other)
@Nonnull public staticStdScopemergeScopes(@Nonnull StdScope first, @Nonnull StdScope second)
ModifierReturn TypeSignature
publicvoidaddConst(String name, @Nullable String value)
publicvoidaddConst(String name, double value)
publicvoidaddConst(String name, boolean value)
publicvoidaddConst(String name, @Nullable String[] value)
publicvoidaddConst(String name, @Nullable double[] value)
publicvoidaddConst(String name, @Nullable boolean[] value)
publicvoidaddConstEmptyArray(String name)
publicvoidaddVar(String name, @Nullable String value)
publicvoidaddVar(String name, double value)
publicvoidaddVar(String name, boolean value)
publicvoidaddVar(String name, @Nullable String[] value)
publicvoidaddVar(String name, @Nullable double[] value)
publicvoidaddVar(String name, @Nullable boolean[] value)
publicvoidaddSupplier(String name, Supplier<String> value)
publicvoidaddSupplier(String name, DoubleSupplier value)
publicvoidaddSupplier(String name, BooleanSupplier value)
publicvoidaddStringArraySupplier(String name, Supplier<String[]> value)
publicvoidaddDoubleArraySupplier(String name, Supplier<double[]> value)
publicvoidaddBooleanArraySupplier(String name, Supplier<boolean[]> value)
publicvoidaddInvariant(@Nonnull String name, Scope.Function function, ValueType returnType, @Nonnull ValueType... argumentTypes)
publicvoidaddVariant(@Nonnull String name, Scope.Function function, ValueType returnType, @Nonnull ValueType... argumentTypes)
ModifierReturn TypeSignature
publicvoidchangeValue(String name, @Nullable String value)
publicvoidchangeValue(String name, double value)
publicvoidchangeValue(String name, boolean value)
publicvoidchangeValue(String name, @Nullable String[] value)
publicvoidchangeValue(String name, @Nullable double[] value)
publicvoidchangeValue(String name, @Nullable boolean[] value)
publicvoidchangeValueToEmptyArray(String name)

Seven protected static inner classes form the symbol hierarchy: Symbol (base with isConstant and valueType), SymbolString, SymbolNumber, SymbolBoolean, SymbolStringArray, SymbolNumberArray, SymbolBooleanArray, and SymbolFunction. Each typed subclass wraps the corresponding supplier or function reference.

  • Scope — interface this class implements
  • StdLib — singleton subclass providing built-in functions
  • ValueType — type discriminant used by symbols
Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.