Example usage for java.lang Float compare

List of usage examples for java.lang Float compare

Introduction

In this page you can find the example usage for java.lang Float compare.

Prototype

public static int compare(float f1, float f2) 

Source Link

Document

Compares the two specified float values.

Usage

From source file:com.android.launcher2.PagedView.java

protected int getChildOffset(int index) {
    int[] childOffsets = Float.compare(mLayoutScale, 1f) == 0 ? mChildOffsets : mChildOffsetsWithLayoutScale;

    if (childOffsets != null && childOffsets[index] != -1) {
        return childOffsets[index];
    } else {/*w w w .  ja v a2  s . com*/
        if (getChildCount() == 0)
            return 0;

        int offset = getRelativeChildOffset(0);
        for (int i = 0; i < index; ++i) {
            offset += getScaledMeasuredWidth(getPageAt(i)) + mPageSpacing;
        }
        if (childOffsets != null) {
            childOffsets[index] = offset;
        }
        return offset;
    }
}

From source file:nl.uva.illc.dataselection.InvitationModel.java

@Override
public int compareTo(Result result) {
    int cmp = Float.compare(result.score, this.score);
    if (cmp == 0) {
        cmp = Float.compare(result.lm_score, this.lm_score);
    }//ww  w.  ja va  2 s. c  o m
    return cmp;
}

From source file:us.parr.animl.data.DataTable.java

public int compare(int rowi, int rowj, int colIndex) {
    VariableType colType = colTypes[colIndex];
    switch (colType) {
    case CATEGORICAL_INT:
    case NUMERICAL_INT:
    case CATEGORICAL_STRING: // strings are encoded as ints
    case TARGET_CATEGORICAL_STRING:
    case TARGET_CATEGORICAL_INT:
    case UNUSED_INT:
    case UNUSED_STRING:
        return Integer.compare(getAsInt(rowi, colIndex), getAsInt(rowj, colIndex));
    case NUMERICAL_FLOAT:
    case UNUSED_FLOAT:
        float a = getAsFloat(rowi, colIndex);
        float b = getAsFloat(rowj, colIndex);
        return Float.compare(a, b);
    default:/*  ww w  .  ja  v  a 2  s.c o m*/
        throw new IllegalArgumentException(colNames[colIndex] + " has invalid type: " + colType);
    }
}

From source file:org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils.java

/**
 * Compare two objects with their respective ObjectInspectors.
 *///from   w w w . j  a va  2 s . c o m
public static int compare(Object o1, ObjectInspector oi1, Object o2, ObjectInspector oi2,
        MapEqualComparer mapEqualComparer) {
    if (oi1.getCategory() != oi2.getCategory()) {
        return oi1.getCategory().compareTo(oi2.getCategory());
    }

    if (o1 == null) {
        return o2 == null ? 0 : -1;
    } else if (o2 == null) {
        return 1;
    }

    switch (oi1.getCategory()) {
    case PRIMITIVE: {
        PrimitiveObjectInspector poi1 = ((PrimitiveObjectInspector) oi1);
        PrimitiveObjectInspector poi2 = ((PrimitiveObjectInspector) oi2);
        if (poi1.getPrimitiveCategory() != poi2.getPrimitiveCategory()) {
            return poi1.getPrimitiveCategory().compareTo(poi2.getPrimitiveCategory());
        }
        switch (poi1.getPrimitiveCategory()) {
        case VOID:
            return 0;
        case BOOLEAN: {
            int v1 = ((BooleanObjectInspector) poi1).get(o1) ? 1 : 0;
            int v2 = ((BooleanObjectInspector) poi2).get(o2) ? 1 : 0;
            return v1 - v2;
        }
        case BYTE: {
            int v1 = ((ByteObjectInspector) poi1).get(o1);
            int v2 = ((ByteObjectInspector) poi2).get(o2);
            return v1 - v2;
        }
        case SHORT: {
            int v1 = ((ShortObjectInspector) poi1).get(o1);
            int v2 = ((ShortObjectInspector) poi2).get(o2);
            return v1 - v2;
        }
        case INT: {
            int v1 = ((IntObjectInspector) poi1).get(o1);
            int v2 = ((IntObjectInspector) poi2).get(o2);
            return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);
        }
        case LONG: {
            long v1 = ((LongObjectInspector) poi1).get(o1);
            long v2 = ((LongObjectInspector) poi2).get(o2);
            return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);
        }
        case FLOAT: {
            float v1 = ((FloatObjectInspector) poi1).get(o1);
            float v2 = ((FloatObjectInspector) poi2).get(o2);

            // The IEEE 754 floating point spec specifies that signed -0.0 and 0.0 should be treated as equal.
            if (v1 == 0.0f && v2 == 0.0f) {
                return 0;
            } else {
                // Float.compare() treats -0.0 and 0.0 as different
                return Float.compare(v1, v2);
            }
        }
        case DOUBLE: {
            double v1 = ((DoubleObjectInspector) poi1).get(o1);
            double v2 = ((DoubleObjectInspector) poi2).get(o2);

            // The IEEE 754 floating point spec specifies that signed -0.0 and 0.0 should be treated as equal.
            if (v1 == 0.0d && v2 == 0.0d) {
                return 0;
            } else {
                // Double.compare() treats -0.0 and 0.0 as different
                return Double.compare(v1, v2);
            }
        }
        case STRING: {
            if (poi1.preferWritable() || poi2.preferWritable()) {
                Text t1 = (Text) poi1.getPrimitiveWritableObject(o1);
                Text t2 = (Text) poi2.getPrimitiveWritableObject(o2);
                return t1 == null ? (t2 == null ? 0 : -1) : (t2 == null ? 1 : t1.compareTo(t2));
            } else {
                String s1 = (String) poi1.getPrimitiveJavaObject(o1);
                String s2 = (String) poi2.getPrimitiveJavaObject(o2);
                return s1 == null ? (s2 == null ? 0 : -1) : (s2 == null ? 1 : s1.compareTo(s2));
            }
        }
        case CHAR: {
            HiveCharWritable t1 = ((HiveCharObjectInspector) poi1).getPrimitiveWritableObject(o1);
            HiveCharWritable t2 = ((HiveCharObjectInspector) poi2).getPrimitiveWritableObject(o2);
            return t1.compareTo(t2);
        }
        case VARCHAR: {
            HiveVarcharWritable t1 = ((HiveVarcharObjectInspector) poi1).getPrimitiveWritableObject(o1);
            HiveVarcharWritable t2 = ((HiveVarcharObjectInspector) poi2).getPrimitiveWritableObject(o2);
            return t1.compareTo(t2);
        }
        case BINARY: {
            BytesWritable bw1 = ((BinaryObjectInspector) poi1).getPrimitiveWritableObject(o1);
            BytesWritable bw2 = ((BinaryObjectInspector) poi2).getPrimitiveWritableObject(o2);
            return bw1.compareTo(bw2);
        }

        case DATE: {
            DateWritable d1 = ((DateObjectInspector) poi1).getPrimitiveWritableObject(o1);
            DateWritable d2 = ((DateObjectInspector) poi2).getPrimitiveWritableObject(o2);
            return d1.compareTo(d2);
        }
        case TIMESTAMP: {
            TimestampWritable t1 = ((TimestampObjectInspector) poi1).getPrimitiveWritableObject(o1);
            TimestampWritable t2 = ((TimestampObjectInspector) poi2).getPrimitiveWritableObject(o2);
            return t1.compareTo(t2);
        }
        case INTERVAL_YEAR_MONTH: {
            HiveIntervalYearMonthWritable i1 = ((HiveIntervalYearMonthObjectInspector) poi1)
                    .getPrimitiveWritableObject(o1);
            HiveIntervalYearMonthWritable i2 = ((HiveIntervalYearMonthObjectInspector) poi2)
                    .getPrimitiveWritableObject(o2);
            return i1.compareTo(i2);
        }
        case INTERVAL_DAY_TIME: {
            HiveIntervalDayTimeWritable i1 = ((HiveIntervalDayTimeObjectInspector) poi1)
                    .getPrimitiveWritableObject(o1);
            HiveIntervalDayTimeWritable i2 = ((HiveIntervalDayTimeObjectInspector) poi2)
                    .getPrimitiveWritableObject(o2);
            return i1.compareTo(i2);
        }
        case DECIMAL: {
            HiveDecimalWritable t1 = ((HiveDecimalObjectInspector) poi1).getPrimitiveWritableObject(o1);
            HiveDecimalWritable t2 = ((HiveDecimalObjectInspector) poi2).getPrimitiveWritableObject(o2);
            return t1.compareTo(t2);
        }
        default: {
            throw new RuntimeException("Unknown type: " + poi1.getPrimitiveCategory());
        }
        }
    }
    case STRUCT: {
        StructObjectInspector soi1 = (StructObjectInspector) oi1;
        StructObjectInspector soi2 = (StructObjectInspector) oi2;
        List<? extends StructField> fields1 = soi1.getAllStructFieldRefs();
        List<? extends StructField> fields2 = soi2.getAllStructFieldRefs();
        int minimum = Math.min(fields1.size(), fields2.size());
        for (int i = 0; i < minimum; i++) {
            int r = compare(soi1.getStructFieldData(o1, fields1.get(i)),
                    fields1.get(i).getFieldObjectInspector(), soi2.getStructFieldData(o2, fields2.get(i)),
                    fields2.get(i).getFieldObjectInspector(), mapEqualComparer);
            if (r != 0) {
                return r;
            }
        }
        return fields1.size() - fields2.size();
    }
    case LIST: {
        ListObjectInspector loi1 = (ListObjectInspector) oi1;
        ListObjectInspector loi2 = (ListObjectInspector) oi2;
        int minimum = Math.min(loi1.getListLength(o1), loi2.getListLength(o2));
        for (int i = 0; i < minimum; i++) {
            int r = compare(loi1.getListElement(o1, i), loi1.getListElementObjectInspector(),
                    loi2.getListElement(o2, i), loi2.getListElementObjectInspector(), mapEqualComparer);
            if (r != 0) {
                return r;
            }
        }
        return loi1.getListLength(o1) - loi2.getListLength(o2);
    }
    case MAP: {
        if (mapEqualComparer == null) {
            throw new RuntimeException("Compare on map type not supported!");
        } else {
            return mapEqualComparer.compare(o1, (MapObjectInspector) oi1, o2, (MapObjectInspector) oi2);
        }
    }
    case UNION: {
        UnionObjectInspector uoi1 = (UnionObjectInspector) oi1;
        UnionObjectInspector uoi2 = (UnionObjectInspector) oi2;
        byte tag1 = uoi1.getTag(o1);
        byte tag2 = uoi2.getTag(o2);
        if (tag1 != tag2) {
            return tag1 - tag2;
        }
        return compare(uoi1.getField(o1), uoi1.getObjectInspectors().get(tag1), uoi2.getField(o2),
                uoi2.getObjectInspectors().get(tag2), mapEqualComparer);
    }
    default:
        throw new RuntimeException("Compare on unknown type: " + oi1.getCategory());
    }
}

From source file:org.ejbca.config.CmpConfiguration.java

/** Implemtation of UpgradableDataHashMap function upgrade. */

public void upgrade() {
    if (Float.compare(LATEST_VERSION, getVersion()) != 0) {
        data.put(VERSION, Float.valueOf(LATEST_VERSION));
    }/*from  w  w w  . j a  v a  2  s . c  o m*/
}

From source file:ml.shifu.shifu.core.dtrain.nn.AbstractNNWorker.java

protected boolean isPositive(float value) {
    return Float.compare(1f, value) == 0;
}

From source file:com.android.launcher2.Workspace.java

@Override
protected void determineScrollingStart(MotionEvent ev) {
    if (isSmall())
        return;/*from w w  w .  j a va  2s. c  om*/
    if (!isFinishedSwitchingState())
        return;

    float deltaX = Math.abs(ev.getX() - mXDown);
    float deltaY = Math.abs(ev.getY() - mYDown);

    if (Float.compare(deltaX, 0f) == 0)
        return;

    float slope = deltaY / deltaX;
    float theta = (float) Math.atan(slope);

    if (deltaX > mTouchSlop || deltaY > mTouchSlop) {
        cancelCurrentPageLongPress();
    }

    if (theta > MAX_SWIPE_ANGLE) {
        // Above MAX_SWIPE_ANGLE, we don't want to ever start scrolling the workspace
        return;
    } else if (theta > START_DAMPING_TOUCH_SLOP_ANGLE) {
        // Above START_DAMPING_TOUCH_SLOP_ANGLE and below MAX_SWIPE_ANGLE, we want to
        // increase the touch slop to make it harder to begin scrolling the workspace. This
        // results in vertically scrolling widgets to more easily. The higher the angle, the
        // more we increase touch slop.
        theta -= START_DAMPING_TOUCH_SLOP_ANGLE;
        float extraRatio = (float) Math.sqrt((theta / (MAX_SWIPE_ANGLE - START_DAMPING_TOUCH_SLOP_ANGLE)));
        super.determineScrollingStart(ev, 1 + TOUCH_SLOP_DAMPING_FACTOR * extraRatio);
    } else {
        // Below START_DAMPING_TOUCH_SLOP_ANGLE, we don't do anything special
        super.determineScrollingStart(ev);
    }
}

From source file:us.parr.animl.data.DataTable.java

public int compare(int a, int b, VariableType colType) {
    switch (colType) {
    case CATEGORICAL_INT:
    case NUMERICAL_INT:
    case CATEGORICAL_STRING: // strings are encoded as ints
    case TARGET_CATEGORICAL_STRING:
    case TARGET_CATEGORICAL_INT:
    case UNUSED_INT:
    case UNUSED_STRING:
        return Integer.compare(a, b);
    case NUMERICAL_FLOAT:
    case UNUSED_FLOAT:
        float af = getAsFloat(a);
        float bf = getAsFloat(b);
        return Float.compare(af, bf);
    default:/*w ww.j a v a 2  s .  com*/
        throw new IllegalArgumentException("invalid type: " + colType);
    }
}

From source file:ml.shifu.shifu.core.dtrain.lr.LogisticRegressionWorker.java

protected boolean isPositive(float value) {
    return Float.compare(1f, value) == 0 ? true : false;
}

From source file:org.kuali.student.r2.lum.course.service.assembler.CourseAssembler.java

private List<BaseDTOAssemblyNode<?, ?>> disassembleCreditOutcomes(CourseInfo course, CluInfo clu,
        List<CluResultInfo> currentCluResults, NodeOperation operation, ContextInfo contextInfo)
        throws AssemblyException, NumberFormatException {

    List<BaseDTOAssemblyNode<?, ?>> results = new ArrayList<BaseDTOAssemblyNode<?, ?>>();

    String courseResultType = CourseAssemblerConstants.COURSE_RESULT_TYPE_CREDITS;

    //See if we need to create any new lrcs
    if (NodeOperation.DELETE != operation) {
        //Find all the existing LRCs for the following three types
        Set<String> resultValueGroupIds = new HashSet<String>();

        try {//from   w  ww .ja va2s.  c  om
            try {
                resultValueGroupIds.addAll(lrcService.getResultValuesGroupKeysByType(
                        LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_FIXED, contextInfo));
            } catch (DoesNotExistException e) {
            }
            try {
                resultValueGroupIds.addAll(lrcService.getResultValuesGroupKeysByType(
                        LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_MULTIPLE, contextInfo));
            } catch (DoesNotExistException e) {
            }
            try {
                resultValueGroupIds.addAll(lrcService.getResultValuesGroupKeysByType(
                        LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_RANGE, contextInfo));
            } catch (DoesNotExistException e) {
            }

            //Create any LRCs that do not yet exist
            for (ResultValuesGroupInfo creditOption : course.getCreditOptions()) {

                String id = null;
                String type = null;
                List<String> resultValues = null;
                ResultValueRangeInfo resultValueRange = null;
                //Depending on the type, set the id, type and result values differently
                if (LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_FIXED.equals(creditOption.getTypeKey())) {
                    float fixedCreditValue = Float.parseFloat(creditOption.getResultValueRange().getMinValue());
                    id = CourseAssemblerConstants.COURSE_RESULT_COMP_CREDIT_PREFIX + fixedCreditValue;
                    type = LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_FIXED;
                    resultValues = new ArrayList<String>();
                    resultValues.add(String.valueOf(fixedCreditValue));
                    resultValueRange = new ResultValueRangeInfo();
                    resultValueRange.setMinValue(String.valueOf(fixedCreditValue));
                    resultValueRange.setMaxValue(String.valueOf(fixedCreditValue));
                } else if (LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_MULTIPLE
                        .equals(creditOption.getTypeKey())) {
                    List<String> resultVals = _computeResultValues(creditOption.getResultValueKeys(),
                            contextInfo);
                    Collections.sort(resultVals, new Comparator<String>() {
                        public int compare(String o1, String o2) {
                            return Float.compare(Float.parseFloat(o1), Float.parseFloat(o2));
                        }
                    });

                    StringBuilder sb = new StringBuilder(
                            CourseAssemblerConstants.COURSE_RESULT_COMP_CREDIT_PREFIX);
                    for (Iterator<String> iter = resultVals.iterator(); iter.hasNext();) {
                        float value = Float.parseFloat(iter.next());
                        sb.append(value);
                        if (iter.hasNext()) {
                            sb.append(",");
                        }
                    }
                    id = sb.toString();
                    type = LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_MULTIPLE;
                    resultValues = new ArrayList<String>();
                    resultValues.addAll(creditOption.getResultValueKeys());
                } else if (LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_RANGE
                        .equals(creditOption.getTypeKey())) {
                    /*
                       * For variable credits create a Result values that goes from min to max with the specified increment.
                       * If no increment is specified, use 1.0 as the increment. The increment can be specified as a float.
                       */

                    float minCredits = Float.parseFloat(creditOption.getResultValueRange().getMinValue());
                    float maxCredits = Float.parseFloat(creditOption.getResultValueRange().getMaxValue());
                    String creditValueIncr = creditOption.getResultValueRange().getIncrement();
                    float increment = (null != creditValueIncr && creditValueIncr.length() > 0)
                            ? Float.parseFloat(creditValueIncr)
                            : defaultCreditIncrement;

                    id = CourseAssemblerConstants.COURSE_RESULT_COMP_CREDIT_PREFIX + String.valueOf(minCredits)
                            + "-" + String.valueOf(maxCredits);
                    //Add in the increment to the key (logic is duplicated in LRC service)
                    if (creditValueIncr != null && !"1".equals(creditValueIncr)
                            && !"1.0".equals(creditValueIncr)) {
                        id += (" by " + creditValueIncr);
                    }

                    type = LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_RANGE;
                    resultValues = new ArrayList<String>();
                    for (float i = minCredits; i <= maxCredits; i += increment) {
                        // TODO: Refer KSCM-1910
                        resultValues.add(
                                LrcServiceConstants.RESULT_VALUE_KEY_CREDIT_DEGREE_PREFIX + String.valueOf(i));
                    }
                    resultValueRange = new ResultValueRangeInfo();
                    resultValueRange.setMinValue(String.valueOf(minCredits));
                    resultValueRange.setMaxValue(String.valueOf(maxCredits));
                    resultValueRange.setIncrement(String.valueOf(increment));
                } else {
                    resultValues = Collections.emptyList();
                }

                //Set the id
                creditOption.setKey(id);

                //Ensure the resultValueKey has the proper prefix
                // TODO: Comment: Shouldn't muck around with altering IDs
                // Assumption is result values contains IDs, not string values like 2.0

                //                    String resultValueKeyPrefix = "kuali.result.value.credit.degree.";
                //                    for(int i = 0; i < resultValues.size(); i++){
                //                        if (!resultValues.get(i).contains("kuali.result.value")){ //only add the prefix if this is not a proper key
                //                            String ithResultVal = resultValues.get(i);
                //                            resultValues.set(i,resultValueKeyPrefix+Float.parseFloat(ithResultVal));
                //                        }
                //                    }

                //Create a new result component
                if (id != null && !resultValueGroupIds.contains(id)) {

                    //Build the new ResultValuesGroup
                    ResultValuesGroupInfo resultValueGroup = new ResultValuesGroupInfo();
                    resultValueGroup.setKey(id);
                    resultValueGroup.setTypeKey(type);
                    if (DtoConstants.STATE_DRAFT.equals(course.getStateKey())) {
                        resultValueGroup.setStateKey(LrcServiceConstants.RESULT_GROUPS_STATE_DRAFT);
                    } else if (DtoConstants.STATE_APPROVED.equals(course.getStateKey())) {
                        resultValueGroup.setStateKey(LrcServiceConstants.RESULT_GROUPS_STATE_APPROVED);
                    } else {
                        resultValueGroup.setStateKey(LrcServiceConstants.RESULT_GROUPS_STATE_RETIRED);
                    }
                    resultValueGroup.setResultScaleKey(LrcServiceConstants.RESULT_SCALE_KEY_CREDIT_DEGREE);
                    resultValueGroup.setResultValueKeys(resultValues);
                    resultValueGroup.setResultValueRange(resultValueRange);
                    resultValueGroup.setName(creditOption.getName());
                    RichTextInfo creditOptionDescr = creditOption.getDescr();
                    if (creditOptionDescr != null) {
                        RichTextInfo descr = new RichTextInfo();
                        descr.setPlain(creditOptionDescr.getPlain());
                        descr.setFormatted(creditOptionDescr.getFormatted());
                        resultValueGroup.setDescr(descr);
                    }
                    BaseDTOAssemblyNode<ResultValuesGroupInfo, ResultValuesGroupInfo> node = new BaseDTOAssemblyNode<ResultValuesGroupInfo, ResultValuesGroupInfo>(
                            null);
                    node.setOperation(NodeOperation.CREATE);
                    node.setNodeData(resultValueGroup);
                    node.setBusinessDTORef(creditOption);
                    results.add(node);

                    resultValueGroupIds.add(id);
                }
            }
        } catch (NumberFormatException e) {
            throw new AssemblyException("Invalid Arguments for credit outcome values", e);
        } catch (Exception e) {
            throw new AssemblyException("Error Assembling", e);
        }
    }

    //Now do dissassembly for the actual clu-lrc relations and result options

    // Get the current options and put them in a map of option type id/cluResult
    Map<String, List<CluResultInfo>> currentResults = new HashMap<String, List<CluResultInfo>>();

    //If this is not a create, lookup the results for this clu
    if (!NodeOperation.CREATE.equals(operation)) {
        for (CluResultInfo currentResult : currentCluResults) {
            if (courseResultType.equals(currentResult.getTypeKey())) {
                //There should only be one grading option per CluResult for credit outcomes
                if (currentResult.getResultOptions().size() == 1) {
                    //Create a mapping to a list of cluresults with the same result componentId
                    String resultComponentId = currentResult.getResultOptions().get(0).getResultComponentId();
                    if (!currentResults.containsKey(resultComponentId)) {
                        currentResults.put(resultComponentId, new ArrayList<CluResultInfo>());
                    }
                    currentResults.get(resultComponentId).add(currentResult);
                } else {
                    LOG.warn("Credit Results should have exactly one result option each");
                }
            }
        }
    }

    //Loop through options on the course, if they are new, create a new cluResult
    for (ResultValuesGroupInfo creditOption : course.getCreditOptions()) {
        if (NodeOperation.CREATE == operation
                || (NodeOperation.UPDATE == operation && !currentResults.containsKey(creditOption.getKey()))) {

            ResultOptionInfo resultOption = new ResultOptionInfo();
            resultOption.setStateKey(course.getStateKey());
            resultOption.setResultComponentId(creditOption.getKey());

            CluResultInfo cluResult = new CluResultInfo();
            cluResult.setCluId(clu.getId());
            cluResult.setStateKey(course.getStateKey());
            cluResult.setTypeKey(courseResultType);

            cluResult.getResultOptions().add(resultOption);

            BaseDTOAssemblyNode<ResultValuesGroupInfo, CluResultInfo> cluResultNode = new BaseDTOAssemblyNode<ResultValuesGroupInfo, CluResultInfo>(
                    null);
            cluResultNode.setNodeData(cluResult);
            cluResultNode.setOperation(NodeOperation.CREATE);

            results.add(cluResultNode);
        } else if (NodeOperation.UPDATE == operation && currentResults.containsKey(creditOption.getKey())) {
            //Get the list from the map and remove an entry, if the list is empty then remove it from the map
            List<CluResultInfo> cluResults = currentResults.get(creditOption.getKey());
            cluResults.remove(cluResults.size() - 1);
            if (cluResults.isEmpty()) {
                currentResults.remove(creditOption.getKey());
            }
        }
    }

    //Delete the leftovers
    for (Entry<String, List<CluResultInfo>> entry : currentResults.entrySet()) {
        for (CluResultInfo cluResult : entry.getValue()) {
            BaseDTOAssemblyNode<ResultValuesGroupInfo, CluResultInfo> cluResultNode = new BaseDTOAssemblyNode<ResultValuesGroupInfo, CluResultInfo>(
                    null);
            cluResultNode.setNodeData(cluResult);
            cluResultNode.setOperation(NodeOperation.DELETE);
            results.add(cluResultNode);
        }
    }

    return results;
}