Java Code Examples for org.apache.commons.lang3.builder.CompareToBuilder#toComparison()
The following examples show how to use
org.apache.commons.lang3.builder.CompareToBuilder#toComparison() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StateChange.java From uyuni with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} */ public int compareTo(StateChange rhs) { CompareToBuilder builder = new CompareToBuilder(); builder.append(getDate(), rhs.getDate()); builder.append(getId(), rhs.getId()); builder.append(this.getState(), rhs.getState()); builder.append(this.getUser(), rhs.getUser()); builder.append(this.getChangedBy(), rhs.getChangedBy()); return builder.toComparison(); }
Example 2
Source File: CacheIndex.java From jstarcraft-core with Apache License 2.0 | 5 votes |
@Override public int compareTo(CacheIndex that) { CompareToBuilder comparator = new CompareToBuilder(); comparator.append(this.name, that.name); comparator.append(this.value, that.value); return comparator.toComparison(); }
Example 3
Source File: SailfishURI.java From sailfish-core with Apache License 2.0 | 5 votes |
@Override public int compareTo(SailfishURI o) { if(o == null) { return 1; } CompareToBuilder builder = new CompareToBuilder(); builder.append(pluginAlias, o.pluginAlias, String.CASE_INSENSITIVE_ORDER); builder.append(classAlias, o.classAlias, String.CASE_INSENSITIVE_ORDER); builder.append(resourceName, o.resourceName, String.CASE_INSENSITIVE_ORDER); return builder.toComparison(); }
Example 4
Source File: BugDescription.java From sailfish-core with Apache License 2.0 | 5 votes |
@Override public int compareTo(BugDescription o) { if(o == null) { return 1; } CompareToBuilder builder = new CompareToBuilder(); builder.append(category, o.category); builder.append(subject, o.subject); return builder.toComparison(); }
Example 5
Source File: BugCategoriesComparator.java From sailfish-core with Apache License 2.0 | 5 votes |
@Override public int compare(String[] array1, String[] array2) { CompareToBuilder compareToBuilder = new CompareToBuilder(); int minSize = Math.min(array1.length, array2.length); if (minSize > 0 && array1.length != array2.length) { // compare arrays like they have the same size compareToBuilder.append(ArrayUtils.subarray(array1, 0, minSize), ArrayUtils.subarray(array2, 0, minSize), String.CASE_INSENSITIVE_ORDER); compareToBuilder.append(array1.length, array2.length); } else { compareToBuilder.append(array1, array2, String.CASE_INSENSITIVE_ORDER); } return compareToBuilder.toComparison(); }
Example 6
Source File: ServiceName.java From sailfish-core with Apache License 2.0 | 5 votes |
@Override public int compareTo(ServiceName o) { if(o == null) { return 1; } CompareToBuilder builder = new CompareToBuilder(); builder.append(environment, o.environment, String.CASE_INSENSITIVE_ORDER); builder.append(serviceName, o.serviceName); return builder.toComparison(); }
Example 7
Source File: GroupEntryTools.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
public static int compareWith(LinkedHashMap<String, Object> m1, LinkedHashMap<String, Object> m2, GroupEntry groupEntry) { CompareToBuilder compareToBuilder = new CompareToBuilder(); if (Objects.equals(OrderType.asc, groupEntry.getOrderType())) { compareToBuilder.append(m1.get("group"), m2.get("group")); } else { compareToBuilder.append(m2.get("group"), m1.get("group")); } return compareToBuilder.toComparison(); }
Example 8
Source File: OrderEntryTools.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
public static int compareWith(Row o1, Row o2, List<OrderEntry> orderEntries) { CompareToBuilder compareToBuilder = new CompareToBuilder(); for (OrderEntry en : orderEntries) { if (Objects.equals(OrderType.asc, en.getOrderType())) { compareToBuilder.append(o1.find(en.getColumn()), o2.find(en.getColumn())); } else { compareToBuilder.append(o2.find(en.getColumn()), o1.find(en.getColumn())); } } return compareToBuilder.toComparison(); }
Example 9
Source File: CalculateEntryTools.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
public static int compareWith(Entry<Object, ? extends Number> e1, Entry<Object, ? extends Number> e2, OrderEffectType orderEffectType, OrderType orderType) { CompareToBuilder compareToBuilder = new CompareToBuilder(); switch (orderType) { case asc: switch (orderEffectType) { case key: compareToBuilder.append(e1.getKey(), e2.getKey()); break; case value: compareToBuilder.append(e1.getValue(), e2.getValue()); break; default: break; } break; case desc: switch (orderEffectType) { case key: compareToBuilder.append(e2.getKey(), e1.getKey()); break; case value: compareToBuilder.append(e2.getValue(), e1.getValue()); break; default: break; } break; default: break; } return compareToBuilder.toComparison(); }
Example 10
Source File: Meta.java From timely with Apache License 2.0 | 5 votes |
@Override public int compareTo(Meta o) { CompareToBuilder builder = new CompareToBuilder(); builder.append(this.metric, o.metric); builder.append(this.tagKey, o.tagKey); builder.append(this.tagValue, o.tagValue); return builder.toComparison(); }
Example 11
Source File: FeedEntryStatusDAO.java From commafeed with Apache License 2.0 | 5 votes |
@Override public int compare(FeedEntryStatus o1, FeedEntryStatus o2) { CompareToBuilder builder = new CompareToBuilder(); builder.append(o2.getEntryUpdated(), o1.getEntryUpdated()); builder.append(o2.getId(), o1.getId()); return builder.toComparison(); }
Example 12
Source File: FeedEntryStatusDAO.java From commafeed with Apache License 2.0 | 5 votes |
@Override public int compare(FeedEntryStatus o1, FeedEntryStatus o2) { CompareToBuilder builder = new CompareToBuilder(); builder.append(o1.getEntry().getContent().getTitle(), o2.getEntry().getContent().getTitle()); builder.append(o1.getId(), o2.getId()); return builder.toComparison(); }
Example 13
Source File: PropertyDefinition.java From jstarcraft-core with Apache License 2.0 | 4 votes |
@Override public int compareTo(PropertyDefinition that) { CompareToBuilder comparator = new CompareToBuilder(); comparator.append(this.name, that.name); return comparator.toComparison(); }
Example 14
Source File: ClassDefinition.java From jstarcraft-core with Apache License 2.0 | 4 votes |
@Override public int compareTo(ClassDefinition that) { CompareToBuilder comparator = new CompareToBuilder(); comparator.append(this.code, that.code); return comparator.toComparison(); }