Package eu.scape_project.planning.model.measurement

Examples of eu.scape_project.planning.model.measurement.Measure


        when(plan1.getOverallResults()).thenReturn(plan1ResultNode);
        when(plan1.getWinningAlternative()).thenReturn("alternative3");
        plans.add(plan1);

        // Measures
        Measure m1 = mock(Measure.class);
        when(m1.getUri()).thenReturn("http://measure1");
        Measure m2 = mock(Measure.class);
        when(m2.getUri()).thenReturn("http://measure2");
        Measure m3 = mock(Measure.class);
        when(m3.getUri()).thenReturn("http://measure3");

        // Leaves
        // Leaf1
        VPlanLeaf leaf1 = mock(VPlanLeaf.class);
        when(leaf1.isMapped()).thenReturn(true);
View Full Code Here


        when(plan1.getOverallResults()).thenReturn(plan1ResultNode);
        when(plan1.getWinningAlternative()).thenReturn("alternative3");
        plans.add(plan1);

        // Measures
        Measure m1 = mock(Measure.class);
        when(m1.getUri()).thenReturn("http://measure1");

        // Leaves
        // Leaf1
        VPlanLeaf leaf1 = mock(VPlanLeaf.class);
        when(leaf1.isMapped()).thenReturn(true);
        when(leaf1.getPlanId()).thenReturn(1);
        when(leaf1.getMeasure()).thenReturn(m1);
        when(leaf1.hasKOPotential()).thenReturn(false);
        when(leaf1.getPotentialMinimum()).thenReturn(1d);
        when(leaf1.getPotentialMaximum()).thenReturn(4d);
        when(leaf1.getTotalWeight()).thenReturn(0.1d);
        Map<String, Double> leaf1Results = new HashMap<String, Double>();
        leaf1Results.put("alternative1", 1d);
        leaf1Results.put("alternative2", 2d);
        leaf1Results.put("alternative3", 3d);
        when(leaf1.getAlternativeResultsAsMap()).thenReturn(leaf1Results);

        List<VPlanLeaf> leaves = new ArrayList<VPlanLeaf>();
        leaves.add(leaf1);
        leaves.add(leaf1);
        leaves.add(leaf1);

        DominatedSets c = new RankChangingDominatedSets(plans, leaves);

        List<List<String>> rangeChangingSets = c.getDominatedSets(Aggregation.ALL);

        // Assert
        assertEquals(rangeChangingSets.size(), 1);
        List<String> set1 = rangeChangingSets.get(0);
        assertEquals(set1.size(), 1);
        assertTrue(set1.contains(m1.getUri()));
    }
View Full Code Here

    public void testExportToFreemindXml_severalMappedCriteria() throws Exception {
        // create criteria-hierarchy tree
        CriteriaLeaf leaf1 = new CriteriaLeaf();
        leaf1.setName("leaf1");
        Measure imageWidthEqualsCrit = new Measure();
        imageWidthEqualsCrit.setUri("outcome://object/image/width#equal");
        leaf1.setMeasure(imageWidthEqualsCrit);
        leaf1.setMapped(true);
        CriteriaLeaf leaf2 = new CriteriaLeaf();
        leaf2.setName("leaf2");
        CriteriaLeaf leaf3 = new CriteriaLeaf();
        leaf3.setName("leaf3");
        Measure textQualityCrit = new Measure();
        textQualityCrit.setUri("outcome://object/image/textQuality");
        leaf3.setMeasure(textQualityCrit);
        leaf3.setMapped(true);

        CriteriaNode subNode = new CriteriaNode();
        subNode.setName("subNode");
View Full Code Here

        else {
          String name = TEXT.substring(0, mappingSeparatorIndex);
          String criterionUri = TEXT.substring(mappingSeparatorIndex + 1);
          leaf.setName(name);
          // set criterion only if we can identify it
          Measure crit = criteriaManager.getMeasure(criterionUri);
          if (crit != null) {
            leaf.setMapped(true);
            leaf.setMeasure(new Measure(crit));
          }
          else {
            leaf.setMapped(false);
          }
        }
View Full Code Here

     *            the measure to assign
     * @param criteriaLeaf
     *            the leaf to assign the measure to
     */
    public void assignMeasureToLeaf(final Measure measure, CriteriaLeaf criteriaLeaf) {
        Measure oldMeasure = criteriaLeaf.getMeasure();
        if (oldMeasure != null) {
            measuresToDelete.add(oldMeasure);
        }

        criteriaLeaf.setMeasure(measure);
View Full Code Here

        }
      return triggers;
    }
   
    private void addTrigger(Leaf leaf) {
      Measure meas = leaf.getMeasure();
      Question q = null;
        if (leaf.getTransformer() instanceof OrdinalTransformer) {
          // TODO
        } else if (leaf.getTransformer() instanceof NumericTransformer){
            NumericTransformer numericT = (NumericTransformer)leaf.getTransformer();
           
            String name = meas.getName();
            String operator;
            if (numericT.hasIncreasingOrder()) {
              // values must be greater or equal threshold 1, therefore we watch for smaller values
                operator = " < ";
            } else {
              // values must be smaller or equal threshold 1, therefore we watch for higher values
                operator = " > ";
            }
           
        if ("http://purl.org/DP/quality/measures#11".equals(meas.getUri())) {
          // this value is accumulated, we check for min/max
         
              if (numericT.hasIncreasingOrder()) {
                  name = "Minimum " + name;
              } else {
View Full Code Here

TOP

Related Classes of eu.scape_project.planning.model.measurement.Measure

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.