use of com.serotonin.m2m2.rt.dataImage.PointValueTime in project ma-core-public by infiniteautomation.
the class MockPointValueDao method getPointValuesBetween.
/* (non-Javadoc)
* @see com.serotonin.m2m2.db.dao.PointValueDao#getPointValuesBetween(int, long, long, int)
*/
@Override
public List<PointValueTime> getPointValuesBetween(int pointId, long from, long to, int limit) {
List<PointValueTime> pvts = new ArrayList<>();
List<PointValueTime> existing = data.get(pointId);
if (existing != null) {
for (PointValueTime pvt : existing) {
if (pvt.getTime() >= from && pvt.getTime() < to)
pvts.add(pvt);
if (pvts.size() >= limit)
break;
}
}
return pvts;
}
use of com.serotonin.m2m2.rt.dataImage.PointValueTime in project ma-core-public by infiniteautomation.
the class ImagePointWrapper method ago.
public byte[] ago(int periodType, int periods) {
long from = DateUtils.minus(getContext().getRuntime(), periodType, periods);
PointValueTime pvt = point.getPointValueBefore(from);
if (pvt == null)
return null;
return ((ImageValue) pvt.getValue()).getData();
}
use of com.serotonin.m2m2.rt.dataImage.PointValueTime in project ma-core-public by infiniteautomation.
the class AlphanumericPointWrapper method ago.
public String ago(int periodType, int count) {
long from = DateUtils.minus(getContext().getRuntime(), periodType, count);
PointValueTime pvt = point.getPointValueBefore(from);
if (pvt == null)
return null;
return pvt.getValue().getStringValue();
}
use of com.serotonin.m2m2.rt.dataImage.PointValueTime in project ma-core-public by infiniteautomation.
the class AlphanumericPointWrapper method getStats.
public ValueChangeCounterWrapper getStats(long from, long to) {
PointValueTime start = point.getPointValueBefore(from);
List<PointValueTime> values = point.getPointValuesBetween(from, to);
ValueChangeCounter stats = new ValueChangeCounter(from, to, start, values);
ValueChangeCounterWrapper wrapper = new ValueChangeCounterWrapper(stats);
return wrapper;
}
use of com.serotonin.m2m2.rt.dataImage.PointValueTime in project ma-core-public by infiniteautomation.
the class BinaryPointWrapper method ago.
public boolean ago(int periodType, int count) {
long from = DateUtils.minus(getContext().getRuntime(), periodType, count);
PointValueTime pvt = point.getPointValueBefore(from);
if (pvt == null)
return false;
return pvt.getBooleanValue();
}
Aggregations