/** * 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()); } }
/** * * @param range * @return the hashcode consistent with the equals method for this comparator */ public static int hashCode(Range range){ if (unambiguousRangeComparator == null){ unambiguousRangeComparator = new UnambiguousRangeComparator(); } 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); return hashcode; } }
/** * * @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; } }