Class ConnectionBlock


public final class ConnectionBlock extends DeclarationScope

Connection Block.

A Connection Block is a Statement within a Connection Statement. It acts as a block, whether it takes the form of a block or not. It further acts as if enclosed by a second fictitious block, called a "connection block". During the execution of a connection block the object X is said to be "connected".

See Simula Standard 4.8 Connection statement.

Link to GitHub: Source File.

Author:
Øystein Myhre Andersen
  • Field Details

    • statement

      public Statement statement
      The Connection Statement.
    • whenClassIdentifier

      private String whenClassIdentifier
      When clause class identifier.
    • whenClassDeclaration

      private Declaration whenClassDeclaration
      When clause class Declaration. Set during checking.
    • inspectedVariable

      public VariableExpression inspectedVariable
      The inspected variable.
    • connID

      public String connID
      The connected ident. E.g: the ident in the Java statement: if(_inspect_7 instanceof RTS_Infile connID)
    • classDeclaration

      public ClassDeclaration classDeclaration
      The when class declaration. Set during checking.
  • Constructor Details

    • ConnectionBlock

      public ConnectionBlock(VariableExpression inspectedVariable, String whenClassIdentifier)
      Create a new ConnectionBlock.
      Parameters:
      inspectedVariable - the inspected variable
      whenClassIdentifier - the when class identifier
    • ConnectionBlock

      public ConnectionBlock(String identifier)
      Default constructor used by Attribute File I/O
      Parameters:
      identifier - the block identifier.
  • Method Details

    • getTypedInspectedVariable

      public Expression getTypedInspectedVariable()
      Get inspected variable.
      Returns:
      inspected variable.
    • end

      public void end()
      Connection block end.
    • setClassDeclaration

      public void setClassDeclaration(ClassDeclaration classDeclaration)
      Set the Connected ClassDeclaration.
      Parameters:
      classDeclaration - the Connected ClassDeclaration.
    • setStatement

      public void setStatement(Statement statement)
      Set the Connection Statement.
      Parameters:
      statement - the Connection Statement
    • findMeaning

      public Meaning findMeaning(String identifier)
      Description copied from class: DeclarationScope
      Find Meaning
      Overrides:
      findMeaning in class DeclarationScope
      Parameters:
      identifier - declared identifier
      Returns:
      the resulting Meaning
    • findVisibleAttributeMeaning

      public Meaning findVisibleAttributeMeaning(String ident)
      Description copied from class: DeclarationScope
      Find visible attribute's Meaning
      Overrides:
      findVisibleAttributeMeaning in class DeclarationScope
      Parameters:
      ident - attribute identifier
      Returns:
      the resulting Meaning
    • doChecking

      public void doChecking()
      Description copied from class: SyntaxClass

      Perform semantic checking.

      This must be redefined in every subclass.

      Overrides:
      doChecking in class SyntaxClass
    • getRTBlockLevel

      public int getRTBlockLevel()
      Description copied from class: DeclarationScope
      Utility: Get Runtime BlockLevel.
      Overrides:
      getRTBlockLevel in class DeclarationScope
      Returns:
      true: the Runtime BlockLevel.
    • doJavaCoding

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

      public String toJavaCode()
      Description copied from class: SyntaxClass
      Generate Java code for this Syntax Class.
      Overrides:
      toJavaCode in class SyntaxClass
      Returns:
      Java code
    • getClassDesc

      public ClassDesc getClassDesc()
      Description copied from class: DeclarationScope
      Return the ClassDesc
      Overrides:
      getClassDesc in class DeclarationScope
      Returns:
      the ClassDesc
    • buildByteCode

      public void buildByteCode(CodeBuilder codeBuilder)
      Description copied from class: SyntaxClass
      Build Java ClassFile ByteCode.
      Overrides:
      buildByteCode in class SyntaxClass
      Parameters:
      codeBuilder - the codeBuilder to use.
    • 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
    • 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
    • buildClassFile

      public byte[] buildClassFile()
      Description copied from class: DeclarationScope
      Build Class File
      Specified by:
      buildClassFile in class DeclarationScope
      Returns:
      Class File bytes
    • 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 ConnectionBlock readObject(AttributeInputStream inpt) throws IOException
      Read and return a ConnectionBlock object.
      Parameters:
      inpt - the AttributeInputStream to read from
      Returns:
      the object read from the stream.
      Throws:
      IOException - if something went wrong.