1 11 package org.eclipse.ui.internal.texteditor.quickdiff.compare.rangedifferencer; 12 13 import java.util.ArrayList ; 14 import java.util.List ; 15 16 22 class DifferencesIterator { 23 24 List fRange; 25 int fIndex; 26 RangeDifference[] fArray; 27 RangeDifference fDifference; 28 29 32 DifferencesIterator(RangeDifference[] differenceRanges) { 33 34 fArray= differenceRanges; 35 fIndex= 0; 36 fRange= new ArrayList (); 37 if (fIndex < fArray.length) 38 fDifference= fArray[fIndex++]; 39 else 40 fDifference= null; 41 } 42 43 46 int getCount() { 47 return fRange.size(); 48 } 49 50 53 void next() { 54 fRange.add(fDifference); 55 if (fDifference != null) { 56 if (fIndex < fArray.length) 57 fDifference= fArray[fIndex++]; 58 else 59 fDifference= null; 60 } 61 } 62 63 67 DifferencesIterator other(DifferencesIterator right, DifferencesIterator left) { 68 if (this == right) 69 return left; 70 return right; 71 } 72 73 76 void removeAll() { 77 fRange.clear(); 78 } 79 } 80 | Popular Tags |