Package eu.scape_project.planning.model.scales

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


                // add names of tools as comment
                value.setComment(toCommaSeparated(resultSet.getColResults("swname"))
                    + "; - according to miniREEF/P2 knowledge base");
                listener.updateStatus("MiniREEF evaluated " + measureId);
            } else if (MeasureConstants.FORMAT_IPR_PROTECTION.equals(measureId)) {
                scale = new OrdinalScale();

                if (resultSet.size() > 0) {
                    // e.g. open = false, comment: "Format is encumbered by IPR"
                    String comment = "";
                    String valueStr = "";
                    for (int i = 0; i < resultSet.size(); i++) {
                        List<String> vals = resultSet.getRow(i);
                        comment = comment + vals.get(0) + "\n";
                        String type = vals.get(1);
                        if (P2_RESOURCE_FORMAT_LICENSE_RIGHTS_IPR_PROTECTED.equals(type)) {
                            valueStr = "ipr_protected";
                            comment = comment + valueStr;
                        } else if (P2_RESOURCE_FORMAT_LICENSE_RIGHTS_PROPRIETARY.equals(type)) {
                            valueStr = "proprietary";
                            comment = comment + valueStr;
                        } else if (P2_RESOURCE_FORMAT_LICENSE_RIGHTS_OPEN.equals(type)) {
                            valueStr = "open";
                            comment = comment + valueStr;
                        }
                    }
                    if (resultSet.size() > 1) {
                        comment = comment
                            + ": more than one right category applies to this format, check for reason of this conflict.\n";
                    }
                    value = scale.createValue();
                    value.parse(valueStr);
                    value.setComment(comment + ": according to MiniREEF/P2 knowledge base");
                    listener.updateStatus("MiniREEF evaluated " + measureId);
                }
                listener.updateStatus("P2 does not contain enough information to evaluate " + measureId
                    + " for this format.");
            } else if ((MeasureConstants.FORMAT_COMPLEXITY.equals(measureId))) {
                // || (MeasureConstants.FORMAT_DISCLOSURE.equals(measureId))
                // FIXME: the results from p2 have to be matched to the defined
                // measures
                // || (MeasureConstants.FORMAT_UBIQUITY.equals(measureId))
                // ||
                // (MeasureConstants.FORMAT_DOCUMENTATION_QUALITY.equals(measureId))
                // || (MeasureConstants.FORMAT_STABILITY.equals(measureId))
                // || (MeasureConstants.FORMAT_LICENSE.equals(measureId))) {

                scale = new OrdinalScale();

                if (resultSet.size() > 0) {
                    String text = resultSet.getRow(0).get(0);
                    if (text.trim().length() > 0) {
                        value = scale.createValue();
View Full Code Here


        mapping.put("N", tv1);
        ordinalTrans.setMapping(mapping);
        leaf.setTransformer(ordinalTrans);

        // set scale
        OrdinalScale ordinalScale = new OrdinalScale();
        ordinalScale.setRestriction("Yes/No");
        leaf.setScale(ordinalScale);

        // valueMap
        OrdinalValue yes = new OrdinalValue();
        yes.setValue("Y");
View Full Code Here

        }

        List<Scale> scales = new ArrayList<Scale>();
        scales.add(new BooleanScale());
        scales.add(new YanScale());
        scales.add(new OrdinalScale());
        scales.add(new IntegerScale());
        scales.add(new IntRangeScale());
        scales.add(new FloatScale());
        scales.add(new FloatRangeScale());
        scales.add(new PositiveFloatScale());
View Full Code Here

        Assert.assertTrue(l.getTransformer() == null);
    }

    @Test
    public void testSetDefaultTransformer_Scale_Equals_Ordinal() {
        OrdinalScale o = new OrdinalScale();
        o.setRestriction("GOD/BAD/HORRIBLE");
        Leaf l = new Leaf();
        l.setScale(o);
        l.setDefaultTransformer();
        Assert.assertTrue(l.getTransformer() instanceof OrdinalTransformer);
        OrdinalTransformer ord = (OrdinalTransformer) l.getTransformer();
View Full Code Here

    }

    @Test
    public void testChangeScale_Scale_Not_Null() {
        OrdinalScale ord = new OrdinalScale();
        Leaf l = new Leaf();
        l.changeScale(ord);
        Assert.assertFalse(l.getScale() == ord); // it is a clone
        Assert.assertTrue(l.getAggregationMode().equals(SampleAggregationMode.WORST));
    }
View Full Code Here

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

        } else if ("PositiveNumber".equalsIgnoreCase(scaleName)) {
            return new PositiveFloatScale();
        } else if ("PositiveInteger".equalsIgnoreCase(scaleName)) {
            return new PositiveIntegerScale();
        } else if ("Ordinal".equalsIgnoreCase(scaleName)) {
            return new OrdinalScale();
        }

        return null;
    }
View Full Code Here

//              v = new OrdinalScale();
//              v.setRestriction(TEXT);
//              }
                v = new IntRangeScale();
                if (! ((IntRangeScale)v).validateAndSetRestriction(TEXT)) {
                    v= new OrdinalScale();
                    v.setRestriction(TEXT);
                }
                return v;
            }
        } catch (Exception e) {
View Full Code Here

            if (getTEXT().indexOf(Scale.SEPARATOR) != -1 ) {
                RestrictedScale v = null;
                v = new IntRangeScale();
                if (! ((IntRangeScale)v).validateAndSetRestriction(getTEXT())) {
                    v= new OrdinalScale();
                    v.setRestriction(getTEXT());
                }
                return v;
            }
        } catch (Exception e) {
View Full Code Here

                        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
View Full Code Here

TOP

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

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.