Class VeLaEnvironment<T>

java.lang.Object
org.aavso.tools.vstar.vela.VeLaEnvironment<T>
Direct Known Subclasses:
EmptyVeLaEnvironment, VeLaScope, VeLaValidObservationEnvironment

public class VeLaEnvironment<T> extends Object
A generic symbol binding and lookup environment implementation, the base class for all VeLa environments.
  • Field Details

  • Constructor Details

    • VeLaEnvironment

      public VeLaEnvironment()
      Construct an environment with an empty name and constant set.
    • VeLaEnvironment

      public VeLaEnvironment(Map<String,T> map, Set<String> isBoundConstants)
      Construct an environment with a specified empty name and constant set.
  • Method Details

    • isMutable

      public boolean isMutable()
      Is this environment mutable (can be modified)?
      Returns:
      true if mutable, false if not
    • lookup

      public Optional<T> lookup(String name)
      Lookup the named symbol in the environment.
      Parameters:
      name - The symbol's name.
      Returns:
      An optional Operand instance if it exists.
    • hasBinding

      @Deprecated public boolean hasBinding(String name)
      Deprecated.
      Does this environment contain the named binding?
      Parameters:
      name - The name of the binding to lookup.
      Returns:
      Whether the name is bound in this environment. Less useful now, given the use of Optional values
    • bind

      public void bind(String name, T value, boolean isConstant)
      Bind a value to a name.
      It is an invariant that a constant binding cannot be overridden.
      Parameters:
      name - The name to which to bind the value.
      value - The value to be bound.
      isConstant - Is this a constant binding?
    • addAll

      public void addAll(VeLaEnvironment<T> other)
      Add all symbol bindings from another scope to this one.
      Parameters:
      other - The scope to be added to this one.
    • isEmpty

      public boolean isEmpty()
      Is this VeLa environment empty?
    • toString

      public String toString()
      Overrides:
      toString in class Object