Package eu.planets_project.pp.plato.model.measurement

Examples of eu.planets_project.pp.plato.model.measurement.MeasurementInfo


       
       parser.load(descriptor, digestedProperties, digestedMetrics);
      
       // merge digested properties with already existing
       for (MeasurableProperty p : digestedProperties.values()) {
           MeasurementInfo helperInfo = new MeasurementInfo();
           helperInfo.setMetric(null);
           helperInfo.setProperty(p);
           String uri = helperInfo.getUri();
           String propertyId = p.getPropertyId();
           if (uri == null){
               log.error("found invalid property definition");
           } else {
               // We check if we have that property already. If not, we put
               // the property into the map.
               MeasurableProperty existingP = properties.get(propertyId);
               if (existingP == null) {
                   // this property could not be measured so far - add it to the map
                   properties.put(propertyId, p);
                   // and add the scale of this property too
                   measurementScales.put(uri, p.getScale());
               }
               // We look at all metrics and look
               // a. is the property+metric already mapped to a scale?
               // b. is the metric already listed in the property?
               for(Metric m : p.getPossibleMetrics()) {
                   helperInfo.setMetric(m);
                   uri = helperInfo.getUri();
                   // a. if property+metric isnt yet mapped, we put down the scale.
                   if (!measurementScales.containsKey(uri)) {
                       measurementScales.put(uri, m.getScale());
                   }
                   // If we have an existing property, we have to check if it contains this metric.
View Full Code Here


            if ((this.scale == null) //we don't have a scale yet
               || (!scale.getClass().getName().equals(newScale.getClass().getName())))
                // the new scale is not the same as ours
            {
                // a new scale was chosen, remove mapping
                setMeasurementInfo(new MeasurementInfo());

                setScale(newScale.clone());
                setDefaultAggregation();
               
                if (scale != null) {
View Full Code Here

        this.predefined = predefined;
    }
   
    public Leaf addCriterion() {
        Leaf l = new Leaf();
        MeasurementInfo mInfo = l.getMeasurementInfo();
//        if ((mInfo.getScheme() == null) ||("".equals(mInfo.getScheme()))) {
//            if ((category == CriterionCategory.AJ)||
//                (category == CriterionCategory.AR)||
//                (category == CriterionCategory.AS)){
//                mInfo.setScheme("action");
View Full Code Here

            // ok
        }
    }
    @Test()
    public void testFromUri() {
        MeasurementInfo info = new MeasurementInfo();
        info.fromUri("outcome://object/image/dimension/width#equal");
        Assert.assertNotNull(info.getProperty(), "should be initialised");
        Assert.assertEquals(info.getProperty().getPropertyId(),"image/dimension/width");
        Assert.assertNotNull(info.getMetric(), "should be initialised");
        Assert.assertEquals(info.getMetric().getMetricId(),"equal");

        info.fromUri("");
        Assert.assertNull(info.getUri(), "should be reset");
        Assert.assertNull(info.getProperty(), "should be reset");
        Assert.assertNull(info.getMetric(), "should be reset");
       
        info.fromUri(null);
        Assert.assertNull(info.getUri(), "should be reset");
        Assert.assertNull(info.getProperty(), "should be reset");
        Assert.assertNull(info.getMetric(), "should be reset");
    }
View Full Code Here

        Assert.assertNull(info.getMetric(), "should be reset");
    }
   
    @Test(expectedExceptions=IllegalArgumentException.class)
    public void testFromUriInvalidCategory() {
        MeasurementInfo info = new MeasurementInfo();
        info.fromUri("object://xcl/object/image/dimension/width#equal");
    }
View Full Code Here

        if (mpmSelectedLeaf == null) {
            return;
        }
        if (mappingProperty != null) {
   
            MeasurementInfo mappingInfo = new MeasurementInfo();
            mappingInfo.setProperty(mappingProperty.clone());
           
            if (mappingMetric != null){
                mappingInfo.setMetric(mappingMetric.clone());
            } else {
                mappingInfo.setMetric(null);
            }
            Scale mappingScale =  mappingInfo.getScale();
               
            if (mappingScale != null) {
                // We have to set the scale first, as the measurement info will be reseted, if the scale changes
                mpmSelectedLeaf.changeScale(mappingScale);
                mpmSelectedLeaf.getMeasurementInfo().setProperty(mappingInfo.getProperty());
                mpmSelectedLeaf.getMeasurementInfo().setMetric(mappingInfo.getMetric());
               
                // only outcome object and action runtime criteria are evaluated per object, all others per action
                CriterionCategory mappingCategory = mappingProperty.getCategory();
                mpmSelectedLeaf.setSingle(!
                        (CriterionCategory.ACTION_RUNTIME.equals(mappingCategory) ||
View Full Code Here

        LibraryTree lib = new LibraryTree();
        lib.addMainRequirements();
        lib.getRoot().setDescription("This is a description");
        Leaf c = new Leaf();
        c.setName("ImageWidth");
        MeasurementInfo mInfo = new MeasurementInfo();
        mInfo.fromUri("xcl://imageWidth#equal");
        c.setMeasurementInfo(mInfo);
        ((LibraryRequirement)lib.getRoot().getChildren().get(0).getChildren().get(0)).addChild(c);
       
        LibraryExport export = new LibraryExport();
        File exported = new File ("test-data/lib_export.xml");
View Full Code Here

TOP

Related Classes of eu.planets_project.pp.plato.model.measurement.MeasurementInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.