You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by tw...@apache.org on 2007/05/22 15:51:06 UTC

svn commit: r540585 - /incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/

Author: twgoetz
Date: Tue May 22 06:51:04 2007
New Revision: 540585

URL: http://svn.apache.org/viewvc?view=rev&rev=540585
Log:
Jira UIMA-408: CASImpl API clean-up.

https://issues.apache.org/jira/browse/UIMA-408

Modified:
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMetadata.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSTypeConstraintImpl.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/ListUtils.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASDeserializer.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASSerializer.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasDeserializer.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasSerializer.java

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMetadata.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMetadata.java?view=diff&rev=540585&r1=540584&r2=540585
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMetadata.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMetadata.java Tue May 22 06:51:04 2007
@@ -98,7 +98,7 @@
     final int numTypes = ts.getNumberOfTypes();
     this.fsSpaceReq = new int[numTypes + 1];
     for (int i = 1; i <= numTypes; i++) {
-      this.fsSpaceReq[i] = ts.getAppropriateFeatures(i).length + 1;
+      this.fsSpaceReq[i] = ts.ll_getAppropriateFeatures(i).length + 1;
     }
     // Initialize the non-creatable types info.
     initCreatableTypeTable();

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSTypeConstraintImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSTypeConstraintImpl.java?view=diff&rev=540585&r1=540584&r2=540585
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSTypeConstraintImpl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSTypeConstraintImpl.java Tue May 22 06:51:04 2007
@@ -92,7 +92,7 @@
 		int typeCode;
 		while (it.hasNext()) {
 			typeName = (String) it.next();
-			typeCode = tsi.getTypeCode(typeName);
+			typeCode = tsi.ll_getCodeForTypeName(typeName);
 			if (typeCode < tsi.getSmallestType()) {
 				CASRuntimeException e = new CASRuntimeException(
 						CASRuntimeException.UNKNOWN_CONSTRAINT_TYPE, new String[] { typeName });

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/ListUtils.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/ListUtils.java?view=diff&rev=540585&r1=540584&r2=540585
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/ListUtils.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/ListUtils.java Tue May 22 06:51:04 2007
@@ -101,26 +101,26 @@
     this.logger = aLogger;
     this.eh = aErrorHandler;
     TypeSystemImpl ts = aCASImpl.getTypeSystemImpl();
-    this.intListType = ts.getTypeCode(CAS.TYPE_NAME_INTEGER_LIST);
-    this.floatListType = ts.getTypeCode(CAS.TYPE_NAME_FLOAT_LIST);
-    this.stringListType = ts.getTypeCode(CAS.TYPE_NAME_STRING_LIST);
-    this.fsListType = ts.getTypeCode(CAS.TYPE_NAME_FS_LIST);
-    this.neIntListType = ts.getTypeCode(CAS.TYPE_NAME_NON_EMPTY_INTEGER_LIST);
-    this.neFloatListType = ts.getTypeCode(CAS.TYPE_NAME_NON_EMPTY_FLOAT_LIST);
-    this.neStringListType = ts.getTypeCode(CAS.TYPE_NAME_NON_EMPTY_STRING_LIST);
-    this.neFsListType = ts.getTypeCode(CAS.TYPE_NAME_NON_EMPTY_FS_LIST);
-    this.eIntListType = ts.getTypeCode(CAS.TYPE_NAME_EMPTY_INTEGER_LIST);
-    this.eFloatListType = ts.getTypeCode(CAS.TYPE_NAME_EMPTY_FLOAT_LIST);
-    this.eStringListType = ts.getTypeCode(CAS.TYPE_NAME_EMPTY_STRING_LIST);
-    this.eFsListType = ts.getTypeCode(CAS.TYPE_NAME_EMPTY_FS_LIST);
-    this.intHeadFeat = ts.getFeatureCode(CAS.FEATURE_FULL_NAME_INTEGER_LIST_HEAD);
-    this.floatHeadFeat = ts.getFeatureCode(CAS.FEATURE_FULL_NAME_FLOAT_LIST_HEAD);
-    this.stringHeadFeat = ts.getFeatureCode(CAS.FEATURE_FULL_NAME_STRING_LIST_HEAD);
-    this.fsHeadFeat = ts.getFeatureCode(CAS.FEATURE_FULL_NAME_FS_LIST_HEAD);
-    this.intTailFeat = ts.getFeatureCode(CAS.FEATURE_FULL_NAME_INTEGER_LIST_TAIL);
-    this.floatTailFeat = ts.getFeatureCode(CAS.FEATURE_FULL_NAME_FLOAT_LIST_TAIL);
-    this.stringTailFeat = ts.getFeatureCode(CAS.FEATURE_FULL_NAME_STRING_LIST_TAIL);
-    this.fsTailFeat = ts.getFeatureCode(CAS.FEATURE_FULL_NAME_FS_LIST_TAIL);
+    this.intListType = ts.ll_getCodeForTypeName(CAS.TYPE_NAME_INTEGER_LIST);
+    this.floatListType = ts.ll_getCodeForTypeName(CAS.TYPE_NAME_FLOAT_LIST);
+    this.stringListType = ts.ll_getCodeForTypeName(CAS.TYPE_NAME_STRING_LIST);
+    this.fsListType = ts.ll_getCodeForTypeName(CAS.TYPE_NAME_FS_LIST);
+    this.neIntListType = ts.ll_getCodeForTypeName(CAS.TYPE_NAME_NON_EMPTY_INTEGER_LIST);
+    this.neFloatListType = ts.ll_getCodeForTypeName(CAS.TYPE_NAME_NON_EMPTY_FLOAT_LIST);
+    this.neStringListType = ts.ll_getCodeForTypeName(CAS.TYPE_NAME_NON_EMPTY_STRING_LIST);
+    this.neFsListType = ts.ll_getCodeForTypeName(CAS.TYPE_NAME_NON_EMPTY_FS_LIST);
+    this.eIntListType = ts.ll_getCodeForTypeName(CAS.TYPE_NAME_EMPTY_INTEGER_LIST);
+    this.eFloatListType = ts.ll_getCodeForTypeName(CAS.TYPE_NAME_EMPTY_FLOAT_LIST);
+    this.eStringListType = ts.ll_getCodeForTypeName(CAS.TYPE_NAME_EMPTY_STRING_LIST);
+    this.eFsListType = ts.ll_getCodeForTypeName(CAS.TYPE_NAME_EMPTY_FS_LIST);
+    this.intHeadFeat = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_INTEGER_LIST_HEAD);
+    this.floatHeadFeat = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_FLOAT_LIST_HEAD);
+    this.stringHeadFeat = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_STRING_LIST_HEAD);
+    this.fsHeadFeat = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_FS_LIST_HEAD);
+    this.intTailFeat = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_INTEGER_LIST_TAIL);
+    this.floatTailFeat = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_FLOAT_LIST_TAIL);
+    this.stringTailFeat = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_STRING_LIST_TAIL);
+    this.fsTailFeat = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_FS_LIST_TAIL);
   }
 
   public boolean isIntListType(int type) {

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java?view=diff&rev=540585&r1=540584&r2=540585
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java Tue May 22 06:51:04 2007
@@ -106,7 +106,7 @@
    * @return The number of features.
    */
   public int getNumberOfFeatures() {
-    return this.ts.getAppropriateFeatures(this.code).length;
+    return this.ts.ll_getAppropriateFeatures(this.code).length;
   }
 
   /**
@@ -210,7 +210,7 @@
   }
 
   public List getFeatures() {
-    int[] feats = this.ts.getAppropriateFeatures(this.code);
+    int[] feats = this.ts.ll_getAppropriateFeatures(this.code);
     ArrayList list = new ArrayList(feats.length);
     for (int i = 0; i < feats.length; i++) {
       list.add(this.ts.getFeature(feats[i]));

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java?view=diff&rev=540585&r1=540584&r2=540585
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java Tue May 22 06:51:04 2007
@@ -812,13 +812,6 @@
   }
 
   /**
-   * Get the code for a feature, given its name.
-   */
-  public int getFeatureCode(String feat) {
-    return ll_getCodeForFeatureName(feat);
-  }
-
-  /**
    * Get an array of the appropriate features for this type.
    */
   public int[] ll_getAppropriateFeatures(int type) {
@@ -829,10 +822,6 @@
     return ((IntVector) this.approp.get(type)).toArrayCopy();
   }
 
-  public int[] getAppropriateFeatures(int type) {
-    return ll_getAppropriateFeatures(type);
-  }
-
   /**
    * @return An offset <code>&gt;0</code> if <code>feat</code> exists; <code>0</code>, else.
    */
@@ -1061,10 +1050,6 @@
 
   public SymbolTable getFeatureNameST() {
     return this.featureNameST;
-  }
-
-  public int getTypeCode(String typeName) {
-    return this.typeNameST.get(typeName);
   }
 
   private final String getTypeString(Type t) {

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASDeserializer.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASDeserializer.java?view=diff&rev=540585&r1=540584&r2=540585
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASDeserializer.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASDeserializer.java Tue May 22 06:51:04 2007
@@ -803,7 +803,7 @@
         finalizeArray(type, addr, fsInfo);
         return;
       }
-      int[] feats = cas.getTypeSystemImpl().getAppropriateFeatures(type);
+      int[] feats = cas.getTypeSystemImpl().ll_getAppropriateFeatures(type);
       int feat;
       FSInfo fsValInfo;
       for (int i = 0; i < feats.length; i++) {

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASSerializer.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASSerializer.java?view=diff&rev=540585&r1=540584&r2=540585
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASSerializer.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASSerializer.java Tue May 22 06:51:04 2007
@@ -616,7 +616,7 @@
      */
     private void encodeFeatures(int addr, AttributesImpl attrs) {
       int heapValue = cas.getHeapValue(addr);
-      int[] feats = ts.getAppropriateFeatures(heapValue);
+      int[] feats = ts.ll_getAppropriateFeatures(heapValue);
       int featAddr, featVal;
       String featName, attrValue;
       boolean nameMapping = false;
@@ -650,7 +650,7 @@
     }
 
     private void enqueueFeatures(int addr, int heapValue) {
-      int[] feats = ts.getAppropriateFeatures(heapValue);
+      int[] feats = ts.ll_getAppropriateFeatures(heapValue);
       int featAddr, featVal;
 
       for (int i = 0; i < feats.length; i++) {

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasDeserializer.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasDeserializer.java?view=diff&rev=540585&r1=540584&r2=540585
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasDeserializer.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasDeserializer.java Tue May 22 06:51:04 2007
@@ -242,9 +242,9 @@
         }        
       }      
       final TypeSystemImpl tsOfReceivingCas = casBeingFilled.getTypeSystemImpl();
-      this.sofaTypeCode = tsOfReceivingCas.getTypeCode(CAS.TYPE_NAME_SOFA);
-      this.sofaNumFeatCode = tsOfReceivingCas.getFeatureCode(CAS.FEATURE_FULL_NAME_SOFANUM);
-      this.sofaFeatCode = tsOfReceivingCas.getFeatureCode(CAS.FEATURE_FULL_NAME_SOFA);
+      this.sofaTypeCode = tsOfReceivingCas.ll_getCodeForTypeName(CAS.TYPE_NAME_SOFA);
+      this.sofaNumFeatCode = tsOfReceivingCas.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_SOFANUM);
+      this.sofaFeatCode = tsOfReceivingCas.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_SOFA);
       this.nextSofaNum = 2;
       this.listUtils = new ListUtils(casBeingFilled, UIMAFramework.getLogger(XmiCasDeserializer.class), null);
 
@@ -1046,7 +1046,7 @@
         return;
       }
       // remap IDs for all nonprimtive, non-multivalued-property features
-      int[] feats = casBeingFilled.getTypeSystemImpl().getAppropriateFeatures(type);
+      int[] feats = casBeingFilled.getTypeSystemImpl().ll_getAppropriateFeatures(type);
       Feature feat;
       for (int i = 0; i < feats.length; i++) {
         feat = ts.getFeature(feats[i]);
@@ -1088,7 +1088,7 @@
       final int type = casBeingFilled.getHeapValue(addr);
       if (!listUtils.isFsListType(type))
         return;
-      int[] feats = casBeingFilled.getTypeSystemImpl().getAppropriateFeatures(type);
+      int[] feats = casBeingFilled.getTypeSystemImpl().ll_getAppropriateFeatures(type);
       if (feats.length == 0)
         return;
       int headFeat = feats[0];

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasSerializer.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasSerializer.java?view=diff&rev=540585&r1=540584&r2=540585
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasSerializer.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasSerializer.java Tue May 22 06:51:04 2007
@@ -430,7 +430,7 @@
      */
     private void enqueueFeatures(int addr, int typeCode) throws SAXException {
       boolean insideListNode = listUtils.isListType(typeCode);
-      int[] feats = cas.getTypeSystemImpl().getAppropriateFeatures(typeCode);
+      int[] feats = cas.getTypeSystemImpl().ll_getAppropriateFeatures(typeCode);
       int featAddr, featVal, fsClass;
       for (int i = 0; i < feats.length; i++) {
         if (isFiltering) {
@@ -688,7 +688,7 @@
             throws SAXException {
       List childElements = new ArrayList();
       int heapValue = cas.getHeapValue(addr);
-      int[] feats = cas.getTypeSystemImpl().getAppropriateFeatures(heapValue);
+      int[] feats = cas.getTypeSystemImpl().ll_getAppropriateFeatures(heapValue);
       int featAddr, featVal, fsClass;
       String featName, attrValue;
       // boolean isSofa = false;