Package eu.scape_project.planning.model.values

Examples of eu.scape_project.planning.model.values.BooleanValue


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


                for (String measureUri : measureUris) {
                    if (MeasureConstants.RETAIN_ORIGINAL_FILENAME.equals(measureUri)) {
                        // for all wrapped minimee migrators the output filename
                        // can be determined by -o <filename> or something
                        // similar
                        Value v = new BooleanValue();
                        v.setComment("obtained from PCDL descriptor");
                        v.parse("Yes");
                        results.put(measureUri, v);
                    }

                    String extractionPath = extractionPaths.get(measureUri);
                    if (extractionPath != null) {
                        Value v = new XmlExtractor().extractValue(doc, new OrdinalScale(), extractionPath, null);
                        if (v != null) {
                            v.setComment("obtained from PCDL descriptor");
                            results.put(measureUri, v);
                        } else {
                            // No: only successfully evaluated values are
                            // returned
                            // v = leaf.getScale().createValue();
View Full Code Here

                            int resultWidth = Integer.parseInt(extractor.extractText(fitsDocResult,
                                "//fits:imageWidth/text()"));

                            double sampleRatio = ((double) sampleWidth) / sampleHeight;
                            double resultRatio = ((double) resultWidth) / resultHeight;
                            v = new BooleanValue();
                            ((BooleanValue) v).bool(0 == Double.compare(sampleRatio, resultRatio));
                            v.setComment(String.format("Reference value: %s\nActual value: %s",
                                formatter.formatFloat(sampleRatio), formatter.formatFloat(resultRatio)));
                        } catch (NumberFormatException e) {
                            // not all values are available - aspectRatio cannot
                            // be calculated
                            v = new BooleanValue();
                            v.setComment("Image width and/or height are not available - aspectRatio cannot be calculated");
                        }
                        // } else if
                        // ((OBJECT_COMPRESSION_SCHEME_RETAINED).equals(measureUri))
                        // {
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.scape_project.planning.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.