本文整理汇总了Java中de.fraunhofer.iosb.ilt.sta.model.Observation.getPhenomenonTime方法的典型用法代码示例。如果您正苦于以下问题:Java Observation.getPhenomenonTime方法的具体用法?Java Observation.getPhenomenonTime怎么用?Java Observation.getPhenomenonTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.fraunhofer.iosb.ilt.sta.model.Observation
的用法示例。
在下文中一共展示了Observation.getPhenomenonTime方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isValid
import de.fraunhofer.iosb.ilt.sta.model.Observation; //导入方法依赖的package包/类
@Override
public boolean isValid(Observation obs) throws ProcessException {
try {
Instant latest;
Datastream ds = obs.getDatastream();
if (ds == null) {
MultiDatastream mds = obs.getMultiDatastream();
if (mds == null) {
throw new ProcessException("Observation has no Datastream of Multidatastream set!");
}
latest = getTimeForMultiDatastream(mds);
} else {
latest = getTimeForDatastream(ds);
}
TimeObject phenomenonTime = obs.getPhenomenonTime();
Instant obsInstant;
if (phenomenonTime.isInterval()) {
obsInstant = phenomenonTime.getAsInterval().getStart();
} else {
obsInstant = phenomenonTime.getAsDateTime().toInstant();
}
return latest.isBefore(obsInstant);
} catch (ServiceFailureException ex) {
throw new ProcessException("Failed to validate.", ex);
}
}
示例2: getTimeForDatastream
import de.fraunhofer.iosb.ilt.sta.model.Observation; //导入方法依赖的package包/类
private Instant getTimeForDatastream(Datastream ds) throws ServiceFailureException {
Id dsId = ds.getId();
Instant latest = datastreamCache.get(dsId);
if (latest == null) {
Observation firstObs = ds.observations().query().select("@iot.id", "phenomenonTime").orderBy("phenomenonTime desc").first();
if (firstObs == null) {
latest = Instant.MIN;
} else {
TimeObject phenomenonTime = firstObs.getPhenomenonTime();
if (phenomenonTime.isInterval()) {
latest = phenomenonTime.getAsInterval().getStart();
} else {
latest = phenomenonTime.getAsDateTime().toInstant();
}
}
datastreamCache.put(dsId, latest);
}
return latest;
}
示例3: getTimeForMultiDatastream
import de.fraunhofer.iosb.ilt.sta.model.Observation; //导入方法依赖的package包/类
private Instant getTimeForMultiDatastream(MultiDatastream mds) throws ServiceFailureException {
Id dsId = mds.getId();
Instant latest = multiDatastreamCache.get(dsId);
if (latest == null) {
Observation firstObs = mds.observations().query().select("@iot.id", "phenomenonTime").orderBy("phenomenonTime desc").first();
if (firstObs == null) {
latest = Instant.MIN;
} else {
TimeObject phenomenonTime = firstObs.getPhenomenonTime();
if (phenomenonTime.isInterval()) {
latest = phenomenonTime.getAsInterval().getStart();
} else {
latest = phenomenonTime.getAsDateTime().toInstant();
}
}
multiDatastreamCache.put(dsId, latest);
}
return latest;
}
示例4: getDefinedProperties
import de.fraunhofer.iosb.ilt.sta.model.Observation; //导入方法依赖的package包/类
private Set<DataArrayValue.Property> getDefinedProperties(Observation o) {
Set<DataArrayValue.Property> value = new HashSet<>();
value.add(DataArrayValue.Property.Result);
if (o.getPhenomenonTime() != null) {
value.add(DataArrayValue.Property.PhenomenonTime);
}
if (o.getResultTime() != null) {
value.add(DataArrayValue.Property.ResultTime);
}
if (o.getResultQuality() != null) {
value.add(DataArrayValue.Property.ResultQuality);
}
if (o.getParameters() != null) {
value.add(DataArrayValue.Property.Parameters);
}
if (o.getValidTime() != null) {
value.add(DataArrayValue.Property.ValidTime);
}
return value;
}
示例5: isValid
import de.fraunhofer.iosb.ilt.sta.model.Observation; //导入方法依赖的package包/类
@Override
public boolean isValid(Observation obs) throws ProcessException {
TimeObject phenomenonTime = obs.getPhenomenonTime();
Instant obsInstant;
if (phenomenonTime.isInterval()) {
obsInstant = phenomenonTime.getAsInterval().getStart();
} else {
obsInstant = phenomenonTime.getAsDateTime().toInstant();
}
return refTime.isBefore(obsInstant);
}
示例6: isValid
import de.fraunhofer.iosb.ilt.sta.model.Observation; //导入方法依赖的package包/类
@Override
public boolean isValid(Observation obs) throws ProcessException {
TimeObject phenomenonTime = obs.getPhenomenonTime();
Instant obsInstant;
if (phenomenonTime.isInterval()) {
obsInstant = phenomenonTime.getAsInterval().getStart();
} else {
obsInstant = phenomenonTime.getAsDateTime().toInstant();
}
return refTime.isAfter(obsInstant);
}
示例7: calculateAggregates
import de.fraunhofer.iosb.ilt.sta.model.Observation; //导入方法依赖的package包/类
private void calculateAggregates(AggregateCombo combo) throws ServiceFailureException, ProcessException {
Observation lastAggObs = combo.getLastForTarget();
Instant calcIntervalStart;
if (lastAggObs == null) {
Observation firstSourceObs = combo.getFirstForSource();
if (firstSourceObs == null) {
LOGGER.debug("No source observations at all for {}.", combo);
return;
}
Instant firstSourceStart = getPhenTimeStart(firstSourceObs);
ZonedDateTime atZone = firstSourceStart.atZone(combo.getZoneId());
ZonedDateTime firstIntStart = combo.level.toIntervalStart(atZone);
if (atZone.isEqual(firstIntStart)) {
calcIntervalStart = firstIntStart.toInstant();
} else {
calcIntervalStart = firstIntStart.plus(combo.level.duration).toInstant();
}
} else {
TimeObject lastAggPhenTime = lastAggObs.getPhenomenonTime();
calcIntervalStart = lastAggPhenTime.getAsInterval().getEnd();
}
Observation lastSourceObs = combo.getLastForSource();
if (lastSourceObs == null) {
LOGGER.debug("No source observations at all for {}.", combo);
return;
}
Instant lastSourcePhenTime = getPhenTimeEnd(lastSourceObs);
boolean more = true;
while (more) {
Instant calcIntervalEnd = calcIntervalStart.plus(combo.level.duration);
if (lastSourcePhenTime.isBefore(calcIntervalEnd)) {
LOGGER.info("Nothing (more) to do for {}.", combo);
return;
}
calculateAggregate(combo, Interval.of(calcIntervalStart, calcIntervalEnd));
calcIntervalStart = calcIntervalEnd;
}
}
示例8: getPhenTimeStart
import de.fraunhofer.iosb.ilt.sta.model.Observation; //导入方法依赖的package包/类
private static Instant getPhenTimeStart(Observation obs) {
TimeObject phenTime = obs.getPhenomenonTime();
return getPhenTimeStart(phenTime);
}
示例9: getPhenTimeEnd
import de.fraunhofer.iosb.ilt.sta.model.Observation; //导入方法依赖的package包/类
private static Instant getPhenTimeEnd(Observation obs) {
TimeObject phenTime = obs.getPhenomenonTime();
return getPhenTimeEnd(phenTime);
}