public class RobotConfigMap
extends java.lang.Object
implements java.io.Serializable
RobotConfigMap
represents the loaded and parsed state of an XML robot configuration.
It contains the set of ControllerConfiguration
s in the configuration, accessible by
serial number.Constructor and Description |
---|
RobotConfigMap() |
RobotConfigMap(java.util.Collection<ControllerConfiguration> controllerConfigurations) |
RobotConfigMap(java.util.Map<SerialNumber,ControllerConfiguration> map) |
RobotConfigMap(RobotConfigMap him) |
Modifier and Type | Method and Description |
---|---|
void |
bindUnboundControllers(ScannedDevices scannedDevices)
For each controller in this map that currently lacks a real serial number, try to choose
an unused selection from the scanned devices to associate with same.
|
boolean |
contains(SerialNumber serialNumber) |
protected boolean |
containsSerialNumber(java.util.List<ControllerConfiguration> list,
SerialNumber serialNumber) |
java.util.Collection<ControllerConfiguration> |
controllerConfigurations() |
protected java.lang.String |
generateName(Context context,
ConfigurationType type,
java.util.List<ControllerConfiguration> resultSoFar)
Generates a name that's unique across both this whole configuration and the candidate swaps
that have been produced so far.
|
ControllerConfiguration |
get(SerialNumber serialNumber) |
java.util.List<ControllerConfiguration> |
getEligibleSwapTargets(ControllerConfiguration target,
ScannedDevices scannedDevices,
Context context)
Returns a list of the candidate configurations with which the target may be swapped.
|
boolean |
isSwappable(ControllerConfiguration target,
ScannedDevices scannedDevices,
Context context) |
protected boolean |
nameExists(java.lang.String name,
java.util.List<ControllerConfiguration> resultSoFar) |
void |
put(SerialNumber serialNumber,
ControllerConfiguration controllerConfiguration) |
boolean |
remove(SerialNumber serialNumber) |
java.util.Collection<SerialNumber> |
serialNumbers() |
void |
setSerialNumber(ControllerConfiguration controllerConfiguration,
SerialNumber serialNumber)
Changes a serial number of a controller known to be in this configuration
|
int |
size() |
void |
swapSerialNumbers(ControllerConfiguration a,
ControllerConfiguration b)
Swaps the serial numbers (and attachment status) of two controllers both known to be in this configuration
|
void |
writeToLog(java.lang.String tag,
java.lang.String message) |
void |
writeToLog(java.lang.String tag,
java.lang.String message,
ControllerConfiguration controllerConfiguration) |
public RobotConfigMap(java.util.Collection<ControllerConfiguration> controllerConfigurations)
public RobotConfigMap(java.util.Map<SerialNumber,ControllerConfiguration> map)
public RobotConfigMap(RobotConfigMap him)
public RobotConfigMap()
public boolean contains(SerialNumber serialNumber)
public ControllerConfiguration get(SerialNumber serialNumber)
public void put(SerialNumber serialNumber, ControllerConfiguration controllerConfiguration)
public boolean remove(SerialNumber serialNumber)
public int size()
public java.util.Collection<SerialNumber> serialNumbers()
public java.util.Collection<ControllerConfiguration> controllerConfigurations()
public void writeToLog(java.lang.String tag, java.lang.String message)
public void writeToLog(java.lang.String tag, java.lang.String message, ControllerConfiguration controllerConfiguration)
public void bindUnboundControllers(ScannedDevices scannedDevices)
public void setSerialNumber(ControllerConfiguration controllerConfiguration, SerialNumber serialNumber)
public void swapSerialNumbers(ControllerConfiguration a, ControllerConfiguration b)
public boolean isSwappable(ControllerConfiguration target, ScannedDevices scannedDevices, Context context)
public java.util.List<ControllerConfiguration> getEligibleSwapTargets(ControllerConfiguration target, ScannedDevices scannedDevices, Context context)
RobotConfigMap
and
what's currently attached to the USB bus: those are possibly intersecting sets, but each
may have members which are not in the other.protected java.lang.String generateName(Context context, ConfigurationType type, java.util.List<ControllerConfiguration> resultSoFar)
protected boolean nameExists(java.lang.String name, java.util.List<ControllerConfiguration> resultSoFar)
protected boolean containsSerialNumber(java.util.List<ControllerConfiguration> list, SerialNumber serialNumber)