當前位置: 首頁>>代碼示例>>Java>>正文


Java Datastream.setUnitOfMeasurement方法代碼示例

本文整理匯總了Java中de.fraunhofer.iosb.ilt.sta.model.Datastream.setUnitOfMeasurement方法的典型用法代碼示例。如果您正苦於以下問題:Java Datastream.setUnitOfMeasurement方法的具體用法?Java Datastream.setUnitOfMeasurement怎麽用?Java Datastream.setUnitOfMeasurement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在de.fraunhofer.iosb.ilt.sta.model.Datastream的用法示例。


在下文中一共展示了Datastream.setUnitOfMeasurement方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: create

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //導入方法依賴的package包/類
@Override
public Datastream create(Tuple tuple, Query query, DataSize dataSize) {
    Set<Property> select = query == null ? Collections.emptySet() : query.getSelect();

    Datastream entity = new Datastream();
    entity.setName(tuple.get(qInstance.name));
    entity.setDescription(tuple.get(qInstance.description));
    UUID id = tuple.get(qInstance.id);
    if (id != null) {
        entity.setId(new UuidId(tuple.get(qInstance.id)));
    }
    entity.setObservationType(tuple.get(qInstance.observationType));

    String observedArea = tuple.get(qInstance.observedArea.asText());
    if (observedArea != null) {
        try {
            Polygon polygon = GeoHelper.parsePolygon(observedArea);
            entity.setObservedArea(polygon);
        } catch (IllegalArgumentException e) {
            // It's not a polygon, probably a point or a line.
        }
    }
    ObservedProperty op = observedProperyFromId(tuple.get(qInstance.obsPropertyId));
    entity.setObservedProperty(op);

    Timestamp pTimeStart = tuple.get(qInstance.phenomenonTimeStart);
    Timestamp pTimeEnd = tuple.get(qInstance.phenomenonTimeEnd);
    if (pTimeStart != null && pTimeEnd != null) {
        entity.setPhenomenonTime(intervalFromTimes(pTimeStart, pTimeEnd));
    }

    Timestamp rTimeStart = tuple.get(qInstance.resultTimeStart);
    Timestamp rTimeEnd = tuple.get(qInstance.resultTimeEnd);
    if (rTimeStart != null && rTimeEnd != null) {
        entity.setResultTime(intervalFromTimes(rTimeStart, rTimeEnd));
    }

    if (select.isEmpty() || select.contains(EntityProperty.Properties)) {
        String props = tuple.get(qInstance.properties);
        entity.setProperties(jsonToObject(props, Map.class));
    }

    entity.setSensor(sensorFromId(tuple.get(qInstance.sensorId)));
    entity.setThing(thingFromId(tuple.get(qInstance.thingId)));

    entity.setUnitOfMeasurement(new UnitOfMeasurement(tuple.get(qInstance.unitName), tuple.get(qInstance.unitSymbol), tuple.get(qInstance.unitDefinition)));
    return entity;
}
 
開發者ID:FraunhoferIOSB,項目名稱:SensorThingsServer,代碼行數:49,代碼來源:PropertyHelper.java

示例2: create

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //導入方法依賴的package包/類
@Override
public Datastream create(Tuple tuple, Query query, DataSize dataSize) {
    Set<Property> select = query == null ? Collections.emptySet() : query.getSelect();

    Datastream entity = new Datastream();
    entity.setName(tuple.get(qInstance.name));
    entity.setDescription(tuple.get(qInstance.description));
    Long id = tuple.get(qInstance.id);
    if (id != null) {
        entity.setId(new LongId(tuple.get(qInstance.id)));
    }
    entity.setObservationType(tuple.get(qInstance.observationType));

    String observedArea = tuple.get(qInstance.observedArea.asText());
    if (observedArea != null) {
        try {
            Polygon polygon = GeoHelper.parsePolygon(observedArea);
            entity.setObservedArea(polygon);
        } catch (IllegalArgumentException e) {
            // It's not a polygon, probably a point or a line.
        }
    }
    ObservedProperty op = observedProperyFromId(tuple.get(qInstance.obsPropertyId));
    entity.setObservedProperty(op);

    Timestamp pTimeStart = tuple.get(qInstance.phenomenonTimeStart);
    Timestamp pTimeEnd = tuple.get(qInstance.phenomenonTimeEnd);
    if (pTimeStart != null && pTimeEnd != null) {
        entity.setPhenomenonTime(intervalFromTimes(pTimeStart, pTimeEnd));
    }

    Timestamp rTimeStart = tuple.get(qInstance.resultTimeStart);
    Timestamp rTimeEnd = tuple.get(qInstance.resultTimeEnd);
    if (rTimeStart != null && rTimeEnd != null) {
        entity.setResultTime(intervalFromTimes(rTimeStart, rTimeEnd));
    }

    if (select.isEmpty() || select.contains(EntityProperty.Properties)) {
        String props = tuple.get(qInstance.properties);
        entity.setProperties(jsonToObject(props, Map.class));
    }

    entity.setSensor(sensorFromId(tuple.get(qInstance.sensorId)));
    entity.setThing(thingFromId(tuple.get(qInstance.thingId)));

    entity.setUnitOfMeasurement(new UnitOfMeasurement(tuple.get(qInstance.unitName), tuple.get(qInstance.unitSymbol), tuple.get(qInstance.unitDefinition)));
    return entity;
}
 
開發者ID:FraunhoferIOSB,項目名稱:SensorThingsServer,代碼行數:49,代碼來源:PropertyHelper.java

示例3: create

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //導入方法依賴的package包/類
@Override
public Datastream create(Tuple tuple, Query query, DataSize dataSize) {
    Set<Property> select = query == null ? Collections.emptySet() : query.getSelect();

    Datastream entity = new Datastream();
    entity.setName(tuple.get(qInstance.name));
    entity.setDescription(tuple.get(qInstance.description));
    String id = tuple.get(qInstance.id);
    if (id != null) {
        entity.setId(new StringId(tuple.get(qInstance.id)));
    }
    entity.setObservationType(tuple.get(qInstance.observationType));

    String observedArea = tuple.get(qInstance.observedArea.asText());
    if (observedArea != null) {
        try {
            Polygon polygon = GeoHelper.parsePolygon(observedArea);
            entity.setObservedArea(polygon);
        } catch (IllegalArgumentException e) {
            // It's not a polygon, probably a point or a line.
        }
    }
    ObservedProperty op = observedProperyFromId(tuple.get(qInstance.obsPropertyId));
    entity.setObservedProperty(op);

    Timestamp pTimeStart = tuple.get(qInstance.phenomenonTimeStart);
    Timestamp pTimeEnd = tuple.get(qInstance.phenomenonTimeEnd);
    if (pTimeStart != null && pTimeEnd != null) {
        entity.setPhenomenonTime(intervalFromTimes(pTimeStart, pTimeEnd));
    }

    Timestamp rTimeStart = tuple.get(qInstance.resultTimeStart);
    Timestamp rTimeEnd = tuple.get(qInstance.resultTimeEnd);
    if (rTimeStart != null && rTimeEnd != null) {
        entity.setResultTime(intervalFromTimes(rTimeStart, rTimeEnd));
    }

    if (select.isEmpty() || select.contains(EntityProperty.Properties)) {
        String props = tuple.get(qInstance.properties);
        entity.setProperties(jsonToObject(props, Map.class));
    }

    entity.setSensor(sensorFromId(tuple.get(qInstance.sensorId)));
    entity.setThing(thingFromId(tuple.get(qInstance.thingId)));

    entity.setUnitOfMeasurement(new UnitOfMeasurement(tuple.get(qInstance.unitName), tuple.get(qInstance.unitSymbol), tuple.get(qInstance.unitDefinition)));
    return entity;
}
 
開發者ID:FraunhoferIOSB,項目名稱:SensorThingsServer,代碼行數:49,代碼來源:PropertyHelper.java


注:本文中的de.fraunhofer.iosb.ilt.sta.model.Datastream.setUnitOfMeasurement方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。