update:demo4

This commit is contained in:
dichgrem
2025-11-28 16:59:17 +08:00
parent 41e6b71bd7
commit 5832b4fe9d
34 changed files with 307 additions and 0 deletions

View 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";
}
}