Class EnumTokenType

  • All Implemented Interfaces:
    ScalarTokenType, ScalarTyped, TokenType, TokenTyped, Serializable

    public class EnumTokenType
    extends Object
    implements ScalarTokenType
    Deprecated.
    Replace with string+domain
    A description of a scalar data type for a set of fixed string values. This is an extension of the concept of the string datatype. Because the range of values is restricted to the enumerated values, DataRush can handle them more efficiently than strings. Additionally, values can be validated to ensure they are within the specified set.

    Since enumerated values are strings, read-only interfaces for objects of an enumerated data type can also be used as string typed objects. So, for instance, a EnumFlow is also a StringFlow. The converse, however, is not true, since string values may fall outside the accepted value set. Thus it is not the case that a EnumOutput is also a StringOutput, since input validation errors can be raised which are not expected.

    Enumerated data types are only compatible with themselves. It is not possible to compare two enumerated types unless the types are equal - which is only true if the enumerations specify the same values in the same order.

    To define a enumerate token type, use TokenTypeConstant#ENUM(LIST) to obtain an instance describing the type.

    See Also:
    Serialized Form
    • Field Detail

      • NULL_ORDINAL

        public static final int NULL_ORDINAL
        Deprecated.
        The ordinal value used for null.
        See Also:
        Constant Field Values
      • ABSTRACT_ENUM

        public static final EnumTokenType ABSTRACT_ENUM
        Deprecated.
    • Constructor Detail

      • EnumTokenType

        public EnumTokenType​(List<String> values)
        Deprecated.
    • Method Detail

      • name

        public String name()
        Deprecated.
        Description copied from interface: TokenType
        Gets the printable name of this type.
        Specified by:
        name in interface TokenType
        Returns:
        a user-friendly name for this type
      • getType

        public EnumTokenType getType()
        Deprecated.
        Description copied from interface: TokenTyped
        Gets the type of data tokens handled by the implementor.
        Specified by:
        getType in interface ScalarTyped
        Specified by:
        getType in interface TokenTyped
        Returns:
        the type of tokens associated with the class.
      • validateType

        public <T extends EnumTokenType> T validateType​(T other)
        Deprecated.
        Checks whether the given object is using the same enumeration as the type.
        Type Parameters:
        T - any EnumTyped class
        Parameters:
        other - the enumeration typed object to test
        Returns:
        the given object
        Throws:
        IllegalArgumentException - if the enumerations are not identical
      • isComposite

        public boolean isComposite()
        Deprecated.
        Description copied from interface: TokenType
        Indicates whether this type is a composite type. That is, whether this type describes a structure composed from other types.
        Specified by:
        isComposite in interface TokenType
        Returns:
        whether this type is composite.
      • isGeneric

        public boolean isGeneric()
        Deprecated.
        Description copied from interface: TokenType
        Indicates whether this type is the generic type.
        Specified by:
        isGeneric in interface TokenType
        Returns:
        whether this type is the generic type.
      • isScalar

        public boolean isScalar()
        Deprecated.
        Description copied from interface: TokenType
        Indicates whether this type is a scalar type.
        Specified by:
        isScalar in interface TokenType
        Returns:
        whether this type is scalar.
      • isAbstract

        public boolean isAbstract()
        Deprecated.
        Description copied from interface: TokenType
        Indicates whether this type is abstract. Scalar types are never abstract. The generic type always is. Composite types are abstract if either: they are comprised of no fields or they contain an abstract type.
        Specified by:
        isAbstract in interface TokenType
        Returns:
        whether this type is abstract.
      • getValueCount

        public int getValueCount()
        Deprecated.
        Gets the number of values in the enumeration.
        Returns:
        the count of the enumerated values
      • getValues

        public List<String> getValues()
        Deprecated.
        Gets the values in the enumeration. These will be returned in enumeration order.
        Returns:
        the possible values of the enumeration
      • isValidOrdinal

        public boolean isValidOrdinal​(int ordinal)
        Deprecated.
        Indicates whether the given ordinal is valid for the enumeration.
        Parameters:
        ordinal - the ordinal value to test
        Returns:
        true if the ordinal specifies a value in the enumeration, false otherwise
      • getValue

        public String getValue​(int ordinal)
        Deprecated.
        Gets the enumerated value with the given ordinal value.
        Parameters:
        ordinal - the ordinal value identifying the enumeration value
        Returns:
        the value associated with the ordinal
        Throws:
        IndexOutOfBoundsException - if the ordinal is not valid for the type.
      • isValidValue

        public boolean isValidValue​(String value)
        Deprecated.
        Indicates whether the given value is valid for the enumeration.
        Parameters:
        value - the value to test
        Returns:
        true if the value is in the enumeration, false otherwise
      • getOrdinal

        public int getOrdinal​(String value)
        Deprecated.
        Gets the ordinal value of the given value.
        Parameters:
        value - the enumeration value for which to get the ordinal
        Returns:
        the ordinal value of the enumerated value
        Throws:
        IndexOutOfBoundsException - if the value is not valid for the type.
      • isAssignableFrom

        public boolean isAssignableFrom​(TokenType source)
        Deprecated.
        Description copied from interface: TokenType
        Indicates whether tokens of the specified type are compatible or implicitly convertible to this type.
        Specified by:
        isAssignableFrom in interface TokenType
        Parameters:
        source - the token type of the source data
        Returns:
        true if the source type can be converted.
      • checkComparable

        public void checkComparable​(TokenType type)
        Deprecated.
        Description copied from interface: TokenType
        Tests whether tokens of the specified type can be compared to tokens of this type. For two types to be comparable, at least one type must be implicitly convertible to the other.
        Specified by:
        checkComparable in interface TokenType
        Parameters:
        type - the token type of data to compare
      • dispatchByType

        public void dispatchByType​(TokenTypeDispatcher dispatcher)
        Deprecated.
        Description copied from interface: TokenType
        Dispatches processing to the type-appropriate method of the specified dispatcher. This is used in generic code to perform type-specific actions based on other input; a rather common case is object construction, where the dispatcher is usually derived from TypeDispatchedConstructor.
        Specified by:
        dispatchByType in interface TokenType
        Parameters:
        dispatcher - the class to which to dispatch control
      • getEncodedByteSize

        public int getEncodedByteSize()
        Deprecated.
        Description copied from interface: TokenType
        Gets the expected size, in bytes, for tokens of this type. For variable sized types, such as binary data or strings, this is a guess of the average size.
        Specified by:
        getEncodedByteSize in interface TokenType
        Returns:
        the estimated encoded size of a token of this type.
      • hashCode

        public int hashCode()
        Deprecated.
        Overrides:
        hashCode in class Object
      • equals

        public boolean equals​(Object o)
        Deprecated.
        Overrides:
        equals in class Object
      • getDefaultOrdinal

        public int getDefaultOrdinal()
        Deprecated.