57 lines
1.1 KiB
Java
57 lines
1.1 KiB
Java
package de.ctdo.bunti.model;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @author: lucas
|
|
* @date: 15.03.12 21:51
|
|
*/
|
|
public final class Room {
|
|
|
|
private int id;
|
|
private String name;
|
|
private List<BuntiDevice> devices = new ArrayList<BuntiDevice>();
|
|
|
|
public int getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(int id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
public void setName(String name) {
|
|
this.name = name;
|
|
}
|
|
|
|
public boolean addDevice(BuntiDevice device) {
|
|
return devices.add(device);
|
|
}
|
|
|
|
public boolean removeDevice(BuntiDevice device) {
|
|
return devices.remove(device);
|
|
}
|
|
|
|
public BuntiDevice getDevice(int id) {
|
|
for (BuntiDevice device: devices) {
|
|
if( device.getDeviceId() == id) {
|
|
return device;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public Collection<BuntiDevice> getDeviceList() {
|
|
return Collections.unmodifiableList(devices);
|
|
}
|
|
|
|
|
|
}
|