Package eu.planets_project.pp.plato.model

Examples of eu.planets_project.pp.plato.model.TargetValueObject


     * @param v the ordinal value to be transformed
     * @return {@link TargetValue} transformed value.
     */
    public TargetValue transform(IOrdinalValue v) {
        TargetValue t = new TargetValue();
        TargetValueObject o = mapping.get(v.getValue());
        t.setValue(o.getValue());
        return t;
    }
View Full Code Here


     * We still leave the checks in because it can't hurt.
     */
    public boolean isTransformable(List<String> errorMessages) {
        boolean result = true;
        for (String key: mapping.keySet()) {
            TargetValueObject value = mapping.get(key);
            //  Target values are initialised and set to 0.0, so we can assume it is not null:
            if ((value.getValue() < 0.0) ||
                (value.getValue() > 5.0)) {
                result = false;
                errorMessages.add("Transformation of '" + key + "' to " + value.getValue() +
                        ": For ordinal values only target values between 0.0 and 5.0 are allowed.");
            }
        }
        return result;
    }
View Full Code Here

    @Override
    public Transformer clone() {
        OrdinalTransformer t = new OrdinalTransformer();
        t.setId(0);
        for (String s : mapping.keySet()) {
            TargetValueObject tvo = mapping.get(s);
            t.getMapping().put(s, tvo.clone());
        }
        return t;
    }
View Full Code Here

            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());
                }
            }
        } else {
            NumericTransformer t = new NumericTransformer();
            this.setTransformer(t);
View Full Code Here

          
            // We add all values that occur, but dont are not in the map yet:
            for (String s: allValues) {
                if (!map.containsKey(s)) {
                    if (defaultTarget == null) {
                        map.put(s, new TargetValueObject());
                    } else {
                        map.put(s, new TargetValueObject(defaultTarget.doubleValue()));
                    }
                }
            }     
           
            // We also have to publish the known values
View Full Code Here

public class OrdinalTransformerMappingFactory extends AbstractObjectCreationFactory {

    @Override
    public Object createObject(Attributes arg0) throws Exception {
        TargetValueObject o = new TargetValueObject();
        o.setValue(Double.parseDouble(arg0.getValue("target")));
        return  o;
    }
View Full Code Here

TOP

Related Classes of eu.planets_project.pp.plato.model.TargetValueObject

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.