-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from MeasureAuthoringTool/MAT-7963_DropDownLis…
…tOfDependencies Mat 7963 drop down list of dependencies
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/gov/cms/madie/cql_elm_translator/dto/CqlBuilderLookupComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package gov.cms.madie.cql_elm_translator.dto; | ||
|
||
import java.util.Comparator; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
public class CqlBuilderLookupComparator<T> implements Comparator<CqlBuilderLookup.Lookup> { | ||
|
||
/*** | ||
* This is required because the name/line numbers can conflict between line | ||
* numbers | ||
*/ | ||
public int compare(CqlBuilderLookup.Lookup lookup1, CqlBuilderLookup.Lookup lookup2) { | ||
|
||
int result; | ||
|
||
if (StringUtils.equalsIgnoreCase(lookup1.getName(), lookup2.getName()) | ||
&& StringUtils.equalsIgnoreCase(lookup1.getLibraryAlias(), lookup2.getLibraryAlias())) { | ||
result = 0; | ||
} else if (lookup1.getStartLine() == lookup2.getStartLine()) { | ||
// if the names are different but the lines are the same | ||
result = lookup1.getStartLine() - lookup2.getStartLine() + 1; | ||
} else { | ||
result = lookup1.getStartLine() - lookup2.getStartLine(); | ||
} | ||
|
||
return result; | ||
} | ||
} |