You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2013/02/14 23:55:06 UTC
svn commit: r1446378 [3/3] - in
/uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src:
main/java/org/apache/uima/cas/impl/ main/java/org/apache/uima/util/impl/
test/java/org/apache/uima/cas/impl/
Propchange: uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java?rev=1446378&r1=1446377&r2=1446378&view=diff
==============================================================================
--- uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java (original)
+++ uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java Thu Feb 14 22:55:06 2013
@@ -79,6 +79,7 @@ import org.apache.uima.cas.admin.CASMgr;
import org.apache.uima.cas.admin.FSIndexComparator;
import org.apache.uima.cas.admin.FSIndexRepositoryMgr;
import org.apache.uima.cas.admin.TypeSystemMgr;
+import org.apache.uima.cas.impl.BinaryCasSerDes6.ReuseInfo;
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.cas.text.AnnotationIndex;
import org.apache.uima.cas.text.Language;
@@ -1160,9 +1161,14 @@ public class CASImpl extends AbstractCas
* @param istream
* @throws CASRuntimeException
*/
+
public void reinit(InputStream istream) throws CASRuntimeException {
+ reinit(istream, null);
+ }
+
+ public void reinit(InputStream istream, ReuseInfo rfs) throws CASRuntimeException {
if (this != this.svd.baseCAS) {
- this.svd.baseCAS.reinit(istream);
+ this.svd.baseCAS.reinit(istream, rfs);
return;
}
@@ -1194,7 +1200,7 @@ public class CASImpl extends AbstractCas
if (compressedVersion == 0) {
(new BinaryCasSerDes4(this.getTypeSystemImpl())).deserialize(this, dis, delta);
} else {
- (new BinaryCasSerDes5(this.getTypeSystemImpl())).deserialize(this, dis, delta);
+ (new BinaryCasSerDes6(this, rfs)).deserializeAfterVersion(dis, delta);
}
return;
}
@@ -1369,8 +1375,12 @@ public class CASImpl extends AbstractCas
}
} // of delta - modified processing
} catch (IOException e) {
+ String msg = e.getMessage();
+ if (msg == null) {
+ msg = e.toString();
+ }
CASRuntimeException exception = new CASRuntimeException(
- CASRuntimeException.BLOB_DESERIALIZATION, new String[] { e.getMessage() });
+ CASRuntimeException.BLOB_DESERIALIZATION, new String[] { msg });
throw exception;
}
}
Added: uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasSeqAddrMaps.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasSeqAddrMaps.java?rev=1446378&view=auto
==============================================================================
--- uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasSeqAddrMaps.java (added)
+++ uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasSeqAddrMaps.java Thu Feb 14 22:55:06 2013
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.cas.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.uima.internal.util.IntVector;
+import org.apache.uima.internal.util.rb_trees.IntRedBlackTree;
+
+/**
+ * Manage the conversion of Items (FSrefs) to relative sequential index number, and back
+ * Manage the difference in two type systems
+ * both size of the FSs and
+ * handling excluded types
+ *
+ * During serialization, these maps are constructed before serialization.
+ * During deserialization, these maps are constructed while things are being deserialized, and
+ * then used in a "fixup" call at the end.
+ * This allows for forward references.
+ *
+ * For delta deserialization, the base part of these maps (for below-the-line) is
+ * constructed by scanning up to the mark.
+ */
+public class CasSeqAddrMaps {
+
+ /**
+ * map from a target FS sequence nbr to a source address.
+ * value is 0 if the target instance doesn't exist in the source
+ * (this doesn't occur for receiving remote CASes back
+ * (because src ts is always a superset of tgt ts),
+ * but can occur while deserializing from Disk.
+ *
+ * First seq number is 0.
+ */
+ final private IntVector tgtSeq2SrcAddr = new IntVector();
+
+// /**
+// * (Not Used, currently)
+// * map from a source seq number to a target seq number.
+// * value is -1 if the source FS is not in the target
+// */
+// final private IntVector srcSeq2TgtSeq = new IntVector();
+
+// /**
+// * (Not Used, currently)
+// * map from a target seq number to a target address.
+// */
+// final private IntVector tgtSeq2TgtAddr = new IntVector(); // used for comparing
+
+ /**
+ * map from source address to target sequence number.
+ * if source is not in target, value = -1;
+ */
+ final private IntRedBlackTree srcAddr2TgtSeq = new IntRedBlackTree();
+
+ /**
+ * info needed to do a map from target aux heap to source aux heap
+ * Used when applying delta modifications "below the line" to these elements
+ * Assumes any target ts element exists in source ts, so target is a subset
+ * (due to type merging, when delta cas is used to return updates from service)
+ */
+
+
+ /**
+ * Indexed by AuxHeap kind:
+ */
+
+// final private List<List<AuxSkip>> skips = new ArrayList<List<AuxSkip>>(AuxHeap.values().length);
+//
+// { // initialize instance block
+// for (int i = 0; i < skips.size(); i++) {
+// skips.add(new ArrayList<AuxSkip>());
+// }
+// }
+
+ private int nextTgt = 0;
+
+ public CasSeqAddrMaps() {
+ // this call makes the first real seq number == 1.
+ // seq 0 refers to the NULL fs value at heap location 0.
+ addItemAddr(0, 0, true);
+ }
+
+ /**
+ * Add a new FS address - done during prescan of source
+ * Must call in heap scan order
+ * @param addr
+ * @param inTarget true if this type is in the target
+ */
+ public void addItemAddr(int srcAddr, int tgtAddr, boolean inTarget) {
+ if (inTarget) {
+ tgtSeq2SrcAddr.add(srcAddr);
+// tgtSeq2TgtAddr.add(tgtAddr);
+ }
+ srcAddr2TgtSeq.put(srcAddr, inTarget ? nextTgt++ : -1);
+// // debug
+// if (srcAddr < 525) {
+// System.out.format("Adding to srcAddr2TgtSeq: addr: %d tgtSeq: %d, type=%s%n", srcAddr, inTarget ? i : 0,
+// );
+// }
+// srcSeq2TgtSeq.add(inTarget ? nextTgt++ : 0);
+ }
+
+// /**
+// * record skipped entries in an Aux heap
+// * @param auxHeap which heap this is for
+// * @param srcSkipIndex the index of the first skipped slot in the src heap
+// * @param srcSkipSize the number of entries skipped
+// */
+// public void recordSkippedAuxHeap(AuxHeap auxHeap, int srcSkipIndex, int srcSkipSize) {
+// skips.get(auxHeap.ordinal()).add(new AuxSkip(srcSkipIndex, srcSkipSize));
+// }
+
+ /**
+ * Called during deserialize to incrementally add
+ * @param srcAddr
+ * @param inSrc
+ */
+ public void addSrcAddrForTgt(int srcAddr, boolean inSrc) {
+ if (inSrc) {
+ srcAddr2TgtSeq.put(srcAddr, nextTgt);
+// srcSeq2TgtSeq.add(nextTgt);
+ tgtSeq2SrcAddr.add(srcAddr);
+ } else {
+ tgtSeq2SrcAddr.add(0);
+ }
+// tgtSeq2TgtAddr.add(-1); // not used I hope - need to check TODO
+ nextTgt++;
+ }
+
+ public int getSrcAddrFromTgtSeq(int seq) {
+ return tgtSeq2SrcAddr.get(seq);
+ }
+
+// public int getTgtAddrFromTgtSeq(int seq) {
+// return tgtSeq2TgtAddr.get(seq);
+// }
+
+// public int getMappedItemAddr(int index) {
+// if (null == typeMapper) {
+// return tgtIndexToSeq.get(index);
+// } else {
+// return tgtItemIndexToAddr.get(index);
+// }
+// }
+
+ public int getTgtSeqFromSrcAddr(int itemAddr) {
+ return srcAddr2TgtSeq.get(itemAddr);
+ }
+
+ public int getNumberSrcFss() {
+ return srcAddr2TgtSeq.size();
+ }
+}
Propchange: uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasSeqAddrMaps.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/cas/impl/SlotKinds.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/cas/impl/SlotKinds.java?rev=1446378&view=auto
==============================================================================
--- uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/cas/impl/SlotKinds.java (added)
+++ uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/cas/impl/SlotKinds.java Thu Feb 14 22:55:06 2013
@@ -0,0 +1,111 @@
+package org.apache.uima.cas.impl;
+
+/**
+ * The kinds of slots that can exist
+ * an index for getting type-code specific values,
+ * flag - whether or not they should be diff encoded
+ * flag - if they can be negative (and need their sign moved)
+ *
+ * Some are real slots in the heap; others are descriptions of
+ * parts of values, eg. float exponent
+ *
+ * Difference encoding costs 1 bit.
+ * Measurements show it can lessen zip's effectiveness
+ * (especially for single byte values (?)),
+ * probably because it causes more dispersion in
+ * the value kinds.
+ * Because of this 2-fold cost (1 bit and less zip),
+ * differencing being tried only for multi-byte
+ * values (short, int, long), and heap refs
+ * - for array values, diff is with prev array value
+ * (for 1st value in array, diff is with prev FeatureStructure
+ * of the same type in the heap's 1st value if it exists
+ * - for non-array values or 1st array value, diff is with
+ * prev heap value for same type in heap
+ *
+ * Not done for float parts - exponent too short, and
+ * mantissa too random.
+ *
+ * CanBeNegative
+ * Many values are only positive e.g., array lengths
+ * Some values can be negative
+ * (all difference-encoded things can be negative)
+ * Represent as 1 bit + positive number, sign bit in
+ * least sig. bit position. This allows the
+ * bits to cluster closer to 0 on the positive side,
+ * which can make for fewer bytes to represent the number.
+ */
+
+/**
+ * NOTE: adding or altering slots breaks backward compatability and
+ * the ability do deserialize previously serialized things
+ *
+ * This definition shared with BinaryCasSerDes4
+ *
+ * Define all the slot kinds.
+ */
+public class SlotKinds {
+ public static final boolean CAN_BE_NEGATIVE = true;
+ public static final boolean IGNORED = true;
+ public static final boolean IN_MAIN_HEAP = true;
+
+ public enum SlotKind {
+ Slot_ArrayLength( ! CAN_BE_NEGATIVE, 4, IN_MAIN_HEAP),
+ Slot_HeapRef( CAN_BE_NEGATIVE, 4, IN_MAIN_HEAP),
+ Slot_Int( CAN_BE_NEGATIVE, 4, IN_MAIN_HEAP),
+ Slot_Byte( ! CAN_BE_NEGATIVE, 4, IN_MAIN_HEAP),
+ Slot_Short( CAN_BE_NEGATIVE, 4, IN_MAIN_HEAP),
+ Slot_TypeCode( ! CAN_BE_NEGATIVE, 4, IN_MAIN_HEAP),
+
+ Slot_StrOffset( ! CAN_BE_NEGATIVE, 4, !IN_MAIN_HEAP),
+ Slot_StrLength( ! CAN_BE_NEGATIVE, 4, !IN_MAIN_HEAP),
+ Slot_Long_High( CAN_BE_NEGATIVE, 0, !IN_MAIN_HEAP),
+ Slot_Long_Low ( CAN_BE_NEGATIVE, 0, !IN_MAIN_HEAP),
+
+ // the next are not actual slot kinds, but instead
+ // are codes used to control encoding of Floats and Doubles.
+ Slot_Float_Mantissa_Sign( ! CAN_BE_NEGATIVE, 0, !IN_MAIN_HEAP),
+ // exponent is 8 bits, and shifted in the expectation
+ // that many values may be between 1 and 0 (e.g., normalized values)
+ // -- so sign moving is needed
+ Slot_Float_Exponent( ! CAN_BE_NEGATIVE, 0, !IN_MAIN_HEAP),
+
+ Slot_Double_Mantissa_Sign(! CAN_BE_NEGATIVE, 0, !IN_MAIN_HEAP),
+ Slot_Double_Exponent( ! CAN_BE_NEGATIVE, 0, !IN_MAIN_HEAP),
+ Slot_FsIndexes( CAN_BE_NEGATIVE, 4, !IN_MAIN_HEAP),
+
+ Slot_StrChars( IGNORED, 2, !IN_MAIN_HEAP),
+
+ Slot_Control( IGNORED, 0, !IN_MAIN_HEAP),
+ Slot_StrSeg( ! CAN_BE_NEGATIVE, 0, ! IN_MAIN_HEAP),
+
+ // the next slots are not serialized
+ Slot_StrRef( CAN_BE_NEGATIVE, 4, IN_MAIN_HEAP),
+ Slot_BooleanRef( ! CAN_BE_NEGATIVE, 4, IN_MAIN_HEAP),
+ Slot_ByteRef( CAN_BE_NEGATIVE, 4, IN_MAIN_HEAP),
+ Slot_ShortRef( CAN_BE_NEGATIVE, 4, IN_MAIN_HEAP),
+ Slot_LongRef( CAN_BE_NEGATIVE, 4, IN_MAIN_HEAP),
+ Slot_DoubleRef( CAN_BE_NEGATIVE, 4, IN_MAIN_HEAP),
+ Slot_Float( ! CAN_BE_NEGATIVE, 4, IN_MAIN_HEAP),
+ Slot_Boolean( ! CAN_BE_NEGATIVE, 4, IN_MAIN_HEAP),
+ // next used to capture original heap size
+ Slot_MainHeap( IGNORED, 4, !IN_MAIN_HEAP),
+
+ ;
+ public final boolean canBeNegative;
+ public final boolean inMainHeap;
+ public final int elementSize;
+
+ public static final int NBR_SLOT_KIND_ZIP_STREAMS;
+ static {NBR_SLOT_KIND_ZIP_STREAMS = Slot_StrRef.ordinal();}
+
+ SlotKind(boolean canBeNegative,
+ int elementSize,
+ boolean inMainHeap) {
+ this.canBeNegative =canBeNegative;
+ this.elementSize = elementSize;
+ this.inMainHeap = inMainHeap;
+ }
+ }
+}
+
Propchange: uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/cas/impl/SlotKinds.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java?rev=1446378&r1=1446377&r2=1446378&view=diff
==============================================================================
--- uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java (original)
+++ uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java Thu Feb 14 22:55:06 2013
@@ -19,19 +19,19 @@
package org.apache.uima.cas.impl;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_ArrayLength;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_Boolean;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_Byte;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_ByteRef;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_DoubleRef;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_Float;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_HeapRef;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_Int;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_LongRef;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_Short;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_ShortRef;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_StrRef;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_TypeCode;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_ArrayLength;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_Boolean;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_Byte;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_ByteRef;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_DoubleRef;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_Float;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_HeapRef;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_Int;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_LongRef;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_Short;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_ShortRef;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_StrRef;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_TypeCode;
import java.util.ArrayList;
import java.util.Arrays;
@@ -50,7 +50,7 @@ import org.apache.uima.cas.TypeNameSpace
import org.apache.uima.cas.TypeSystem;
import org.apache.uima.cas.admin.CASAdminException;
import org.apache.uima.cas.admin.TypeSystemMgr;
-import org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind;
+import org.apache.uima.cas.impl.SlotKinds.SlotKind;
import org.apache.uima.internal.util.IntVector;
import org.apache.uima.internal.util.StringToIntMap;
import org.apache.uima.internal.util.SymbolTable;
Modified: uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/util/impl/SerializationMeasures.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/util/impl/SerializationMeasures.java?rev=1446378&r1=1446377&r2=1446378&view=diff
==============================================================================
--- uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/util/impl/SerializationMeasures.java (original)
+++ uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/util/impl/SerializationMeasures.java Thu Feb 14 22:55:06 2013
@@ -18,27 +18,27 @@
*/
package org.apache.uima.util.impl;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.CAN_BE_NEGATIVE;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.IN_MAIN_HEAP;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_ArrayLength;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_Byte;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_Double_Exponent;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_Double_Mantissa_Sign;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_Float_Exponent;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_Float_Mantissa_Sign;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_FsIndexes;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_HeapRef;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_Int;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_Long_High;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_Long_Low;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_MainHeap;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_Short;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_StrChars;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_StrLength;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_StrOffset;
-import static org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind.Slot_TypeCode;
+import static org.apache.uima.cas.impl.SlotKinds.CAN_BE_NEGATIVE;
+import static org.apache.uima.cas.impl.SlotKinds.IN_MAIN_HEAP;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_ArrayLength;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_Byte;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_Double_Exponent;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_Double_Mantissa_Sign;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_Float_Exponent;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_Float_Mantissa_Sign;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_FsIndexes;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_HeapRef;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_Int;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_Long_High;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_Long_Low;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_MainHeap;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_Short;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_StrChars;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_StrLength;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_StrOffset;
+import static org.apache.uima.cas.impl.SlotKinds.SlotKind.Slot_TypeCode;
-import org.apache.uima.cas.impl.BinaryCasSerDes5.SlotKind;
+import org.apache.uima.cas.impl.SlotKinds.SlotKind;
/**
Modified: uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest.java?rev=1446378&r1=1446377&r2=1446378&view=diff
==============================================================================
--- uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest.java (original)
+++ uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest.java Thu Feb 14 22:55:06 2013
@@ -45,8 +45,11 @@ import org.apache.uima.cas.Type;
import org.apache.uima.cas.TypeSystem;
import org.apache.uima.cas.admin.FSIndexRepositoryMgr;
import org.apache.uima.cas.admin.TypeSystemMgr;
+import org.apache.uima.cas.impl.BinaryCasSerDes6.ReuseInfo;
import org.apache.uima.cas.test.AnnotatorInitializer;
import org.apache.uima.cas.test.CASInitializer;
+import org.apache.uima.internal.util.IntListIterator;
+import org.apache.uima.internal.util.rb_trees.IntArrayRBT;
import org.apache.uima.util.CasCreationUtils;
import org.apache.uima.util.impl.SerializationMeasures;
@@ -724,19 +727,19 @@ public class SerDesTest extends TestCase
private void verify() {
try {
- BinaryCasSerDes5 bcs = new BinaryCasSerDes5(ts);
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
if (doPlain) {
(new CASSerializer()).addCAS(cas, baos);
} else {
- SerializationMeasures sm = bcs.serialize(cas, baos);
+ BinaryCasSerDes6 bcs = new BinaryCasSerDes6(cas);
+ SerializationMeasures sm = bcs.serialize(baos);
if (null != sm) {
System.out.println(sm);
}
}
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
deserCas.reinit(bais);
- assertTrue(BinaryCasSerDes5.compareCASes(cas, deserCas));
+ assertTrue(BinaryCasSerDes6.compareCASes(cas, deserCas));
} catch (IOException e) {
throw new RuntimeException(e);
}
@@ -744,17 +747,19 @@ public class SerDesTest extends TestCase
private void verifyDelta(MarkerImpl mark) {
try {
+ ReuseInfo ri = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- BinaryCasSerDes5 bcs = new BinaryCasSerDes5(ts);
if (doPlain) {
Serialization.serializeCAS(cas, baos);
} else {
- SerializationMeasures sm = bcs.serialize(cas, baos, mark, cas.getTypeSystemImpl());
- System.out.println(sm);
+ BinaryCasSerDes6 bcs = new BinaryCasSerDes6(cas, mark);
+ SerializationMeasures sm = bcs.serialize(baos);
+ if (sm != null) {System.out.println(sm);}
+ ri = bcs.getReuseInfo();
}
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- deltaCas.reinit(bais);
- assertTrue(BinaryCasSerDes5.compareCASes(cas, deltaCas));
+ deltaCas.reinit(bais, ri);
+ assertTrue(BinaryCasSerDes6.compareCASes(cas, deltaCas));
// verify indexed fs same, and in same order - already done by compareCASes
// int[] fsIndexes1 = cas.getIndexedFSs();