/** * Use DefaultRangeComparator to know if two ranges are equals. * @param range1 * @param range2 * @return true if the two ranges are equal */ public static boolean areEquals(Range range1, Range range2){ if (range1 == range2){ return true; } else if (range1 == null || range2 == null){ return false; } else { if (!DefaultRangeComparator.areEquals(range1, range2)){ return false; } ResultingSequence resultingSequence1 = range1.getResultingSequence(); ResultingSequence resultingSequence2 = range2.getResultingSequence(); return ResultingSequenceComparator.areEquals(resultingSequence1, resultingSequence2); } } }
ResultingSequence resultingSequence1 = range1.getResultingSequence(); ResultingSequence resultingSequence2 = range2.getResultingSequence();
/** * All properties are copied from source to target excepted the participant * @param source * @param target */ public static void copyAndOverrideRangeProperties(Range source, Range target){ if (source != null && target != null){ target.setPositions(source.getStart(), source.getEnd()); target.setLink(source.isLink()); target.setResultingSequence(source.getResultingSequence()); } }
if (object.getResultingSequence() != null && object.getResultingSequence().getNewSequence() != null){ MIJsonUtils.writeSeparator(writer); MIJsonUtils.writeProperty("resultingSequence", JSONValue.escape(object.getResultingSequence().getNewSequence()), writer);
/** * * @param range * @return the hashcode consistent with the equals method for this comparator */ public static int hashCode(Range range){ if (unambiguousRangeAndResultingSequenceComparator == null){ unambiguousRangeAndResultingSequenceComparator = new UnambiguousRangeAndResultingSequenceComparator(); } if (range == null){ return 0; } int hashcode = 31; Position start = range.getStart(); hashcode = 31*hashcode + UnambiguousPositionComparator.hashCode(start); Position end = range.getEnd(); hashcode = 31*hashcode + UnambiguousPositionComparator.hashCode(end); hashcode = 31 * hashcode + (range.isLink() ? 0 : 1); ResultingSequence resultingSequence = range.getResultingSequence(); hashcode = 31 * hashcode + ResultingSequenceComparator.hashCode(resultingSequence); return hashcode; } }