BuildmLearn-Toolkit-Android
2.0.0
The Android version of the BuildmLearn Toolkit. BuildmLearn Toolkit is an easy-to-use program that helps the users make mobile apps without any knowledge of application development.
|
Classes | |
class | Diff |
class | LinesToCharsResult |
enum | Operation |
class | Patch |
Public Member Functions | |
LinkedList< Diff > | diff_main (String text1, String text2) |
LinkedList< Diff > | diff_main (String text1, String text2, boolean checklines) |
LinkedList< Diff > | diff_WordMode (String text1, String text2) |
int | diff_commonPrefix (String text1, String text2) |
int | diff_commonSuffix (String text1, String text2) |
void | diff_cleanupSemantic (LinkedList< Diff > diffs) |
void | diff_cleanupSemanticLossless (LinkedList< Diff > diffs) |
void | diff_cleanupEfficiency (LinkedList< Diff > diffs) |
void | diff_cleanupMerge (LinkedList< Diff > diffs) |
int | diff_xIndex (LinkedList< Diff > diffs, int loc) |
String[] | diff_prettyHtml (LinkedList< Diff > diffs) |
String | diff_text1 (LinkedList< Diff > diffs) |
String | diff_text2 (LinkedList< Diff > diffs) |
int | diff_levenshtein (LinkedList< Diff > diffs) |
String | diff_toDelta (LinkedList< Diff > diffs) |
LinkedList< Diff > | diff_fromDelta (String text1, String delta) throws IllegalArgumentException |
int | match_main (String text, String pattern, int loc) |
LinkedList< Patch > | patch_make (String text1, String text2) |
LinkedList< Patch > | patch_make (LinkedList< Diff > diffs) |
LinkedList< Patch > | patch_make (String text1, String text2, LinkedList< Diff > diffs) |
LinkedList< Patch > | patch_make (String text1, LinkedList< Diff > diffs) |
LinkedList< Patch > | patch_deepCopy (LinkedList< Patch > patches) |
Object[] | patch_apply (LinkedList< Patch > patches, String text) |
String | patch_addPadding (LinkedList< Patch > patches) |
void | patch_splitMax (LinkedList< Patch > patches) |
String | patch_toText (List< Patch > patches) |
List< Patch > | patch_fromText (String textline) throws IllegalArgumentException |
Public Attributes | |
float | Diff_Timeout = 1.0f |
short | Diff_EditCost = 4 |
float | Match_Threshold = 0.5f |
int | Match_Distance = 1000 |
float | Patch_DeleteThreshold = 0.5f |
short | Patch_Margin = 4 |
Protected Member Functions | |
LinkedList< Diff > | diff_bisect (String text1, String text2, long deadline) |
LinesToCharsResult | diff_linesToChars (String text1, String text2) |
LinesToCharsResult | diff_wordsToChars (String text1, String text2) |
void | diff_charsToLines (LinkedList< Diff > diffs, List< String > lineArray) |
int | diff_commonOverlap (String text1, String text2) |
String[] | diff_halfMatch (String text1, String text2) |
int | match_bitap (String text, String pattern, int loc) |
Map< Character, Integer > | match_alphabet (String pattern) |
void | patch_addContext (Patch patch, String text) |
Private Member Functions | |
LinkedList< Diff > | diff_main (String text1, String text2, boolean checklines, long deadline) |
LinkedList< Diff > | diff_compute (String text1, String text2, boolean checklines, long deadline) |
LinkedList< Diff > | diff_lineMode (String text1, String text2, long deadline) |
LinkedList< Diff > | diff_bisectSplit (String text1, String text2, int x, int y, long deadline) |
String | diff_linesToCharsMunge (String text, List< String > lineArray, Map< String, Integer > lineHash) |
String | diff_wordsToCharsMunge (String text, List< String > lineArray, Map< String, Integer > lineHash) |
String[] | diff_halfMatchI (String longtext, String shorttext, int i) |
int | diff_cleanupSemanticScore (String one, String two) |
double | match_bitapScore (int e, int x, int loc, String pattern) |
Static Private Member Functions | |
static String | unescapeForEncodeUriCompatability (String str) |
Private Attributes | |
short | Match_MaxBits = 32 |
Pattern | BLANKLINEEND = Pattern.compile("\\n\\r?\\n\\Z", Pattern.DOTALL) |
Pattern | BLANKLINESTART = Pattern.compile("\\A\\r?\\n\\r?\\n", Pattern.DOTALL) |
Class containing the diff, match and patch methods. Also contains the behaviour settings.
|
protected |
Find the 'middle snake' of a diff, split the problem in two and return the recursively constructed diff. See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
text1 | Old string to be diffed. |
text2 | New string to be diffed. |
deadline | Time at which to bail if not yet complete. |
|
private |
Given the location of the 'middle snake', split the diff in two parts and recurse.
text1 | Old string to be diffed. |
text2 | New string to be diffed. |
x | Index of split point in text1. |
y | Index of split point in text2. |
deadline | Time at which to bail if not yet complete. |
|
protected |
Rehydrate the text in a diff from a string of line hashes to real lines of text.
diffs | LinkedList of Diff objects. |
lineArray | List of unique strings. |
void org.buildmlearn.toolkit.utilities.diff_match_patch.diff_cleanupEfficiency | ( | LinkedList< Diff > | diffs | ) |
Reduce the number of edits by eliminating operationally trivial equalities.
diffs | LinkedList of Diff objects. |
void org.buildmlearn.toolkit.utilities.diff_match_patch.diff_cleanupMerge | ( | LinkedList< Diff > | diffs | ) |
Reorder and merge like edit sections. Merge equalities. Any edit section can move as long as it doesn't cross an equality.
diffs | LinkedList of Diff objects. |
void org.buildmlearn.toolkit.utilities.diff_match_patch.diff_cleanupSemantic | ( | LinkedList< Diff > | diffs | ) |
Reduce the number of edits by eliminating semantically trivial equalities.
diffs | LinkedList of Diff objects. |
void org.buildmlearn.toolkit.utilities.diff_match_patch.diff_cleanupSemanticLossless | ( | LinkedList< Diff > | diffs | ) |
Look for single edits surrounded on both sides by equalities which can be shifted sideways to align the edit to a word boundary. e.g: The c<ins>at c</ins>ame. -> The <ins>cat </ins>came.
diffs | LinkedList of Diff objects. |
|
private |
Given two strings, compute a score representing whether the internal boundary falls on logical boundaries. Scores range from 6 (best) to 0 (worst).
one | First string. |
two | Second string. |
|
protected |
Determine if the suffix of one string is the prefix of another.
text1 | First string. |
text2 | Second string. |
int org.buildmlearn.toolkit.utilities.diff_match_patch.diff_commonPrefix | ( | String | text1, |
String | text2 | ||
) |
Determine the common prefix of two strings
text1 | First string. |
text2 | Second string. |
int org.buildmlearn.toolkit.utilities.diff_match_patch.diff_commonSuffix | ( | String | text1, |
String | text2 | ||
) |
Determine the common suffix of two strings
text1 | First string. |
text2 | Second string. |
|
private |
Find the differences between two texts. Assumes that the texts do not have any common prefix or suffix.
text1 | Old string to be diffed. |
text2 | New string to be diffed. |
checklines | Speedup flag. If false, then don't run a line-level diff first to identify the changed areas. If true, then run a faster slightly less optimal diff. |
deadline | Time when the diff should be complete by. |
LinkedList<Diff> org.buildmlearn.toolkit.utilities.diff_match_patch.diff_fromDelta | ( | String | text1, |
String | delta | ||
) | throws IllegalArgumentException |
Given the original text1, and an encoded string which describes the operations required to transform text1 into text2, compute the full diff.
text1 | Source string for the diff. |
delta | Delta text. |
IllegalArgumentException | If invalid input. |
|
protected |
Do the two texts share a substring which is at least half the length of the longer text? This speedup can produce non-minimal diffs.
text1 | First string. |
text2 | Second string. |
|
private |
Does a substring of shorttext exist within longtext such that the substring is at least half the length of longtext?
longtext | Longer string. |
shorttext | Shorter string. |
i | Start index of quarter length substring within longtext. |
int org.buildmlearn.toolkit.utilities.diff_match_patch.diff_levenshtein | ( | LinkedList< Diff > | diffs | ) |
Compute the Levenshtein distance; the number of inserted, deleted or substituted characters.
diffs | LinkedList of Diff objects. |
|
private |
Do a quick line-level diff on both strings, then rediff the parts for greater accuracy. This speedup can produce non-minimal diffs.
text1 | Old string to be diffed. |
text2 | New string to be diffed. |
deadline | Time when the diff should be complete by. |
|
protected |
Split two texts into a list of strings. Reduce the texts to a string of hashes where each Unicode character represents one line.
text1 | First string. |
text2 | Second string. |
|
private |
Split a text into a list of strings. Reduce the texts to a string of hashes where each Unicode character represents one line.
text | String to encode. |
lineArray | List of unique strings. |
lineHash | Map of strings to indices. |
LinkedList<Diff> org.buildmlearn.toolkit.utilities.diff_match_patch.diff_main | ( | String | text1, |
String | text2 | ||
) |
Find the differences between two texts. Run a faster, slightly less optimal diff. This method allows the 'checklines' of diff_main() to be optional. Most of the time checklines is wanted, so default to true.
text1 | Old string to be diffed. |
text2 | New string to be diffed. |
LinkedList<Diff> org.buildmlearn.toolkit.utilities.diff_match_patch.diff_main | ( | String | text1, |
String | text2, | ||
boolean | checklines | ||
) |
Find the differences between two texts.
text1 | Old string to be diffed. |
text2 | New string to be diffed. |
checklines | Speedup flag. If false, then don't run a line-level diff first to identify the changed areas. If true, then run a faster slightly less optimal diff. |
|
private |
Find the differences between two texts. Simplifies the problem by stripping any common prefix or suffix off the texts before diffing.
text1 | Old string to be diffed. |
text2 | New string to be diffed. |
checklines | Speedup flag. If false, then don't run a line-level diff first to identify the changed areas. If true, then run a faster slightly less optimal diff. |
deadline | Time when the diff should be complete by. Used internally for recursive calls. Users should set DiffTimeout instead. |
String [] org.buildmlearn.toolkit.utilities.diff_match_patch.diff_prettyHtml | ( | LinkedList< Diff > | diffs | ) |
String org.buildmlearn.toolkit.utilities.diff_match_patch.diff_text1 | ( | LinkedList< Diff > | diffs | ) |
Compute and return the source text (all equalities and deletions).
diffs | LinkedList of Diff objects. |
String org.buildmlearn.toolkit.utilities.diff_match_patch.diff_text2 | ( | LinkedList< Diff > | diffs | ) |
Compute and return the destination text (all equalities and insertions).
diffs | LinkedList of Diff objects. |
String org.buildmlearn.toolkit.utilities.diff_match_patch.diff_toDelta | ( | LinkedList< Diff > | diffs | ) |
Crush the diff into an encoded string which describes the operations required to transform text1 into text2. E.g. =3-2+ing -> Keep 3 chars, delete 2 chars, insert 'ing'. Operations are tab-separated. Inserted text is escaped using xx notation.
diffs | Array of Diff objects. |
LinkedList<Diff> org.buildmlearn.toolkit.utilities.diff_match_patch.diff_WordMode | ( | String | text1, |
String | text2 | ||
) |
|
protected |
Split two texts into a list of strings. Reduce the texts to a string of hashes where each Unicode character represents one word.
text1 | First string. |
text2 | Second string. |
|
private |
Split a text into a list of strings. Reduce the texts to a string of hashes where each Unicode character represents one word.
text | String to encode. |
lineArray | List of unique strings. |
lineHash | Map of strings to indices. |
int org.buildmlearn.toolkit.utilities.diff_match_patch.diff_xIndex | ( | LinkedList< Diff > | diffs, |
int | loc | ||
) |
loc is a location in text1, compute and return the equivalent location in text2. e.g. "The cat" vs "The big cat", 1->1, 5->8
diffs | LinkedList of Diff objects. |
loc | Location within text1. |
|
protected |
Initialise the alphabet for the Bitap algorithm.
pattern | The text to encode. |
|
protected |
Locate the best instance of 'pattern' in 'text' near 'loc' using the Bitap algorithm. Returns -1 if no match found.
text | The text to search. |
pattern | The pattern to search for. |
loc | The location to search around. |
|
private |
Compute and return the score for a match with e errors and x location.
e | Number of errors in match. |
x | Location of match. |
loc | Expected location of match. |
pattern | Pattern being sought. |
int org.buildmlearn.toolkit.utilities.diff_match_patch.match_main | ( | String | text, |
String | pattern, | ||
int | loc | ||
) |
Locate the best instance of 'pattern' in 'text' near 'loc'. Returns -1 if no match found.
text | The text to search. |
pattern | The pattern to search for. |
loc | The location to search around. |
|
protected |
Increase the context until it is unique, but don't let the pattern expand beyond Match_MaxBits.
patch | The patch to grow. |
text | Source text. |
String org.buildmlearn.toolkit.utilities.diff_match_patch.patch_addPadding | ( | LinkedList< Patch > | patches | ) |
Add some padding on text start and end so that edges can match something. Intended to be called only from within patch_apply.
patches | Array of Patch objects. |
Object [] org.buildmlearn.toolkit.utilities.diff_match_patch.patch_apply | ( | LinkedList< Patch > | patches, |
String | text | ||
) |
Merge a set of patches onto the text. Return a patched text, as well as an array of true/false values indicating which patches were applied.
patches | Array of Patch objects |
text | Old text. |
List<Patch> org.buildmlearn.toolkit.utilities.diff_match_patch.patch_fromText | ( | String | textline | ) | throws IllegalArgumentException |
LinkedList<Patch> org.buildmlearn.toolkit.utilities.diff_match_patch.patch_make | ( | String | text1, |
String | text2 | ||
) |
Compute a list of patches to turn text1 into text2. A set of diffs will be computed.
text1 | Old text. |
text2 | New text. |
LinkedList<Patch> org.buildmlearn.toolkit.utilities.diff_match_patch.patch_make | ( | String | text1, |
String | text2, | ||
LinkedList< Diff > | diffs | ||
) |
void org.buildmlearn.toolkit.utilities.diff_match_patch.patch_splitMax | ( | LinkedList< Patch > | patches | ) |
Look through the patches and break up any which are longer than the maximum limit of the match algorithm. Intended to be called only from within patch_apply.
patches | LinkedList of Patch objects. |
String org.buildmlearn.toolkit.utilities.diff_match_patch.patch_toText | ( | List< Patch > | patches | ) |
Take a list of patches and return a textual representation.
patches | List of Patch objects. |
|
staticprivate |
Unescape selected chars for compatability with JavaScript's encodeURI. In speed critical applications this could be dropped since the receiving application will certainly decode these fine. Note that this function is case-sensitive. Thus "%3f" would not be unescaped. But this is ok because it is only called with the output of URLEncoder.encode which returns uppercase hex.
Example: "%3F" -> "?", "%24" -> "$", etc.
str | The string to escape. |
|
private |
|
private |
short org.buildmlearn.toolkit.utilities.diff_match_patch.Diff_EditCost = 4 |
Cost of an empty edit operation in terms of edit characters.
float org.buildmlearn.toolkit.utilities.diff_match_patch.Diff_Timeout = 1.0f |
Number of seconds to map a diff before giving up (0 for infinity).
int org.buildmlearn.toolkit.utilities.diff_match_patch.Match_Distance = 1000 |
How far to search for a match (0 = exact location, 1000+ = broad match). A match this many characters away from the expected location will add 1.0 to the score (0.0 is a perfect match).
|
private |
The number of bits in an int.
float org.buildmlearn.toolkit.utilities.diff_match_patch.Match_Threshold = 0.5f |
At what point is no match declared (0.0 = perfection, 1.0 = very loose).
float org.buildmlearn.toolkit.utilities.diff_match_patch.Patch_DeleteThreshold = 0.5f |
When deleting a large block of text (over ~64 characters), how close do the contents have to be to match the expected contents. (0.0 = perfection, 1.0 = very loose). Note that Match_Threshold controls how closely the end points of a delete need to match.
short org.buildmlearn.toolkit.utilities.diff_match_patch.Patch_Margin = 4 |
Chunk size for context length.