Package eu.scape_project.planning.model

Examples of eu.scape_project.planning.model.Values


     * @param record
     *            index of the record for which values shall be removed
     */
    public void removeValues(List<Alternative> list, int record) {
        for (Alternative a : list) {
            Values v = getValues(a.getName());
            // maybe this alternative has no values at all - e.g. because it was
            // just created
            if ((v != null) // there is a Values object
                && (v.getList().size() > record) // there can be a value for
                                                 // this sample record
                && (v.getList().get(record) != null)) { // there is a value
                log.debug("removing values:: " + getName() + " ," + record + ", " + a.getName());
                v.getList().remove(record);
            }
        }
    }
View Full Code Here


            return;
        for (Alternative a : list) {
            // for every Alternative we get the container of the values of each
            // sample object
            // from the map
            Values v = valueMap.get(a.getName());

            // If it doesnt exist, we create it and link it in the map
            if (v == null) {
                v = new Values();
                valueMap.put(a.getName(), v);
                // it the valueMap has just been created and the leaf is single,
                // we need to add one value.
                if (isSingle()) {
                    v.add(scale.createValue());
                }
            }

            // 20090217, hotfix CB: if a Leaf is set to SINGLE *after*
            // initValues has been called,
            // the Value object at position 0 of the ValueS object might not be
            // properly initialised.
            // Check and initialise if needed:
            if (isSingle()) {
                if (v.size() == 0) {
                    log.warn("adding value to a SINGLE LEAF WITH A VALUES OBJECT WITHOUT A PROPER VALUE:" + getName());
                    v.getList().add(scale.createValue());
                } else {
                    if (v.getValue(0) == null) {
                        log.warn("adding value to a SINGLE LEAF WITH A VALUES OBJECT WITHOUT A PROPER VALUE:"
                            + getName());
                        v.setValue(0, scale.createValue());
                    }
                }
            }
            // end hotfix 20090217

            // So we can be sure now that we have a value container and
            // that it is linked and that for Action criteria, i.e. single
            // values, we have the one value.
            // For Object criteria we have to be sure that the number of values
            // corresponds to the number of sample objects, so we fill the list
            // up
            if (!isSingle()) {
                // this is to add MISSING values for records.
                // it doesnt make a difference for this condition
                // whether we just created a new valuemap or are
                // refilling an existing one

                // Note that the index here starts at the size of the values
                // array
                // and runs to the total number of records.
                // so if we have enough - nothing happens; if some are missing,
                // they are
                // added at the end
                for (int i = v.size(); i < records; i++) {
                    v.add(scale.createValue());
                }
            }
        }
        if (addLinkage) {
            initScaleValueLinkage(list, records);
View Full Code Here

     * @param records
     *            denotes the number of records for the iteration
     */
    public void initScaleValueLinkage(List<Alternative> list, int records) {
        for (Alternative a : list) {
            Values v = valueMap.get(a.getName());
            if (v == null) {
                throw new IllegalStateException("initScaleLinkage called,"
                    + " but the valueMap is still empty - that's a bug." + " Leaf:" + getName());
            }
            if (isSingle()) {
                v.getValue(0).setScale(scale);
            } else {
                for (int i = 0; i < records; i++) {
                    v.getValue(i).setScale(scale);
                }
            }
        }
    }
View Full Code Here

    @Override
    public boolean isCompletelyEvaluated(List<Alternative> alternatives, List<ValidationError> errors) {
        boolean validates = true;
        log.debug("checking complete evaluation for leaf " + getName());
        for (Alternative a : alternatives) {
            Values values = valueMap.get(a.getName());
            log.debug("checking values for " + a.getName());
            if (this.isSingle()) {
                if (values.size() < 1) {
                    log.warn("Not Enough Value Objects in Values");
                    validates = false;
                } else {
                    if (!scale.isEvaluated(values.getValue(0))) {
                        validates = false;
                    }
                }
            } else {
                int i = 0;
                for (Value value : values.getList()) {
                    log.debug("checking value for " + (i));
                    if (!scale.isEvaluated(value)) {
                        validates = false;
                        break;
                    }
View Full Code Here

            if (!alternatives.contains(altName)) {
                log.warn("removing Values for " + altName + " at leaf " + getName());
                namesToRemove.add(altName);
                number++;
            } else {
                Values v = valueMap.get(altName);
                int removed = v.removeLooseValues(isSingle() ? 1 : records);
                log.warn("removed " + removed + " Value objects " + "for " + altName + " at leaf " + getName());
                number += removed;
            }
        }
        for (String s : namesToRemove) {
View Full Code Here

            }
            numMeasuresNeededTotal += numMeasuresNeeded;

            for (Iterator<String> alts = consideredAltNames.iterator(); alts.hasNext();) {
                String alt = alts.next();
                Values values = l.getValues(alt);
                if (values != null) {
                    for (Iterator<Value> valueiter = values.getList().iterator(); valueiter.hasNext();) {
                        Value value = valueiter.next();
                        if ((value != null) && (value.getScale() != null) && value.isEvaluated()) {
                            numEvaluated++;
                        }
                    }
View Full Code Here

TOP

Related Classes of eu.scape_project.planning.model.Values

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.