Package eu.planets_project.pp.plato.model.values

Examples of eu.planets_project.pp.plato.model.values.BooleanValue


   
    /**
     *
     */
    public BooleanValue createValue() {
        BooleanValue bv = new BooleanValue();
        bv.setScale(this);
        return bv;
    }
View Full Code Here


    private Value preservedValues(HashMap<String, String> sampleMetadata,
            HashMap<String, String> resultMetadata, Scale scale) {
        int numMissing = 0;
        int numChanged = 0;
        BooleanValue v = (BooleanValue)scale.createValue();
        StringBuilder comment = new StringBuilder();
        for (String key : sampleMetadata.keySet()) {
            String sampleValue = sampleMetadata.get(key);
            String resultValue = resultMetadata.get(key);
            if (resultValue == null) {
                numMissing ++;
                comment.append(" - " + key + "\n");
            } else if (!resultValue.equals(sampleValue)) {
                numChanged++;
                comment.append(" ~ " + key + ": sample="+sampleValue+", result="+resultValue+"\n");
            }
        }
        if ((numChanged ==  0)&&(numMissing == 0)) {
            v.bool(true);
            v.setComment("result contains complete metadata of sample");
        } else {
            v.bool(false);
            comment.insert(0, "following differences found: (- .. missing, ~ .. altered):\n");
            v.setComment(comment.toString());
        }
        return v;
    }
View Full Code Here

        return v;
    }

   
    private Value identicalValues(String v1, String v2, Scale s) {
        BooleanValue bv = (BooleanValue) s.createValue();
        String s1 = (v1 == null || "".equals(v1))? "UNDEFINED" : v1;
        String s2 = (v2 == null || "".equals(v2))? "UNDEFINED" : v2;
       
        if (!"UNDEFINED".equals(s1) && ! "UNDEFINED".equals(s2)) {
            // both values are defined:
            if (s1.equals(s2)) {
                bv.bool(true);
                bv.setComment("Both have value " + s1);
            } else {
                bv.bool(false);
                bv.setComment("Reference value: " + s1 + "\nActual value: " + s2);
            }
        } else if (s1.equals(s2)) {
            // both are undefined :
            bv.setComment("Both values are UNDEFINED");
            //bv.setValue("");
        } else {
            // one value is undefined:
            bv.setComment("Reference value: " + s1 + "\nActual value: " + s2);
        }
        return bv;
    }
View Full Code Here

TOP

Related Classes of eu.planets_project.pp.plato.model.values.BooleanValue

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.