Class DeliveryIdTracker

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<DeliveryIdTracker>

    public class DeliveryIdTracker
    extends java.lang.Number
    implements java.lang.Comparable<DeliveryIdTracker>
    Tracker of Delivery ID values, implements a sequence number and provides ability to keep an not set state for use when allowing for set / not set tracking.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      DeliveryIdTracker()
      Create a new Delivery Id tracker with initial state.
      DeliveryIdTracker​(int startValue)
      Create a new Delivery Id tracker with initial state.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(int other)
      Compares the tracked delivery id value to the int given, if no value is being tracked this method returns -1.
      int compareTo​(java.lang.Number other)
      Compares the tracked delivery id value to the Number given, if no value is being tracked this method returns -1.
      int compareTo​(DeliveryIdTracker other)  
      double doubleValue()  
      boolean equals​(int other)
      Performs an unsigned comparison between the value being tracked and the integer value passed, if no id is currently being tracked then this method returns false.
      boolean equals​(java.lang.Object other)  
      float floatValue()  
      int hashCode()  
      int intValue()  
      boolean isEmpty()  
      long longValue()  
      void reset()
      Clears the tracked value and marks this tracker as empty.
      void set​(int value)
      Sets the current delivery ID value for this DeliveryIdTracker
      java.lang.String toString()  
      UnsignedInteger toUnsignedInteger()  
      • Methods inherited from class java.lang.Number

        byteValue, shortValue
      • Methods inherited from class java.lang.Object

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

      • DeliveryIdTracker

        public DeliveryIdTracker()
        Create a new Delivery Id tracker with initial state.
      • DeliveryIdTracker

        public DeliveryIdTracker​(int startValue)
        Create a new Delivery Id tracker with initial state.
        Parameters:
        startValue - The initial value to assign this tracker.
    • Method Detail

      • set

        public void set​(int value)
        Sets the current delivery ID value for this DeliveryIdTracker
        Parameters:
        value - The new value to assign as the delivery ID.
      • reset

        public void reset()
        Clears the tracked value and marks this tracker as empty.
      • isEmpty

        public boolean isEmpty()
        Returns:
        true if the tracker is not currently tracking a delivery Id.
      • compareTo

        public int compareTo​(java.lang.Number other)
        Compares the tracked delivery id value to the Number given, if no value is being tracked this method returns -1. This method returns 0 if the tracked id is equal to the value provided, value less than 0 if the tracked id is less than the provided value; and a value greater than 0 if the tracked id is larger than the value provided.
        Parameters:
        other - The Number to compare the tracked id with.
        Returns:
        the result of comparing the tracked id to the provided number.
      • compareTo

        public int compareTo​(int other)
        Compares the tracked delivery id value to the int given, if no value is being tracked this method returns -1. This method returns 0 if the tracked id is equal to the value provided, value less than 0 if the tracked id is less than the provided value; and a value greater than 0 if the tracked id is larger than the value provided.
        Parameters:
        other - The primitive Integer to compare the tracked id with.
        Returns:
        the result of comparing the tracked id to the provided primitive integer value.
      • intValue

        public int intValue()
        Specified by:
        intValue in class java.lang.Number
      • longValue

        public long longValue()
        Specified by:
        longValue in class java.lang.Number
      • floatValue

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

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

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • equals

        public boolean equals​(int other)
        Performs an unsigned comparison between the value being tracked and the integer value passed, if no id is currently being tracked then this method returns false.
        Parameters:
        other - The value to compare to the currently tracked id.
        Returns:
        true if the tracked delivery id matches the integer value provided.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toUnsignedInteger

        public UnsignedInteger toUnsignedInteger()
        Returns:
        an UnsignedInteger view of the tracked delivery id, or null if not tracking at this time.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object