Examples of OrdinalTransformer


Examples of eu.planets_project.pp.plato.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));
                    }
                }
            }
        }
    }   
View Full Code Here

Examples of eu.planets_project.pp.plato.model.transform.OrdinalTransformer

                    "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.planets_project.pp.plato.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.planets_project.pp.plato.model.transform.OrdinalTransformer

            log.debug(l.getName()+": "+l.getScale().getDisplayName());
            for (String s: l.getValueMap().keySet()) {
                log.debug("   value entry for "+s);
            }
            if (l.getTransformer() instanceof OrdinalTransformer) {
                OrdinalTransformer t =(OrdinalTransformer) l.getTransformer();
                for (String s: t.getMapping().keySet()) {
                    log.debug("   transformer entry for "+s);
                }
            }

        }
View Full Code Here

Examples of eu.planets_project.pp.plato.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

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

        double outputLowerBound = 10;

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

            for (TargetValueObject tv : otMapping.values()) {
                if (tv.getValue() < outputLowerBound) {
                    outputLowerBound = tv.getValue();
                }
View Full Code Here

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

        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 alternativeValue : alternativeValues) {
                TargetValue targetValue;

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

                    if (alternativeValue instanceof IOrdinalValue) {
                        try {
                            targetValue = ordTrans.transform((IOrdinalValue) alternativeValue);
                        } catch (NullPointerException e) {
                            log.warn("Measurement of leaf doesn't match with OrdinalTransformer! Ignoring it!");
                            log.warn("MeasuredValue-id: " + alternativeValue.getId() + "; Transformer-id: "
                                + ordTrans.getId());
                            // FIXME: this is a workaround for a strange bug
                            // described in changeset 4342
                            skipAlternativeBecauseOfErrors = true;
                            continue;
                        }
View Full Code Here

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

            for (Value alternativeValue : alternativeValues) {
                TargetValue targetValue;

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

                    if (alternativeValue instanceof IOrdinalValue) {
                        try {
                            targetValue = ordTrans.transform((IOrdinalValue) alternativeValue);
                        } catch (NullPointerException e) {
                            log.warn("Measurement of leaf doesn't match with OrdinalTransformer! Ignoring it!");
                            log.warn("MeasuredValue-id: " + alternativeValue.getId() + "; Transformer-id: "
                                + ordTrans.getId());
                            // FIXME: this is a workaround for a strange bug
                            // described in changeset 4342
                            skipAlternativeBecauseOfErrors = true;
                            continue;
                        }
View Full Code Here

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

     * @return true if the leaf has KO potential, otherwise false.
     */
    public Boolean hasKOPotential() {
        // check OrdinalTransformer KnockOut potential
        if (transformer instanceof OrdinalTransformer) {
            OrdinalTransformer ot = (OrdinalTransformer) transformer;
            Map<String, TargetValueObject> otMapping = ot.getMapping();

            // if any string maps to value 0 -> KnockOut potential
            for (TargetValueObject tv : otMapping.values()) {
                if (tv.getValue() == 0) {
                    return true;
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.