1 11 package org.eclipse.compare.rangedifferencer; 12 13 import java.util.ArrayList ; 14 import java.util.List ; 15 16 20 class DifferencesIterator { 21 22 List fRange; 23 int fIndex; 24 RangeDifference[] fArray; 25 RangeDifference fDifference; 26 27 30 DifferencesIterator(RangeDifference[] differenceRanges) { 31 32 fArray= differenceRanges; 33 fIndex= 0; 34 fRange= new ArrayList (); 35 if (fIndex < fArray.length) 36 fDifference= fArray[fIndex++]; 37 else 38 fDifference= null; 39 } 40 41 44 int getCount() { 45 return fRange.size(); 46 } 47 48 51 void next() { 52 fRange.add(fDifference); 53 if (fDifference != null) { 54 if (fIndex < fArray.length) 55 fDifference= fArray[fIndex++]; 56 else 57 fDifference= null; 58 } 59 } 60 61 65 DifferencesIterator other(DifferencesIterator right, DifferencesIterator left) { 66 if (this == right) 67 return left; 68 return right; 69 } 70 71 74 void removeAll() { 75 fRange.clear(); 76 } 77 } 78 | Popular Tags |