/*
 add comments: purpose of this class?
*/

import java.io.*;
import java.util.Random;

public class Sensor {
  /* add comments */
  protected String id;
  protected double value;

  /* add comments */
  private Random r;

  /* add comments */
  public String getId() {
    return this.id;
  }

  /* add comments */
  public double getValue() {
    return this.value;
  }

  /* add comments */
  public void measure() {
    this.value = r.nextFloat() * 100;
  }

  /* add comments */
  public void print() {
   System.out.println("Sensor " + this.id + ": " + this.value);
  }

  /* add comments */
  public String adhocJson() {
    return "{\"id:\"" + id + "\",\"value\":" + value + "}";
  }

  /* add comments */
  public Sensor() {
    this.id = null;
    this.value = 0.0;
    this.r = new Random();
  }

  /* add comments */
  public Sensor(String id) {
    this.id = id;
    this.value = 0;
    this.r = new Random();
  }
}
