Class CheckEval

  • All Implemented Interfaces:
    java.io.Serializable, Check

    public class CheckEval
    extends java.lang.Object
    implements Check, java.io.Serializable

    A check object is the internal atomic step representing a predicate condition. This API is exposed to allow developers implementing a PredicateEnvironment bridge to take advantage of this API.

    Everything required to setup the predicate check, evaluate all the ands/ors, and return true or false is handled by this atomic step.

    To better illustrate what a Check is:

     if ($x == 3)
     { 
        println("\$x is 3");
     }

    The above sleep code would be compiled into a sequence that looks like:

    [Goto]:  (loop: false)
      [Condition]:
          [Predicate]: name->==  negated->false
             [Setup]:
                [Create Frame]
                [Scalar]: $x
                [Push]
                [Scalar]: 3
                [Push]
      [If true]:
          [Create Frame]
          [Parsed Literal]  null
             [Element]: $x is 3
          [Push]
          [Function Call]: &println
      [If False]:

    The parts that are bolded are representative of the word done by the Check object.

    See Also:
    PredicateEnvironment, Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.lang.String name  
    • Constructor Summary

      Constructors 
      Constructor Description
      CheckEval​(java.lang.String n, Block s)
      Constructs a check object, call by the sleep engine.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean check​(ScriptEnvironment env)
      Performs this "check".
      void setInfo​(int _hint)
      Sets the line number in code where this check object occurs, again called by the sleep engine
      java.lang.String toString()
      Returns a string representation of this object
      java.lang.String toString​(java.lang.String prefix)
      Converts this object to a string, used by the sleep engine for constructing an AST like thing
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • name

        public java.lang.String name
    • Constructor Detail

      • CheckEval

        public CheckEval​(java.lang.String n,
                         Block s)
        Constructs a check object, call by the sleep engine.
    • Method Detail

      • toString

        public java.lang.String toString​(java.lang.String prefix)
        Converts this object to a string, used by the sleep engine for constructing an AST like thing
        Specified by:
        toString in interface Check
      • toString

        public java.lang.String toString()
        Returns a string representation of this object
        Overrides:
        toString in class java.lang.Object
      • setInfo

        public void setInfo​(int _hint)
        Sets the line number in code where this check object occurs, again called by the sleep engine
        Specified by:
        setInfo in interface Check
      • check

        public boolean check​(ScriptEnvironment env)
        Performs this "check". Returns the value of the condition that is checked.
        Specified by:
        check in interface Check