-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
39 lines (34 loc) · 1.32 KB
/
Copy pathMain.java
File metadata and controls
39 lines (34 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.util.Scanner;
/**
* Main
*/
public class Main {
public static void main(String[] args) {
System.out.println("Bitte Standort eingeben:");
Scanner input = new Scanner(System.in);
try {
//start client thread
Client client = new Client(input.nextLine());
Thread thrd = new Thread(client);
thrd.start();
System.out.println("\"print\" eingeben um bekannte Messwerte auszugeben, \"quit\" eingeben um den client zu beenden");
boolean running = true;
//input loop
while (running) {
String mostRecentInput = input.nextLine();
if (mostRecentInput.equals("print")) {
//prints readable representation of locally known status
client.printStatusList();
} else if (mostRecentInput.equals("quit")) {
//stops client thread
client.setRunning(false);;
System.exit(0);
} else {
System.out.println("Unbekannter Befehl, \"print\" eingeben um bekannte Messwerte auszugeben, \"quit\" eingeben um den client zu beenden");
}
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}