java.lang.Object
com.aquima.interactions.expressions.definition.Type
All Implemented Interfaces:
Serializable

public class Type extends Object implements Serializable
This object contains the type information which can be associated with an expression.
Since:
5.0
Author:
F. van der Meer, O. Kerpershoek
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Type(DataType type, boolean multivalue)
    Constructs a type object for all types except 'entity'.
    Type(DataType type, String typeName, boolean multivalue)
    Constructs a type object with the type name argument.
    Type(DataType type, String typeName, boolean multivalue, Domain domain)
    Constructs a type object with the type name argument.
    Type(DataType type, String typeName, boolean multivalue, Domain domain, boolean isDerived)
    Constructs a type object with the type name argument.
    Type(DataType type, String typeName, boolean multivalue, IPrimitiveValue... domain)
    Constructs a type object with the type name argument.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
    Returns the dimension of this type object.
    This function returns the domain of this type within a certain context ( i.e.
    static Type
    getLeadingType(Type type1, Type type2)
    This function will check the leading type when two types are used to return a new type.
    protected String
     
    Acquires the integral type of the type object.
    Returns the type name of this type object when known.
    int
     
    boolean
    This function states whether this type is of the 'any' type.
    boolean
    This function checks whether the other type is assignable to this type without losing information.
    boolean
    isAssignableTo(Type other, ITypeEnvironment source, boolean checkDimension)
    This function checks whether the other type is assignable to this type without losing information.
    boolean
    A derived type means that the domain is 'determined' by looking at the values, not the definition.
    boolean
    This method indicates the type is a multivalued object.
    boolean
    This method returns a boolean indicating if the type represents a specified type that has not been altered by any operation.
    boolean
    This function returns true when the type of this type is a string, either multivalued or not.
    This returns a multivalue version of this type.
     
    This returns a singlevalue version of this type.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Type

      public Type(DataType type, boolean multivalue)
      Constructs a type object for all types except 'entity'.
      Parameters:
      type - The data type of the object.
      multivalue - This boolean indicates the type is a multivalued type.
    • Type

      public Type(DataType type, String typeName, boolean multivalue)
      Constructs a type object with the type name argument. Type names are only valid for domain and entity-types.
      Parameters:
      type - The data type of the object.
      typeName - The name of the referred type.
      multivalue - This boolean indicates the type is a multivalued type.
    • Type

      public Type(DataType type, String typeName, boolean multivalue, IPrimitiveValue... domain)
      Constructs a type object with the type name argument. Type names are only valid for domain and entity-types. The type also will contain domain information. ( i.e. the possible value list )
      Parameters:
      type - The data type of the object.
      typeName - The name of the referred type.
      multivalue - This boolean indicates the type is a multivalued type.
      domain - The domain for this type.
    • Type

      public Type(DataType type, String typeName, boolean multivalue, Domain domain)
      Constructs a type object with the type name argument. Type names are only valid for domain and entity-types. The type also will contain domain information. ( i.e. the possible value list )
      Parameters:
      type - The data type of the object.
      typeName - The name of the referred type.
      multivalue - This boolean indicates the type is a multivalued type.
      domain - The domain for this type.
    • Type

      public Type(DataType type, String typeName, boolean multivalue, Domain domain, boolean isDerived)
      Constructs a type object with the type name argument. Type names are only valid for domain and entity-types. The type also will contain domain information. ( i.e. the possible value list )
      Parameters:
      type - The data type of the object.
      typeName - The name of the referred type.
      multivalue - This boolean indicates the type is a multivalued type.
      domain - The domain for this type.
      isDerived - Boolean indicating if the type was derived.
  • Method Details

    • getType

      public DataType getType()
      Acquires the integral type of the type object.
      Returns:
      The integral data type of this type object which is never null
    • isDerived

      public boolean isDerived()
      A derived type means that the domain is 'determined' by looking at the values, not the definition. A non-derived/specified domain can be a specified domain like [a,b,c] in a studio-domain definition.
      Returns:
      Whether the domain is derived (or specified when the method returns false).
    • isSpecified

      public boolean isSpecified()
      This method returns a boolean indicating if the type represents a specified type that has not been altered by any operation.
      Returns:
      Boolean indicating if the type represents a specified type from studio.
    • getTypeName

      public String getTypeName()
      Returns the type name of this type object when known. This is only the case for entity-types and domain-types.
      Returns:
      The type name string for this type which is optionally null.
    • isMultivalue

      public boolean isMultivalue()
      This method indicates the type is a multivalued object.
      Returns:
      A boolean indicating this is a multivalued type (set).
    • getDimension

      public int getDimension()
      Returns the dimension of this type object. Zero meaning singlevalued, while one means an array/set type. Future versions might have multiple dimension arrays.
      Returns:
      The dimension of the type.
    • getDomain

      public Domain getDomain()
      This function returns the domain of this type within a certain context ( i.e. all possible values )
      Returns:
      The domain of this type if it is known, null otherwise.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • packed

      public Type packed()
      This returns a multivalue version of this type.
      Returns:
      A new type representing a multivalue version of the previous type.
    • unpacked

      public Type unpacked()
      This returns a singlevalue version of this type.
      Returns:
      A new type representing a single value version of the previous type.
    • toString

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

      protected String getStringRepresentation()
    • isAssignableTo

      public boolean isAssignableTo(Type other, ITypeEnvironment source)
      This function checks whether the other type is assignable to this type without losing information.
      Parameters:
      other - the other type.
      source - The type environment
      Returns:
      A boolean indicating the types are compatible
    • isAssignableTo

      public boolean isAssignableTo(Type other, ITypeEnvironment source, boolean checkDimension)
      This function checks whether the other type is assignable to this type without losing information.
      Parameters:
      other - the other type.
      source - The type environment
      checkDimension - A boolean indicating it should also check of dimension equality.
      Returns:
      A boolean indicating the types are compatible
    • isString

      public boolean isString()
      This function returns true when the type of this type is a string, either multivalued or not.
      Returns:
      A boolean indicating this type is a string.
    • getLeadingType

      public static Type getLeadingType(Type type1, Type type2)
      This function will check the leading type when two types are used to return a new type. The type holding the most information will be chosen as the resulting type.
      Parameters:
      type1 - The first type
      type2 - The second type.
      Returns:
      The leading type.
    • isAny

      public boolean isAny()
      This function states whether this type is of the 'any' type. It means the type is undefined and will be coercable to all other types.
      Returns:
      true when the type is any regardless of dimension.