Author: schor Date: Tue Sep 15 17:41:08 2015 New Revision: 1703264 URL: http://svn.apache.org/r1703264 Log: no Jira - just clarifying comments, including super UIMA and Java types of arrays
Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMetadata.java uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMgrSerializer.java uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java?rev=1703264&r1=1703263&r2=1703264&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java (original) +++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java Tue Sep 15 17:41:08 2015 @@ -1103,7 +1103,7 @@ public class CASImpl extends AbstractCas if (null != this.svd.casMetadata.fsClassRegistry) { // needed only if caching non-JCas Java cover objects - // NOTE: This code may not work - has not been maintained + // NOTE: This code doesn't work - impl commented outhas not been maintained this.svd.casMetadata.fsClassRegistry.flush(); } if (this.jcas != null) { Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMetadata.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMetadata.java?rev=1703264&r1=1703263&r2=1703264&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMetadata.java (original) +++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMetadata.java Tue Sep 15 17:41:08 2015 @@ -38,6 +38,12 @@ import org.apache.uima.cas.Type; class CASMetadata { final TypeSystemImpl ts; + /** + * Holds generators to create Java objects, either JCas ones or plain ones + * No longer initialized from the XYZ_Type classes' generators, but initialized with + * standard one from initFSClassRegistry(), and + * JCas ones from instantiateJCas_Types + */ final FSClassRegistry fsClassRegistry; Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMgrSerializer.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMgrSerializer.java?rev=1703264&r1=1703263&r2=1703264&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMgrSerializer.java (original) +++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMgrSerializer.java Tue Sep 15 17:41:08 2015 @@ -107,7 +107,8 @@ public class CASMgrSerializer implements // Type system encoding. /** - * A list of type names (symbol table). Note: numbering of types starts at <code>1</code>, and + * A list of type names (symbol table). fs-typed arrays have names XXXX[]. + * Note: numbering of types starts at <code>1</code>, and * we index the names according to their internal code. That means that * <code>typeNames[0] == null</code>. */ Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java?rev=1703264&r1=1703263&r2=1703264&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java (original) +++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java Tue Sep 15 17:41:08 2015 @@ -521,14 +521,61 @@ public class TypeSystemImpl implements T return this.parents.get(typeCode); } + /** + * Given a component type, return the parent type of the corresponding array type, + * without needing the corresponding array type to exist (yet). + * component type -> (member of) array type -> UIMA parent type of that array type. + * + * The UIMA Type parent of an array is either + * ArrayBase (for primitive arrays, plus String[] and TOP[] (see below) + * FsArray - for XYZ[] reference kinds of arrays + * + * The UIMA parent chain goes like this: + * primitive_array -> ArrayBase -> TOP (primitive: boolean, byte, short, int, long, float, double, String) + * String[] -> ArrayBase -> TOP + * TOP[] -> ArrayBase -> TOP + * + * XYZ[] -> FSArray -> TOP where XYZ is not a primitive, not String[], not TOP[] + * It excludes TOP builtin because the creation of the FSArray type requires + * the creation of TOP[] type, which requires (unless this is done) + * the recursive creation of FSArray type - which causes a null pointer exception + * + * Note that the UIMA super chain is not used very much (mainly for subsumption, + * and for this there is special case code anyways), so this doesn't really matter. (2015 Sept) + * + * Note: the super type chain of the Java impl classes varies from the UIMA super type chain. + * It is used to factor out common behavior among classes of arrays. + * + * For non-JCas: + * CommonArrayFSImpl [ for arrays stored on the main heap ] + * ArrayFSImpl (for arrays of FS) + * FloatArrayFSImpl + * IntArrayFSImpl + * StringArrayFSImpl + * CommonAuxArrayFSImpl [ for arrays stored in Aux heaps ] + * BooleanArrayFSImpl + * ByteArrayFSImpl + * ShortArrayFSImpl + * LongArrayFSImpl + * DoubleArrayFSImpl + * + * For JCas: The corresponding types have only TOP as their supertypes + * but they implement the nonJCas interfaces for each subtype. + * Those interfaces implement CommonArrayFS interface + * + * @param componentType + * @return the parent type of the corresponding array type + */ int ll_computeArrayParentFromComponentType(int componentType) { if (ll_isPrimitiveType(componentType) || // note: not using top - until we can confirm this is set // in all cases - (ll_getTypeForCode(componentType).getName().equals(CAS.TYPE_NAME_TOP))) { + (ll_getTypeForCode(componentType).getName().equals(CAS.TYPE_NAME_TOP))) { return arrayBaseTypeCode; } - // is a subtype of FSArray. + // is an array of XYZ[] (except for TOP - see above logic). + // Note: These are put into the UIMA type system as subtypes of FSArray, + // even though other parts of the impl have marked FSArray as Type-Final. // note: not using this.fsArray - until we can confirm this is set in // all cases return fsArrayTypeCode;