You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mo...@apache.org on 2001/10/05 08:26:50 UTC
cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/dom BitArray.java
morten 01/10/04 23:26:50
Modified: java/src/org/apache/xalan/xsltc/dom BitArray.java
Log:
Made a global data-structure static (it should have been in the first place)
to make instanciation of this class a bit faster. Also, made it implement
the Externalizable interface to ensure that the DOM can be serialized.
PR: n/a
Obtained from: n/a
Submitted by: morten@xml.apache.org
Reviewed by: morten@xml.apache.org
Revision Changes Path
1.3 +27 -3 xml-xalan/java/src/org/apache/xalan/xsltc/dom/BitArray.java
Index: BitArray.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/BitArray.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BitArray.java 2001/09/19 15:53:42 1.2
+++ BitArray.java 2001/10/05 06:26:50 1.3
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: BitArray.java,v 1.2 2001/09/19 15:53:42 morten Exp $
+ * @(#)$Id: BitArray.java,v 1.3 2001/10/05 06:26:50 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -62,11 +62,16 @@
package org.apache.xalan.xsltc.dom;
+import java.io.Externalizable;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.IOException;
+
import org.apache.xalan.xsltc.DOM;
import org.apache.xalan.xsltc.NodeIterator;
-public class BitArray {
+public class BitArray implements Externalizable {
private int[] _bits;
private int _bitSize;
@@ -75,7 +80,7 @@
// This table is used to prevent expensive shift operations
// (These operations are inexpensive on CPUs but very expensive on JVMs.)
- private final int[] _masks = {
+ private final static int[] _masks = {
0x80000000, 0x40000000, 0x20000000, 0x10000000,
0x08000000, 0x04000000, 0x02000000, 0x01000000,
0x00800000, 0x00400000, 0x00200000, 0x00100000,
@@ -257,6 +262,25 @@
public BitArray cloneArray() {
return(new BitArray(_intSize, _bits));
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeInt(_bitSize);
+ out.writeInt(_mask);
+ out.writeObject(_bits);
+ out.flush();
+ }
+
+ /**
+ * Read the whole tree from a file (serialized)
+ */
+ public void readExternal(ObjectInput in)
+ throws IOException, ClassNotFoundException {
+ _bitSize = in.readInt();
+ _intSize = (_bitSize >>> 5) + 1;
+ _mask = in.readInt();
+ _bits = (int[])in.readObject();
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org