// Path: src/main/java/edu/sjsu/mithai/sensors/TemperatureSensor.java
// public class TemperatureSensor extends AbstractDevice {
// 
//     private double min;
//     private Random random;
// 
//     public TemperatureSensor(String id) {
//         super(id);
//         random = new Random();
//         min = random.nextDouble() + 100;
//     }
// 
//     @Override
//     public double sense() {
//         return min + random.nextDouble();
//     }
// 
// }


import edu.sjsu.mithai.sensors.TemperatureSensor;
package edu.sjsu.mithai.util;


public class Client {

    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            TaskManager.getInstance().submitTask(new TemperatureSensorTask(i));
        }

//        for (int i = 0; i < 5; i++) {
//            TaskManager.getInstance().submitTask(new KafkaExporterTask("KAFKA"));
//        }

        try {
            Thread.sleep(31000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println("Stopping tasks...");
        try {
            TaskManager.getInstance().stopAll();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    static class TemperatureSensorTask extends StoppableExecutableTask {

// Path: src/main/java/edu/sjsu/mithai/sensors/TemperatureSensor.java
// public class TemperatureSensor extends AbstractDevice {
// 
//     private double min;
//     private Random random;
// 
//     public TemperatureSensor(String id) {
//         super(id);
//         random = new Random();
//         min = random.nextDouble() + 100;
//     }
// 
//     @Override
//     public double sense() {
//         return min + random.nextDouble();
//     }
// 
// }


// Path: src/main/java/edu/sjsu/mithai/util/Client.java
import edu.sjsu.mithai.sensors.TemperatureSensor;

package edu.sjsu.mithai.util;


public class Client {

    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            TaskManager.getInstance().submitTask(new TemperatureSensorTask(i));
        }

//        for (int i = 0; i < 5; i++) {
//            TaskManager.getInstance().submitTask(new KafkaExporterTask("KAFKA"));
//        }

        try {
            Thread.sleep(31000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println("Stopping tasks...");
        try {
            TaskManager.getInstance().stopAll();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    static class TemperatureSensorTask extends StoppableExecutableTask {

        TemperatureSensor sensor;