Class Statement1

All Implemented Interfaces:
Standard<Statement>, Statement, StatementKernel

public class Statement1 extends StatementSecondary
Statement represented as a Tree of StatementLabels with implementations of primary methods.
Representation Invariant (concrete invariant of $this):
[$this.rep is a valid representation of a Statement]
Abstraction Relation (interpretation mapping between $this and this):
this = $this.rep
  • Nested Class Summary

    Nested classes/interfaces inherited from interface components.statement.StatementKernel

    StatementKernel.Condition, StatementKernel.Kind
  • Constructor Summary

    Constructors
    Constructor
    Description
    No-argument constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    addToBlock(int pos, Statement s)
    Adds the statement s at position pos in this BLOCK statement; the declaration notwithstanding, the dynamic type of s must be the same as the dynamic type of this.
    final void
    Assembles in this a CALL statement with root label (CALL, ?, inst) and no subtrees.
    final void
    Assembles in this an IF statement with root label (IF, c, ?) and only subtree the BLOCK s; the declaration notwithstanding, the dynamic type of s must be the same as the dynamic type of this.
    final void
    Assembles in this an IF_ELSE statement with root label (IF_ELSE, c, ?) and as two subtrees the BLOCKs s1 and s2; the declaration notwithstanding, the dynamic type of s1 and s2 must be the same as the dynamic type of this.
    final void
    Assembles in this a WHILE statement with root label (WHILE, c, ?) and only subtree the BLOCK s; the declaration notwithstanding, the dynamic type of s must be the same as the dynamic type of this.
    final void
    Resets this to an initial value.
    final String
    Disassembles CALL statement this and returns the called instruction name as the value of the function.
    Disassembles IF statement this into its test Condition, which is returned as the value of the function, and its only subtree, the BLOCK statement s; the declaration notwithstanding, the dynamic type of s must be the same as the dynamic type of this.
    Disassembles IF_ELSE statement this into its test Condition, which is returned as the value of the function, and its two subtrees, the BLOCK statements s1 and s2; the declaration notwithstanding, the dynamic type of s1 and s2 must be the same as the dynamic type of this.
    Disassembles WHILE statement this into its test Condition , which is returned as the value of the function, and its only subtree, the BLOCK statement s; the declaration notwithstanding, the dynamic type of s must be the same as the dynamic type of this.
    Reports the kind of statement this is.
    final int
    Reports the number of statements in this BLOCK.
    Returns a new object with the same dynamic type as this, having an initial value.
    final Statement
    removeFromBlock(int pos)
    Removes and returns the statement at position pos in this BLOCK statement.
    final void
    Sets this to the incoming value of source, and resets source to an initial value; the declaration notwithstanding, the dynamic type of source must be the same as the dynamic type of this.

    Methods inherited from class components.statement.StatementSecondary

    equals, hashCode, parse, parseBlock, prettyPrint, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Statement1

      public Statement1()
      No-argument constructor.
  • Method Details

    • newInstance

      public final Statement1 newInstance()
      Description copied from interface: Standard
      Returns a new object with the same dynamic type as this, having an initial value. If the type T has a no-argument constructor, then the value of the new returned object satisfies the contract of the no-argument constructor for T. If T does not have a no-argument constructor, then the value of the new returned object satisfies the contract of the constructor call that was used to initialize this .
      Returns:
      new object "like" this with an initial value
    • clear

      public final void clear()
      Description copied from interface: Standard
      Resets this to an initial value. If the type T has a no-argument constructor, then this satisfies the contract of the no-argument constructor for T. If T does not have a no-argument constructor, then this satisfies the contract of the constructor call that was used to initialize #this.
    • transferFrom

      public final void transferFrom(Statement source)
      Description copied from interface: Standard
      Sets this to the incoming value of source, and resets source to an initial value; the declaration notwithstanding, the dynamic type of source must be the same as the dynamic type of this. If the type T has a no-argument constructor, then source satisfies the contract of the no-argument constructor for T. If T does not have a no-argument constructor, then source satisfies the contract of the constructor call that was used to initialize #source.
      Parameters:
      source - object whose value is to be transferred
    • kind

      public final StatementKernel.Kind kind()
      Description copied from interface: StatementKernel
      Reports the kind of statement this is.
      Returns:
      the kind of this statement
    • addToBlock

      public final void addToBlock(int pos, Statement s)
      Description copied from interface: StatementKernel
      Adds the statement s at position pos in this BLOCK statement; the declaration notwithstanding, the dynamic type of s must be the same as the dynamic type of this.
      Parameters:
      pos - the position at which to add s
      s - the Statement to add
    • removeFromBlock

      public final Statement removeFromBlock(int pos)
      Description copied from interface: StatementKernel
      Removes and returns the statement at position pos in this BLOCK statement.
      Parameters:
      pos - the position of the child to remove
      Returns:
      the child at position pos in this
    • lengthOfBlock

      public final int lengthOfBlock()
      Description copied from interface: StatementKernel
      Reports the number of statements in this BLOCK.
      Returns:
      the length of this BLOCK
    • assembleIf

      public final void assembleIf(StatementKernel.Condition c, Statement s)
      Description copied from interface: StatementKernel
      Assembles in this an IF statement with root label (IF, c, ?) and only subtree the BLOCK s; the declaration notwithstanding, the dynamic type of s must be the same as the dynamic type of this.
      Parameters:
      c - the Condition of the IF statement
      s - the body of the IF statement
    • disassembleIf

      Description copied from interface: StatementKernel
      Disassembles IF statement this into its test Condition, which is returned as the value of the function, and its only subtree, the BLOCK statement s; the declaration notwithstanding, the dynamic type of s must be the same as the dynamic type of this.
      Parameters:
      s - the body of this IF statement
      Returns:
      the Condition of this IF statement
    • assembleIfElse

      Description copied from interface: StatementKernel
      Assembles in this an IF_ELSE statement with root label (IF_ELSE, c, ?) and as two subtrees the BLOCKs s1 and s2; the declaration notwithstanding, the dynamic type of s1 and s2 must be the same as the dynamic type of this.
      Parameters:
      c - the Condition of the IF_ELSE statement
      s1 - the body of the "then" part of the IF_ELSE statement
      s2 - the body of the "else" part of the IF_ELSE statement
    • disassembleIfElse

      Description copied from interface: StatementKernel
      Disassembles IF_ELSE statement this into its test Condition, which is returned as the value of the function, and its two subtrees, the BLOCK statements s1 and s2; the declaration notwithstanding, the dynamic type of s1 and s2 must be the same as the dynamic type of this.
      Parameters:
      s1 - the body of the "then" part of the IF_ELSE statement
      s2 - the body of the "else" part of the IF_ELSE statement
      Returns:
      the Condition of this IF_ELSE statement
    • assembleWhile

      Description copied from interface: StatementKernel
      Assembles in this a WHILE statement with root label (WHILE, c, ?) and only subtree the BLOCK s; the declaration notwithstanding, the dynamic type of s must be the same as the dynamic type of this.
      Parameters:
      c - the Condition of the WHILE statement
      s - the body of the WHILE statement
    • disassembleWhile

      Description copied from interface: StatementKernel
      Disassembles WHILE statement this into its test Condition , which is returned as the value of the function, and its only subtree, the BLOCK statement s; the declaration notwithstanding, the dynamic type of s must be the same as the dynamic type of this.
      Parameters:
      s - the body of this WHILE statement
      Returns:
      the Condition of this WHILE statement
    • assembleCall

      public final void assembleCall(String inst)
      Description copied from interface: StatementKernel
      Assembles in this a CALL statement with root label (CALL, ?, inst) and no subtrees.
      Parameters:
      inst - the name of the instruction of the CALL statement
    • disassembleCall

      public final String disassembleCall()
      Description copied from interface: StatementKernel
      Disassembles CALL statement this and returns the called instruction name as the value of the function.
      Returns:
      the name of the instruction of this CALL statement