Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2006 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM Corporation - initial API and implementation /
package org.eclipse.compare.rangedifferencer;
A custom iterator to iterate over a List of RangeDifferences. It is used internally by the RangeDifferencer.
/* package */class DifferencesIterator {
    List fRange;
    int fIndex;
    /*
     * Creates a differences iterator on an array of <code>RangeDifference</code>s.
     */
    DifferencesIterator(RangeDifference[] differenceRanges) {
         = differenceRanges;
         = 0;
         = new ArrayList();
        if ( < .)
             = [++];
        else
             = null;
    }
    /*
     * Returns the number of RangeDifferences
     */
    int getCount() {
        return .size();
    }
    /*
     * Appends the edit to its list and moves to the next <code>RangeDifference</code>.
     */
    void next() {
        .add();
        if ( != null) {
            if ( < .)
                 = [++];
            else
                 = null;
        }
    }
    /*
     * Difference iterators are used in pairs. This method returns the other
     * iterator.
     */
            DifferencesIterator left) {
        if (this == right)
            return left;
        return right;
    }
    /*
     * Removes all <code>RangeDifference</code>s
     */
    void removeAll() {
        .clear();
    }
New to GrepCode? Check out our FAQ X