Package com.ibm.icu.dev.demo.translit
Class IntDiffer
- java.lang.Object
-
- com.ibm.icu.dev.demo.translit.IntDiffer
-
public final class IntDiffer extends java.lang.Object
VERY Basic Diff program. Compares two sequences of ints fed into it, and lets you know where they are different.This version compares ints while the CLDR class Differ compares Objects.
- Version:
- 1.0
-
-
Constructor Summary
Constructors Constructor Description IntDiffer(int stackSize, int matchCount)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addA(int aStr)
void
addB(int bStr)
void
checkMatch(boolean finalPass)
Checks for initial & final match.private int
find(int[] aArr, int aStart, int aEnd, int[] bArr, int bStart, int bEnd)
Finds a segment of the first array in the second array.private void
flush()
Removes equal prefixes of both arrays.int
getA(int offset)
int
getACount()
int
getB(int offset)
int
getBCount()
-
-
-
Method Detail
-
addA
public void addA(int aStr)
-
addB
public void addB(int bStr)
-
getA
public int getA(int offset)
-
getACount
public int getACount()
-
getBCount
public int getBCount()
-
getB
public int getB(int offset)
-
checkMatch
public void checkMatch(boolean finalPass)
Checks for initial & final match. To be called after addA() and addB(). Middle segments that are different are returned via get*Count() and get*().- Parameters:
finalPass
- true if no more input
-
find
private int find(int[] aArr, int aStart, int aEnd, int[] bArr, int bStart, int bEnd)
Finds a segment of the first array in the second array.- Returns:
- -1 if not found, otherwise start position in bArr
-
flush
private void flush()
Removes equal prefixes of both arrays.
-
-