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 2016/11/01 17:51:07 UTC
svn commit: r1767533 [1/2] - in
/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src:
main/java/org/apache/uima/jcas/cas/ test/java/org/apache/uima/jcas/test/
test/resources/SerDes4/
Author: schor
Date: Tue Nov 1 17:51:07 2016
New Revision: 1767533
URL: http://svn.apache.org/viewvc?rev=1767533&view=rev
Log:
[UIMA-5164] add 2 new built-in types, FSArrayList and IntegerArrayList. Add tests for these. Update the SerDes4 tests because new built-in types implies that the type system has changed.
Added:
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/FSArrayList.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/IntegerArrayList.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/FSArrayListTest.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/IntegerArrayListTest.java
Modified:
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/CASInitializer.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/JCasTest.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/resources/SerDes4/AllKinds.binary
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/resources/SerDes4/ArrayAuxLongs.binary
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/resources/SerDes4/ArrayAuxStrings.binary
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/resources/SerDes4/DeltaWithIndexMods.binary
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/resources/SerDes4/DeltaWithMods.binary
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/resources/SerDes4/DeltaWithRefsBelow.binary
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/resources/SerDes4/SavedInts.binary
Added: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/FSArrayList.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/FSArrayList.java?rev=1767533&view=auto
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/FSArrayList.java (added)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/FSArrayList.java Tue Nov 1 17:51:07 2016
@@ -0,0 +1,610 @@
+/*
+ * 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.jcas.cas;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.RandomAccess;
+import java.util.Spliterator;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.function.UnaryOperator;
+import java.util.stream.Stream;
+
+import org.apache.uima.UimaSerializableFSs;
+import org.apache.uima.cas.CASRuntimeException;
+import org.apache.uima.cas.CommonArrayFS;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FeatureStructureImplC;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.impl.TypeSystemImpl;
+import org.apache.uima.internal.util.Misc;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+
+/**
+ * An ArrayList type containing Feature Structures, for UIMA
+ * - Has all the methods of List
+ * - Implements the select(...) APIs
+ *
+ * Implementation notes:
+ * - Uses UimaSerializable APIs
+ * - two implementations of the array list:
+ * -- one uses the original FSArray, via an asList wrapper
+ * -- This is used until an add or remove operation;
+ * --- switches to ArrayList, resetting the original FSArray to null
+ *
+ * - This enables operation without creating the Java Object in use cases of deserializing and
+ * referencing when updating is not being used.
+ */
+public final class FSArrayList <T extends TOP> extends TOP implements
+ UimaSerializableFSs, CommonArray, CommonArrayFS, SelectViaCopyToArray,
+ List<T>, RandomAccess, Cloneable {
+
+ private final static List<? extends TOP> EMPTY_LIST = (List<? extends TOP>) Arrays.asList(new TOP[0]);
+ /**
+ * each cover class when loaded sets an index. used in the JCas typeArray to go from the cover
+ * class or class instance to the corresponding instance of the _Type class
+ */
+ public final static int typeIndexID = JCasRegistry.register(FSArrayList.class);
+
+ public final static int type = typeIndexID;
+
+ /**
+ * used to obtain reference to the _Type instance
+ *
+ * @return the type array index
+ */
+ // can't be factored - refs locally defined field
+ public int getTypeIndexID() {
+ return typeIndexID;
+ }
+
+ /**
+ * lifecycle
+ * - starts as empty array list
+ * - becomes non-empty when updated (add)
+ * -- used from that point on
+ */
+ private final List<T> fsArrayList;
+
+ /**
+ * lifecycle
+ * - starts as the empty list
+ * - set when _init_from_cas_data()
+ * - set to null when update (add/remove) happens
+ */
+ private List<T> fsArrayAsList = (List<T>) EMPTY_LIST;
+
+ public static final int _FI_fsArray = TypeSystemImpl.getAdjustedFeatureOffset("fsArray");
+
+ // never called. Here to disable default constructor
+ @SuppressWarnings("unused")
+ private FSArrayList() {
+ fsArrayList = null;
+ }
+
+ /**
+ * Make a new ArrayList
+ * @param jcas The JCas
+ * @param length initial size
+ */
+ public FSArrayList(JCas jcas) {
+ super(jcas);
+ fsArrayList = new ArrayList<>();
+
+ if (CASImpl.traceFSs) { // tracing done after array setting, skipped in super class
+ _casView.traceFSCreate(this);
+ }
+ }
+
+ /**
+ * Make a new ArrayList with an initial size
+ * @param jcas The JCas
+ * @param length initial size
+ */
+ public FSArrayList(JCas jcas, int length) {
+ super(jcas);
+ _casView.validateArraySize(length);
+ fsArrayList = new ArrayList<>(length);
+
+ if (CASImpl.traceFSs) { // tracing done after array setting, skipped in super class
+ _casView.traceFSCreate(this);
+ }
+ }
+
+ /**
+ * used by generator
+ * Make a new FSArrayList
+ * @param c -
+ * @param t -
+ */
+ public FSArrayList(TypeImpl t, CASImpl c) {
+ super(t, c);
+
+ if (CASImpl.traceFSs) { // tracing done after array setting, skipped in super class
+ _casView.traceFSCreate(this);
+ }
+ fsArrayList = new ArrayList<>();
+ }
+
+ // *------------------*
+ // * Feature: fsArray
+ /* getter for fsArray */
+ private FSArray getFsArray() { return (FSArray) _getFeatureValueNc(_FI_fsArray); }
+
+ /* setter for fsArray */
+ private void setFsArray(FSArray v) {
+ _setFeatureValueNcWj(_FI_fsArray, v); }
+
+ private void maybeStartUsingArrayList() {
+ if (fsArrayAsList != null) {
+ fsArrayList.clear();
+ fsArrayList.addAll(fsArrayAsList);
+ fsArrayAsList = null; // stop using this one
+ setFsArray(null); // clear
+ }
+ }
+
+ public void _init_from_cas_data() {
+ fsArrayAsList = (List<T>) Arrays.asList(getFsArray());
+ }
+
+ public void _save_to_cas_data() {
+ if (getFsArray() == null) {
+ FSArray a = new FSArray(_casView.getExistingJCas(), fsArrayList.size());
+ setFsArray(a);
+ fsArrayList.toArray(a._getTheArray());
+ }
+ }
+
+ private List<T> gl () {
+ return (null == fsArrayAsList)
+ ? fsArrayList
+ : fsArrayAsList;
+ }
+
+ /** return the indexed value from the corresponding Cas FSArray as a Java Model object. */
+ public T get(int i) {
+ return (T) _maybeGetPearFs(gl().get(i));
+ }
+
+ /**
+ * updates the i-th value of the FSArrayList
+ */
+ public T set(int i, T v) {
+
+ if (v != null && _casView.getBaseCAS() != v._casView.getBaseCAS()) {
+ /** Feature Structure {0} belongs to CAS {1}, may not be set as the value of an array or list element in a different CAS {2}.*/
+ throw new CASRuntimeException(CASRuntimeException.FS_NOT_MEMBER_OF_CAS, v, v._casView, _casView);
+ }
+ return gl().set(i, _maybeGetBaseForPearFs(v));
+ }
+
+ /** return the size of the array. */
+ public int size() {
+ return gl().size();
+ }
+
+ /**
+ * @see org.apache.uima.cas.ArrayFS#copyFromArray(FeatureStructure[], int, int, int)
+ */
+ public void copyFromArray(T[] src, int srcPos, int destPos, int length) {
+ int srcEnd = srcPos + length;
+ int destEnd = destPos + length;
+ if (srcPos < 0 ||
+ srcEnd > src.length ||
+ destEnd > size()) {
+ throw new ArrayIndexOutOfBoundsException(
+ String.format("FSArrayList.copyFromArray, srcPos: %,d destPos: %,d length: %,d", srcPos, destPos, length));
+ }
+ for (;srcPos < srcEnd && destPos < destEnd;) {
+ set(destPos++, src[srcPos++]);
+ }
+ }
+
+ /**
+ * @see org.apache.uima.cas.ArrayFS#copyToArray(int, FeatureStructure[], int, int)
+ */
+ public void copyToArray(int srcPos, FeatureStructure[] dest, int destPos, int length) {
+ int srcEnd = srcPos + length;
+ int destEnd = destPos + length;
+ if (srcPos < 0 ||
+ srcEnd > size() ||
+ destEnd > dest.length) {
+ throw new ArrayIndexOutOfBoundsException(
+ String.format("FSArrayList.copyToArray, srcPos: %,d destPos: %,d length: %,d", srcPos, destPos, length));
+ }
+ for (;srcPos < srcEnd && destPos < destEnd;) {
+ dest[destPos++] = _maybeGetPearFs(get(srcPos++));
+ }
+ }
+
+ /**
+ * @see org.apache.uima.cas.ArrayFS#toArray()
+ */
+ public FeatureStructure[] toArray() {
+ FeatureStructure[] r = new FeatureStructure[size()];
+ copyToArray(0, r, 0, size());
+ return r;
+ }
+
+ /**
+ * Not supported, will throw UnsupportedOperationException
+ */
+ public void copyFromArray(String[] src, int srcPos, int destPos, int length) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Copies an array of Feature Structures to an Array of Strings.
+ * The strings are the "toString()" representation of the feature structures,
+ *
+ * @param srcPos
+ * The index of the first element to copy.
+ * @param dest
+ * The array to copy to.
+ * @param destPos
+ * Where to start copying into <code>dest</code>.
+ * @param length
+ * The number of elements to copy.
+ * @exception ArrayIndexOutOfBoundsException
+ * If <code>srcPos < 0</code> or
+ * <code>length > size()</code> or
+ * <code>destPos + length > destArray.length</code>.
+ */
+ public void copyToArray(int srcPos, String[] dest, int destPos, int length) {
+ _casView.checkArrayBounds(size(), srcPos, length);
+ for (int i = 0; i < length; i++) {
+ FeatureStructure fs = _maybeGetPearFs(get(i + srcPos));
+ dest[i + destPos] = (fs == null) ? null : fs.toString();
+ }
+ }
+
+ public String[] toStringArray() {
+ final int size = size();
+ String[] strArray = new String[size];
+ copyToArray(0, strArray, 0, size);
+ return strArray;
+ }
+
+ /*
+ *
+ * (non-Javadoc)
+ * @see org.apache.uima.jcas.cas.CommonArray#copyValuesFrom(org.apache.uima.jcas.cas.CommonArray)
+ * no conversion to Pear trampolines done
+ */
+ @Override
+ public void copyValuesFrom(CommonArray v) {
+ T[] a;
+
+ if (v instanceof FSArrayList) {
+ a = (T[]) ((FSArrayList<T>)v).toArray();
+ } else if (v instanceof FSArray) {
+ a = (T[]) ((FSArray)v)._getTheArray();
+ } else {
+ throw new ClassCastException("argument must be of class FSArray or FSArrayList");
+ }
+ copyFromArray(a, 0, 0, a.length);
+ }
+
+ /**
+ * Convenience - create a FSArrayList from an existing FeatureStructure[]
+ * @param jcas -
+ * @param a -
+ * @return -
+ */
+ public static <N extends TOP> FSArrayList<N> create(JCas jcas, N[] a) {
+ FSArrayList<N> fsa = new FSArrayList<>(jcas, a.length);
+ fsa.copyFromArray(a, 0, 0, a.length);
+ return fsa;
+ }
+
+ public FeatureStructureImplC _superClone() {return clone();} // enable common clone
+
+ /**
+ * @param c
+ * @return
+ * @see java.util.AbstractCollection#containsAll(java.util.Collection)
+ */
+ public boolean containsAll(Collection<?> c) {
+ return gl().containsAll(c);
+ }
+
+ /**
+ * @return
+ * @see java.util.ArrayList#isEmpty()
+ */
+ public boolean isEmpty() {
+ return gl().isEmpty();
+ }
+
+ /**
+ * @param o
+ * @return
+ * @see java.util.ArrayList#contains(java.lang.Object)
+ */
+ public boolean contains(Object o) {
+ return gl().contains(o);
+ }
+
+ /**
+ * @param o
+ * @return
+ * @see java.util.ArrayList#indexOf(java.lang.Object)
+ */
+ public int indexOf(Object o) {
+ return gl().indexOf(o);
+ }
+
+ /**
+ * @param o
+ * @return
+ * @see java.util.ArrayList#lastIndexOf(java.lang.Object)
+ */
+ public int lastIndexOf(Object o) {
+ return gl().lastIndexOf(o);
+ }
+
+ /**
+ * @param a
+ * @return
+ * @see java.util.ArrayList#toArray(java.lang.Object[])
+ */
+ public <T> T[] toArray(T[] a) {
+ return gl().toArray(a);
+ }
+
+ /**
+ * @return
+ * @see java.util.AbstractCollection#toString()
+ */
+ public String toString() {
+ return gl().toString();
+ }
+
+ /**
+ * @param e
+ * @return
+ * @see java.util.ArrayList#add(java.lang.Object)
+ */
+ public boolean add(T e) {
+ maybeStartUsingArrayList();
+ return fsArrayList.add(e);
+ }
+
+ /**
+ * want equals to mean equal items, regardless of what format
+ * @param o -
+ * @return -
+ * @see java.util.AbstractList#equals(java.lang.Object)
+ */
+ public boolean equals(Object o) {
+ if (o instanceof FSArrayList) {
+ FSArrayList other = (FSArrayList) o;
+ if (size() == other.size()) {
+ for (int i = size() - 1; i >= 0; i--) {
+ if (!get(i).equals(other.get(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @param index
+ * @param element
+ * @see java.util.ArrayList#add(int, java.lang.Object)
+ */
+ public void add(int index, T element) {
+ maybeStartUsingArrayList();
+ fsArrayList.add(index, element);
+ }
+
+ /**
+ * @param index
+ * @return
+ * @see java.util.ArrayList#remove(int)
+ */
+ public T remove(int index) {
+ maybeStartUsingArrayList();
+ return fsArrayList.remove(index);
+ }
+
+ /**
+ * @param o
+ * @return
+ * @see java.util.ArrayList#remove(java.lang.Object)
+ */
+ public boolean remove(Object o) {
+ maybeStartUsingArrayList();
+ return fsArrayList.remove(o);
+ }
+
+ /**
+ * want hashcode to depend only on equal items, regardless of what format
+ * @return -
+ * @see java.util.AbstractList#hashCode()
+ */
+ public int hashCode() {
+ int hc = 1;
+ final int prime = 31;
+ for (int i = size() - 1; i >= 0; i++) {
+ hc = hc * prime + i;
+ hc = hc * prime + get(i).hashCode();
+ }
+ return hc;
+ }
+
+ /**
+ *
+ * @see java.util.ArrayList#clear()
+ */
+ public void clear() {
+ maybeStartUsingArrayList();
+ fsArrayList.clear();
+ }
+
+ /**
+ * @param c
+ * @return
+ * @see java.util.ArrayList#addAll(java.util.Collection)
+ */
+ public boolean addAll(Collection<? extends T> c) {
+ maybeStartUsingArrayList();
+ return fsArrayList.addAll(c);
+ }
+
+ /**
+ * @param index
+ * @param c
+ * @return
+ * @see java.util.ArrayList#addAll(int, java.util.Collection)
+ */
+ public boolean addAll(int index, Collection<? extends T> c) {
+ maybeStartUsingArrayList();
+ return fsArrayList.addAll(index, c);
+ }
+
+ /**
+ * @param c
+ * @return
+ * @see java.util.ArrayList#removeAll(java.util.Collection)
+ */
+ public boolean removeAll(Collection<?> c) {
+ maybeStartUsingArrayList();
+ return fsArrayList.removeAll(c);
+ }
+
+ /**
+ * @param c
+ * @return
+ * @see java.util.ArrayList#retainAll(java.util.Collection)
+ */
+ public boolean retainAll(Collection<?> c) {
+ maybeStartUsingArrayList();
+ return fsArrayList.retainAll(c);
+ }
+
+ /**
+ * @return
+ * @see java.util.Collection#stream()
+ */
+ public Stream<T> stream() {
+ return gl().stream();
+ }
+
+ /**
+ * @return
+ * @see java.util.Collection#parallelStream()
+ */
+ public Stream<T> parallelStream() {
+ return gl().parallelStream();
+ }
+
+ /**
+ * @param index
+ * @return
+ * @see java.util.ArrayList#listIterator(int)
+ */
+ public ListIterator<T> listIterator(int index) {
+ return gl().listIterator(index);
+ }
+
+ /**
+ * @return
+ * @see java.util.ArrayList#listIterator()
+ */
+ public ListIterator<T> listIterator() {
+ return gl().listIterator();
+ }
+
+ /**
+ * @return
+ * @see java.util.ArrayList#iterator()
+ */
+ public Iterator<T> iterator() {
+ return gl().iterator();
+ }
+
+ /**
+ * @param fromIndex
+ * @param toIndex
+ * @return
+ * @see java.util.ArrayList#subList(int, int)
+ */
+ public List<T> subList(int fromIndex, int toIndex) {
+ return gl().subList(fromIndex, toIndex);
+ }
+
+ /**
+ * @param action
+ * @see java.util.ArrayList#forEach(java.util.function.Consumer)
+ */
+ public void forEach(Consumer<? super T> action) {
+ gl().forEach(action);
+ }
+
+ /**
+ * @return
+ * @see java.util.ArrayList#spliterator()
+ */
+ public Spliterator<T> spliterator() {
+ return gl().spliterator();
+ }
+
+ /**
+ * @param filter
+ * @return
+ * @see java.util.ArrayList#removeIf(java.util.function.Predicate)
+ */
+ public boolean removeIf(Predicate<? super T> filter) {
+ maybeStartUsingArrayList();
+ return fsArrayList.removeIf(filter);
+ }
+
+ /**
+ * @param operator
+ * @see java.util.ArrayList#replaceAll(java.util.function.UnaryOperator)
+ */
+ public void replaceAll(UnaryOperator<T> operator) {
+ maybeStartUsingArrayList();
+ fsArrayList.replaceAll(operator);
+ }
+
+ /**
+ * @param c
+ * @see java.util.ArrayList#sort(java.util.Comparator)
+ */
+ public void sort(Comparator<? super T> c) {
+ gl().sort(c);
+ }
+
+}
Added: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/IntegerArrayList.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/IntegerArrayList.java?rev=1767533&view=auto
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/IntegerArrayList.java (added)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/IntegerArrayList.java Tue Nov 1 17:51:07 2016
@@ -0,0 +1,503 @@
+/*
+ * 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.jcas.cas;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.RandomAccess;
+import java.util.Spliterator;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.function.UnaryOperator;
+import java.util.stream.Stream;
+
+import org.apache.uima.List_of_ints;
+import org.apache.uima.UimaSerializable;
+import org.apache.uima.UimaSerializableFSs;
+import org.apache.uima.cas.CASRuntimeException;
+import org.apache.uima.cas.CommonArrayFS;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FeatureStructureImplC;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.impl.TypeSystemImpl;
+import org.apache.uima.internal.util.IntListIterator;
+import org.apache.uima.internal.util.IntVector;
+import org.apache.uima.internal.util.Misc;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+
+/**
+ * An ArrayList type containing ints, for UIMA
+ * - implements a subset of the List API, Iterable<Integer>, IntListIterator.
+ * - it is adjustable, like ArrayList
+ *
+ * Implementation notes:
+ * - Uses UimaSerializable APIs
+ * - two implementations of the array list:
+ * -- one uses the original IntegerArray, via a variant of the asList wrapper that returns ints
+ * -- This is used until an add or remove operation that changes the size.
+ * --- switches to IntVector, resetting the original IntegerArray to null
+ *
+ * - This enables operation without creating the Java Object in use cases of deserializing and
+ * referencing when updating is not being used.
+ */
+public final class IntegerArrayList extends TOP implements
+ Iterable<Integer>,
+ UimaSerializable, CommonArray,
+ RandomAccess, Cloneable {
+
+ /**
+ * each cover class when loaded sets an index. used in the JCas typeArray to go from the cover
+ * class or class instance to the corresponding instance of the _Type class
+ */
+ public final static int typeIndexID = JCasRegistry.register(IntegerArrayList.class);
+
+ public final static int type = typeIndexID;
+
+ /**
+ * used to obtain reference to the _Type instance
+ *
+ * @return the type array index
+ */
+ // can't be factored - refs locally defined field
+ public int getTypeIndexID() {
+ return typeIndexID;
+ }
+
+ /**
+ * lifecycle
+ * - starts as empty array list
+ * - becomes non-empty when updated (add)
+ * -- used from that point on
+ */
+ private final IntVector intArrayList;
+
+ /**
+ * lifecycle
+ * - starts as the empty list
+ * - set when _init_from_cas_data()
+ * - set to null when update (add/remove) happens
+ */
+ private List_of_ints intArrayAsList = List_of_ints.EMPTY_LIST();
+
+ public static final int _FI_intArray = TypeSystemImpl.getAdjustedFeatureOffset("intArray");
+
+ // never called. Here to disable default constructor
+ @SuppressWarnings("unused")
+ private IntegerArrayList() {
+ intArrayList = null;
+ }
+
+ /**
+ * Make a new ArrayList
+ * @param jcas The JCas
+ * @param length initial size
+ */
+ public IntegerArrayList(JCas jcas) {
+ super(jcas);
+ intArrayList = new IntVector();
+ if (CASImpl.traceFSs) { // tracing done after array setting, skipped in super class
+ _casView.traceFSCreate(this);
+ }
+ }
+
+ /**
+ * Make a new ArrayList with an initial size
+ * @param jcas The JCas
+ * @param length initial size
+ */
+ public IntegerArrayList(JCas jcas, int length) {
+ super(jcas);
+ _casView.validateArraySize(length);
+ intArrayList = new IntVector(length);
+
+ if (CASImpl.traceFSs) { // tracing done after array setting, skipped in super class
+ _casView.traceFSCreate(this);
+ }
+ }
+
+ /**
+ * used by generator
+ * Make a new FSArrayList
+ * @param c -
+ * @param t -
+ */
+ public IntegerArrayList(TypeImpl t, CASImpl c) {
+ super(t, c);
+
+ if (CASImpl.traceFSs) { // tracing done after array setting, skipped in super class
+ _casView.traceFSCreate(this);
+ }
+ intArrayList = new IntVector();
+ }
+
+ // *------------------*
+ // * Feature: fsArray
+ /* getter for fsArray */
+ private IntegerArray getIntegerArray() { return (IntegerArray) _getFeatureValueNc(_FI_intArray); }
+
+ /* setter for fsArray */
+ private void setIntegerArray(IntegerArray v) {
+ _setFeatureValueNcWj(_FI_intArray, v); }
+
+ private void maybeStartUsingIntegerArrayList() {
+ if (intArrayAsList != null) {
+ intArrayList.removeAllElements();
+ intArrayList.copyFromArray(intArrayAsList.toArrayMinCopy(), 0, 0, size());
+ intArrayAsList = null; // stop using this one
+ setIntegerArray(null); // clear
+ }
+ }
+
+ public void _init_from_cas_data() {
+ intArrayAsList = List_of_ints.newInstance(getIntegerArray()._getTheArray());
+ }
+
+ public void _save_to_cas_data() {
+ if (getIntegerArray() == null) {
+ IntegerArray a = new IntegerArray(_casView.getExistingJCas(), intArrayList.size());
+ setIntegerArray(a);
+ a.copyFromArray(intArrayList.getArray(), 0, 0, size());
+ }
+ }
+
+ /** return the indexed value from the corresponding Cas IntegerArray as a Java Model object. */
+ public int get(int i) {
+ return (null == intArrayAsList)
+ ? intArrayList.get(i)
+ : intArrayAsList.get(i);
+ }
+
+ /**
+ * updates the i-th value of the FSArrayList
+ */
+ public void set(int i, int v) {
+ if (null == intArrayAsList) {
+ intArrayList.set(i, v);
+ } else {
+ intArrayAsList.set(i, v);
+ }
+ }
+
+ /** return the size of the array. */
+ public int size() {
+ return (null == intArrayAsList)
+ ? intArrayList.size()
+ : intArrayAsList.size();
+ }
+
+ /**
+ * @see org.apache.uima.cas.ArrayFS#copyFromArray(FeatureStructure[], int, int, int)
+ */
+ public void copyFromArray(int[] src, int srcPos, int destPos, int length) {
+ int srcEnd = srcPos + length;
+ int destEnd = destPos + length;
+ if (srcPos < 0 ||
+ srcEnd > src.length ||
+ destEnd > size()) {
+ throw new ArrayIndexOutOfBoundsException(
+ String.format("FSArrayList.copyFromArray, srcPos: %,d destPos: %,d length: %,d", srcPos, destPos, length));
+ }
+ if (null == intArrayAsList) {
+ intArrayList.copyFromArray(src, srcPos, destPos, length);
+ } else {
+ intArrayAsList.copyFromArray(src, srcPos, destPos, length);
+ }
+ }
+
+ /**
+ * @see org.apache.uima.cas.ArrayFS#copyToArray(int, FeatureStructure[], int, int)
+ */
+ public void copyToArray(int srcPos, int[] dest, int destPos, int length) {
+ int srcEnd = srcPos + length;
+ int destEnd = destPos + length;
+ if (srcPos < 0 ||
+ srcEnd > size() ||
+ destEnd > dest.length) {
+ throw new ArrayIndexOutOfBoundsException(
+ String.format("FSArrayList.copyToArray, srcPos: %,d destPos: %,d length: %,d", srcPos, destPos, length));
+ }
+ if (null == intArrayAsList) {
+ intArrayList.copyToArray(srcPos, dest, destPos, length);
+ } else {
+ intArrayAsList.copyToArray(srcPos, dest, destPos, length);
+ }
+ }
+
+ /**
+ * @see org.apache.uima.cas.ArrayFS#toArray()
+ */
+ public int[] toArray() {
+ int[] r = new int[size()];
+ copyToArray(0, r, 0, size());
+ return r;
+ }
+
+ /**
+ * Not supported, will throw UnsupportedOperationException
+ */
+ public void copyFromArray(String[] src, int srcPos, int destPos, int length) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Copies an array of ints to an Array of Strings.
+ *
+ * @param srcPos
+ * The index of the first element to copy.
+ * @param dest
+ * The array to copy to.
+ * @param destPos
+ * Where to start copying into <code>dest</code>.
+ * @param length
+ * The number of elements to copy.
+ * @exception ArrayIndexOutOfBoundsException
+ * If <code>srcPos < 0</code> or
+ * <code>length > size()</code> or
+ * <code>destPos + length > destArray.length</code>.
+ */
+ public void copyToArray(int srcPos, String[] dest, int destPos, int length) {
+ _casView.checkArrayBounds(size(), srcPos, length);
+ for (int i = 0; i < length; i++) {
+ dest[i + destPos] = Integer.toBinaryString(get(srcPos + i));
+ }
+ }
+
+ public String[] toStringArray() {
+ final int size = size();
+ String[] strArray = new String[size];
+ copyToArray(0, strArray, 0, size);
+ return strArray;
+ }
+
+ /*
+ *
+ * (non-Javadoc)
+ * @see org.apache.uima.jcas.cas.CommonArray#copyValuesFrom(org.apache.uima.jcas.cas.CommonArray)
+ */
+ @Override
+ public void copyValuesFrom(CommonArray v) {
+ int[] a;
+
+ if (v instanceof IntegerArrayList) {
+ a = ((IntegerArrayList)v).intArrayList.getArray();
+ } else if (v instanceof IntegerArray) {
+ a = ((IntegerArray)v)._getTheArray();
+ } else {
+ throw new ClassCastException("argument must be of class IntegerArray or IntegerArrayList");
+ }
+
+ copyFromArray(a, 0, 0, a.length);
+ }
+
+ /**
+ * Convenience - create a FSArrayList from an existing FeatureStructure[]
+ * @param jcas -
+ * @param a -
+ * @return -
+ */
+ public static IntegerArrayList create(JCas jcas, int[] a) {
+ IntegerArrayList ial = new IntegerArrayList(jcas, a.length);
+ ial.copyFromArray(a, 0, 0, a.length);
+ return ial;
+ }
+
+ public FeatureStructureImplC _superClone() {return clone();} // enable common clone
+
+ /**
+ * @return
+ * @see java.util.ArrayList#isEmpty()
+ */
+ public boolean isEmpty() {
+ return size() == 0;
+ }
+
+ /**
+ * @param i -
+ * @return -
+ */
+ public boolean contains(int i) {
+ return indexOf(i) != -1;
+ }
+
+ /**
+ * @param i -
+ * @return -
+ * @see java.util.ArrayList#indexOf(java.lang.Object)
+ */
+ public int indexOf(int i) {
+ if (null == intArrayAsList) {
+ return intArrayList.indexOf(i);
+ }
+ return intArrayAsList.indexOf(i);
+ }
+
+ /**
+ * @param i -
+ * @return -
+ * @see java.util.ArrayList#lastIndexOf(java.lang.Object)
+ */
+ public int lastIndexOf(int i) {
+ if (null == intArrayAsList) {
+ return intArrayList.lastIndexOf(i);
+ }
+ return intArrayAsList.lastIndexOf(i);
+ }
+
+ /**
+ * @param a
+ * @return
+ * @see java.util.ArrayList#toArray(java.lang.Object[])
+ */
+ public int[] toArray(int[] a) {
+ return (null == intArrayAsList)
+ ? intArrayList.toArray()
+ : intArrayAsList.toArray();
+ }
+
+ /**
+ * @return -
+ * @see java.util.AbstractCollection#toString()
+ */
+ public String toString() {
+ return String.format("IntegerArrayList[size: %,d]", size());
+ }
+
+ /**
+ * @param e
+ * @return
+ * @see java.util.ArrayList#add(java.lang.Object)
+ */
+ public boolean add(int e) {
+ maybeStartUsingIntegerArrayList();
+ intArrayList.add(e);
+ return true;
+ }
+
+ /**
+ * @param o -
+ * @return true if all elements are the same, and in same order, and same number
+ * @see java.util.AbstractList#equals(java.lang.Object)
+ */
+ public boolean equals(Object o) {
+ if (o instanceof IntegerArrayList) {
+ IntegerArrayList other = (IntegerArrayList) o;
+ if (size() == other.size()) {
+ for (int i = size() - 1; i >= 0; i--) {
+ if (get(i) != other.get(i)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @param index
+ * @param element
+ * @see java.util.ArrayList#add(int, java.lang.Object)
+ */
+ public void add(int index, int element) {
+ maybeStartUsingIntegerArrayList();
+ intArrayList.add(index, element);
+ }
+
+ /**
+ * @param index
+ * @return
+ * @see java.util.ArrayList#removeAt(int)
+ */
+ public int removeAt(int index) {
+ maybeStartUsingIntegerArrayList();
+ return intArrayList.remove(index);
+ }
+
+ /**
+ * @param o - locate and if found remove this object
+ * @return true if removed
+ * @see java.util.ArrayList#remove(java.lang.Object)
+ */
+ public boolean remove(int o) {
+ maybeStartUsingIntegerArrayList();
+ int pos = intArrayList.indexOf(o);
+ if (pos >= 0) {
+ intArrayList.remove(pos);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @return
+ * @see java.util.AbstractList#hashCode()
+ */
+ public int hashCode() {
+ int hc = 1;
+ final int prime = 31;
+ for (int i = size() - 1; i >= 0; i++) {
+ hc = hc * prime + i;
+ hc = hc * prime + get(i);
+ }
+ return hc;
+ }
+
+ /**
+ *
+ * @see java.util.ArrayList#clear()
+ */
+ public void clear() {
+ maybeStartUsingIntegerArrayList();
+ intArrayList.removeAllElements();
+ }
+
+ /**
+ * @return
+ * @see java.util.ArrayList#iterator()
+ */
+ public Iterator<Integer> iterator() {
+ return (null == intArrayAsList)
+ ? intArrayList.iterator()
+ : intArrayAsList.iterator();
+ }
+
+ public IntListIterator intListIterator() {
+ return (null == intArrayAsList)
+ ? intArrayList.intListIterator()
+ : intArrayAsList.intListIterator();
+ }
+
+ public void sort() {
+ if (null == intArrayAsList) {
+ intArrayList.sort();
+ } else {
+ intArrayAsList.sort();
+ }
+ }
+
+}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/CASInitializer.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/CASInitializer.java?rev=1767533&r1=1767532&r2=1767533&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/CASInitializer.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/CASInitializer.java Tue Nov 1 17:51:07 2016
@@ -19,6 +19,8 @@
package org.apache.uima.jcas.test;
+import java.util.function.Consumer;
+
import org.apache.uima.cas.CAS;
import org.apache.uima.cas.CASException;
import org.apache.uima.cas.admin.CASFactory;
@@ -32,7 +34,8 @@ import org.apache.uima.cas.impl.CASImpl;
*/
public class CASInitializer {
- public static CAS initCas(AnnotatorInitializer init) throws CASException {
+ public static CAS initCas(AnnotatorInitializer init,
+ Consumer<TypeSystemMgr> moreTypes) throws CASException {
// Create an initial CASMgr from the factory.
CASMgr casMgr = CASFactory.createCAS();
// Create a writable type system.
@@ -40,6 +43,9 @@ public class CASInitializer {
// assert(tsa != null);
// Create a CASMgr. Ensures existence of AnnotationFS type.
init.initTypeSystem(tsa);
+ if (moreTypes != null) {
+ moreTypes.accept(tsa);
+ }
// Commit the type system.
((CASImpl) casMgr).commitTypeSystem();
// assert(tsa.isCommitted());
@@ -55,5 +61,6 @@ public class CASInitializer {
return casMgr.getCAS().getCurrentView();
}
+
}
Added: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/FSArrayListTest.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/FSArrayListTest.java?rev=1767533&view=auto
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/FSArrayListTest.java (added)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/FSArrayListTest.java Tue Nov 1 17:51:07 2016
@@ -0,0 +1,95 @@
+/*
+ * 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.jcas.test;
+
+import java.util.Iterator;
+import java.util.Spliterator;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.cas.FSArray;
+import org.apache.uima.jcas.cas.FSArrayList;
+
+import junit.framework.TestCase;
+import x.y.z.EndOfSentence;
+import x.y.z.Token;
+
+/**
+ * Test FSArrayList
+ *
+ */
+public class FSArrayListTest extends TestCase {
+
+ private CAS cas;
+
+ private JCas jcas;
+
+ private TypeSystem ts;
+
+ public EndOfSentence endOfSentenceInstance;
+
+ /**
+ * Constructor for CASTest.
+ *
+ * @param arg0
+ */
+ public FSArrayListTest(String arg0) {
+ super(arg0);
+ }
+
+ public void setUp() throws Exception {
+ this.cas = CASInitializer.initCas(new CASTestSetup(),
+ null
+// (tsm -> {
+// Type fsat = tsm.addType("org.apache.uima.jcas.cas.FSArrayList", tsm.getTopType());
+// tsm.addFeature("fsArray", fsat, tsm.getType("uima.cas.FSArray"));
+// }
+// )
+ );
+ this.ts = this.cas.getTypeSystem();
+ this.jcas = cas.getJCas();
+ }
+
+ public void testBasic() {
+ FSArrayList<Token> al = new FSArrayList<>(jcas);
+ Token t1 = new Token(jcas);
+ Token t2 = new Token(jcas);
+ al.add(t1);
+ al.add(t2);
+ al.remove(t1);
+
+ assertEquals(1, al.size());
+
+ Iterator<Token> it = al.iterator();
+ Token k = null;
+ while (it.hasNext()) {
+ assertNotNull(k = it.next());
+ }
+ assertNotNull(k);
+ al._save_fsRefs_to_cas_data();
+ FSArray fa = (FSArray) al.getFeatureValue(al.getType().getFeatureByBaseName("fsArray"));
+ assertNotNull(fa);
+ assertEquals(fa.get(0), k);
+ }
+
+
+}
Added: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/IntegerArrayListTest.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/IntegerArrayListTest.java?rev=1767533&view=auto
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/IntegerArrayListTest.java (added)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/IntegerArrayListTest.java Tue Nov 1 17:51:07 2016
@@ -0,0 +1,96 @@
+/*
+ * 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.jcas.test;
+
+import java.util.Iterator;
+import java.util.Spliterator;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.cas.FSArray;
+import org.apache.uima.jcas.cas.FSArrayList;
+import org.apache.uima.jcas.cas.IntegerArray;
+import org.apache.uima.jcas.cas.IntegerArrayList;
+
+import junit.framework.TestCase;
+import x.y.z.EndOfSentence;
+import x.y.z.Token;
+
+/**
+ * Test FSArrayList
+ *
+ */
+public class IntegerArrayListTest extends TestCase {
+
+ private CAS cas;
+
+ private JCas jcas;
+
+ private TypeSystem ts;
+
+ public EndOfSentence endOfSentenceInstance;
+
+ /**
+ * Constructor for CASTest.
+ *
+ * @param arg0
+ */
+ public IntegerArrayListTest(String arg0) {
+ super(arg0);
+ }
+
+ public void setUp() throws Exception {
+ this.cas = CASInitializer.initCas(new CASTestSetup(),
+ null
+// (tsm -> {
+// Type fsat = tsm.addType("org.apache.uima.jcas.cas.FSArrayList", tsm.getTopType());
+// tsm.addFeature("fsArray", fsat, tsm.getType("uima.cas.FSArray"));
+// }
+// )
+ );
+ this.ts = this.cas.getTypeSystem();
+ this.jcas = cas.getJCas();
+ }
+
+ public void testBasic() {
+ IntegerArrayList al = new IntegerArrayList(jcas);
+ al.add(1);
+ al.add(2);
+ assertFalse(al.remove(3));
+ assertTrue(al.remove(1));
+
+ assertEquals(1, al.size());
+
+ Iterator<Integer> it = al.iterator();
+ Integer k = null;
+ while (it.hasNext()) {
+ assertNotNull(k = it.next());
+ }
+ assertNotNull(k);
+ al._save_to_cas_data();
+ IntegerArray fa = (IntegerArray) al.getFeatureValue(al.getType().getFeatureByBaseName("intArray"));
+ assertNotNull(fa);
+ assertEquals(fa.get(0), (int) k);
+ }
+
+
+}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/JCasTest.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/JCasTest.java?rev=1767533&r1=1767532&r2=1767533&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/JCasTest.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/JCasTest.java Tue Nov 1 17:51:07 2016
@@ -85,7 +85,7 @@ public class JCasTest extends TestCase {
public void setUp() throws Exception {
try {
try {
- this.cas = CASInitializer.initCas(new CASTestSetup());
+ this.cas = CASInitializer.initCas(new CASTestSetup(), null);
this.ts = this.cas.getTypeSystem();
this.jcas = cas.getJCas();
endOfSentenceInstance = new EndOfSentence(jcas);
@@ -141,7 +141,7 @@ public class JCasTest extends TestCase {
boolean errFound = false;
try {
// error happens during setup
- localCas = CASInitializer.initCas(new CASTestSetup(CASTestSetup.BAD_MISSING_FEATURE_IN_CAS));
+ localCas = CASInitializer.initCas(new CASTestSetup(CASTestSetup.BAD_MISSING_FEATURE_IN_CAS), null);
} catch (CASRuntimeException e) {
assertTrue(e.getMessageKey().equals(CASException.JCAS_INIT_ERROR));
}
@@ -164,7 +164,7 @@ public class JCasTest extends TestCase {
JCas localJcas;
boolean errFound = false;
try {
- localCas = CASInitializer.initCas(new CASTestSetup(testId));
+ localCas = CASInitializer.initCas(new CASTestSetup(testId), null);
// ts = this.cas.getTypeSystem();
// try {
// localJcas = localCas.getJCas();
@@ -443,7 +443,7 @@ public class JCasTest extends TestCase {
public void test2CASs() throws Exception {
try {
try {
- CAS cas2 = CASInitializer.initCas(new CASTestSetup());
+ CAS cas2 = CASInitializer.initCas(new CASTestSetup(), null);
TypeSystem ts2 = cas2.getTypeSystem();
JCas jcas2 = cas2.getJCas();
assertTrue(jcas.getCasType(Annotation.type) == jcas2.getCasType(Annotation.type));
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/resources/SerDes4/AllKinds.binary
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/resources/SerDes4/AllKinds.binary?rev=1767533&r1=1767532&r2=1767533&view=diff
==============================================================================
Binary files - no diff available.
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/resources/SerDes4/ArrayAuxLongs.binary
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/resources/SerDes4/ArrayAuxLongs.binary?rev=1767533&r1=1767532&r2=1767533&view=diff
==============================================================================
Binary files - no diff available.
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/resources/SerDes4/ArrayAuxStrings.binary
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/resources/SerDes4/ArrayAuxStrings.binary?rev=1767533&r1=1767532&r2=1767533&view=diff
==============================================================================
Binary files - no diff available.
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/resources/SerDes4/DeltaWithIndexMods.binary
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/resources/SerDes4/DeltaWithIndexMods.binary?rev=1767533&r1=1767532&r2=1767533&view=diff
==============================================================================
Binary files - no diff available.
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/resources/SerDes4/DeltaWithMods.binary
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/resources/SerDes4/DeltaWithMods.binary?rev=1767533&r1=1767532&r2=1767533&view=diff
==============================================================================
Binary files - no diff available.
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/resources/SerDes4/DeltaWithRefsBelow.binary
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/resources/SerDes4/DeltaWithRefsBelow.binary?rev=1767533&r1=1767532&r2=1767533&view=diff
==============================================================================
Binary files - no diff available.