當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。