All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.capitalone.dashboard.util.SuperFeatureComparator Maven / Gradle / Ivy

There is a newer version: 4.0.2
Show newest version
package com.capitalone.dashboard.util;

import java.util.Comparator;

import com.capitalone.dashboard.model.Feature;

/**
 * Comparator utility class for handling comparisons of Super Features (epics)
 * to other Super Features. This is used when manipulating results of MongoDB
 * repository responses and sorting them in an efficient manner within memory.
 * 
 * @author kfk884
 * 
 */
public class SuperFeatureComparator implements Comparator {

	public SuperFeatureComparator() {
		// No instantiation requirements
	}

	/**
	 * Compares two feature object models and sorts based on their subsequent
	 * epic IDs, as a string comparator
	 * 
	 * @return A list of Features sorted by EpicID, descending
	 */
	@Override
	public int compare(Feature f, Feature ff) {
		if (f.getsEpicID().compareToIgnoreCase(ff.getsEpicID()) <= -1) {
			return -1;
		} else if (f.getsEpicID().compareToIgnoreCase(ff.getsEpicID()) >= 1) {
			return 1;
		} else {
			return 0;
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy