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


Java MeasuredDataPublication类代码示例

本文整理汇总了Java中com.thales.ntis.subscriber.datex.MeasuredDataPublication的典型用法代码示例。如果您正苦于以下问题:Java MeasuredDataPublication类的具体用法?Java MeasuredDataPublication怎么用?Java MeasuredDataPublication使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MeasuredDataPublication类属于com.thales.ntis.subscriber.datex包,在下文中一共展示了MeasuredDataPublication类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handle

import com.thales.ntis.subscriber.datex.MeasuredDataPublication; //导入依赖的package包/类
@Override
public void handle(D2LogicalModel d2LogicalModel) {
    LOG.info("handling TMU Request !");

    try {
        if (d2LogicalModel.getPayloadPublication() != null) {
            List<SiteMeasurements> siteMeasurementsList = ((MeasuredDataPublication) d2LogicalModel.getPayloadPublication())
                    .getSiteMeasurements();
            for (SiteMeasurements siteMeasurements : siteMeasurementsList) {
                List<SiteMeasurementsIndexMeasuredValue> measuredValueList = siteMeasurements.getMeasuredValue();
                for (SiteMeasurementsIndexMeasuredValue siteMeasurementsIndexMeasuredValue : measuredValueList) {
                    MeasuredValue measuredValue = siteMeasurementsIndexMeasuredValue.getMeasuredValue();
                    BasicData basicData = measuredValue.getBasicData();
                    if (basicData instanceof TrafficFlow) {
                        VehicleFlowValue value = ((TrafficFlow) basicData).getVehicleFlow();
                        LOG.info("Vehicle flow rate : " + value.getVehicleFlowRate().intValue());
                    } else if (basicData instanceof TrafficSpeed) {
                        float speed = ((TrafficSpeed) basicData).getAverageVehicleSpeed().getSpeed();
                        LOG.info("Traffic speed : " + speed);
                    } else if (basicData instanceof TrafficHeadway) {
                        float headWay = ((TrafficHeadway) basicData).getAverageTimeHeadway().getDuration();
                        LOG.info("Traffic Headway : " + headWay);
                    } else if (basicData instanceof TrafficConcentration) {
                        float percentage = ((TrafficConcentration) basicData).getOccupancy().getPercentage();
                        LOG.info("Traffic concentration percentage : " + percentage);
                    }
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        LOG.error(e.getMessage());
    }
    LOG.info("TMU Request: Processing Completed Successfuly");
}
 
开发者ID:ntisservices,项目名称:OBSOLETE-ntis-java-web-services-Release2.4,代码行数:36,代码来源:TMUTrafficDataServiceImpl.java


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