Class DelegatingType

java.lang.Object
net.ssehub.easy.varModel.model.datatypes.DelegatingType
All Implemented Interfaces:
IDatatype, IDatatypeVisitable

class DelegatingType extends Object implements IDatatype
An internal delegating type to resolve cyclic class dependencies. A delegating type represents (common) singleton type instances.
Author:
Holger Eichelberger
  • Field Details

    • operationList

      private List<Operation> operationList
    • delegate

      private IDatatype delegate
      Stores the type to delegate to.
    • parent

      private DelegatingType parent
    • parentOperationCount

      private int parentOperationCount
  • Constructor Details

    • DelegatingType

      DelegatingType()
      Creates a delegating type.
    • DelegatingType

      DelegatingType(IDatatype delegate)
      Creates a delegating type.
      Parameters:
      delegate - the delegate
    • DelegatingType

      DelegatingType(DelegatingType parent)
      Creates a delegating type.
      Parameters:
      parent - the parent delegate (considers operations)
    • DelegatingType

      DelegatingType(IDatatype delegate, DelegatingType parent)
      Creates a delegating type.
      Parameters:
      delegate - the delegate
      parent - the parent delegate (considers operations)
  • Method Details

    • updateParentInformation

      public void updateParentInformation()
      Updates the information collected about the parent.
    • getAllOperationCount

      private int getAllOperationCount()
      Returns the number of operations of the parent an all parents above.
      Returns:
      the number of operation
    • getAllOperation

      private Operation getAllOperation(int index)
      Returns the operation at position index and considers also parent operations.
      Parameters:
      index - the index number of the operation
      Returns:
      the specified operation
      Throws:
      IndexOutOfBoundsException - if index<0 || index>=getAllOperationCount()
    • setDelegate

      public void setDelegate(IDatatype delegate)
      Changes the delegate.
      Parameters:
      delegate - the new delegate
    • getName

      public String getName()
      Description copied from interface: IDatatype
      Method to get the name of the Datatype.
      Specified by:
      getName in interface IDatatype
      Returns:
      name of the Datatype
    • getNameSpace

      public String getNameSpace()
      Description copied from interface: IDatatype
      Returns the namespace of this datatype.
      Specified by:
      getNameSpace in interface IDatatype
      Returns:
      Namespace of this datatype.
    • getQualifiedName

      public String getQualifiedName()
      Description copied from interface: IDatatype
      Returns the qualified name of this element.
      Specified by:
      getQualifiedName in interface IDatatype
      Returns:
      the qualified name
    • getUniqueName

      public String getUniqueName()
      Description copied from interface: IDatatype
      Returns the unique name of this element.
      Specified by:
      getUniqueName in interface IDatatype
      Returns:
      the unique name
    • getOperation

      public Operation getOperation(int index)
      Description copied from interface: IDatatype
      Returns the operation specified by index.
      Specified by:
      getOperation in interface IDatatype
      Parameters:
      index - a 0-based index specifying the operation to be returned
      Returns:
      the operation
    • getOperationCount

      public int getOperationCount()
      Description copied from interface: IDatatype
      Returns the number of operations.
      Specified by:
      getOperationCount in interface IDatatype
      Returns:
      the number of operations
    • isAssignableFrom

      public boolean isAssignableFrom(IDatatype type)
      Description copied from interface: IDatatype
      Determines if the data type represented by this object is either the same as, or is a supertype of type.
      Specified by:
      isAssignableFrom in interface IDatatype
      Parameters:
      type - the type being checked
      Returns:
      true if this type is either the same or a supertype of type, false else
    • addOperation

      void addOperation(Operation operator)
      Allows child classes to add Operations to itself.
      Parameters:
      operator - One operation, which should be added.
    • prependOperation

      void prependOperation(Operation operator)
      Allows child classes to add Operations to itself.
      Parameters:
      operator - One operation, which should be added.
    • getTypeClass

      public Class<? extends IDatatype> getTypeClass()
      Description copied from interface: IDatatype
      Returns the java class realizing the type.
      Specified by:
      getTypeClass in interface IDatatype
      Returns:
      the java class realizing the type
    • getType

      public IDatatype getType()
      Returns the object realizing the type.
      Specified by:
      getType in interface IDatatype
      Returns:
      the object realizing the type
    • getGenericType

      public IDatatype getGenericType(int index)
      Description copied from interface: IDatatype
      Returns the specified generic type.
      Specified by:
      getGenericType in interface IDatatype
      Parameters:
      index - the index of the type
      Returns:
      the specified generic type
    • getGenericTypeCount

      public int getGenericTypeCount()
      Description copied from interface: IDatatype
      Returns the number of generic types.
      Specified by:
      getGenericTypeCount in interface IDatatype
      Returns:
      the number of generic types
    • accept

      public void accept(IDatatypeVisitor visitor)
      Description copied from interface: IDatatypeVisitable
      Accepts a specialized visitor for creating a textual representation of the identity of this type.
      Specified by:
      accept in interface IDatatypeVisitable
      Parameters:
      visitor - the visitor to accept
    • isPseudoType

      public boolean isPseudoType()
      Description copied from interface: IDatatype
      Returns whether this type is a pseudo type. This operation shall be used to prevent the output of internal types to the user.
      Specified by:
      isPseudoType in interface IDatatype
      Returns:
      true if it is a pseudo type, false else
    • getDelegate

      public IDatatype getDelegate()
      Returns the delegate type.
      Returns:
      the delegate type
    • toString

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

      public boolean isPrimitive()
      Description copied from interface: IDatatype
      Returns whether this type is a primitive type.
      Specified by:
      isPrimitive in interface IDatatype
      Returns:
      true if it is a primitive type, false else