Class OmemoCachedDeviceList

  • All Implemented Interfaces:
    java.io.Serializable

    public class OmemoCachedDeviceList
    extends java.lang.Object
    implements java.io.Serializable
    This class is used to represent device lists of contacts. There are active devices (a set of device ids, which was published with the last device list update) and inactive devices (set of devices that once were active, but are not included in recent list updates). Both kinds are cached by the client. When a device that was active in the last update is not included in a new update, it becomes an inactive device. Vice versa, inactive devices can also become active again, by being included in the latest device list update.

    The client ensures, that his own device id is on the list of active devices, as soon as he gets online.

    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addDevice​(int deviceId)
      Add a device to the list of active devices and remove it from inactive.
      void addInactiveDevice​(int deviceId)  
      boolean contains​(int deviceId)
      Returns true if deviceId is either in the list of active or inactive devices.
      java.util.Set<java.lang.Integer> getActiveDevices()
      Returns all active devices.
      java.util.Set<java.lang.Integer> getAllDevices()
      Returns an OmemoDeviceListElement containing all devices (active and inactive).
      java.util.Set<java.lang.Integer> getInactiveDevices()
      Return all inactive devices.
      boolean isActive​(int deviceId)  
      void merge​(java.util.Set<java.lang.Integer> deviceListUpdate)
      Merge a device list update into the CachedDeviceList.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getActiveDevices

        public java.util.Set<java.lang.Integer> getActiveDevices()
        Returns all active devices. Active devices are all devices that were in the latest DeviceList update.
        Returns:
        active devices
      • getInactiveDevices

        public java.util.Set<java.lang.Integer> getInactiveDevices()
        Return all inactive devices. Inactive devices are devices which were in a past DeviceList update once, but were not included in the latest update.
        Returns:
        inactive devices
      • getAllDevices

        public java.util.Set<java.lang.Integer> getAllDevices()
        Returns an OmemoDeviceListElement containing all devices (active and inactive).
        Returns:
        all devices
      • merge

        public void merge​(java.util.Set<java.lang.Integer> deviceListUpdate)
        Merge a device list update into the CachedDeviceList. The source code should be self explanatory.
        Parameters:
        deviceListUpdate - received device list update
      • addDevice

        public void addDevice​(int deviceId)
        Add a device to the list of active devices and remove it from inactive.
        Parameters:
        deviceId - deviceId that will be added
      • contains

        public boolean contains​(int deviceId)
        Returns true if deviceId is either in the list of active or inactive devices.
        Parameters:
        deviceId - id
        Returns:
        true or false
      • isActive

        public boolean isActive​(int deviceId)
      • toString

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