You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sa...@apache.org on 2002/06/26 21:03:06 UTC
cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/util IntegerArray.java
santiagopg 2002/06/26 12:03:06
Modified: java/src/org/apache/xalan/xsltc/util IntegerArray.java
Log:
Fixed bug in clone().
Revision Changes Path
1.2 +14 -10 xml-xalan/java/src/org/apache/xalan/xsltc/util/IntegerArray.java
Index: IntegerArray.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/util/IntegerArray.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IntegerArray.java 17 Apr 2001 18:52:49 -0000 1.1
+++ IntegerArray.java 26 Jun 2002 19:03:06 -0000 1.2
@@ -87,7 +87,9 @@
}
public Object clone() {
- return new IntegerArray(_array);
+ final IntegerArray clone = new IntegerArray(_array);
+ clone._free = _free;
+ return clone;
}
public int[] toIntArray() {
@@ -105,23 +107,24 @@
}
public int indexOf(int n) {
- for (int i = 0; i < _free; i++)
- if (n == _array[i])
- return i;
+ for (int i = 0; i < _free; i++) {
+ if (n == _array[i]) return i;
+ }
return -1;
}
public final void add(int value) {
- if (_free == _size)
+ if (_free == _size) {
growArray(_size * 2);
+ }
_array[_free++] = value;
}
/** adds new int at the end if not already present */
public void addNew(int value) {
- for (int i = 0; i < _free; i++)
- if (_array[i] == value) // already in array
- return;
+ for (int i = 0; i < _free; i++) {
+ if (_array[i] == value) return; // already in array
+ }
add(value);
}
@@ -163,7 +166,8 @@
}
out.println(_array[_free - 1]);
}
- else
+ else {
out.println("IntegerArray: empty");
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org