public int compare(VcsRef ref1, VcsRef ref2) { VcsRefType type1 = ref1.getType(); VcsRefType type2 = ref2.getType(); int typeComparison = REF_TYPE_COMPARATOR.compare(type1, type2); if (typeComparison != 0) { return typeComparison; } //noinspection UnnecessaryLocalVariable VcsRefType type = type1; // common type if (type == BRANCH) { if (ref1.getName().equals(DEFAULT)) { return -1; } if (ref2.getName().equals(DEFAULT)) { return 1; } return ref1.getName().compareTo(ref2.getName()); } return ref1.getName().compareTo(ref2.getName()); }
@Override public boolean equals(@NotNull VcsRef ref1, @NotNull VcsRef ref2) { return ref1.getName().equals(ref2.getName()) && ref1.getType().equals(ref2.getType()); }
@Override public int computeHashCode(@NotNull VcsRef ref) { return 31 * ref.getName().hashCode() + ref.getType().hashCode(); }
@Override public String fun(VcsRef ref) { return ref.getType() == GitRefManager.TAG ? ref.getName() : null; }