Class DelegatingType

  • All Implemented Interfaces:
    IDatatype, IDatatypeVisitable

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

      • operationList

        private java.util.List<Operation> operationList
      • delegate

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

        private int parentOperationCount
    • Constructor Detail

      • 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 Detail

      • 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:
        java.lang.IndexOutOfBoundsException - if index<0 || index>=getAllOperationCount()
      • setDelegate

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

        public java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.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