Class OmemoCachedDeviceList
- java.lang.Object
-
- org.jivesoftware.smackx.omemo.internal.OmemoCachedDeviceList
-
- All Implemented Interfaces:
Serializable
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
-
-
Constructor Summary
Constructors Constructor Description OmemoCachedDeviceList()
OmemoCachedDeviceList(Set<Integer> activeDevices, Set<Integer> inactiveDevices)
OmemoCachedDeviceList(OmemoCachedDeviceList original)
-
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.Set<Integer>
getActiveDevices()
Returns all active devices.Set<Integer>
getAllDevices()
Returns an OmemoDeviceListElement containing all devices (active and inactive).Set<Integer>
getInactiveDevices()
Return all inactive devices.boolean
isActive(int deviceId)
void
merge(Set<Integer> deviceListUpdate)
Merge a device list update into the CachedDeviceList.String
toString()
-
-
-
Constructor Detail
-
OmemoCachedDeviceList
public OmemoCachedDeviceList()
-
OmemoCachedDeviceList
public OmemoCachedDeviceList(Set<Integer> activeDevices, Set<Integer> inactiveDevices)
-
OmemoCachedDeviceList
public OmemoCachedDeviceList(OmemoCachedDeviceList original)
-
-
Method Detail
-
getActiveDevices
public Set<Integer> getActiveDevices()
Returns all active devices. Active devices are all devices that were in the latest DeviceList update.- Returns:
- active devices
-
getInactiveDevices
public Set<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 Set<Integer> getAllDevices()
Returns an OmemoDeviceListElement containing all devices (active and inactive).- Returns:
- all devices
-
merge
public void merge(Set<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
-
addInactiveDevice
public void addInactiveDevice(int deviceId)
-
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)
-
-