Class DerivedDatatype

    • Constructor Detail

      • DerivedDatatype

        private DerivedDatatype()
        Creates the singleton instance for TYPE.
      • DerivedDatatype

        public DerivedDatatype​(java.lang.String name,
                               IDatatype basisType,
                               ModelElement parent)
        Constructor for the derived data type.
        Parameters:
        name - the name of the derived data type
        basisType - the type the this datatype is derived from
        parent - the object, in which this specific one is embedded
      • DerivedDatatype

        public DerivedDatatype​(java.lang.String name,
                               IDatatype basisType,
                               ModelElement parent,
                               Constraint... constraints)
        Constructor for the derived data type.
        Parameters:
        name - the name of the derived data type
        basisType - the type the this datatype is derived from
        parent - the object, in which this specific one is embedded
        constraints - restricting constraints on basisType, may be null
    • Method Detail

      • setConstraints

        public void setConstraints​(Constraint[] constraints)
        Changes the derivation constraints. [required as consequence of parent elements]
        Parameters:
        constraints - restricting constraints on basisType, may be null
      • unregister

        public boolean unregister​(IDerivedDatatypeListener listener)
        Unregisters an existing IDerivedDatatypeListener to this type.
        Parameters:
        listener - An instance of this type.
        Returns:
        true if this type contained the specified listener
      • getConstraintCount

        public int getConstraintCount()
        Returns the number of constraints.
        Returns:
        the number of constraints
      • getTypeDeclaration

        public DecisionVariableDeclaration getTypeDeclaration()
        This typeDeclaration is needed for the constraints.
        Returns:
        typeDeclaration related to this datatype
      • getConstraint

        public Constraint getConstraint​(int index)
        Returns a specific constraint.
        Parameters:
        index - the index of the constraint
        Returns:
        the specified constraint
        Throws:
        java.lang.IndexOutOfBoundsException - if 0<index || index>getConstraintCount()
      • getBasisType

        public IDatatype getBasisType()
        Returns the basis type.
        Returns:
        the basis type
      • accept

        public void accept​(IModelVisitor visitor)
        Description copied from interface: IModelElement
        Accept method for the visitor.
        Parameters:
        visitor - The visitor, which should process this model element.
      • isAssignableFrom

        public boolean isAssignableFrom​(IDatatype type)
        Description copied from class: CustomDatatype
        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
        Overrides:
        isAssignableFrom in class CustomDatatype
        Parameters:
        type - the type being checked
        Returns:
        true if this type is either the same or a supertype of type, true else
      • resolveToBasis

        public static final IDatatype resolveToBasis​(IDatatype type)
        Resolves the given type to its innermost basis datatype. We cannot do this automatically, as otherwise the tests for assignable types, e.g. to Compounds, would fail.
        Parameters:
        type - the type to be resolved
        Returns:
        the innermost basis datatype, type if type is not a DerivedDatatype.