Created
July 13, 2019 17:08
-
-
Save e3oroush/d4fb377facb62650d17846a39ce49a51 to your computer and use it in GitHub Desktop.
Simple JAVA class for device and temperature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mypackage.events; | |
public class Sensor { | |
private int deviceId; | |
private double temperature; | |
private long timestamp; | |
public Sensor(int deviceId, double temperature, long timestamp) | |
{ | |
this.deviceId = deviceId; | |
this.temperature = temperature; | |
this.timestamp = timestamp; | |
} | |
public int getDeviceId() { | |
return deviceId; | |
} | |
public void setDeviceId(int deviceId) { | |
this.deviceId = deviceId; | |
} | |
public double getTemperature() { | |
return temperature; | |
} | |
public void setTemperature(double temperature) { | |
this.temperature = temperature; | |
} | |
public long getTimestamp() { | |
return timestamp; | |
} | |
public void setTimestamp(long timestamp) { | |
this.timestamp = timestamp; | |
} | |
@Override | |
public String toString() { | |
return "device id: " + this.deviceId + ", temperature: " + this.temperature; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment