|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.common.diff.Commonality
public final class Commonality
A Commonality is shared text at the beginning, middle or end of two strings.
Based on the LGPL Diff_Match_Patch v1.5 javascript of Neil Fraser, Copyright (C) 2006
http://neil.fraser.name/software/diff_match_patch/
The GNU Lesser General Public License for details.
Constructor Summary | |
---|---|
private |
Commonality()
This is a utility class, therefore the constructor is private. |
Method Summary | |
---|---|
private static int |
ceil(int number,
int divisor)
|
static CommonMiddle |
halfMatch(String source,
String target)
Do the two texts share a substring which is at least half the length of the longer text? |
private static CommonMiddle |
halfMatch(String longText,
String shortText,
int startIndex)
Does a substring of shortText exist within longText such that the substring is at least half the length of longText? |
static int |
prefix(String source,
String target)
Find the length of a common prefix. |
static int |
suffix(String source,
String target)
Find the length of a common suffix. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
private Commonality()
Method Detail |
---|
public static int prefix(String source, String target)
source
- First stringtarget
- Second string
public static int suffix(String source, String target)
source
- First stringtarget
- Second string
public static CommonMiddle halfMatch(String source, String target)
source
- Baseline stringtarget
- Changed string
private static int ceil(int number, int divisor)
private static CommonMiddle halfMatch(String longText, String shortText, int startIndex)
longText
- Longer stringshortText
- Shorter stringstartIndex
- Start index of quarter length substring within longText
|
Copyright ยจ 2003-2015 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |