com.eg.agent.android.sample.Sample Maven / Gradle / Ivy
package com.eg.agent.android.sample;/*
package com.eg.agent.android.sample;
import JsonArray;
public class Sample {
private long timestamp;
private SampleValue sampleValue;
private SampleType type;
public static enum SampleType
{
MEMORY, CPU;
private SampleType() {}
}
public Sample(SampleType type)
{
setSampleType(type);
setTimestamp(System.currentTimeMillis());
}
public Sample(long timestamp)
{
setTimestamp(timestamp);
}
public Sample(long timestamp, SampleValue sampleValue)
{
setTimestamp(timestamp);
setSampleValue(sampleValue);
}
public long getTimestamp()
{
return this.timestamp;
}
public void setTimestamp(long timestamp)
{
this.timestamp = timestamp;
}
public SampleValue getSampleValue()
{
return this.sampleValue;
}
public void setSampleValue(SampleValue sampleValue)
{
this.sampleValue = sampleValue;
}
public void setSampleValue(double value)
{
this.sampleValue = new SampleValue(value);
}
public void setSampleValue(long value)
{
this.sampleValue = new SampleValue(value);
}
public Number getValue()
{
return this.sampleValue.getValue();
}
public SampleType getSampleType()
{
return this.type;
}
public void setSampleType(SampleType type)
{
this.type = type;
}
public JsonArray asJsonArray()
{
JsonArray jsonArray = new JsonArray();
try{
jsonArray.add(this.timestamp);
jsonArray.add(this.sampleValue.getValue());
}
catch(Exception e){
System.out.println(e.getMessage());
}
return jsonArray;
}
}
*/
© 2015 - 2024 Weber Informatics LLC | Privacy Policy