Module dev.civl.mc

Interface DynamicScope


public interface DynamicScope
A DynamicScope is a runtime instance of a static scope. It assigns a value to each variable in the static scope. The values are symbolic expressions of the appropriate types.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the dyscope ID of the parent of this dynamic scope in the dyscope tree.
    Returns the reachers field.
    dev.civl.sarl.IF.expr.SymbolicExpression
    getValue(int vid)
    Gets the value of the variable with variable ID vid.
    Iterable<dev.civl.sarl.IF.expr.SymbolicExpression>
    Returns an iterable object over the variable values.
    Returns the lexical (static) scope of which this dynamic scope is an instance.
    int
    Returns the number of variable values stored in the dynamic scope.
    void
    print(PrintStream out, String prefix)
    Prints a human-readable representation of this dynamic scope.
    setValue(int vid, dev.civl.sarl.IF.expr.SymbolicExpression value)
    Sets the value assigned to the vid-th variable.
  • Method Details

    • lexicalScope

      Scope lexicalScope()
      Returns the lexical (static) scope of which this dynamic scope is an instance. A single static scope may have many (or 0) dynamic scope instances associated to it, but each dynamic scope is an instance of exactly one static scope.
      Returns:
      the static scope associated to this dynamic scope
    • getValue

      dev.civl.sarl.IF.expr.SymbolicExpression getValue(int vid)
      Gets the value of the variable with variable ID vid. The variables belonging to a static scope are numbered starting from 0.
      Parameters:
      vid - the variable ID, an integer in the range [0,numVars-1], where numVars is the number of variables in the static scope
      Returns:
      the value associated to the specified variable
    • setValue

      DynamicScope setValue(int vid, dev.civl.sarl.IF.expr.SymbolicExpression value)
      Sets the value assigned to the vid-th variable. If this dynamic scope is mutable, this method modifies this dynamic scope and returns this. Otherwise, it returns a new dynamic scope which is equivalent to this one except that the value assigned to the variable is the given value.
      Parameters:
      vid - the variable ID
      value - the value to assign to that variable
      Returns:
      an instance of DynamicScope obtained by modifying this instance to reflect the new assignment
    • getValues

      Iterable<dev.civl.sarl.IF.expr.SymbolicExpression> getValues()
      Returns an iterable object over the variable values. The iteration is guaranteed to give the values in variable ID order.
      Returns:
      iterable over variable values, starting from variable with vid 0 and going up
    • print

      void print(PrintStream out, String prefix)
      Prints a human-readable representation of this dynamic scope. The prefix is a string that pre-pended to each line of the output. It is typically something like "| | ", used to give a tabbed tree structure to the output.
      Parameters:
      out - print stream to which output is sent
      prefix - a string to prepend to each line of output
    • numberOfValues

      int numberOfValues()
      Returns the number of variable values stored in the dynamic scope. The number of variable values should be the same as the number of variables of the associated lexical scope.
      Returns:
      the number of variable values stored in the dynamic scope.
    • getReachers

      BitSet getReachers()
      Returns the reachers field.
      Returns:
      the reachers field
    • getParent

      int getParent()
      Returns the dyscope ID of the parent of this dynamic scope in the dyscope tree. If this is the root dyscope (i.e., the lexicalScope is the root static scope), returns -1.
      Returns:
      The dyscope ID of the parent of this dyscope or -1