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


Java ElaboratedData.getBasicData方法代码示例

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


在下文中一共展示了ElaboratedData.getBasicData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: extractTrafficDataFromElaboratedData

import com.thales.ntis.subscriber.datex.ElaboratedData; //导入方法依赖的package包/类
private void extractTrafficDataFromElaboratedData(ElaboratedData dataItem) {

        // Location is always specified as LocationByReference (referenced to a
        // single Network Link)
        LocationByReference location = (LocationByReference) dataItem.getBasicData().getPertinentLocation();
        LOG.info("Data for Network Link: " + location.getPredefinedLocationReference().getId());

        BasicData basicData = dataItem.getBasicData();

        // Determine what class (type) of traffic data is contained in the basic
        // data
        if (TrafficSpeed.class.equals(basicData.getClass())) {
            TrafficSpeed speed = (TrafficSpeed) basicData;
            LOG.info("Average Speed: " + speed.getAverageVehicleSpeed().getSpeed());

        } else if (TravelTimeData.class.equals(basicData.getClass())) {
            TravelTimeData travelTimeData = (TravelTimeData) basicData;
            LOG.info("Travel Time: " + travelTimeData.getTravelTime().getDuration());
            LOG.info("Free Flow Travel Time: " + travelTimeData.getFreeFlowTravelTime().getDuration());
            LOG.info("Normally Expected Travel Time: " + travelTimeData.getNormallyExpectedTravelTime().getDuration());

        } else if (TrafficFlow.class.equals(basicData.getClass())) {
            TrafficFlow flow = (TrafficFlow) basicData;
            LOG.info("Traffic Flow: " + flow.getVehicleFlow().getVehicleFlowRate());

        } else if (TrafficConcentration.class.equals(basicData.getClass())) {
            TrafficConcentration concentration = (TrafficConcentration) basicData;
            LOG.info("Occupancy (%age): " + concentration.getOccupancy().getPercentage());

        } else if (TrafficHeadway.class.equals(basicData.getClass())) {
            TrafficHeadway headway = (TrafficHeadway) basicData;
            LOG.info("Headway: " + headway.getAverageTimeHeadway().getDuration());

        } else {
            LOG.error("Unexpected traffic data type contained in publication: " + dataItem.getClass().getSimpleName());
        }
    }
 
开发者ID:ntisservices,项目名称:ntis-java-web-services-Release3.2,代码行数:38,代码来源:FusedSensorOnlyTrafficDataServiceImpl.java

示例2: extractTrafficDataFromElaboratedData

import com.thales.ntis.subscriber.datex.ElaboratedData; //导入方法依赖的package包/类
private void extractTrafficDataFromElaboratedData(ElaboratedData dataItem) {

        // Location is always specified as LocationByReference (referenced to a
        // single Network Link)
        LocationByReference location = (LocationByReference) dataItem.getBasicData().getPertinentLocation();
        LOG.info("Data for Network Link: " + location.getPredefinedLocationReference().getId());
        
        BasicData basicData = dataItem.getBasicData();

        // Determine what class (type) of traffic data is contained in the basic data
        if (TrafficSpeed.class.equals(basicData.getClass())) {
            TrafficSpeed speed = (TrafficSpeed)basicData;
            
            // There are 2 types of speed data - current and forecast, determined by 
            // whether a measurementOrCalculationTime element exists in the data item.
            if(speed.getMeasurementOrCalculationTime() == null) {
                LOG.info("Fused Average Speed: " + speed.getAverageVehicleSpeed().getSpeed());
                LOG.info("FVD-Only Average Speed: " + speed.getTrafficSpeedExtension().getSpeedFvdOnly().getSpeed());
            } else {
                LOG.info("Fused Average Speed (forecast for " + speed.getMeasurementOrCalculationTime().toString() + "): "
                        + speed.getAverageVehicleSpeed().getSpeed());
            }
            
        } else if (TravelTimeData.class.equals(basicData.getClass())) {
                TravelTimeData travelTimeData = (TravelTimeData)basicData;

            // There are 2 types of travel time data - current and forecast,
            // determined by whether a measurementOrCalculationTime element
            // exists in the data item.
            if (travelTimeData.getMeasurementOrCalculationTime() == null) {
                LOG.info("Travel Time: " + travelTimeData.getTravelTime().getDuration());
                LOG.info("Free Flow Travel Time: " + travelTimeData.getFreeFlowTravelTime().getDuration());
                LOG.info("Normally Expected Travel Time: " + travelTimeData.getNormallyExpectedTravelTime().getDuration());
            } else {
                LOG.info("Travel Time (forecast for " + travelTimeData.getMeasurementOrCalculationTime().toString() + "): "
                        + travelTimeData.getTravelTime().getDuration());
            }

        } else {
            LOG.error("Unexpected traffic data type contained in publication: " + dataItem.getClass().getSimpleName());
        }
    }
 
开发者ID:ntisservices,项目名称:ntis-java-web-services-Release3.2,代码行数:43,代码来源:FusedFvdAndSensorTrafficDataServiceImpl.java


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