/** This method compares the range of this vector with a range of the same length * in another. If there is a mismatch, the index of the mismatch is returned - otherwise * it returns -1. * @param thisoffset The offset within this CharWrapVector to begin the comparison at. * @param other The other CharWrapVector to compare this object with. * @param otheroffset The offset within the other CharWrapVector to begin the comparison at. * @param length The common length of the segments to be compared from each CharWrapVector. * @return -1 if the specified ranges match exactly, otherwise the index of the mismatch * point from the offset position. */ public int compareRange(int thisoffset, CharWrapVector other, int otheroffset, int length) { for (int i = 0; i < length; ++ i) { if ( ! (storage[thisoffset + i].equals(other.storage[otheroffset + i]))) return i; } return -1; }