Class ConditionalStatement


public final class ConditionalStatement extends Statement

Conditional Statement.


Simula Standard: 4.2 Conditional statement

  conditional-statement = if-clause { Label : } for-statement
                        | if-clause { Label : } unconditional-statement  [ ELSE statement ]
                        
    if-clause = IF boolean-expression THEN

Link to GitHub: Source File.

Author:
SIMULA Standards Group, Øystein Myhre Andersen
  • Field Details

    • condition

      private Expression condition
      The if-clause condition
    • thenStatement

      private Statement thenStatement
      The then-statement
    • elseStatement

      private Statement elseStatement
      The else-statement
  • Constructor Details

    • ConditionalStatement

      ConditionalStatement(int line)
      Create a new ConditionalStatement.
      Parameters:
      line - the source line number
    • ConditionalStatement

      private ConditionalStatement()
      Default constructor used by Attribute File I/O
  • Method Details

    • print

      public void print(int indent)
      Description copied from class: SyntaxClass
      Utility print method.
      Overrides:
      print in class SyntaxClass
      Parameters:
      indent - number of spaces leading the line
    • doChecking

      public void doChecking()
      Description copied from class: SyntaxClass

      Perform semantic checking.

      This must be redefined in every subclass.

      Overrides:
      doChecking in class SyntaxClass
    • doJavaCoding

      public void doJavaCoding()
      Description copied from class: SyntaxClass
      Output Java code.
      Overrides:
      doJavaCoding in class Statement
    • buildByteCode

      public void buildByteCode(CodeBuilder codeBuilder)
      Description copied from class: Statement
      Build Java ByteCode.
      Overrides:
      buildByteCode in class Statement
      Parameters:
      codeBuilder - the codeBuilder to use.
    • printTree

      public void printTree(int indent, Object head)
      Description copied from class: SyntaxClass
      Utility print syntax tree method.
      Overrides:
      printTree in class SyntaxClass
      Parameters:
      indent - number of spaces leading the lines
      head - the head of the tree.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • writeObject

      public void writeObject(AttributeOutputStream oupt) throws IOException
      Description copied from class: SyntaxClass
      Write a SyntaxClass object to a AttributeOutputStream.
      Overrides:
      writeObject in class SyntaxClass
      Parameters:
      oupt - the AttributeOutputStream to write to.
      Throws:
      IOException - if something went wrong.
    • readObject

      public static ConditionalStatement readObject(AttributeInputStream inpt) throws IOException
      Read and return a ConditionalStatement object.
      Parameters:
      inpt - the AttributeInputStream to read from
      Returns:
      the ConditionalStatement object read from the stream.
      Throws:
      IOException - if something went wrong.