Class NullToken

java.lang.Object
com.pervasive.datarush.tokens.scalar.NullToken
All Implemented Interfaces:
DataToken, BinaryValued, BooleanValued, CharValued, DateValued, DoubleValued, DurationValued, FloatValued, IntValued, Ip4AddressValued, Ip6AddressValued, LongValued, MoneyValued, NumericValued, PeriodValued, ScalarToken, ScalarValued, StringValued, TimestampValued, TimeValued, TokenValued, ScalarTyped, TokenTyped, Serializable, Comparable<NullToken>

An null token.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final NullToken
    A null valued NullToken

    Fields inherited from interface com.pervasive.datarush.tokens.scalar.NumericValued

    MAX_INFINITY, MIN_INFINITY
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Gets the contained raw IPv4 address value.
    Gets the contained numeric value.
    byte[]
    Gets the contained binary value.
    byte[]
    Gets a reference to the contained binary value.
    boolean
    Gets the contained boolean value.
    Gets the contained date value.
    long
    Gets the contained cents value as a long
    char
    Gets the contained character value.
    Gets the contained date value as a java.sql.Date relative to the default time zone.
    asDate(ZoneId zoneId)
    Gets the contained date value as a java.sql.Date relative to the given time zone.
    int
    Gets the contained time value as the number of milliseconds elapsed since midnight.
    double
    Gets the contained double value.
    Gets the contained Duration value as a java.time.Duration.
    long
    Gets the contained date value as the number of days since Java epoch (January 1, 1970).
    long
    Gets the contained timestamp value as the number of seconds since Java epoch (January 1, 1970 00:00:00 GMT).
    float
    Gets the contained float value.
    Gets the contained IP address as an Inet4Address.
    Gets the contained IP address as an Inet6Address.
    int
    Gets the contained integer value.
    long
    Gets the contained long value.
    Gets the contained Period value as a java.time.Period.
    long
    Get the contained duration value as the number of seconds.
    Gets the contained string value.
    Gets the contained time value.
    Gets the contained timestamp value as a java.sql.Timestamp relative to the default time zone.
    int
     
    boolean
    Indicates whether another object is equal to this token.
    int
    Gets the day portion of the contained period value.
    int
    Gets the month portion of the contained period value.
    Gets the data type of the token.
    int
    Gets the year portion of the contained period value.
    int
    Returns a hash code for the token.
    final boolean
    Indicates whether the token is null valued.
    boolean
    Indicates whether the value is the zero value for the type.
    int
    Gets the time zone and daylight saving time offset of the contained timestamp value, in seconds.
    int
    Gets the subsecond portion of the contained timestamp value.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.pervasive.datarush.tokens.DataToken

    toString

    Methods inherited from interface com.pervasive.datarush.tokens.TokenValued

    isNull
  • Field Details

    • NULL

      public static final NullToken NULL
      A null valued NullToken
  • Constructor Details

    • NullToken

      protected NullToken()
  • Method Details

    • compareTo

      public int compareTo(NullToken o)
      Specified by:
      compareTo in interface Comparable<NullToken>
    • equals

      public boolean equals(Object obj)
      Description copied from interface: DataToken
      Indicates whether another object is equal to this token. Two null valued tokens are considered equal. This differs from the behavior of TokenComparator.equal(TokenValued,TokenValued) but makes it possible to store DataTokens in Maps.
      Specified by:
      equals in interface DataToken
      Overrides:
      equals in class Object
      Parameters:
      obj - the object to compare
      Returns:
      true if the other object is a token of the same type and contains the same value, false otherwise.
    • hashCode

      public int hashCode()
      Description copied from interface: DataToken
      Returns a hash code for the token. This value is guaranteed to be consistent with that returned by TokenConverter.asHashCode(TokenValued).
      Specified by:
      hashCode in interface DataToken
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for the token
    • getType

      public ScalarTokenType getType()
      Description copied from interface: TokenValued
      Gets the data type of the token. This type will dictate the valid values that can be contained.
      Specified by:
      getType in interface ScalarTyped
      Specified by:
      getType in interface ScalarValued
      Specified by:
      getType in interface TokenTyped
      Specified by:
      getType in interface TokenValued
      Returns:
      the token type.
    • isZero

      public boolean isZero()
      Description copied from interface: ScalarValued
      Indicates whether the value is the zero value for the type. Zero values are not stored in sparse representation formats.
      Specified by:
      isZero in interface ScalarValued
      Returns:
      true if the value is the zero value, false otherwise.
    • asDouble

      public double asDouble()
      Description copied from interface: DoubleValued
      Gets the contained double value.
      Specified by:
      asDouble in interface DoubleValued
      Returns:
      the contained value as a double. If null valued, as indicated by TokenValued.isNull(), Double.NaN is returned.
    • asBigDecimal

      public BigDecimal asBigDecimal()
      Description copied from interface: NumericValued
      Gets the contained numeric value.
      Specified by:
      asBigDecimal in interface NumericValued
      Returns:
      the contained value as a java.math.BigDecimal. If null valued, as indicated by TokenValued.isNull(), null is returned.
    • asLong

      public long asLong()
      Description copied from interface: LongValued
      Gets the contained long value.
      Specified by:
      asLong in interface LongValued
      Returns:
      the contained value as a long. If null valued, as indicated by TokenValued.isNull(), 0 is returned.
    • asFloat

      public float asFloat()
      Description copied from interface: FloatValued
      Gets the contained float value.
      Specified by:
      asFloat in interface FloatValued
      Returns:
      the contained value as a float. If null valued, as indicated by TokenValued.isNull(), Float.NaN is returned.
    • asTimestamp

      public Timestamp asTimestamp()
      Description copied from interface: TimestampValued
      Gets the contained timestamp value as a java.sql.Timestamp relative to the default time zone. The time zone used by TimeZone#getDefault() is used.
      Specified by:
      asTimestamp in interface TimestampValued
      Returns:
      the contained value as a java.sql.Timestamp. If null valued, as indicated by TokenValued.isNull(), null is returned.
    • asEpochSecs

      public long asEpochSecs()
      Description copied from interface: TimestampValued
      Gets the contained timestamp value as the number of seconds since Java epoch (January 1, 1970 00:00:00 GMT). Timestamp values support nanosecond precision, although this method does not expose it. To access this level of detail, use subsecNanos() in conjunction with this method.
      Specified by:
      asEpochSecs in interface TimestampValued
      Returns:
      the contained value as days since Java epoch. If null valued, as indicated by TokenValued.isNull(), 0 is returned.
      See Also:
    • subsecNanos

      public int subsecNanos()
      Description copied from interface: TimestampValued
      Gets the subsecond portion of the contained timestamp value. The value returned is relative to the seconds value returned by asEpochSecs(). Thus the value asEpochSecs() * 1000000000 + subsecNanos() represents the number of nanoseconds since Java epoch.
      Specified by:
      subsecNanos in interface DurationValued
      Specified by:
      subsecNanos in interface TimestampValued
      Returns:
      the subsecond portion of the contained value, in nanoseconds. If null valued, as indicated by TokenValued.isNull(), 0 is returned.
      See Also:
    • offsetSecs

      public int offsetSecs()
      Description copied from interface: TimestampValued
      Gets the time zone and daylight saving time offset of the contained timestamp value, in seconds.
      Specified by:
      offsetSecs in interface TimestampValued
      Returns:
      the time zone and daylight saving time offset of the contained value, in seconds. If null valued, as indicated by TokenValued.isNull(), 0 is returned.
      See Also:
    • asDayMillis

      public int asDayMillis()
      Description copied from interface: TimeValued
      Gets the contained time value as the number of milliseconds elapsed since midnight.
      Specified by:
      asDayMillis in interface TimeValued
      Returns:
      the contained value as milliseconds since midnight. If null valued, as indicated by TokenValued.isNull(), 0 is returned.
    • asTimeOfDay

      public TimeOfDay asTimeOfDay()
      Description copied from interface: TimeValued
      Gets the contained time value. This value represents the timezone free time portion of a timestamp.
      Specified by:
      asTimeOfDay in interface TimeValued
      Returns:
      the contained value. If null valued, as indicated by TokenValued.isNull(), null is returned.
    • asString

      public String asString()
      Description copied from interface: StringValued
      Gets the contained string value.
      Specified by:
      asString in interface StringValued
      Returns:
      the contained value as a String. If null valued, as indicated by TokenValued.isNull(), the empty string ("") is returned.
    • asInt

      public int asInt()
      Description copied from interface: IntValued
      Gets the contained integer value.
      Specified by:
      asInt in interface IntValued
      Returns:
      the contained value as an int. If null valued, as indicated by TokenValued.isNull(), 0 is returned.
    • asDate

      public Date asDate()
      Description copied from interface: DateValued
      Gets the contained date value as a java.sql.Date relative to the default time zone. The time zone id used by {@link ZoneId.systemDefault()} is used.
      Specified by:
      asDate in interface DateValued
      Returns:
      the contained value as a java.sql.Date. If null valued, as indicated by TokenValued.isNull(), null is returned.
    • asDate

      public Date asDate(ZoneId zoneId)
      Description copied from interface: DateValued
      Gets the contained date value as a java.sql.Date relative to the given time zone.
      Specified by:
      asDate in interface DateValued
      Parameters:
      zoneId - the time zone id in which to interpret the date
      Returns:
      the contained value as a java.sql.Date. If null valued, as indicated by TokenValued.isNull(), null is returned.
    • asEpochDays

      public long asEpochDays()
      Description copied from interface: DateValued
      Gets the contained date value as the number of days since Java epoch (January 1, 1970).
      Specified by:
      asEpochDays in interface DateValued
      Returns:
      the contained value as days since Java epoch. If null valued, as indicated by TokenValued.isNull(), 0 is returned.
    • asCalendarDate

      public CalendarDate asCalendarDate()
      Description copied from interface: DateValued
      Gets the contained date value. This value represents the timezone free date portion of a timestamp.
      Specified by:
      asCalendarDate in interface DateValued
      Returns:
      the contained value as a calendar date. If null valued, as indicated by TokenValued.isNull(), null is returned.
    • asChar

      public char asChar()
      Description copied from interface: CharValued
      Gets the contained character value.
      Specified by:
      asChar in interface CharValued
      Returns:
      the contained value as a char. If null valued, as indicated by TokenValued.isNull(), Character.MAX_VALUE is returned.
    • asBoolean

      public boolean asBoolean()
      Description copied from interface: BooleanValued
      Gets the contained boolean value.
      Specified by:
      asBoolean in interface BooleanValued
      Returns:
      the contained value as a boolean. If null valued, as indicated by TokenValued.isNull(), false is returned.
    • asBinary

      public byte[] asBinary()
      Description copied from interface: BinaryValued
      Gets the contained binary value.

      The array returned is a copy of the binary data contained in the object. To avoid this overhead, use BinaryValued.asBinaryRef() instead.

      Specified by:
      asBinary in interface BinaryValued
      Returns:
      the contained value as a byte[]. If null valued, as indicated by TokenValued.isNull(), null is returned.
    • asBinaryRef

      public byte[] asBinaryRef()
      Description copied from interface: BinaryValued
      Gets a reference to the contained binary value.

      While this call avoids the overhead seen with BinaryValued.asBinary(), the caller must guarantee that the returned array will not be modified. Failure to comply may result in the dataflow exhibiting unexpected behavior, as other operators may (or may not) see the modified value.

      Specified by:
      asBinaryRef in interface BinaryValued
      Returns:
      a reference to the byte[] holding the contained value. If null valued, as indicated by TokenValued.isNull(), null is returned.
    • asInet4Address

      public Inet4Address asInet4Address()
      Description copied from interface: Ip4AddressValued
      Gets the contained IP address as an Inet4Address.
      Specified by:
      asInet4Address in interface Ip4AddressValued
      Returns:
      the contained value as a Inet4Address. If null valued, as indicated by TokenValued.isNull(), null is returned.
    • asInet6Address

      public Inet6Address asInet6Address()
      Description copied from interface: Ip6AddressValued
      Gets the contained IP address as an Inet6Address.
      Specified by:
      asInet6Address in interface Ip6AddressValued
      Returns:
      the contained value as a Inet6Address. If null valued, as indicated by TokenValued.isNull(), null is returned.
    • asAddress

      public byte[] asAddress()
      Description copied from interface: Ip4AddressValued
      Gets the contained raw IPv4 address value. The array returned is a copy of the binary data contained in the object.
      Specified by:
      asAddress in interface Ip4AddressValued
      Specified by:
      asAddress in interface Ip6AddressValued
      Returns:
      the contained value as a byte[4]. If null valued, as indicated by TokenValued.isNull(), null is returned.
    • asPeriod

      public Period asPeriod()
      Description copied from interface: PeriodValued
      Gets the contained Period value as a java.time.Period.
      Specified by:
      asPeriod in interface PeriodValued
      Returns:
      the contained value as a java.time.Period. If null valued, as indicated by TokenValued.isNull(), null is returned.
    • getYears

      public int getYears()
      Description copied from interface: PeriodValued
      Gets the year portion of the contained period value.
      Specified by:
      getYears in interface PeriodValued
      Returns:
      the year portion of the contained value If null valued, as indicated by TokenValued.isNull(), 0 is returned.
    • getMonths

      public int getMonths()
      Description copied from interface: PeriodValued
      Gets the month portion of the contained period value. This does not include the year portion.
      Specified by:
      getMonths in interface PeriodValued
      Returns:
      the month portion of the contained value If null valued, as indicated by TokenValued.isNull(), 0 is returned.
    • getDays

      public int getDays()
      Description copied from interface: PeriodValued
      Gets the day portion of the contained period value. This does not include the year or month portion.
      Specified by:
      getDays in interface PeriodValued
      Returns:
      the day portion of the contained value If null valued, as indicated by TokenValued.isNull(), 0 is returned.
    • asDuration

      public Duration asDuration()
      Description copied from interface: DurationValued
      Gets the contained Duration value as a java.time.Duration.
      Specified by:
      asDuration in interface DurationValued
      Returns:
      the contained value as a java.time.Duration. If null valued, as indicated by TokenValued.isNull(), null is returned.
    • asSeconds

      public long asSeconds()
      Description copied from interface: DurationValued
      Get the contained duration value as the number of seconds.
      Specified by:
      asSeconds in interface DurationValued
      Returns:
      the contained value as seconds. If null valued, as indicated by TokenValued.isNull(), 0 is returned.
      See Also:
    • asCents

      public long asCents()
      Description copied from interface: MoneyValued
      Gets the contained cents value as a long
      Specified by:
      asCents in interface MoneyValued
      Returns:
      the contained cents value as a long. If null valued, as indicated by TokenValued.isNull(), 0 is returned.
    • isNull

      public final boolean isNull()
      Description copied from interface: TokenValued
      Indicates whether the token is null valued. Tokens support null values analogous to SQL. Before accessing the value of the container, it is usually best to ensure it is not null valued using this method.
      Specified by:
      isNull in interface TokenValued
      Returns:
      true if the token is null valued, false otherwise