Class ObjectGenerator


public final class ObjectGenerator extends Expression

ObjectGenerator i.e. new Object expression.


Simula Standard: 3.8 Object expressions

object-generator = NEW class-identifier [ ( actual-parameter-part ) ]

   actual-parameter-part
        =  "("  actual-parameter  {  ,  actual-parameter  }  ")"

      actual-parameter
          =  expression
          |  array-identifier-1
          |  switch-identifier
          |  procedure-identifier-1

Link to GitHub: Source File.

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

    • classIdentifier

      private String classIdentifier
      The class-identifier
    • meaning

      Meaning meaning
      The semantic meaning
    • params

      private Vector<Expression> params
      The actual parameters before checking
    • checkedParams

      private Vector<Expression> checkedParams
      The actual parameters after checking
  • Constructor Details

    • ObjectGenerator

      private ObjectGenerator(String ident, Vector<Expression> params)
      Create a new ObjectGenerator.
      Parameters:
      ident - class-identifier
      params - the actual parameters
    • ObjectGenerator

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

    • expectNew

      static Expression expectNew()

      Parse an object generator.

      object-generator = NEW class-identifier [ ( actual-parameter-part ) ]
      
         actual-parameter-part
              =  "("  actual-parameter  {  ,  actual-parameter  }  ")"
      
      Returns:
      the newly created ObjectGenerator.
    • doChecking

      public void doChecking()
      Description copied from class: SyntaxClass

      Perform semantic checking.

      This must be redefined in every subclass.

      Overrides:
      doChecking in class SyntaxClass
    • maybeStatement

      public boolean maybeStatement()
      Description copied from class: Expression
      Returns true if this expression may be used as a statement.
      Specified by:
      maybeStatement in class Expression
      Returns:
      true if this expression may be used as a statement
    • toJavaCode

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

      public void buildEvaluation(Expression rightPart, CodeBuilder codeBuilder)
      Description copied from class: Expression
      ClassFile coding utility: Build Evaluation Code.
      Specified by:
      buildEvaluation in class Expression
      Parameters:
      rightPart - expression
      codeBuilder - the codeBuilder used.
    • toString

      public String toString()
      Overrides:
      toString in class Expression
    • 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 ObjectGenerator readObject(AttributeInputStream inpt) throws IOException
      Read and return an ObjectGenerator object.
      Parameters:
      inpt - the AttributeInputStream to read from
      Returns:
      the ObjectGenerator object read from the stream.
      Throws:
      IOException - if something went wrong.