DEVICE_TYPE
- public class HardwareMap.DeviceMapping<DEVICE_TYPE extends HardwareDevice>
extends java.lang.Object
implements java.lang.Iterable<DEVICE_TYPE>
HardwareMap
comprised of all the devices of a particular device typeget(String)
,
get(String)
Constructor and Description |
---|
DeviceMapping(java.lang.Class<DEVICE_TYPE> deviceTypeClass) |
Modifier and Type | Method and Description |
---|---|
DEVICE_TYPE |
cast(java.lang.Object obj)
A small utility that assists in keeping the Java generics type system happy
|
boolean |
contains(java.lang.String deviceName)
Returns whether a device of the indicated name is contained within this mapping
|
java.util.Set<java.util.Map.Entry<java.lang.String,DEVICE_TYPE>> |
entrySet()
Returns a collection of all the (name, device) pairs in this DeviceMapping.
|
DEVICE_TYPE |
get(java.lang.String deviceName) |
java.lang.Class<DEVICE_TYPE> |
getDeviceTypeClass()
Returns the runtime device type for this mapping
|
protected void |
internalPut(SerialNumber serialNumber,
java.lang.String deviceName,
DEVICE_TYPE device) |
java.util.Iterator<DEVICE_TYPE> |
iterator()
Returns an iterator over all the devices in this DeviceMapping.
|
void |
put(SerialNumber serialNumber,
java.lang.String deviceName,
DEVICE_TYPE device)
(Advanced) Registers a new device in this DeviceMapping under the indicated name.
|
void |
put(java.lang.String deviceName,
DEVICE_TYPE device)
Registers a new device in this DeviceMapping under the indicated name.
|
void |
putLocal(java.lang.String deviceName,
DEVICE_TYPE device) |
boolean |
remove(SerialNumber serialNumber,
java.lang.String deviceName)
(Advanced) Removes the device with the indicated name (if any) from this DeviceMapping.
|
boolean |
remove(java.lang.String deviceName)
(Advanced) Removes the device with the indicated name (if any) from this DeviceMapping.
|
int |
size()
Returns the number of devices currently in this DeviceMapping
|
public DeviceMapping(java.lang.Class<DEVICE_TYPE> deviceTypeClass)
public java.lang.Class<DEVICE_TYPE> getDeviceTypeClass()
public DEVICE_TYPE cast(java.lang.Object obj)
public DEVICE_TYPE get(java.lang.String deviceName)
public void put(java.lang.String deviceName, DEVICE_TYPE device)
deviceName
- the name by which the new device is to be known (case sensitive)device
- the new device to be namedHardwareMap.put(String, HardwareDevice)
public void put(SerialNumber serialNumber, java.lang.String deviceName, DEVICE_TYPE device)
serialNumber
- the serial number of the devicedeviceName
- the name by which the new device is to be known (case sensitive)device
- the new device to be namedHardwareMap.put(String, HardwareDevice)
protected void internalPut(SerialNumber serialNumber, java.lang.String deviceName, DEVICE_TYPE device)
public void putLocal(java.lang.String deviceName, DEVICE_TYPE device)
public boolean contains(java.lang.String deviceName)
deviceName
- the name soughtpublic boolean remove(java.lang.String deviceName)
deviceName
- the name of the device to remove.HardwareMap.remove(java.lang.String, com.qualcomm.robotcore.hardware.HardwareDevice)
public boolean remove(SerialNumber serialNumber, java.lang.String deviceName)
serialNumber
- (optional) the serial number of the device to removedeviceName
- the name of the device to remove.HardwareMap.remove(java.lang.String, com.qualcomm.robotcore.hardware.HardwareDevice)
public java.util.Iterator<DEVICE_TYPE> iterator()
iterator
in interface java.lang.Iterable<DEVICE_TYPE extends HardwareDevice>
public java.util.Set<java.util.Map.Entry<java.lang.String,DEVICE_TYPE>> entrySet()
public int size()