public synchronized void setSelfTrue(String deviceID) { for (DeviceInfoNode node : deviceList) { if (node.getDeviceID().equals(deviceID)) { node.setUpdated(DeviceInfoNode.Updated.TRUE); } } }
public DeviceInfoNode getServerNode(String deviceID) { for (DeviceInfoNode node : deviceList) { if (node.getDeviceID().equals(deviceID)) { return node; } } return null; }
public DeviceInfoNode getDeviceNode(String userName, String deviceID) { for (DeviceInfoNode node : deviceList) { if (node.getUserName().equals(userName) && node.getDeviceID().equals(deviceID)) { return node; } } return null; }
@Override public String toString() { String toString = fileName + "(" + userName + ")" + "\t"; for (DeviceInfoNode node : deviceList) { toString += node.toString() + "\t"; } return toString; }
/** * Constructor without userName * * @param fileName * @param deviceList */ public FileDeviceList( String userName, String fileName, ArrayList<DeviceInfoNode> inputDeviceList) { // this.deviceList = deviceList; for (DeviceInfoNode din : inputDeviceList) { DeviceInfoNode newDin = new DeviceInfoNode(din.getUserName(), din.getDeviceID()); this.deviceList.add(newDin); } this.userName = userName; this.fileName = fileName; }
/** * Constructor with userName * * @param userName * @param deviceName * @param dl * @param fileName */ public FileDeviceList( String userName, String deviceName, ArrayList<DeviceInfoNode> dl, String fileName) { this.userName = userName; this.fileName = fileName; this.deviceList = dl; for (DeviceInfoNode node : this.deviceList) { if (node.getDeviceID().equals(deviceName)) { node.setUpdated(DeviceInfoNode.Updated.TRUE); } } }