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 Details

    • DTYPE

      static final DelegatingType DTYPE
    • 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
    • IF_DEFINED

      public static final Operation IF_DEFINED
    • COPY

      public static final Operation COPY
    • REF_BY

      public static final Operation REF_BY
    • type

      private IDatatype type
  • Constructor Details

    • Reference

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

      public Reference(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 Details

    • getType

      public IDatatype getType()
      Returns the type this reference is referring to.
      Specified by:
      getType in interface IDatatype
      Overrides:
      getType in class CustomDatatype
      Returns:
      the type
    • accept

      public void accept(IModelVisitor visitor)
      Accept method for the visitor.
      Parameters:
      visitor - The visitor, which should process this model element.
    • 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
      Overrides:
      accept in class ContainableModelElement
      Parameters:
      visitor - the visitor to accept
    • 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