Class OmemoCachedDeviceList

  • All Implemented Interfaces:

    public class OmemoCachedDeviceList
    extends Object
    implements 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 Detail

      • getActiveDevices

        public Set<IntegergetActiveDevices()
        Returns all active devices. Active devices are all devices that were in the latest DeviceList update.
        active devices
      • getInactiveDevices

        public Set<IntegergetInactiveDevices()
        Return all inactive devices. Inactive devices are devices which were in a past DeviceList update once, but were not included in the latest update.
        inactive devices
      • getAllDevices

        public Set<IntegergetAllDevices()
        Returns an OmemoDeviceListElement containing all devices (active and inactive).
        all devices
      • merge

        public void merge​(Set<Integer> deviceListUpdate)
        Merge a device list update into the CachedDeviceList. The source code should be self explanatory.
        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.
        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.
        deviceId - id
        true or false
      • isActive

        public boolean isActive​(int deviceId)