View Javadoc
1   package org.vaadin.aceeditor.client;
2   
3   
4   import org.vaadin.aceeditor.client.GwtTextDiff.Diff;
5   import org.vaadin.aceeditor.client.GwtTextDiff.Patch;
6   
7   import com.google.gwt.core.client.JavaScriptObject;
8   import com.google.gwt.core.client.JsArray;
9   
10  public class DiffMatchPatchJSNI extends JavaScriptObject {
11  
12  	protected DiffMatchPatchJSNI() {
13  	}
14  
15  	native final static public DiffMatchPatchJSNI newInstance() /*-{
16  		return new $wnd.diff_match_patch();
17  	}-*/;
18  
19  	native final public JsArray<Diff> diff_main(String text1, String text2) /*-{
20  		return this.diff_main(text1, text2);
21  	}-*/;
22  
23  	native final public int match_main(String text, String pattern, int loc) /*-{
24  		return this.match_main(text, pattern, loc);
25  	}-*/;
26  
27  	native final public String patch_apply(JsArray<Patch> patches, String text) /*-{
28  		return this.patch_apply(patches, text)[0];
29  	}-*/;
30  
31  	native final public JsArray<Patch> patch_fromText(String text) /*-{
32  		return this.patch_fromText(text);
33  	}-*/;
34  
35  	native final public String patch_toText(JsArray<Patch> patches) /*-{
36  		return this.patch_toText(patches);
37  	}-*/;
38  
39  	native final public int diff_xIndex(JsArray<Diff> diffs, int pos) /*-{
40  		return this.diff_xIndex(diffs, pos);
41  	}-*/;
42  
43  	native final public int diff_xIndex_patches(JsArray<Patch> patches, int pos) /*-{
44  		for (var i=0; i<patches.length; i++) {
45  			pos = this.diff_xIndex(patches[i].diffs, pos);
46  		}
47  		return pos;
48  	}-*/;
49  
50  	native final public JsArray<Patch> patch_make_diff_main(String text1, String text2) /*-{
51  		return this.patch_make(text1, this.diff_main(text1,text2));
52  	}-*/;
53  	
54  	native final public JsArray<Patch> patch_make(String text1, String text2) /*-{
55  		return this.patch_make(text1, text2);
56  	}-*/;
57  
58  	native final public void setMatch_Threshold(double d) /*-{
59  		this.Match_Threshold = d;
60  	}-*/;
61  	
62  	native final public void setPatch_Margin(int m) /*-{
63  		this.Patch_Margin = m;
64  	}-*/;
65  	
66  	native final public void setMatch_Distance(int m) /*-{
67  		this.Match_Distance = m;
68  	}-*/;
69  	
70  	native final public void setDiff_EditCost(int c) /*-{
71  		this.Diff_EditCost = c;
72  	}-*/;
73  	
74  	
75  }