Package eu.scape_project.planning.model.transform

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


                    }
                }
                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

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

            }

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

        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

Related Classes of eu.scape_project.planning.model.transform.OrdinalTransformer

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.