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


Java SiteMeasurements类代码示例

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


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

示例1: extractTravelTimesFromSiteMeasurements

import com.thales.ntis.subscriber.datex.SiteMeasurements; //导入依赖的package包/类
private void extractTravelTimesFromSiteMeasurements(SiteMeasurements siteMeasurements) {
    String anprRouteId = siteMeasurements.getMeasurementSiteReference().getId();
    // Should only be one travel time value per SiteMeasurements
    // element (index=0)
    MeasuredValue value = siteMeasurements.getMeasuredValue().get(0).getMeasuredValue();
    if (TravelTimeData.class.equals(value.getBasicData().getClass()))
    {
        TravelTimeData ttData = (TravelTimeData) value.getBasicData();
        LOG.info("Travel Time for ANPR Route " + anprRouteId + " : " + ttData.getTravelTime().getDuration() + "s");
    }
}
 
开发者ID:ntisservices,项目名称:ntis-java-web-services-Release3.2,代码行数:12,代码来源:ANPRTrafficDataServiceImpl.java

示例2: handle

import com.thales.ntis.subscriber.datex.SiteMeasurements; //导入依赖的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

示例3: convertToModelObjects

import com.thales.ntis.subscriber.datex.SiteMeasurements; //导入依赖的package包/类
/**
 * The method below demonstrates how to extract SiteMeasurement from the
 * incoming requests and convert it into a list of your own model classes.
 * 
 * @param siteMeasurements
 * @return
 */
public List<TrafficData> convertToModelObjects(final List<SiteMeasurements> siteMeasurements) {

    LOG.info("Cycling through the list of site measurements");
    LOG.info("Number of site measurements returned: " + siteMeasurements.size());

    List<TrafficData> trafficDataList = new ArrayList<TrafficData>();

    for (SiteMeasurements measurement : siteMeasurements) {
        TrafficData trafficDatum = new TrafficData();

        // This is how you can the Site Reference ID and set it on your
        // domain class.
        trafficDatum.setGuid(measurement.getMeasurementSiteReference()
                .getId());

        /*
         * You could calculate the lane and set it on your model object. For
         * example trafficDatum.setLaneNumber(0);
         * 
         * Convert the basic data to either TrafficFlow,
         * TrafficConcentration, TrafficSpeed or TrafficHeadway object and
         * extract the values as below.
         * 
         * TrafficSpeed trafficSpeed = (TrafficSpeed) measurement
         * .getMeasuredValue().get(0).getMeasuredValue() .getBasicData();
         */

        trafficDataList.add(trafficDatum);
    }
    return trafficDataList;
}
 
开发者ID:ntisservices,项目名称:OBSOLETE-ntis-java-web-services-Release2.4,代码行数:39,代码来源:MIDASTrafficDataServiceImpl.java

示例4: extractTrafficDataFromSiteMeasurements

import com.thales.ntis.subscriber.datex.SiteMeasurements; //导入依赖的package包/类
private void extractTrafficDataFromSiteMeasurements(SiteMeasurements measurementsForSite) {

        String siteGUID = measurementsForSite.getMeasurementSiteReference().getId();
        LOG.info("TMU site ID: " + siteGUID);
        LOG.info("Number of measurements for TMU site: " + measurementsForSite.getMeasuredValue().size());

        // There can be a number of measured values reported for the site
        for (SiteMeasurementsIndexMeasuredValue measuredValue : measurementsForSite.getMeasuredValue()) {

            MeasuredValue mv = measuredValue.getMeasuredValue();
            BasicData basicData = mv.getBasicData();

            // The index number of the site measurement is important - as this
            // relates the data
            // to the NTIS reference model, which adds context to the value
            // (e.g. lane information,
            // or vehicle characteristics)
            int index = measuredValue.getIndex();

            // Determine what class (type) of traffic data is contained in the
            // basic data
            if (TrafficFlow.class.equals(basicData.getClass())) {
                TrafficFlow flow = (TrafficFlow) basicData;
                LOG.info("[Measurement Index : " + index + "] Vehicle Flow Rate: " + flow.getVehicleFlow().getVehicleFlowRate());

                if (flow.getVehicleFlow().isDataError()) {
                    List<MultilingualStringValue> errorReason = flow.getVehicleFlow().getReasonForDataError().getValues()
                            .getValue();
                    for (MultilingualStringValue value : errorReason) {
                        LOG.info("    Data in error. Reason: \"" + value.getValue() + "\"");
                    }
                }

            } else if (TrafficSpeed.class.equals(basicData.getClass())) {
                TrafficSpeed speed = (TrafficSpeed) basicData;
                LOG.info("[Measurement Index : " + index + "] Average Speed: " + speed.getAverageVehicleSpeed().getSpeed());

            } else if (TrafficHeadway.class.equals(basicData.getClass())) {
                TrafficHeadway headway = (TrafficHeadway) basicData;
                LOG.info("[Measurement Index : " + index + "] Average Headway: " + headway.getAverageTimeHeadway().getDuration());

            } else if (TrafficConcentration.class.equals(basicData.getClass())) {
                TrafficConcentration concentration = (TrafficConcentration) basicData;
                LOG.info("[Measurement Index : " + index + "] Traffic Occupancy (%): "
                        + concentration.getOccupancy().getPercentage());

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

示例5: extractTrafficDataFromSiteMeasurements

import com.thales.ntis.subscriber.datex.SiteMeasurements; //导入依赖的package包/类
private void extractTrafficDataFromSiteMeasurements(SiteMeasurements measurementsForSite) {

        String siteGUID = measurementsForSite.getMeasurementSiteReference().getId();
        LOG.info("MIDAS site ID: " + siteGUID);
        LOG.info("Number of measurements for MIDAS site: " + measurementsForSite.getMeasuredValue().size());

        // There can be a number of measured values reported for the site
        for (SiteMeasurementsIndexMeasuredValue measuredValue : measurementsForSite.getMeasuredValue()) {

            MeasuredValue mv = measuredValue.getMeasuredValue();
            BasicData basicData = mv.getBasicData();
            
            // The index number of the site measurement is important - as this relates the data
            // to the NTIS reference model, which adds context to the value (e.g. lane information, 
            // or vehicle characteristics)
            int index = measuredValue.getIndex();

            // Determine what class (type) of traffic data is contained in the basic data
            if (TrafficFlow.class.equals(basicData.getClass())) {
                TrafficFlow flow = (TrafficFlow)basicData;
                LOG.info("[Measurement Index : " + index + "] Vehicle Flow Rate: " + flow.getVehicleFlow().getVehicleFlowRate());
                
                if(flow.getVehicleFlow().isDataError()) {
                    List<MultilingualStringValue> errorReason = flow.getVehicleFlow().getReasonForDataError().getValues().getValue();
                    for(MultilingualStringValue value : errorReason) {
                        LOG.info("    Data in error. Reason: \"" + value.getValue() + "\"");
                    }
                }

            } else if (TrafficSpeed.class.equals(basicData.getClass())) {
                TrafficSpeed speed = (TrafficSpeed) basicData;
                LOG.info("[Measurement Index : " + index + "] Average Speed: " + speed.getAverageVehicleSpeed().getSpeed());

            } else if (TrafficHeadway.class.equals(basicData.getClass())) {
                TrafficHeadway headway = (TrafficHeadway) basicData;
                LOG.info("[Measurement Index : " + index + "] Average Headway: " + headway.getAverageTimeHeadway().getDuration());

            } else if (TrafficConcentration.class.equals(basicData.getClass())) {
                TrafficConcentration concentration = (TrafficConcentration) basicData;
                LOG.info("[Measurement Index : " + index + "] Traffic Occupancy (%): "
                        + concentration.getOccupancy().getPercentage());

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


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