Class NotificationOrder

java.lang.Object
org.eclipse.californium.core.observe.NotificationOrder

public class NotificationOrder extends Object
The NotificationOrderer holds the state of an observe relation such as the timeout of the last notification and the current number.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final long
    The timestamp of the response
    protected final int
    The observe number
  • Constructor Summary

    Constructors
    Constructor
    Description
    NotificationOrder(int observe)
    Creates a new notification order for a given notification.
    NotificationOrder(int observe, long nanoTime)
    Creates a new notification order for a given notification and nano-time.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the notification number.
    static boolean
    isNew(long T1, int V1, long T2, int V2)
    Compare order of notifications.
    boolean
    isNew(Response response)
    Test, if the provided notification is newer than the current one.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • number

      protected final int number
      The observe number
    • nanoTimestamp

      protected final long nanoTimestamp
      The timestamp of the response
  • Constructor Details

    • NotificationOrder

      public NotificationOrder(int observe)
      Creates a new notification order for a given notification.
      Parameters:
      observe - observe of the notification
      Since:
      3.0 changed type of observe from Integer to int.
    • NotificationOrder

      public NotificationOrder(int observe, long nanoTime)
      Creates a new notification order for a given notification and nano-time.
      Parameters:
      observe - observe of the notification
      nanoTime - receive time of notification
      Since:
      3.0 changed type of observe from Integer to int.
  • Method Details

    • getObserve

      public int getObserve()
      Returns the notification number.
      Returns:
      the notification number.
      Since:
      3.0 changed return type from Integer to int.
    • isNew

      public boolean isNew(Response response)
      Test, if the provided notification is newer than the current one.
      Parameters:
      response - the notification
      Returns:
      true if the notification is new
    • isNew

      public static boolean isNew(long T1, int V1, long T2, int V2)
      Compare order of notifications.
      Parameters:
      T1 - nano realtimestamp of first notification
      V1 - observe number of first notification
      T2 - nano realtimestamp of second notification
      V2 - observe number of second notification
      Returns:
      true, if second notification is newer.