/** * Returns the devices definitions in the portal. * @return The registered devices definitions. */ public final Collection<DeviceInPortal> values() { return deviceMap().values(); }
/** * Returns the number of devices definitions in the collection. * @return The collection size. */ public final int size() { return deviceMap().size(); }
/** * Returns whether the a device is registered. * @param device Device to check. * @return True if the device is registered. */ public final boolean containsDevice(Device device) { return deviceMap().containsKey(device); }
/** * Returns whether the collection is empty. * @return True if the collection is empty. */ public final boolean isEmpty() { return deviceMap().isEmpty(); }
/** * Returns the devices registered in the portal. * @return The devices registered in the portal. */ public final Set<Device> getDevices() { return deviceMap().keySet(); }
/** * Returns the device definition for a given device. * @param device Device to get. * @return The device definition. * @throws NullPointerException if the argument is null. * @throws IllegalArgumentException if the device is not registered. */ public final DeviceInPortal getByDevice(Device device) { final DeviceInPortal dip = deviceMap().get(checkNotNull(device, "Null devices not allowed")); checkArgument(dip != null, "Device not registered"); return dip; }
private Filter(DevicesInPortal devices, Predicate<? super DeviceInPortal> filter) { this.deviceMap = Maps.filterValues(devices.deviceMap(), filter); this.idMap = Maps.filterValues(devices.idMap(), filter); this.nameMap = Maps.filterValues(devices.nameMap(), filter); }