Poging tot het flexibel laten werken van devices met features. Zou moeten werken via een enum, maar lukt nog niet.
This commit is contained in:
31
java/src/pm/device/Device.java
Normal file
31
java/src/pm/device/Device.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package pm.device;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import pm.device.feature.Feature;
|
||||
|
||||
|
||||
public abstract class Device {
|
||||
protected ArrayList<Feature> featureList;
|
||||
|
||||
protected Device() {
|
||||
featureList = new ArrayList<Feature>();
|
||||
}
|
||||
|
||||
public void addFeature(Feature feature) {
|
||||
if (!hasFeature(feature)) {
|
||||
if (this instanceof feature.getClass()) {
|
||||
|
||||
}
|
||||
featureList.add(feature);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeFeature(Feature feature) {
|
||||
featureList.remove(feature);
|
||||
}
|
||||
|
||||
public boolean hasFeature(Feature feature) {
|
||||
return featureList.contains(feature);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user