Package eu.scape_project.planning.model.kbrowser

Examples of eu.scape_project.planning.model.kbrowser.VPlanLeaf


        assertEquals(0, leaf.getActualOutputRange(), 0.001);
    }

    @Test
    public void getActualOutputRange_numericTransformer_average() {
        VPlanLeaf leaf = createLeafWithNumericTransformer(SampleAggregationMode.AVERAGE);

        assertEquals(0.6, leaf.getActualOutputRange(), 0.001);
    }
View Full Code Here


        assertEquals(0.6, leaf.getActualOutputRange(), 0.001);
    }

    @Test
    public void getActualOutputRange_numericTransformer_worst() {
        VPlanLeaf leaf = createLeafWithNumericTransformer(SampleAggregationMode.WORST);

        assertEquals(1, leaf.getActualOutputRange(), 0.001);
    }
View Full Code Here

    }

    // -------------------------- helper methods --------------------------

    private VPlanLeaf createLeafWithOrdinalTransformer(SampleAggregationMode aggregationMode) {
        VPlanLeaf leaf = new VPlanLeaf();

        // create simple transformer
        OrdinalTransformer ordinalTrans = new OrdinalTransformer();
        Map<String, TargetValueObject> mapping = new HashMap<String, TargetValueObject>();
        TargetValueObject tv0 = new TargetValueObject();
        TargetValueObject tv1 = new TargetValueObject();
        tv0.setValue(5);
        tv1.setValue(1);
        mapping.put("Y", tv0);
        mapping.put("N", tv1);
        ordinalTrans.setMapping(mapping);
        leaf.setTransformer(ordinalTrans);

        // set scale
        OrdinalScale ordinalScale = new OrdinalScale();
        ordinalScale.setRestriction("Yes/No");
        leaf.setScale(ordinalScale);

        // valueMap
        OrdinalValue yes = new OrdinalValue();
        yes.setValue("Y");
        OrdinalValue no = new OrdinalValue();
        no.setValue("N");

        Values valuesAlternative1 = new Values();
        Values valuesAlternative2 = new Values();
        valuesAlternative1.add(yes);
        valuesAlternative1.add(yes);
        valuesAlternative1.add(yes);
        valuesAlternative1.add(no);
        valuesAlternative2.add(no);
        valuesAlternative2.add(no);
        valuesAlternative2.add(no);
        valuesAlternative2.add(no);

        Map<String, Values> valueMap = new HashMap<String, Values>();
        valueMap.put("alt1", valuesAlternative1);
        valueMap.put("alt2", valuesAlternative2);
        leaf.setValueMap(valueMap);

        leaf.setAggregationMode(aggregationMode);
        leaf.setWeight(1);
        leaf.setTotalWeight(1);

        return leaf;
    }
View Full Code Here

        return leaf;
    }

    private VPlanLeaf createLeafWithNumericTransformer(SampleAggregationMode aggregationMode) {
        VPlanLeaf leaf = new VPlanLeaf();

        // create simple transformer
        NumericTransformer numericTrans = new NumericTransformer();
        numericTrans.setThreshold1(1d);
        numericTrans.setThreshold2(2d);
        numericTrans.setThreshold3(3d);
        numericTrans.setThreshold4(4d);
        numericTrans.setThreshold5(5d);
        leaf.setTransformer(numericTrans);

        // set scale
        PositiveFloatScale scale = new PositiveFloatScale();
        leaf.setScale(scale);

        // valueMap
        FloatValue v0 = new FloatValue();
        v0.setValue(0d);
        FloatValue v1 = new FloatValue();
        v1.setValue(1d);
        FloatValue v2 = new FloatValue();
        v2.setValue(2d);
        FloatValue v3 = new FloatValue();
        v3.setValue(3d);
        FloatValue v4 = new FloatValue();
        v4.setValue(4d);
        FloatValue v5 = new FloatValue();
        v5.setValue(5d);

        Values valuesAlternative1 = new Values();
        Values valuesAlternative2 = new Values();
        valuesAlternative1.add(v0);
        valuesAlternative1.add(v0);
        valuesAlternative1.add(v3);
        valuesAlternative1.add(v4);
        valuesAlternative1.add(v5);
        valuesAlternative2.add(v3);
        valuesAlternative2.add(v3);
        valuesAlternative2.add(v1);
        valuesAlternative2.add(v3);
        valuesAlternative2.add(v5);

        Map<String, Values> valueMap = new HashMap<String, Values>();
        valueMap.put("alt1", valuesAlternative1);
        valueMap.put("alt2", valuesAlternative2);
        leaf.setValueMap(valueMap);

        leaf.setAggregationMode(aggregationMode);
        leaf.setWeight(1);
        leaf.setTotalWeight(1);

        return leaf;
    }
View Full Code Here

        Measure m3 = mock(Measure.class);
        when(m3.getUri()).thenReturn("http://measure3");

        // 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);

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

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

        List<VPlanLeaf> leaves = new ArrayList<VPlanLeaf>();
        leaves.add(leaf1);
        leaves.add(leaf2);
        leaves.add(leaf3);
View Full Code Here

        Measure m2 = mock(Measure.class);
        when(m2.getUri()).thenReturn("http://measure2");

        // 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(true);
        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);

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

        List<VPlanLeaf> leaves = new ArrayList<VPlanLeaf>();
        leaves.add(leaf1);
        leaves.add(leaf2);
View Full Code Here

        Measure m3 = mock(Measure.class);
        when(m3.getUri()).thenReturn("http://measure3");

        // 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);

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

        // Leaf3
        VPlanLeaf leaf3 = mock(VPlanLeaf.class);
        when(leaf3.isMapped()).thenReturn(true);
        when(leaf3.getPlanId()).thenReturn(1);
        when(leaf3.getMeasure()).thenReturn(m3);
        when(leaf3.hasKOPotential()).thenReturn(false);
        when(leaf3.getPotentialMinimum()).thenReturn(1d);
        when(leaf3.getPotentialMaximum()).thenReturn(4d);
        when(leaf3.getTotalWeight()).thenReturn(0.5d);
        Map<String, Double> leaf3Results = new HashMap<String, Double>();
        leaf3Results.put("alternative1", 1d);
        leaf3Results.put("alternative2", 2d);
        leaf3Results.put("alternative3", 3d);
        when(leaf3.getAlternativeResultsAsMap()).thenReturn(leaf3Results);

        List<VPlanLeaf> leaves = new ArrayList<VPlanLeaf>();
        leaves.add(leaf1);
        leaves.add(leaf2);
        leaves.add(leaf3);
View Full Code Here

        Measure m3 = mock(Measure.class);
        when(m3.getUri()).thenReturn("http://measure3");

        // 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.2d);
        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);

        // Leaf2
        VPlanLeaf leaf2 = mock(VPlanLeaf.class);
        when(leaf2.isMapped()).thenReturn(true);
        when(leaf2.getPlanId()).thenReturn(1);
        when(leaf2.getMeasure()).thenReturn(m2);
        when(leaf2.hasKOPotential()).thenReturn(false);
        when(leaf2.getPotentialMinimum()).thenReturn(1d);
        when(leaf2.getPotentialMaximum()).thenReturn(4d);
        when(leaf2.getTotalWeight()).thenReturn(0.2d);
        Map<String, Double> leaf2Results = new HashMap<String, Double>();
        leaf2Results.put("alternative1", 1d);
        leaf2Results.put("alternative2", 2d);
        leaf2Results.put("alternative3", 3d);
        when(leaf2.getAlternativeResultsAsMap()).thenReturn(leaf2Results);

        // Leaf3
        VPlanLeaf leaf3 = mock(VPlanLeaf.class);
        when(leaf3.isMapped()).thenReturn(true);
        when(leaf3.getPlanId()).thenReturn(1);
        when(leaf3.getMeasure()).thenReturn(m3);
        when(leaf3.hasKOPotential()).thenReturn(false);
        when(leaf3.getPotentialMinimum()).thenReturn(1d);
        when(leaf3.getPotentialMaximum()).thenReturn(4d);
        when(leaf3.getTotalWeight()).thenReturn(0.2d);
        Map<String, Double> leaf3Results = new HashMap<String, Double>();
        leaf3Results.put("alternative1", 1d);
        leaf3Results.put("alternative2", 2d);
        leaf3Results.put("alternative3", 3d);
        when(leaf3.getAlternativeResultsAsMap()).thenReturn(leaf3Results);

        List<VPlanLeaf> leaves = new ArrayList<VPlanLeaf>();
        leaves.add(leaf1);
        leaves.add(leaf2);
        leaves.add(leaf3);
View Full Code Here

        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);
View Full Code Here

TOP

Related Classes of eu.scape_project.planning.model.kbrowser.VPlanLeaf

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.