Class Val

All Implemented Interfaces:
HostResult
Direct Known Subclasses:
BindingVal, BinVal, ExceptionVal, FunVal, JavaVal, LocationVal, MaybeTraitVal, NumVal, RngVal, StrVal, TraceVal, VarrefVal, VecVal

public class Val extends HostResultCore implements HostResult
A Kink value or val.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final Vm
    The vm.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Val(Vm vm)
    Constructs a val.
    protected
    Val(Vm vm, SharedVars sharedVars)
    Constructs a val with the shared vars.
  • Method Summary

    Modifier and Type
    Method
    Description
    final Val
    getVar(int symHandle)
    Returns the target of the var specified by sym; or null if absent.
    final Set<Integer>
    Returns the sym handle set of the vars of this val.
    final boolean
    hasVar(int symHandle)
    Returns whether the val has the var specified by sym.
    Returns the identity number of this val.
    Returns the core of the result, which the executor handles.
    final void
    setVar(int symHandle, Val val)
    Assigns val to the var specified by symHandle.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • vm

      public final Vm vm
      The vm.
  • Constructor Details

    • Val

      protected Val(Vm vm)
      Constructs a val.
      Parameters:
      vm - the vm.
    • Val

      protected Val(Vm vm, SharedVars sharedVars)
      Constructs a val with the shared vars.
      Parameters:
      vm - the vm.
      sharedVars - the shared vars.
  • Method Details

    • makeHostResultCore

      public final HostResultCore makeHostResultCore()
      Description copied from interface: HostResult
      Returns the core of the result, which the executor handles.

      This method is intended to be used by the Kink runtime implementation. Do not call this method from your program.

      Specified by:
      makeHostResultCore in interface HostResult
      Returns:
      the core of the result.
    • identity

      public final BigInteger identity()
      Returns the identity number of this val.

      The identity number is unique within the vm.

      Returns:
      the identity number of this val.
    • setVar

      public final void setVar(int symHandle, Val val)
      Assigns val to the var specified by symHandle.
      Parameters:
      symHandle - the sym handle of the var.
      val - the val to be assigned.
    • getVar

      @Nullable public final Val getVar(int symHandle)
      Returns the target of the var specified by sym; or null if absent.
      Parameters:
      symHandle - the sym handle of the var.
      Returns:
      the target of the var specified by sym; or null if absent.
    • hasVar

      public final boolean hasVar(int symHandle)
      Returns whether the val has the var specified by sym.
      Parameters:
      symHandle - the sym handle of the varl.
      Returns:
      true if the val has the var specified by sym.
    • getVarSymHandleSet

      public final Set<Integer> getVarSymHandleSet()
      Returns the sym handle set of the vars of this val.
      Returns:
      the sym handle set of the vars of this val.