Class DeclarationList

All Implemented Interfaces:
Serializable, Cloneable, Iterable<Declaration>, Collection<Declaration>, List<Declaration>, RandomAccess, SequencedCollection<Declaration>

public final class DeclarationList extends Vector<Declaration>

Declaration List.

This is a utility class to hold local declaration lists in declaration scopes.

Link to GitHub: Source File.

Author:
Øystein Myhre Andersen
See Also:
  • Field Details

    • identifier

      public final String identifier
      Identifier.
  • Constructor Details

    • DeclarationList

      public DeclarationList(String identifier)
      Create a new DeclarationList.
      Parameters:
      identifier - the given identifier
  • Method Details

    • find

      public Declaration find(String identifier)
      Find a declaration in this DeclarationList
      Parameters:
      identifier - declaration identifier
      Returns:
      the resulting Declaration
    • add

      public boolean add(Declaration dcl)
      Add a declaration to this list.
      Specified by:
      add in interface Collection<Declaration>
      Specified by:
      add in interface List<Declaration>
      Overrides:
      add in class Vector<Declaration>
    • print

      public void print(String title)
      Utility print method.
      Parameters:
      title - the title
    • writeObject

      public void writeObject(AttributeOutputStream oupt) throws IOException
      Write a DeclarationList object to a AttributeOutputStream.
      Parameters:
      oupt - the AttributeOutputStream to write to.
      Throws:
      IOException - if something went wrong.
    • readObject

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