Class Reference

  • All Implemented Interfaces:
    IDatatype, IDatatypeVisitable, IModelElement

    public class Reference
    extends CustomDatatype
    A reference allows the definition of individual configurations of an (external) element for the referencing element. Currently, operations such as assignments are represented as the respective operations of the base type. Actually, this may be confusing / wrong. See ConstraintSyntaxTree.inferDatatype().
    Author:
    heiko beck, Holger Eichelberger
    • Field Detail

      • TYPE

        public static final IDatatype TYPE
        This constant represents the common type of all references. Each specific reference type is assignable to this type.
      • TYPE_OF

        public static final Operation TYPE_OF
      • EQUALS

        public static final Operation EQUALS
      • UNEQUALS

        public static final Operation UNEQUALS
      • UNEQUALS_ALIAS

        public static final Operation UNEQUALS_ALIAS
      • ASSIGNMENT

        public static final Operation ASSIGNMENT
      • IS_DEFINED

        public static final Operation IS_DEFINED
      • REF_BY

        public static final Operation REF_BY
    • Constructor Detail

      • Reference

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

        public Reference​(java.lang.String name,
                         IDatatype type,
                         ModelElement parent)
        Constructor for the reference.
        Parameters:
        name - Name of reference
        type - the type to refer to
        parent - the object, in which this specific one is embedded
    • Method Detail

      • accept

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

        public boolean isAssignableFrom​(IDatatype type)
        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
      • dereference

        public static IDatatype dereference​(IDatatype type)
        Aims at dereference type in case that it is a reference.
        Parameters:
        type - the type to dereference
        Returns:
        the dereferenced type (or type if type was not a reference)
      • dereference

        public static void dereference​(IDatatype[] types)
        Dereferences all datatypes in type.
        Parameters:
        types - the types to be dereferenced
      • isReferenceTo

        public static boolean isReferenceTo​(IDatatype type,
                                            IDatatype parameter)
        Returns whether the given type is a reference with given generic.
        Parameters:
        type - the type to check
        parameter - the parameter type of the expected reference (may also be a more generic type)
        Returns:
        true if type is refTo(generic), false else