add device model
This commit is contained in:
parent
450b1393b2
commit
de04d31825
2 changed files with 48 additions and 1 deletions
|
@ -0,0 +1,5 @@
|
|||
package com.sap.tamagotchi.model;
|
||||
|
||||
public enum Color {
|
||||
RED, YELLOW, BLUE, GREEN
|
||||
}
|
|
@ -1,4 +1,46 @@
|
|||
package com.sap.tamagotchi.model;
|
||||
|
||||
public class Device {
|
||||
import java.time.Instant;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Queue;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
public class Device extends Thread {
|
||||
|
||||
private final String getDeviceId = UUID.randomUUID().toString();
|
||||
private final String owner;
|
||||
private final Color color;
|
||||
private final Instant born = Instant.now();
|
||||
private final Queue<String> messages = new ConcurrentLinkedQueue<String>();
|
||||
|
||||
public Device(String owner, Color color) {
|
||||
this.owner = owner;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public String getDeviceId() {
|
||||
return getDeviceId;
|
||||
}
|
||||
|
||||
public String getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public Instant getBorn() {
|
||||
return born;
|
||||
}
|
||||
|
||||
public boolean hasMessages() {
|
||||
return !messages.isEmpty();
|
||||
}
|
||||
|
||||
public Collection<IoTMessage> getMessages() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue