Package eu.scape_project.planning.model.scales

Examples of eu.scape_project.planning.model.scales.FreeStringScale


        scales.add(new IntRangeScale());
        scales.add(new FloatScale());
        scales.add(new FloatRangeScale());
        scales.add(new PositiveFloatScale());
        scales.add(new PositiveIntegerScale());
        scales.add(new FreeStringScale());

        for (Scale scale : scales) {
            scaleList.add(new SelectItem(scale.getClass().getCanonicalName(), scale.getDisplayName()));
        }
    }
View Full Code Here


     *            as provided.
     */
    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;
                    if (!text.toString().equals("")) {
                        for (String s : map.keySet()) {
                            // if the value is NOT the same, but IS the same
                            // with other case,
                            // we replace the value with the cases predefined by
                            // the mapping
                            if (text.getValue().equalsIgnoreCase(s) && !text.getValue().equals(s)) {
                                text.setValue(s);
                            }
                        }
                        allValues.add(text.getValue());
                    }
                }
            }

            // We remove all values from the transformer that do not actually
            // occur (anymore)
            // I am disabling this for now - why would we want to remove known
            // mappings?
            // They don't do harm because for the lookup, we use the actually
            // encountered values
            // (see below)
            // HashSet<String> keysToRemove = new HashSet<String>();
            // for (String s: map.keySet()) {
            // if (!allValues.contains(s)) {
            // keysToRemove.add(s);
            // }
            // }
            // for (String s: keysToRemove) {
            // map.remove(s);
            // }

            // We add all values that occur, but 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
            // to the SCALE because it provides the reference lookup
            // for iterating and defining the transformation
            freeScale.setPossibleValues(allValues);
        }
    }
View Full Code Here

    private Scale createScale(String scaleName) {

        if ("Boolean".equalsIgnoreCase(scaleName)) {
            return new BooleanScale();
        } else if ("FreeText".equalsIgnoreCase(scaleName)) {
            return new FreeStringScale();
        } else if ("Number".equalsIgnoreCase(scaleName)) {
            return new FloatScale();
        } else if ("PositiveNumber".equalsIgnoreCase(scaleName)) {
            return new PositiveFloatScale();
        } else if ("PositiveInteger".equalsIgnoreCase(scaleName)) {
View Full Code Here

            if ("?".equals(TEXT)) {
                return null;
            }
           
            if ("FREE TEXT".equals(TEXT.toUpperCase())) {
                return new FreeStringScale();
            }

            if (TEXT.indexOf(Scale.SEPARATOR) != -1 ) {
                RestrictedScale v = null;
//              try {
View Full Code Here

                        v = extractor.extractValue(fitsDocResult, new BooleanScale(),
                            "//fits:filestatus/fits:valid[@status='SINGLE_RESULT']/text()",
                            "//fits:filestatus/fits:message/text()");
                    }
                    if (MeasureConstants.COMPRESSION_ALGORITHM.equals(measureUri)) {
                        v = extractor.extractValue(fitsDocResult, new FreeStringScale(),
                            "//fits:compressionScheme/text()", null);
                    }

                    if ((v != null) && (v.getComment() == null || "".equals(v.getComment()))) {
                        v.setComment(SOURCE);
View Full Code Here

TOP

Related Classes of eu.scape_project.planning.model.scales.FreeStringScale

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.