Пример #1
0
 @Override
 public int compare(VisitedTree o1, VisitedTree o2) {
   CompareToBuilder compareToBuilder = new CompareToBuilder();
   compareToBuilder.append(o1.getAbsolutePath(), o2.getAbsolutePath());
   if (compareToBuilder.toComparison() != 0) {
     return compareToBuilder.toComparison();
   }
   compareToBuilder.append(
       o1.getPatternSet() != null ? o1.getPatternSet().hashCode() : 0,
       o2.getPatternSet() != null ? o2.getPatternSet().hashCode() : 0);
   if (compareToBuilder.toComparison() != 0) {
     return compareToBuilder.toComparison();
   }
   compareToBuilder.append(o1.hashCode(), o2.hashCode());
   return compareToBuilder.toComparison();
 }
 /**
  * Compare this to the given object.
  *
  * @param compare the object to compare to.
  * @return the result of the comparison.
  */
 @Override
 public int compareTo(IGetStorageItems compare) {
   CompareToBuilder builder = new CompareToBuilder();
   builder.append(this.loginId, compare.getLoginId());
   builder.append(this.instanceId, compare.getInstanceId());
   return builder.toComparison();
 }
  @Override
  public int compareTo(InferredEdge o) {
    final CompareToBuilder comparator = new CompareToBuilder();
    comparator.append(this.endVertex.getLabel(), o.endVertex.getLabel());
    comparator.append(this.startVertex.getLabel(), o.startVertex.getLabel());

    return comparator.toComparison();
  }
 /**
  * Compare this to the given object.
  *
  * @param compare the object to compare to.
  * @return the result of the comparison.
  */
 @Override
 public int compareTo(IGetUnitsByFactionId compare) {
   CompareToBuilder builder = new CompareToBuilder();
   builder.append(this.loginId, compare.getLoginId());
   builder.append(this.instanceId, compare.getInstanceId());
   builder.append(this.id, compare.getId());
   return builder.toComparison();
 }
Пример #5
0
  @Override
  public int compareTo(final HoursByDay that) {
    if (that == null) {
      return 0;
    }

    if (this.equals(that)) {
      return 0;
    }

    final CompareToBuilder compareBuilder = new CompareToBuilder();

    compareBuilder.append(day.getYear(), that.day.getYear());
    compareBuilder.append(day.getDayOfYear(), that.day.getDayOfYear());

    // Sort by start date but the other way round. That way the latest
    // activity is always on top.
    return compareBuilder.toComparison();
  }
Пример #6
0
  @Override
  public int compareTo(MediaFile mf) {

    if (!isDirectory && mf.isDirectory) {
      return 1;
    } else if (isDirectory && !mf.isDirectory) {
      return -1;
    } else if (isDirectory && mf.isDirectory) {
      return getName().compareTo(mf.getName());
    }

    MetaData md1 = getMetaData();
    MetaData md2 = mf.getMetaData();

    CompareToBuilder ctb =
        new CompareToBuilder()
            .append(nvl(md1.getDiscNumber(), 1), nvl(md2.getDiscNumber(), 1))
            .append(nvl(md1.getTrackNumber(), -1), nvl(md2.getTrackNumber(), -1))
            .append(md1.getTitle(), md2.getTitle());

    return ctb.toComparison();
  }