Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / javax / swing / text / GapVector.js
index 5cb780d..318a611 100644 (file)
-Clazz.declarePackage ("javax.swing.text");\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.array = null;\r
-this.g0 = 0;\r
-this.g1 = 0;\r
-Clazz.instantialize (this, arguments);\r
-}, javax.swing.text, "GapVector");\r
-Clazz.makeConstructor (c$, \r
-function () {\r
-this.construct (10);\r
-});\r
-Clazz.makeConstructor (c$, \r
-function (initialLength) {\r
-this.array = this.allocateArray (initialLength);\r
-this.g0 = 0;\r
-this.g1 = initialLength;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "getArray", \r
-function () {\r
-return this.array;\r
-});\r
-Clazz.defineMethod (c$, "getGapStart", \r
-function () {\r
-return this.g0;\r
-});\r
-Clazz.defineMethod (c$, "getGapEnd", \r
-function () {\r
-return this.g1;\r
-});\r
-Clazz.defineMethod (c$, "replace", \r
-function (position, rmSize, addItems, addSize) {\r
-var addOffset = 0;\r
-if (addSize == 0) {\r
-this.close (position, rmSize);\r
-return;\r
-} else if (rmSize > addSize) {\r
-this.close (position + addSize, rmSize - addSize);\r
-} else {\r
-var endSize = addSize - rmSize;\r
-var end = this.open (position + rmSize, endSize);\r
-System.arraycopy (addItems, rmSize, this.array, end, endSize);\r
-addSize = rmSize;\r
-}System.arraycopy (addItems, addOffset, this.array, position, addSize);\r
-}, "~N,~N,~O,~N");\r
-Clazz.defineMethod (c$, "close", \r
-function (position, nItems) {\r
-if (nItems == 0) return;\r
-var end = position + nItems;\r
-var new_gs = (this.g1 - this.g0) + nItems;\r
-if (end <= this.g0) {\r
-if (this.g0 != end) {\r
-this.shiftGap (end);\r
-}this.shiftGapStartDown (this.g0 - nItems);\r
-} else if (position >= this.g0) {\r
-if (this.g0 != position) {\r
-this.shiftGap (position);\r
-}this.shiftGapEndUp (this.g0 + new_gs);\r
-} else {\r
-this.shiftGapStartDown (position);\r
-this.shiftGapEndUp (this.g0 + new_gs);\r
-}}, "~N,~N");\r
-Clazz.defineMethod (c$, "open", \r
-function (position, nItems) {\r
-var gapSize = this.g1 - this.g0;\r
-if (nItems == 0) {\r
-if (position > this.g0) position += gapSize;\r
-return position;\r
-}this.shiftGap (position);\r
-if (nItems >= gapSize) {\r
-this.shiftEnd (this.getArrayLength () - gapSize + nItems);\r
-gapSize = this.g1 - this.g0;\r
-}this.g0 = this.g0 + nItems;\r
-return position;\r
-}, "~N,~N");\r
-Clazz.defineMethod (c$, "resize", \r
-function (nsize) {\r
-var narray = this.allocateArray (nsize);\r
-System.arraycopy (this.array, 0, narray, 0, Math.min (nsize, this.getArrayLength ()));\r
-this.array = narray;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "shiftEnd", \r
-function (newSize) {\r
-var oldSize = this.getArrayLength ();\r
-var oldGapEnd = this.g1;\r
-var upperSize = oldSize - oldGapEnd;\r
-var arrayLength = this.getNewArraySize (newSize);\r
-var newGapEnd = arrayLength - upperSize;\r
-this.resize (arrayLength);\r
-this.g1 = newGapEnd;\r
-if (upperSize != 0) {\r
-System.arraycopy (this.array, oldGapEnd, this.array, newGapEnd, upperSize);\r
-}}, "~N");\r
-Clazz.defineMethod (c$, "getNewArraySize", \r
-function (reqSize) {\r
-return (reqSize + 1) * 2;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "shiftGap", \r
-function (newGapStart) {\r
-if (newGapStart == this.g0) {\r
-return;\r
-}var oldGapStart = this.g0;\r
-var dg = newGapStart - oldGapStart;\r
-var oldGapEnd = this.g1;\r
-var newGapEnd = oldGapEnd + dg;\r
-var gapSize = oldGapEnd - oldGapStart;\r
-this.g0 = newGapStart;\r
-this.g1 = newGapEnd;\r
-if (dg > 0) {\r
-System.arraycopy (this.array, oldGapEnd, this.array, oldGapStart, dg);\r
-} else if (dg < 0) {\r
-System.arraycopy (this.array, newGapStart, this.array, newGapEnd, -dg);\r
-}}, "~N");\r
-Clazz.defineMethod (c$, "shiftGapStartDown", \r
-function (newGapStart) {\r
-this.g0 = newGapStart;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "shiftGapEndUp", \r
-function (newGapEnd) {\r
-this.g1 = newGapEnd;\r
-}, "~N");\r
+Clazz.declarePackage ("javax.swing.text");
+c$ = Clazz.decorateAsClass (function () {
+this.array = null;
+this.g0 = 0;
+this.g1 = 0;
+Clazz.instantialize (this, arguments);
+}, javax.swing.text, "GapVector");
+Clazz.makeConstructor (c$, 
+function () {
+this.construct (10);
+});
+Clazz.makeConstructor (c$, 
+function (initialLength) {
+this.array = this.allocateArray (initialLength);
+this.g0 = 0;
+this.g1 = initialLength;
+}, "~N");
+Clazz.defineMethod (c$, "getArray", 
+function () {
+return this.array;
+});
+Clazz.defineMethod (c$, "getGapStart", 
+function () {
+return this.g0;
+});
+Clazz.defineMethod (c$, "getGapEnd", 
+function () {
+return this.g1;
+});
+Clazz.defineMethod (c$, "replace", 
+function (position, rmSize, addItems, addSize) {
+var addOffset = 0;
+if (addSize == 0) {
+this.close (position, rmSize);
+return;
+} else if (rmSize > addSize) {
+this.close (position + addSize, rmSize - addSize);
+} else {
+var endSize = addSize - rmSize;
+var end = this.open (position + rmSize, endSize);
+System.arraycopy (addItems, rmSize, this.array, end, endSize);
+addSize = rmSize;
+}System.arraycopy (addItems, addOffset, this.array, position, addSize);
+}, "~N,~N,~O,~N");
+Clazz.defineMethod (c$, "close", 
+function (position, nItems) {
+if (nItems == 0) return;
+var end = position + nItems;
+var new_gs = (this.g1 - this.g0) + nItems;
+if (end <= this.g0) {
+if (this.g0 != end) {
+this.shiftGap (end);
+}this.shiftGapStartDown (this.g0 - nItems);
+} else if (position >= this.g0) {
+if (this.g0 != position) {
+this.shiftGap (position);
+}this.shiftGapEndUp (this.g0 + new_gs);
+} else {
+this.shiftGapStartDown (position);
+this.shiftGapEndUp (this.g0 + new_gs);
+}}, "~N,~N");
+Clazz.defineMethod (c$, "open", 
+function (position, nItems) {
+var gapSize = this.g1 - this.g0;
+if (nItems == 0) {
+if (position > this.g0) position += gapSize;
+return position;
+}this.shiftGap (position);
+if (nItems >= gapSize) {
+this.shiftEnd (this.getArrayLength () - gapSize + nItems);
+gapSize = this.g1 - this.g0;
+}this.g0 = this.g0 + nItems;
+return position;
+}, "~N,~N");
+Clazz.defineMethod (c$, "resize", 
+function (nsize) {
+var narray = this.allocateArray (nsize);
+System.arraycopy (this.array, 0, narray, 0, Math.min (nsize, this.getArrayLength ()));
+this.array = narray;
+}, "~N");
+Clazz.defineMethod (c$, "shiftEnd", 
+function (newSize) {
+var oldSize = this.getArrayLength ();
+var oldGapEnd = this.g1;
+var upperSize = oldSize - oldGapEnd;
+var arrayLength = this.getNewArraySize (newSize);
+var newGapEnd = arrayLength - upperSize;
+this.resize (arrayLength);
+this.g1 = newGapEnd;
+if (upperSize != 0) {
+System.arraycopy (this.array, oldGapEnd, this.array, newGapEnd, upperSize);
+}}, "~N");
+Clazz.defineMethod (c$, "getNewArraySize", 
+function (reqSize) {
+return (reqSize + 1) * 2;
+}, "~N");
+Clazz.defineMethod (c$, "shiftGap", 
+function (newGapStart) {
+if (newGapStart == this.g0) {
+return;
+}var oldGapStart = this.g0;
+var dg = newGapStart - oldGapStart;
+var oldGapEnd = this.g1;
+var newGapEnd = oldGapEnd + dg;
+var gapSize = oldGapEnd - oldGapStart;
+this.g0 = newGapStart;
+this.g1 = newGapEnd;
+if (dg > 0) {
+System.arraycopy (this.array, oldGapEnd, this.array, oldGapStart, dg);
+} else if (dg < 0) {
+System.arraycopy (this.array, newGapStart, this.array, newGapEnd, -dg);
+}}, "~N");
+Clazz.defineMethod (c$, "shiftGapStartDown", 
+function (newGapStart) {
+this.g0 = newGapStart;
+}, "~N");
+Clazz.defineMethod (c$, "shiftGapEndUp", 
+function (newGapEnd) {
+this.g1 = newGapEnd;
+}, "~N");