Examples of OrdinalTransformer


Examples of eu.scape_project.planning.model.transform.OrdinalTransformer

            log.warn("Can't set DefaultTransformer, no scale set!");
            this.setTransformer(null);
            return;
        }
        if (ScaleType.ordinal.equals(scale.getType())) {
            OrdinalTransformer t = new OrdinalTransformer();
            this.setTransformer(t);
            if (!(scale instanceof FreeStringScale)) {
                Map<String, TargetValueObject> map = t.getMapping();
                OrdinalScale o = (OrdinalScale) scale;
                for (String s : o.getList()) {
                    map.put(s, new TargetValueObject());
                }
            }
View Full Code Here

Examples of eu.scape_project.planning.model.transform.OrdinalTransformer

    public void initTransformer(Double defaultTarget) {

        if (scale instanceof FreeStringScale) {
            FreeStringScale freeScale = (FreeStringScale) scale;
            // We collect all distinct actually EXISTING values
            OrdinalTransformer t = (OrdinalTransformer) transformer;
            Map<String, TargetValueObject> map = t.getMapping();

            HashSet<String> allValues = new HashSet<String>();
            for (Values values : valueMap.values()) {
                for (Value v : values.getList()) {
                    FreeStringValue text = (FreeStringValue) v;
View Full Code Here

Examples of eu.scape_project.planning.model.transform.OrdinalTransformer

        double outputLowerBound = 10;
        double outputUpperBound = -10;

        // Check OrdinalTransformer
        if (transformer instanceof OrdinalTransformer) {
            OrdinalTransformer ot = (OrdinalTransformer) transformer;
            Map<String, TargetValueObject> otMapping = ot.getMapping();

            // set upper- and lower-bound
            for (TargetValueObject tv : otMapping.values()) {
                if (tv.getValue() > outputUpperBound) {
                    outputUpperBound = tv.getValue();
View Full Code Here

Examples of eu.scape_project.planning.model.transform.OrdinalTransformer

        for (Value val : valueList) {
            TargetValue targetValue;

            // do ordinal transformationCriterion
            if (transformer instanceof OrdinalTransformer) {
                OrdinalTransformer ordTrans = (OrdinalTransformer) transformer;

                if (val instanceof IOrdinalValue) {
                    try {
                        targetValue = ordTrans.transform((IOrdinalValue) val);
                    } catch (NullPointerException e) {
                        log.warn("Measurement of leaf doesn't match with OrdinalTransformer! Ignoring it!");
                        log.warn("MeasuredValue-id: " + val.getId() + "; Transformer-id: " + ordTrans.getId());
                        continue;
                    }
                    transformedValues.add(targetValue.getValue());
                } else {
                    log.warn("getActualOutputRange(): INumericValue value passed to OrdinalTransformer - ignore value");
View Full Code Here

Examples of eu.scape_project.planning.model.transform.OrdinalTransformer

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

Examples of eu.scape_project.planning.model.transform.OrdinalTransformer

        o.setRestriction("GOD/BAD/HORRIBLE");
        Leaf l = new Leaf();
        l.setScale(o);
        l.setDefaultTransformer();
        Assert.assertTrue(l.getTransformer() instanceof OrdinalTransformer);
        OrdinalTransformer ord = (OrdinalTransformer) l.getTransformer();
        Assert.assertTrue(ord.getMapping().containsKey("GOD"));
        Assert.assertTrue(ord.getMapping().containsKey("BAD"));
        Assert.assertTrue(ord.getMapping().containsKey("HORRIBLE"));
    }
View Full Code Here

Examples of eu.scape_project.planning.model.transform.OrdinalTransformer

                    }
                }
                nt.defaults(min, max);
                nt.setMode(TransformationMode.LINEAR);
            } else {
                OrdinalTransformer ot = (OrdinalTransformer) t;
                if (leaf.getScale() instanceof BooleanScale) {

                    ot.getMapping().put("Yes", new TargetValueObject(5));
                    ot.getMapping().put("No", new TargetValueObject(1));
                } else {
                    // total nonsense placeholder for setting something
                    // until we have proper heuristics and property-specific
                    // transformers in the knowledge base
                    for (String s : ot.getMapping().keySet()) {
                        ot.getMapping().put(s, new TargetValueObject(3.33));
                    }
                }
            }
            t.touch();
        }
View Full Code Here

Examples of eu.scape_project.planning.model.transform.OrdinalTransformer

        // is this a drop out criteria?
        if (leaf.getTransformer() instanceof OrdinalTransformer) {
            //Element search for the unacceptable values (there can be more than one!)
            String explanation = leaf.getMeasure().getName() + " must have (one) of the the following values: [";
            String test = "";
            OrdinalTransformer ordinalT = (OrdinalTransformer)leaf.getTransformer();
            for (String key : ordinalT.getMapping().keySet()) {
                double value = ordinalT.getMapping().get(key).getValue();
                if (Double.compare(value, 0.0) <= 0) {
                    test = test + "(. != '" + key + "') and ";
                } else {
                    explanation = explanation + key + ", ";
                }
View Full Code Here

Examples of eu.scape_project.planning.model.transform.OrdinalTransformer

            }

            // OrdinalTransformer
            if (trans instanceof OrdinalTransformer) {
                table.setOrdinal(true);
                OrdinalTransformer oTrans = (OrdinalTransformer) trans;
                Map<String, TargetValueObject> oTransMapping = oTrans.getMapping();
                Map<Double, String> tableMapping = new HashMap<Double, String>();

                for (String str : oTransMapping.keySet()) {
                    Double tv = oTransMapping.get(str).getValue();
                    table.addTargetValue(tv);
View Full Code Here

Examples of eu.scape_project.planning.model.transform.OrdinalTransformer

        if (node.isLeaf()) {
            Leaf leaf = (Leaf) node;
            Transformer t = leaf.getTransformer();
            Hibernate.initialize(t);
            if (t instanceof OrdinalTransformer) {
                OrdinalTransformer nt = (OrdinalTransformer) t;
                Hibernate.initialize(nt.getMapping());
            }
            // log.debug("hibernate initialising Transformer: " +
            // leaf.getTransformer());
            for (Values value : leaf.getValueMap().values()) {
                Hibernate.initialize(value);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.