Class DeltaLong

  • All Implemented Interfaces:
    Serializable

    public class DeltaLong
    extends Delta
    Value holding a base Long value and a delta.

    This is used when the actual intent of the value is to be an incremental update to an existing value.

    Since:
    6.0
    See Also:
    Serialized Form
    • Constructor Detail

      • DeltaLong

        public DeltaLong​(Long base,
                         long delta)
        A DeltaLong with the given base and delta.
    • Method Detail

      • valueOf

        public static DeltaLong valueOf​(Number base,
                                        long delta)
        Returns a DeltaLong from the given base number and delta.

        The base number may be a Long (which may be null), or a DeltaLong. If it is a DeltaLong then the returned value will keep its base and just add deltas.

        Parameters:
        base - the base number
        delta - the delta
        Returns:
        a DeltaLong
      • deltaOrLong

        @Deprecated
        public static DeltaLong deltaOrLong​(Number base,
                                            long delta)
        Deprecated.
        since 8.3, use valueOf(Number, long) instead.
        Returns a DeltaLong from the given base number and delta.

        The base number may be a Long (which may be null), or a DeltaLong. If it is a DeltaLong then the returned value will keep its base and just add deltas.

        Parameters:
        base - the base number
        delta - the delta
        Returns:
        a DeltaLong
      • add

        public Delta add​(Delta other)
        Description copied from class: Delta
        Adds this delta to another delta.
        Specified by:
        add in class Delta
        Parameters:
        other - the other delta
        Returns:
        the added delta
      • add

        public Number add​(Number other)
        Description copied from class: Delta
        Adds this delta to a number.
        Specified by:
        add in class Delta
        Parameters:
        other - the number
        Returns:
        the resulting number
      • getBase

        public Long getBase()
        Description copied from class: Delta
        Gets the base value.
        Specified by:
        getBase in class Delta
        Returns:
        the base value
      • getDelta

        public long getDelta()
      • getDeltaValue

        public Long getDeltaValue()
        Description copied from class: Delta
        Gets the delta value as an object.
        Specified by:
        getDeltaValue in class Delta
        Returns:
        the delta value
      • getFullValue

        public Long getFullValue()
        Description copied from class: Delta
        Gets the full value (base + delta) as an object.
        Specified by:
        getFullValue in class Delta
        Returns:
        the full value
      • longValue

        public long longValue()
        Specified by:
        longValue in class Number
      • intValue

        public int intValue()
        Specified by:
        intValue in class Number
      • floatValue

        public float floatValue()
        Specified by:
        floatValue in class Number
      • doubleValue

        public double doubleValue()
        Specified by:
        doubleValue in class Number
      • equals

        public boolean equals​(Object obj)
        Specified by:
        equals in class Delta
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in class Delta