Class NormalClassDeclaration

All Implemented Interfaces:
ASTNode, TypeDeclaration, TypeDeclarationContainer

public class NormalClassDeclaration extends AbstractTypeDeclarationNode
A class declaration. Its structure is as follows:
 NormalClassDeclaration:
    'class' Identifier [TypeParameters] ['extends' Type] ['implements' TypeList] ClassBody
 
Version:
1.0
  • Field Details

    • typeParams

      private List<TypeParameter> typeParams
    • extendedType

      private Type extendedType
    • implementedList

      private List<Type> implementedList
  • Constructor Details

    • NormalClassDeclaration

      public NormalClassDeclaration(Scanner s, int offs, String className)
  • Method Details

    • addImplemented

      public void addImplemented(Type implemented)
      Adds an implemented type to this class declaration.
      Parameters:
      implemented - The implemented type.
    • getExtendedType

      public Type getExtendedType()
    • getImplementedCount

      public int getImplementedCount()
    • getImplementedIterator

      public Iterator<Type> getImplementedIterator()
    • getMethodContainingOffset

      public Method getMethodContainingOffset(int offs)
      Gets the method in this class that contains a given offset.
      Parameters:
      offs - The offset.
      Returns:
      The method containing the offset, or null if no method in this class contains the offset.
    • getTypeParameters

      public List<TypeParameter> getTypeParameters()
    • getTypeString

      public String getTypeString()
      Description copied from interface: TypeDeclaration
      Returns the type of this type declaration, as a string.
      Returns:
      The type.
    • isTypeCompatible

      private boolean isTypeCompatible(Type type, String typeName)
      Returns whether a Type and a type name are type compatible. This method currently is a sham!
      Parameters:
      type - The type to check against.
      typeName - The type name to also check.
      Returns:
      Whether they are type-compatible.
    • setExtendedType

      public void setExtendedType(Type type)
    • setTypeParameters

      public void setTypeParameters(List<TypeParameter> typeParams)