Package eu.scape_project.planning.model.measurement

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


     *
     * @param measure
     * @param leaf
     */
    public void assignMeasureToLeaf(final Measure measure, Leaf leaf) {
        Measure oldMeasure = leaf.getMeasure();
        if ((oldMeasure == null) || (!oldMeasure.getUri().equals(measure.getUri()))) {
            // schedule removal of old measure
            if (oldMeasure != null) {
                measuresToDelete.add(oldMeasure);
            }
            // and apply the new one
View Full Code Here


        newTree.setRoot(root);

        for (ControlPolicy cp : preservationCase.getControlPolicies()) {

            Measure m = criteriaManager.getMeasure(cp.getMeasure().getUri());

            List<String> criteriaHierarchy = criteriaManager.getCategoryHierachy(m.getUri());

            Leaf leaf = createLeafInCriteriaHierarchy(newTree.getRoot(), criteriaHierarchy);

            if (leaf != null) {
                assignMeasureToLeaf(m, leaf);
View Full Code Here

        em.getTransaction().commit();
        em.refresh(l);
       
        assertEquals(1((Long)em.createQuery("select count(*) from Scale").getSingleResult()).longValue());

        Measure meas = new Measure();
        Attribute attr = new Attribute();
        CriterionCategory cat = new CriterionCategory("test://category/1", "testcategory", EvaluationScope.ALTERNATIVE_ACTION);
        attr.setCategory(cat);
        attr.setName("test attr");
        attr.setUri("test://attribute/1");
        meas.setAttribute(attr);
        meas.setName("test measure");
        meas.setUri("test://measure/1");
       
    }
View Full Code Here

        em.getTransaction().rollback();
       
        em.getTransaction().begin();
        lStored = em.merge(lStored);
        em.refresh(lStored);
        Measure m = new Measure();
        lStored.setMeasure(m);
        em.persist(lStored);
        assertEquals("Measure should be persisted together with leaf", 1,
            ((Long)em.createQuery("select count(*) from Measure").getSingleResult()).longValue());
       

        em.getTransaction().commit();
        em.getTransaction().begin();
       
        em.remove(lStored);
        assertEquals("Measure should be deleted together with leaf", 0,
            ((Long)em.createQuery("select count(*) from Measure").getSingleResult()).longValue());

        em.getTransaction().rollback();
        em.getTransaction().begin();
        lStored = em.merge(lStored);

        assertEquals("Measure should be persisted together with leaf", 1,
            ((Long)em.createQuery("select count(*) from Measure").getSingleResult()).longValue());
       
        Measure m2 = new Measure();
        m2.setName("m2");
        lStored.setMeasure(m2);
       
        em.persist(lStored);
        assertEquals("Measure should be persisted together with leaf", 2,
            ((Long)em.createQuery("select count(*) from Measure").getSingleResult()).longValue());
View Full Code Here

     */
    private Measurement createMeasurement(String measureId, Object value) {
        Measurement measurement = null;
        String measureUri = T2FlowExecutablePlanGenerator.guessMeasureUrl(measureId);
        if (measureUri != null) {
            Measure measure = cm.getMeasure(measureUri);
            if (measure != null) {
                Value v = measure.getScale().createValue();
                try {
                    v.parse(value.toString());
                    // The measurement value does not need a scale
                    v.setScale(null);
                    measurement = new Measurement();
View Full Code Here

        for (Port p : outputPorts) {
            String measure = p.getValue();
            // Ignore non-measures, measures for sample object
            if (measure != null && !measure.isEmpty() && measureUris.contains(measure)) {
                Object value = outputData.get(p.getName());
                Measure m = cm.getMeasure(measure);
                Value v = m.getScale().createValue();
                v.setComment("Evaluated by " + service.getDescriptor());
                v.parse(value.toString());
                results.put(measure, v);
            }
        }
View Full Code Here

                        String measureUri = qs.getResource("measure").toString();
                        String modality = qs.getResource("modality").getLocalName();
                        String value = qs.getLiteral("value").getString();
                        Resource qualifier = qs.getResource("qualifier");

                        Measure m = criteriaManager.getMeasure(measureUri);

                        cp.setUri(controlPolicyUri);
                        cp.setName(controlPolicyName);
                        cp.setValue(value);
                        cp.setMeasure(m);
View Full Code Here

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

     *
     * @param m
     */
    public void applyMeasure(final Measure m) {
        adjustScale(m.getScale());
        setMeasure(new Measure(m));
        setSingle(m.getAttribute().getCategory().getScope() == EvaluationScope.ALTERNATIVE_ACTION);
        if (StringUtils.isEmpty(name)) {
            setName(m.getName());
        }
        touchIncludingScale();
View Full Code Here

            newTransformer = transformer.clone();
        }
        clone.setTransformer(newTransformer);
        clone.setAggregationMode(this.getAggregationMode());
        if (measure != null) {
            clone.setMeasure(new Measure(measure));
        }
        return clone;
    }
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.