mirror of
https://github.com/Dichgrem/Java.git
synced 2025-12-17 04:51:58 -05:00
update:demo4
This commit is contained in:
21
com/study/demo4/HomeController.java
Normal file
21
com/study/demo4/HomeController.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.study.demo4;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
class HomeController {
|
||||
private List<SmartDevice> devices = new ArrayList<>();
|
||||
|
||||
public void addDevice(SmartDevice device) {
|
||||
devices.add(device);
|
||||
}
|
||||
|
||||
public String getDeviceStatus(String name) {
|
||||
for (SmartDevice device : devices) {
|
||||
if (device.getStatus().contains(name)) {
|
||||
return device.getStatus();
|
||||
}
|
||||
}
|
||||
return "Device not found";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user