当前位置: 首页>>代码示例>>Java>>正文


Java Observation.getPhenomenonTime方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:hylkevds,项目名称:SensorThingsProcessor,代码行数:27,代码来源:ValidatorNewer.java

示例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;
}
 
开发者ID:hylkevds,项目名称:SensorThingsProcessor,代码行数:20,代码来源:ValidatorNewer.java

示例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;
}
 
开发者ID:hylkevds,项目名称:SensorThingsProcessor,代码行数:20,代码来源:ValidatorNewer.java

示例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;
}
 
开发者ID:hylkevds,项目名称:SensorThingsProcessor,代码行数:21,代码来源:Service.java

示例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);
}
 
开发者ID:hylkevds,项目名称:SensorThingsProcessor,代码行数:12,代码来源:ValidatorAfter.java

示例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);
}
 
开发者ID:hylkevds,项目名称:SensorThingsProcessor,代码行数:12,代码来源:ValidatorBefore.java

示例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;
    }

}
 
开发者ID:hylkevds,项目名称:SensorThingsProcessor,代码行数:46,代码来源:ProcessorBatchAggregate.java

示例8: getPhenTimeStart

import de.fraunhofer.iosb.ilt.sta.model.Observation; //导入方法依赖的package包/类
private static Instant getPhenTimeStart(Observation obs) {
    TimeObject phenTime = obs.getPhenomenonTime();
    return getPhenTimeStart(phenTime);
}
 
开发者ID:hylkevds,项目名称:SensorThingsProcessor,代码行数:5,代码来源:ProcessorBatchAggregate.java

示例9: getPhenTimeEnd

import de.fraunhofer.iosb.ilt.sta.model.Observation; //导入方法依赖的package包/类
private static Instant getPhenTimeEnd(Observation obs) {
    TimeObject phenTime = obs.getPhenomenonTime();
    return getPhenTimeEnd(phenTime);
}
 
开发者ID:hylkevds,项目名称:SensorThingsProcessor,代码行数:5,代码来源:ProcessorBatchAggregate.java


注:本文中的de.fraunhofer.iosb.ilt.sta.model.Observation.getPhenomenonTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。