You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by ea...@apache.org on 2007/01/11 23:41:43 UTC
svn commit: r495414 - in /incubator/uima/uimaj/trunk/uimaj-core/src:
main/java/org/apache/uima/cas/impl/ main/java/org/apache/uima/cas/text/
main/java/org/apache/uima/jcas/cas/ main/java/org/apache/uima/resource/impl/
main/java/org/apache/uima/uimacpp/...
Author: eae
Date: Thu Jan 11 14:41:42 2007
New Revision: 495414
URL: http://svn.apache.org/viewvc?view=rev&rev=495414
Log:
UIMA-115 First step on the path: eliminate TCASImpl
Removed:
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TCASImpl.java
Modified:
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureValuePathImpl.java
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/Serialization.java
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/SofaFSImpl.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/XmiCasDeserializer.java
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/text/TCAS.java
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/text/TCASMgr.java
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/Sofa.java
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/TOP.java
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/resource/impl/CasManager_impl.java
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/uimacpp/UimacppEngine.java
incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/AnnotationIteratorTest.java
incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/FilteredIteratorTest.java
incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IndexComparitorTest.java
incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IndexSerializationTest.java
incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java
incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/SerializationNoMDTest.java
incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/SerializationReinitTest.java
incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeSystemReinitTest.java
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java?view=diff&rev=495414&r1=495413&r2=495414
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java Thu Jan 11 14:41:42 2007
@@ -74,7 +74,9 @@
import org.apache.uima.cas.admin.FSIndexRepositoryMgr;
import org.apache.uima.cas.admin.TypeSystemMgr;
import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.cas.text.Language;
import org.apache.uima.cas.text.TCAS;
+import org.apache.uima.cas.text.TCASRuntimeException;
import org.apache.uima.internal.util.IntVector;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.impl.JCasImpl;
@@ -143,6 +145,9 @@
protected LongHeap longHeap; // for storing 64 bit values
+ // The document text.
+ private String documentText;
+
// The index repository.
protected FSIndexRepositoryImpl indexRepository;
@@ -241,10 +246,14 @@
private TypeImpl annotBaseType;
+ private TypeImpl docType;
+
private FeatureImpl startFeat;
private FeatureImpl endFeat;
+ private FeatureImpl langFeat;
+
private TypeImpl byteType;
private TypeImpl byteArrayType;
@@ -283,7 +292,7 @@
private int sofaTypeCode;
- protected int annotTypeCode; // accessed from TCASImpl
+ protected int annotTypeCode;
private int annotBaseTypeCode;
@@ -323,6 +332,8 @@
int endFeatCode;
+ protected int langFeatCode;
+
// If this CAS can be flushed or not.
private boolean flushEnabled = true;
@@ -380,6 +391,7 @@
this.annotType = in.annotType;
this.annotBaseType = in.annotBaseType;
this.sofaType = in.sofaType;
+ this.docType = in.docType;
this.byteType = in.byteType;
this.byteArrayType = in.byteArrayType;
@@ -401,13 +413,13 @@
// this(typeSystem, DEFAULT_INITIAL_HEAP_SIZE);
// }
- // Reference existing CAS
- // For use when creating views of the CAS
- CASImpl(CAS cas) {
- this.setCAS(cas);
- this.useFSCache = false;
- initTypeVariables();
- }
+// // Reference existing CAS
+// // For use when creating views of the CAS
+// CASImpl(CAS cas) {
+// this.setCAS(cas);
+// this.useFSCache = false;
+// initTypeVariables();
+// }
public CASImpl(TypeSystemImpl typeSystem, int initialHeapSize) {
this(typeSystem, initialHeapSize, DEFAULT_USE_FS_CACHE);
@@ -469,6 +481,69 @@
this.setIndexRepository(ser.getIndexRepository(this));
}
+ // Use this when creating a CAS view
+ CASImpl(CAS cas, SofaFS aSofa) {
+
+ this.setCAS(cas);
+ this.useFSCache = false;
+ initTypeVariables();
+
+ // this.mySofa = aSofa;
+ if (aSofa != null) {
+ // save address of SofaFS
+ this.mySofaRef = aSofa.hashCode();
+ } else {
+ // this is the InitialView
+ this.mySofaRef = -1;
+ }
+
+ initFSClassRegistry();
+
+ // get the indexRepository for this Sofa
+ this.indexRepository = (this.mySofaRef == -1) ? (FSIndexRepositoryImpl) ((CASImpl) cas)
+ .getSofaIndexRepository(1) : (FSIndexRepositoryImpl) ((CASImpl) cas)
+ .getSofaIndexRepository(aSofa);
+ if (null == this.indexRepository) {
+ // create the indexRepository for this TCAS
+ // use the baseIR to create a lightweight IR copy
+ this.indexRepository = new FSIndexRepositoryImpl((CASImpl) this,
+ (FSIndexRepositoryImpl) ((CASImpl) cas).getBaseIndexRepository());
+ this.indexRepository.commit();
+ // save new sofa index
+ if (this.mySofaRef == -1) {
+ ((CASImpl) cas).setSofaIndexRepository(1, this.indexRepository);
+ } else {
+ ((CASImpl) cas).setSofaIndexRepository(aSofa, this.indexRepository);
+ }
+ }
+ }
+
+ // Use this when creating a CAS view
+ protected void refreshView(CAS cas, SofaFS aSofa) {
+ this.setCAS(cas);
+ if (aSofa != null) {
+ // save address of SofaFS
+ this.mySofaRef = aSofa.hashCode();
+ } else {
+ // this is the InitialView
+ this.mySofaRef = -1;
+ }
+
+ // toss the JCas, if it exists
+ this.jcas = null;
+
+ // create the indexRepository for this Sofa
+ this.indexRepository = new FSIndexRepositoryImpl(this,
+ (FSIndexRepositoryImpl) ((CASImpl) cas).getBaseIndexRepository());
+ this.indexRepository.commit();
+ // save new sofa index
+ if (this.mySofaRef == -1) {
+ ((CASImpl) cas).setSofaIndexRepository(1, this.indexRepository);
+ } else {
+ ((CASImpl) cas).setSofaIndexRepository(aSofa, this.indexRepository);
+ }
+ }
+
private final void initTypeVariables() {
// Type objects.
this.topType = (TypeImpl) this.ts.getTopType();
@@ -485,6 +560,8 @@
this.annotBaseType = (TypeImpl) this.ts.getType(CAS.TYPE_NAME_ANNOTATION_BASE);
this.startFeat = (FeatureImpl) this.ts.getFeatureByFullName(TCAS.FEATURE_FULL_NAME_BEGIN);
this.endFeat = (FeatureImpl) this.ts.getFeatureByFullName(TCAS.FEATURE_FULL_NAME_END);
+ this.langFeat = (FeatureImpl) this.ts.getFeatureByFullName(TCAS.FEATURE_FULL_NAME_LANGUAGE);
+ this.docType = (TypeImpl) this.ts.getType(TCAS.TYPE_NAME_DOCUMENT_ANNOTATION);
this.byteType = (TypeImpl) this.ts.getType(TYPE_NAME_BYTE);
this.byteArrayType = (TypeImpl) this.ts.getType(TYPE_NAME_BYTE_ARRAY);
@@ -541,7 +618,8 @@
this.annotType.getFeatureByBaseName(TCAS.FEATURE_BASE_NAME_BEGIN));
this.endFeatCode = ll_getTypeSystem().ll_getCodeForFeature(
this.annotType.getFeatureByBaseName(TCAS.FEATURE_BASE_NAME_END));
-
+ this.langFeatCode = ll_getTypeSystem().ll_getCodeForFeature(
+ this.docType.getFeatureByBaseName(TCAS.FEATURE_BASE_NAME_LANGUAGE));
}
private void checkInternalCodes(CASMgrSerializer ser) throws CASAdminException {
@@ -948,13 +1026,33 @@
this.baseCAS.resetNoQuestions();
}
+ private void resetView() {
+ this.indexRepository.flush();
+ this.documentText = null;
+ if (this.mySofaRef > 0 && this.getSofa().getSofaRef() == 1) {
+ // indicate no Sofa exists for the initial view
+ this.mySofaRef = -1;
+ } else {
+ this.mySofaRef = 0;
+ }
+ if (this.jcas != null) {
+ try {
+ JCasImpl.clearData(this);
+ } catch (CASException e) {
+ CASAdminException cae = new CASAdminException(CASAdminException.JCAS_ERROR);
+ cae.addArgument(e.getMessage());
+ throw cae;
+ }
+ }
+ }
+
public void resetNoQuestions() {
int numViews = this.getBaseSofaCount();
// Flush indexRepository for all Sofa
for (int view = 1; view <= numViews; view++) {
CAS tcas = (view == 1) ? getInitialView() : getTCAS(view);
if (tcas != null) {
- ((TCASImpl) tcas).resetNoQuestions();
+ ((CASImpl) tcas).resetView();
}
}
if (this.heap.getCurrentTempSize() > this.resetHeapSize) {
@@ -1000,8 +1098,14 @@
/**
*
*/
- // BaseCas has no indexes for users
public FSIndexRepository getIndexRepository() {
+ if (this == this.baseCAS) {
+ // BaseCas has no indexes for users
+ return null;
+ }
+ if (this.indexRepository.isCommitted()) {
+ return this.indexRepository;
+ }
return null;
}
@@ -1016,6 +1120,10 @@
this.baseCAS.getBaseIndexRepository().addFS(sofa);
}
+ protected void registerView(SofaFS aSofa) {
+ this.mySofaRef = aSofa.hashCode();
+ }
+
public void reinit(CASSerializer ser) {
if (this != this.baseCAS) {
this.baseCAS.reinit(ser);
@@ -1130,7 +1238,7 @@
this.sofaCount = 0;
// freshen the initial view
- ((TCASImpl) initialView).refreshView(this.baseCAS, null);
+ ((CASImpl) initialView).refreshView(this.baseCAS, null);
this.sofa2tcasMap.put(new Integer(1), initialView);
this.baseCAS.sofaCount = 1;
@@ -1431,7 +1539,7 @@
// only bump count if not the initial view
this.baseCAS.sofaCount++;
}
- ((TCASImpl) this.getView(sofa)).registerView(sofa);
+ ((CASImpl) this.getView(sofa)).registerView(sofa);
iterator.moveToNext();
}
for (int view = 1; view <= numViews; view++) {
@@ -1443,7 +1551,7 @@
loopIndexRep.addFS(fsIndex[i]);
}
loopStart += loopLen + 1;
- ((TCASImpl) tcas).updateDocumentAnnotation();
+ ((CASImpl) tcas).updateDocumentAnnotation();
} else {
loopStart += 1;
}
@@ -2254,7 +2362,7 @@
// Type remoteSofa = ts.addType(CAS.TYPE_NAME_REMOTESOFA, sofa);
ts.addFeature(CAS.FEATURE_BASE_NAME_SOFAURI, sofa, stringT);
- // Annotations (moved here from TCASImpl)
+ // Annotations
Type annotBaseType = ts.addType(CAS.TYPE_NAME_ANNOTATION_BASE, top);
ts.addFeature(TCAS.FEATURE_BASE_NAME_SOFA, annotBaseType, sofa);
Type annotType = ts.addType(TCAS.TYPE_NAME_ANNOTATION, annotBaseType);
@@ -2413,7 +2521,7 @@
return couldBeThis;
}
// create the initial view, without a Sofa
- CAS aTcas = new TCASImpl(this.baseCAS, null);
+ CAS aTcas = new CASImpl(this.baseCAS, null);
this.sofa2tcasMap.put(new Integer(1), aTcas);
this.baseCAS.sofaCount = 1;
return aTcas;
@@ -2437,7 +2545,7 @@
}
SofaFS newSofa = createSofa(absoluteSofaName, null);
CAS newView = getView(newSofa);
- ((TCASImpl) newView).registerView(newSofa);
+ ((CASImpl) newView).registerView(newSofa);
return newView;
}
@@ -2467,10 +2575,10 @@
}
public CAS getView(SofaFS aSofa) {
- TCASImpl aTcas = (TCASImpl) this.sofa2tcasMap.get(new Integer(aSofa.getSofaRef()));
+ CASImpl aTcas = (CASImpl) this.sofa2tcasMap.get(new Integer(aSofa.getSofaRef()));
if (null == aTcas) {
// create a new TCAS view
- aTcas = new TCASImpl(this.baseCAS, aSofa);
+ aTcas = new CASImpl(this.baseCAS, aSofa);
this.sofa2tcasMap.put(new Integer(aSofa.getSofaRef()), aTcas);
if (this.baseCAS.sofaCount < aSofa.getSofaRef()) {
// for binary deserialization
@@ -3504,11 +3612,29 @@
ll_setDoubleArrayValue(fsRef, position, value);
}
+ public boolean isAnnotationType(Type t) {
+ return getTypeSystem().subsumes(getAnnotationType(), t);
+ }
+
+ public boolean isAnnotationType(int t) {
+ return this.ts.subsumes(this.annotTypeCode, t);
+ }
+
public AnnotationFS createAnnotation(Type type, int begin, int end) {
- // Can't create annotation on base CAS
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INVALID_BASE_CAS_METHOD);
- e.addArgument("createAnnotation");
- throw e;
+ if (this == this.baseCAS) {
+ // Can't create annotation on base CAS
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INVALID_BASE_CAS_METHOD);
+ e.addArgument("createAnnotation");
+ throw e;
+ }
+ FeatureStructure fs = createFS(type);
+ final int addr = ll_getFSRef(fs);
+ // setSofaFeat(addr, this.mySofaRef); // already done by createFS
+ setFeatureValue(addr, this.startFeatCode, begin);
+ // setStartFeat(addr, begin);
+ setFeatureValue(addr, this.endFeatCode, end);
+ // setEndFeat(addr, end);
+ return (AnnotationFS) fs;
}
public FSIndex getAnnotationIndex() {
@@ -3540,39 +3666,104 @@
return this.startFeat;
}
+ private AnnotationFS createDocumentAnnotation(int length) {
+ // Remove any existing document annotations.
+ FSIterator it = getAnnotationIndex(this.docType).iterator();
+ ArrayList list = new ArrayList();
+ while (it.isValid()) {
+ list.add(it.get());
+ it.moveToNext();
+ }
+ for (int i = 0; i < list.size(); i++) {
+ getIndexRepository().removeFS((FeatureStructure) list.get(i));
+ }
+ // Create a new document annotation.
+ AnnotationFS doc = createAnnotation(this.docType, 0, length);
+ getIndexRepository().addFS(doc);
+ // Set the language feature to the default value.
+ doc.setStringValue(this.langFeat, TCAS.DEFAULT_LANGUAGE_NAME);
+ return doc;
+ }
+
+ // Update the document Text and document Annotation if required
+ public void updateDocumentAnnotation() {
+ if (!mySofaIsValid()) {
+ return;
+ }
+ final Type SofaType = this.ts.getType(CAS.TYPE_NAME_SOFA);
+ final Feature sofaString = SofaType.getFeatureByBaseName(FEATURE_BASE_NAME_SOFASTRING);
+ String newDoc = getSofa(this.mySofaRef).getStringValue(sofaString);
+ this.documentText = newDoc;
+ if (null != newDoc)
+ getDocumentAnnotation().setIntValue(getEndFeature(), newDoc.length());
+ }
+
public AnnotationFS getDocumentAnnotation() {
- // base CAS has no document
- return null;
+ if (this == this.baseCAS) {
+ // base CAS has no document
+ return null;
+ }
+ FSIterator it = getAnnotationIndex(this.docType).iterator();
+ if (it.isValid()) {
+ return (AnnotationFS) it.get();
+ }
+ return createDocumentAnnotation(0);
}
public String getDocumentLanguage() {
- // base CAS has no document
- return null;
+ if (this == this.baseCAS) {
+ // base CAS has no document
+ return null;
+ }
+ LowLevelCAS llc = this;
+ final int docAnnotAddr = llc.ll_getFSRef(getDocumentAnnotation());
+ return llc.ll_getStringValue(docAnnotAddr, this.langFeatCode);
}
public String getDocumentText() {
- // base CAS has no document
- return null;
+ if (this == this.baseCAS) {
+ // base CAS has no document
+ return null;
+ }
+ return this.documentText;
}
public String getSofaDataString() {
- // base CAS has no document
- return null;
+ if (this == this.baseCAS) {
+ // base CAS has no document
+ return null;
+ }
+ return this.documentText;
}
public FeatureStructure getSofaDataArray() {
- // base CAS has no SofaArray
+ if (this == this.baseCAS) {
+ // base CAS has no Sofa
+ return null;
+ }
+ if (mySofaIsValid()) {
+ return this.getSofa(mySofaRef).getLocalFSData();
+ }
return null;
}
public String getSofaDataURI() {
- // base CAS has no Sofa nothin
+ if (this == this.baseCAS) {
+ // base CAS has no Sofa
+ return null;
+ }
+ if (mySofaIsValid()) {
+ return this.getSofa(mySofaRef).getSofaURI();
+ }
return null;
}
public InputStream getSofaDataStream() {
- // base CAS has no Sofa nothin
- return null;
+ if (this == this.baseCAS) {
+ // base CAS has no Sofa nothin
+ return null;
+ }
+ return this.getSofaDataStream(this.getSofa());
}
public SofaFS getSofa() {
@@ -3592,34 +3783,83 @@
}
}
+ private boolean mySofaIsValid() {
+ return this.mySofaRef > 0;
+ }
+
+ protected void setDocTextFromDeserializtion(String text) {
+ if (mySofaIsValid()) {
+ final int SofaStringCode = ll_getTypeSystem().ll_getCodeForFeature(
+ this.getTypeSystem().getFeatureByFullName(CAS.FEATURE_FULL_NAME_SOFASTRING));
+ final int llsofa = getLowLevelCAS().ll_getFSRef(this.getSofa());
+ getLowLevelCAS().ll_setStringValue(llsofa, SofaStringCode, text);
+ this.documentText = text;
+ }
+ }
+
public void setDocumentLanguage(String languageCode) {
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INVALID_BASE_CAS_METHOD);
- e.addArgument("setDocumentLanguage");
- throw e;
+ if (this == this.baseCAS) {
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INVALID_BASE_CAS_METHOD);
+ e.addArgument("setDocumentLanguage");
+ throw e;
+ }
+ // LowLevelCAS llc = getLowLevelCAS();
+ LowLevelCAS llc = this;
+ final int docAnnotAddr = llc.ll_getFSRef(getDocumentAnnotation());
+ languageCode = Language.normalize(languageCode);
+ llc.ll_setStringValue(docAnnotAddr, this.langFeatCode, languageCode);
}
public void setDocumentText(String text) {
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INVALID_BASE_CAS_METHOD);
- e.addArgument("setDocumentText");
- throw e;
+ if (this == this.baseCAS) {
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INVALID_BASE_CAS_METHOD);
+ e.addArgument("setDocumentText");
+ throw e;
+ }
+ setSofaDataString(text, "text");
}
public void setSofaDataString(String text, String mime) throws CASRuntimeException {
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INVALID_BASE_CAS_METHOD);
- e.addArgument("setDocumentLanguage");
- throw e;
+ if (this == this.baseCAS) {
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INVALID_BASE_CAS_METHOD);
+ e.addArgument("setDocumentText");
+ throw e;
+ }
+
+ if (!mySofaIsValid()) {
+ this.createInitialSofa(mime);
+ }
+ // try to put the document into the SofaString ...
+ // ... will fail if previously set
+ getSofa(this.mySofaRef).setLocalSofaData(text);
}
public void setSofaDataArray(FeatureStructure array, String mime) throws CASRuntimeException {
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INVALID_BASE_CAS_METHOD);
- e.addArgument("setDocumentLanguage");
- throw e;
+ if (this == this.baseCAS) {
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INVALID_BASE_CAS_METHOD);
+ e.addArgument("setSofaDataArray");
+ throw e;
+ }
+ if (!mySofaIsValid()) {
+ this.baseCAS.createInitialSofa(mime);
+ }
+ // try to put the document into the SofaString ...
+ // ... will fail if previously set
+ getSofa(this.mySofaRef).setLocalSofaData(array);
}
public void setSofaDataURI(String uri, String mime) throws CASRuntimeException {
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INVALID_BASE_CAS_METHOD);
- e.addArgument("setDocumentLanguage");
- throw e;
+ if (this == this.baseCAS) {
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INVALID_BASE_CAS_METHOD);
+ e.addArgument("setSofaDataURI");
+ throw e;
+ }
+ if (!mySofaIsValid()) {
+ this.baseCAS.createInitialSofa(mime);
+ }
+ // try to put the document into the SofaString ...
+ // ... will fail if previously set
+ getSofa(this.mySofaRef).setRemoteSofaURI(uri);
}
public void setCurrentComponentInfo(ComponentInfo info) {
@@ -3662,7 +3902,8 @@
int sofaId = this.getSofaFeat(addr);
if (sofaId > 0) {
// check if same as that of current CAS view
- if (!(this instanceof TCASImpl) || (sofaId != ((TCASImpl) this).getSofaRef())) {
+// if (!(this instanceof TCASImpl) || (sofaId != ((TCASImpl) this).getSofaRef())) {
+ if (sofaId != ((CASImpl) this).getSofaRef()) {
// Does not match. get TCAS for the sofaRef feature found in
// annotation
return (CASImpl) this.getTCAS(getSofa(sofaId).getSofaRef());
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureValuePathImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureValuePathImpl.java?view=diff&rev=495414&r1=495413&r2=495414
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureValuePathImpl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureValuePathImpl.java Thu Jan 11 14:41:42 2007
@@ -1170,7 +1170,7 @@
private boolean isEmptyList(LowLevelCAS cas, int type) {
Type candidateType = cas.ll_getTypeSystem().ll_getTypeForCode(type);
- TypeSystem typeSystem = ((TCASImpl) cas).getTypeSystem();
+ TypeSystem typeSystem = ((CASImpl) cas).getTypeSystem();
boolean isEmpty = false;
for (int i = 0; i < this.emptyListTypes.length && (!isEmpty); i++) {
isEmpty = typeSystem.subsumes(this.emptyListTypes[i], candidateType);
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/Serialization.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/Serialization.java?view=diff&rev=495414&r1=495413&r2=495414
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/Serialization.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/Serialization.java Thu Jan 11 14:41:42 2007
@@ -58,7 +58,7 @@
}
public static void deserializeTCASComplete(CASCompleteSerializer casCompSer, CASMgr casMgr) {
- ((TCASImpl) casMgr).reinit(casCompSer);
+ ((CASImpl) casMgr).reinit(casCompSer);
}
public static CASMgr createCASMgr(CASMgrSerializer ser) {
@@ -75,7 +75,7 @@
}
public static TCAS createTCAS(TCASMgr tcasMgr, CASSerializer casSer) {
- ((TCASImpl) tcasMgr).reinit(casSer);
+ ((CASImpl) tcasMgr).reinit(casSer);
return tcasMgr.getTCAS();
}
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/SofaFSImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/SofaFSImpl.java?view=diff&rev=495414&r1=495413&r2=495414
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/SofaFSImpl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/SofaFSImpl.java Thu Jan 11 14:41:42 2007
@@ -111,7 +111,7 @@
super.setStringValue(stringFeat, aString);
// create or update the document annotation for this Sofa's view
CAS view = this.casImpl.getView(this);
- ((TCASImpl) view).updateDocumentAnnotation();
+ ((CASImpl) view).updateDocumentAnnotation();
}
/**
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=495414&r1=495413&r2=495414
==============================================================================
--- 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 Thu Jan 11 14:41:42 2007
@@ -461,7 +461,7 @@
// add indexRepo for views other than the initial view
indexRepositories.add(cas.getSofaIndexRepository(sofa));
}
- ((TCASImpl) view).registerView(sofa);
+ ((CASImpl) view).registerView(sofa);
tcasInstances.add(view);
}
FSInfo fsInfo = new FSInfo(addr, indexRep);
@@ -692,7 +692,7 @@
case DOC_TEXT_STATE: {
// Assume old style TCAS with one text Sofa
SofaFS newSofa = cas.createInitialSofa("text");
- TCASImpl tcas = (TCASImpl) cas.getInitialView();
+ CASImpl tcas = (CASImpl) cas.getInitialView();
tcas.registerView(newSofa);
// Set the document text without creating a documentAnnotation
tcas.setDocTextFromDeserializtion(buffer.toString());
@@ -781,7 +781,7 @@
}
for (int i = 0; i < tcasInstances.size(); i++) {
- ((TCASImpl) tcasInstances.get(i)).updateDocumentAnnotation();
+ ((CASImpl) tcasInstances.get(i)).updateDocumentAnnotation();
}
}
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=495414&r1=495413&r2=495414
==============================================================================
--- 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 Thu Jan 11 14:41:42 2007
@@ -449,7 +449,7 @@
// add indexRepo for views other than the initial view
indexRepositories.add(cas.getSofaIndexRepository(sofa));
}
- ((TCASImpl) view).registerView(sofa);
+ ((CASImpl) view).registerView(sofa);
tcasInstances.add(view);
}
if (id < 0) {
@@ -932,7 +932,7 @@
// System.out.println("Done in " + new TimeSpan(time));
for (int i = 0; i < tcasInstances.size(); i++) {
- ((TCASImpl) tcasInstances.get(i)).updateDocumentAnnotation();
+ ((CASImpl) tcasInstances.get(i)).updateDocumentAnnotation();
}
}
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/text/TCAS.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/text/TCAS.java?view=diff&rev=495414&r1=495413&r2=495414
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/text/TCAS.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/text/TCAS.java Thu Jan 11 14:41:42 2007
@@ -20,7 +20,6 @@
package org.apache.uima.cas.text;
import org.apache.uima.cas.CAS;
-import org.apache.uima.cas.TypeSystem;
/**
* TCAS: Text Common Analysis System.
@@ -32,76 +31,5 @@
* and constants on this interface were moved to the {@link CAS} interface.
*/
public interface TCAS extends CAS {
-
- /**
- * Name of TCAS name space.
- */
- static final String NAME_SPACE_UIMA_TCAS = "uima" + TypeSystem.NAMESPACE_SEPARATOR + "tcas";
-
- /**
- * Name of annotation type.
- */
- static final String TYPE_NAME_ANNOTATION = NAME_SPACE_UIMA_TCAS + TypeSystem.NAMESPACE_SEPARATOR
- + "Annotation";
-
- /**
- * Name of document annotation type.
- */
- static final String TYPE_NAME_DOCUMENT_ANNOTATION = NAME_SPACE_UIMA_TCAS
- + TypeSystem.NAMESPACE_SEPARATOR + "DocumentAnnotation";
-
- /**
- * Sofa ID feature that is the handle to a text Sofa.
- */
- static final String FEATURE_BASE_NAME_SOFA = "sofa";
-
- /**
- * Base name of annotation begin feature.
- */
- static final String FEATURE_BASE_NAME_BEGIN = "begin";
-
- /**
- * Base name of annotation end feature.
- */
- static final String FEATURE_BASE_NAME_END = "end";
-
- /**
- * Base name of document language feature.
- */
- static final String FEATURE_BASE_NAME_LANGUAGE = "language";
-
- /**
- * Fully qualified name of annotation begin feature.
- */
- static final String FEATURE_FULL_NAME_BEGIN = TYPE_NAME_ANNOTATION + TypeSystem.FEATURE_SEPARATOR
- + FEATURE_BASE_NAME_BEGIN;
-
- /**
- * Fully qualified name of annotation sofa feature.
- */
- static final String FEATURE_FULL_NAME_SOFA = TYPE_NAME_ANNOTATION + TypeSystem.FEATURE_SEPARATOR
- + FEATURE_BASE_NAME_SOFA;
-
- /**
- * Fully qualified name of annotation end feature.
- */
- static final String FEATURE_FULL_NAME_END = TYPE_NAME_ANNOTATION + TypeSystem.FEATURE_SEPARATOR
- + FEATURE_BASE_NAME_END;
-
- /**
- * Fully qualified name of document language feature.
- */
- static final String FEATURE_FULL_NAME_LANGUAGE = TYPE_NAME_DOCUMENT_ANNOTATION
- + TypeSystem.FEATURE_SEPARATOR + FEATURE_BASE_NAME_LANGUAGE;
-
- // //////////////////////////////////////////////////////////
- // Feature names
-
- /**
- * Name of the standard index on annotations. The standard index is automatically defined if you
- * use a TCAS.
- */
- static final String STD_ANNOTATION_INDEX = "AnnotationIndex";
-
- static final String DEFAULT_LANGUAGE_NAME = "x-unspecified";
+ // class soon to be history
}
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/text/TCASMgr.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/text/TCASMgr.java?view=diff&rev=495414&r1=495413&r2=495414
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/text/TCASMgr.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/text/TCASMgr.java Thu Jan 11 14:41:42 2007
@@ -25,11 +25,11 @@
* Collect admin functionality for TCAS.
*/
public interface TCASMgr extends CASMgr {
- /**
- * @deprecated no longer used, will throw exception if called.
- * @throws TCASException
- */
- void initTCASIndexes() throws TCASException;
+// /**
+// * @deprecated no longer used, will throw exception if called.
+// * @throws TCASException
+// */
+// void initTCASIndexes() throws TCASException;
/**
* Set the document text.
@@ -42,13 +42,13 @@
*/
void setDocumentText(String text) throws TCASRuntimeException;
- /**
- * Allow or disallow setting the text on the TCAS object corresponding to this manager.
- *
- * @param flag
- * If the text can be set on the corresponding TCAS object.
- */
- void enableSetText(boolean flag);
+// /**
+// * Allow or disallow setting the text on the TCAS object corresponding to this manager.
+// *
+// * @param flag
+// * If the text can be set on the corresponding TCAS object.
+// */
+// void enableSetText(boolean flag);
/**
* Return the TCAS corresponding to this CASMgr instance. This handle will remain valid, even
@@ -58,7 +58,7 @@
* @see org.apache.uima.cas.admin.FSIndexRepositoryMgr
*/
TCAS getTCAS();
-
- void setTCAS(TCAS tcas);
+//
+// void setTCAS(TCAS tcas);
}
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/Sofa.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/Sofa.java?view=diff&rev=495414&r1=495413&r2=495414
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/Sofa.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/Sofa.java Thu Jan 11 14:41:42 2007
@@ -29,7 +29,6 @@
import org.apache.uima.cas.SofaID;
import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.impl.FeatureImpl;
-import org.apache.uima.cas.impl.TCASImpl;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.impl.JCasImpl;
@@ -166,7 +165,7 @@
super.setStringValue(stringFeat, aString);
// create or update the document annotation for this Sofa's view
CAS view = this.getCASImpl().getView(this);
- ((TCASImpl) view).updateDocumentAnnotation();
+ ((CASImpl) view).updateDocumentAnnotation();
}
/**
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/TOP.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/TOP.java?view=diff&rev=495414&r1=495413&r2=495414
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/TOP.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/TOP.java Thu Jan 11 14:41:42 2007
@@ -24,7 +24,6 @@
import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.impl.FeatureStructureImpl;
import org.apache.uima.cas.impl.LowLevelCAS;
-import org.apache.uima.cas.impl.TCASImpl;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.impl.JCasImpl;
@@ -98,8 +97,8 @@
this.addr = jcasType.ll_cas.ll_createFS(jcasType.casTypeCode);
jcas.putJfsFromCaddr(addr, this);
CAS cas = jcas.getCas();
- if (cas instanceof TCASImpl && ((TCASImpl) cas).isAnnotationType(jcasType.casTypeCode)) {
- ((TCASImpl) cas).setSofaFeat(addr, ((TCASImpl) cas).getSofaRef());
+ if (((CASImpl) cas).isAnnotationType(jcasType.casTypeCode)) {
+ ((CASImpl) cas).setSofaFeat(addr, ((CASImpl) cas).getSofaRef());
}
}
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/resource/impl/CasManager_impl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/resource/impl/CasManager_impl.java?view=diff&rev=495414&r1=495413&r2=495414
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/resource/impl/CasManager_impl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/resource/impl/CasManager_impl.java Thu Jan 11 14:41:42 2007
@@ -28,7 +28,7 @@
import org.apache.uima.cas.AbstractCas;
import org.apache.uima.cas.CAS;
import org.apache.uima.cas.CASException;
-import org.apache.uima.cas.impl.TCASImpl;
+import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.jcas.JCas;
import org.apache.uima.resource.CasDefinition;
import org.apache.uima.resource.CasManager;
@@ -160,7 +160,7 @@
private void populateCasToCasPoolMap(CasPool aCasPool) {
CAS[] casArray = new CAS[aCasPool.getSize()];
for (int i = 0; i < casArray.length; i++) {
- casArray[i] = ((TCASImpl) aCasPool.getCas()).getBaseCAS();
+ casArray[i] = ((CASImpl) aCasPool.getCas()).getBaseCAS();
mCasToCasPoolMap.put(casArray[i], aCasPool);
}
for (int i = 0; i < casArray.length; i++) {
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/uimacpp/UimacppEngine.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/uimacpp/UimacppEngine.java?view=diff&rev=495414&r1=495413&r2=495414
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/uimacpp/UimacppEngine.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/uimacpp/UimacppEngine.java Thu Jan 11 14:41:42 2007
@@ -33,7 +33,6 @@
import org.apache.uima.cas.impl.CASSerializer;
import org.apache.uima.cas.impl.FeatureImpl;
import org.apache.uima.cas.impl.Serialization;
-import org.apache.uima.cas.impl.TCASImpl;
import org.apache.uima.cas.impl.TypeImpl;
import org.apache.uima.cas.impl.TypeSystemImpl;
import org.apache.uima.cas.text.TCAS;
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/AnnotationIteratorTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/AnnotationIteratorTest.java?view=diff&rev=495414&r1=495413&r2=495414
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/AnnotationIteratorTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/AnnotationIteratorTest.java Thu Jan 11 14:41:42 2007
@@ -31,7 +31,6 @@
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.cas.text.AnnotationIndex;
import org.apache.uima.cas.text.TCAS;
-import org.apache.uima.cas.text.TCASMgr;
import org.apache.uima.cas.text.TCASRuntimeException;
/**
@@ -144,7 +143,7 @@
final String text = "aaaa bbbb cccc dddd aaaa bbbb cccc dddd aaaa bbbb cccc dddd ";
try {
- ((TCASMgr) cas).setDocumentText(text);
+ cas.setDocumentText(text);
} catch (TCASRuntimeException e) {
assertTrue(false);
}
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/FilteredIteratorTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/FilteredIteratorTest.java?view=diff&rev=495414&r1=495413&r2=495414
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/FilteredIteratorTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/FilteredIteratorTest.java Thu Jan 11 14:41:42 2007
@@ -37,7 +37,6 @@
import org.apache.uima.cas.TypeSystem;
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.cas.text.TCAS;
-import org.apache.uima.cas.text.TCASMgr;
import org.apache.uima.cas.text.TCASRuntimeException;
/**
@@ -153,19 +152,9 @@
} catch (TCASRuntimeException e) {
assertTrue(false);
}
- ((TCASMgr) cas).enableSetText(false);
- boolean exc = false;
- try {
- cas.setDocumentText("A test.");
- } catch (TCASRuntimeException e) {
- assertTrue(e.getError() == TCASRuntimeException.SET_DOC_TEXT_DISABLED);
- exc = true;
- }
- assertTrue(exc);
- ((TCASMgr) cas).enableSetText(true);
try {
- ((TCASMgr) cas).setDocumentText("This is a test.");
+ cas.setDocumentText("This is a test.");
} catch (TCASRuntimeException e) {
assertTrue(false);
}
@@ -225,19 +214,9 @@
} catch (TCASRuntimeException e) {
assertTrue(false);
}
- ((TCASMgr) cas).enableSetText(false);
- boolean exc = false;
- try {
- cas.setDocumentText("A test.");
- } catch (TCASRuntimeException e) {
- assertTrue(e.getError() == TCASRuntimeException.SET_DOC_TEXT_DISABLED);
- exc = true;
- }
- assertTrue(exc);
- ((TCASMgr) cas).enableSetText(true);
try {
- ((TCASMgr) cas).setDocumentText("This is a test.");
+ cas.setDocumentText("This is a test.");
} catch (TCASRuntimeException e) {
assertTrue(false);
}
@@ -302,7 +281,7 @@
public void testIterator2() {
try {
- ((TCASMgr) cas).setDocumentText("This is a test with the word \"the\" in it.");
+ cas.setDocumentText("This is a test with the word \"the\" in it.");
// create token and sentence annotations
String type1 = "type1";
@@ -374,7 +353,7 @@
public void testIterator2a() {
try {
- ((TCASMgr) cas).setDocumentText("This is a test with the word \"the\" in it.");
+ cas.setDocumentText("This is a test with the word \"the\" in it.");
// create token and sentence annotations
String type1 = "type1";
@@ -445,7 +424,7 @@
public void testIterator2b() {
try {
- ((TCASMgr) cas).setDocumentText("This is a test with the word \"the\" in it.");
+ cas.setDocumentText("This is a test with the word \"the\" in it.");
FeatureStructure wordFS = this.cas.createFS(wordType);
FeatureStructure sepFS = this.cas.createFS(sepType);
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IndexComparitorTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IndexComparitorTest.java?view=diff&rev=495414&r1=495413&r2=495414
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IndexComparitorTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IndexComparitorTest.java Thu Jan 11 14:41:42 2007
@@ -34,7 +34,7 @@
import org.apache.uima.cas.admin.LinearTypeOrderBuilder;
import org.apache.uima.cas.admin.TypeSystemMgr;
import org.apache.uima.cas.impl.LinearTypeOrderBuilderImpl;
-import org.apache.uima.cas.impl.TCASImpl;
+import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.text.TCAS;
import org.apache.uima.test.junit_extension.JUnitExtension;
@@ -185,7 +185,7 @@
public void setUp() throws Exception {
try {
- this.cas = (TCASImpl) CASInitializer.initCas(new SetupForIndexCompareTesting());
+ this.cas = (CASImpl) CASInitializer.initCas(new SetupForIndexCompareTesting());
assertNotNull(cas);
ir = cas.getIndexRepository();
sortedType1 = ir.getIndex("SortedType1");
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IndexSerializationTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IndexSerializationTest.java?view=diff&rev=495414&r1=495413&r2=495414
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IndexSerializationTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IndexSerializationTest.java Thu Jan 11 14:41:42 2007
@@ -37,7 +37,6 @@
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.cas.text.TCAS;
import org.apache.uima.cas.text.TCASException;
-import org.apache.uima.cas.text.TCASMgr;
import org.apache.uima.resource.ResourceInitializationException;
import org.apache.uima.resource.metadata.TypeSystemDescription;
import org.apache.uima.util.CasCreationUtils;
@@ -67,7 +66,7 @@
public static final String SENT_TYPE = "Sentence";
- private TCASMgr casMgr;
+ private CASMgr casMgr;
private TCAS cas;
@@ -99,7 +98,7 @@
protected void setUp() throws Exception {
super.setUp();
casMgr = initCAS();
- cas = casMgr.getTCAS();
+ cas = (CASImpl)casMgr;
TypeSystem ts = cas.getTypeSystem();
wordType = ts.getType(WORD_TYPE);
@@ -116,7 +115,7 @@
}
// Initialize the first CAS.
- private static TCASMgr initCAS() throws TCASException {
+ private static CASMgr initCAS() throws TCASException {
// // Create a TCASMgr. Ensures existence of AnnotationFS type.
// TCASMgr tcas = TCASFactory.createTCAS();
CASMgr casMgr = CASFactory.createCAS();
@@ -166,7 +165,7 @@
// assert(cas.getIndexRepositoryMgr().isCommitted());
// Create the default text Sofa and return TCAS view
- return (TCASMgr) casMgr.getCAS().getTCAS();
+ return (CASMgr) casMgr.getCAS().getTCAS();
}
/**
@@ -216,7 +215,7 @@
((CASImpl) realCasMgr).commitTypeSystem();
Serialization.deserializeCASComplete(cs, realCasMgr);
cas = ((CASImpl) realCasMgr).getTCAS();
- casMgr = (TCASMgr) cas;
+ casMgr = (CASMgr) cas;
// System.out.println("After serialization\n");
FSIndex index = cas.getAnnotationIndex();
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java?view=diff&rev=495414&r1=495413&r2=495414
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java Thu Jan 11 14:41:42 2007
@@ -33,7 +33,7 @@
import org.apache.uima.cas.FeatureStructure;
import org.apache.uima.cas.Type;
import org.apache.uima.cas.TypeSystem;
-import org.apache.uima.cas.impl.TCASImpl;
+import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.cas.text.TCAS;
import org.apache.uima.internal.util.IntVector;
@@ -44,7 +44,7 @@
*/
public class IteratorTest extends TestCase {
- private TCASImpl cas;
+ private CASImpl cas;
private TypeSystem ts;
@@ -83,7 +83,7 @@
public void setUp() {
try {
- this.cas = (TCASImpl) CASInitializer.initCas(new CASTestSetup());
+ this.cas = (CASImpl) CASInitializer.initCas(new CASTestSetup());
assertTrue(this.cas != null);
this.ts = this.cas.getTypeSystem();
assertTrue(this.ts != null);
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/SerializationNoMDTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/SerializationNoMDTest.java?view=diff&rev=495414&r1=495413&r2=495414
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/SerializationNoMDTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/SerializationNoMDTest.java Thu Jan 11 14:41:42 2007
@@ -45,9 +45,8 @@
import org.apache.uima.cas.impl.CASSerializer;
import org.apache.uima.cas.impl.Serialization;
import org.apache.uima.cas.text.AnnotationFS;
-import org.apache.uima.cas.text.TCAS;
+import org.apache.uima.cas.CAS;
import org.apache.uima.cas.text.TCASException;
-import org.apache.uima.cas.text.TCASMgr;
import org.apache.uima.internal.util.TextStringTokenizer;
import org.apache.uima.resource.ResourceInitializationException;
import org.apache.uima.resource.metadata.TypeSystemDescription;
@@ -77,9 +76,9 @@
public static final String SENT_TYPE = "Sentence";
- private TCASMgr casMgr;
+ private CASMgr casMgr;
- private TCAS cas;
+ private CAS cas;
private Type wordType;
@@ -107,7 +106,7 @@
public void setUp() throws Exception {
super.setUp();
casMgr = initCAS();
- cas = casMgr.getTCAS();
+ cas = (CASImpl)casMgr;
TypeSystem ts = cas.getTypeSystem();
wordType = ts.getType(WORD_TYPE);
@@ -116,8 +115,8 @@
eosType = ts.getType(EOS_TYPE);
tokenType = ts.getType(TOKEN_TYPE);
tokenTypeFeature = ts.getFeatureByFullName(TOKEN_TYPE_FEAT_Q);
- startFeature = ts.getFeatureByFullName(TCAS.FEATURE_FULL_NAME_BEGIN);
- endFeature = ts.getFeatureByFullName(TCAS.FEATURE_FULL_NAME_END);
+ startFeature = ts.getFeatureByFullName(CAS.FEATURE_FULL_NAME_BEGIN);
+ endFeature = ts.getFeatureByFullName(CAS.FEATURE_FULL_NAME_END);
sentenceType = ts.getType(SENT_TYPE);
}
@@ -136,7 +135,7 @@
}
// Initialize the first CAS.
- private static TCASMgr initCAS() throws TCASException {
+ private static CASMgr initCAS() throws TCASException {
// Create an initial CASMgr from the factory.
// CASMgr cas = CASFactory.createCAS();
// assert(tsa != null);
@@ -152,7 +151,7 @@
TypeSystemMgr tsa = aCas.getTypeSystemMgr();
// Add new types and features.
Type topType = tsa.getTopType();
- Type annotType = tsa.getType(TCAS.TYPE_NAME_ANNOTATION);
+ Type annotType = tsa.getType(CAS.TYPE_NAME_ANNOTATION);
// assert(annotType != null);
tsa.addType(SENT_TYPE, annotType);
Type tokenType = tsa.addType(TOKEN_TYPE, annotType);
@@ -178,7 +177,7 @@
// assert(cas.getIndexRepositoryMgr().isCommitted());
// Create the default text Sofa and return TCAS view
- return (TCASMgr) aCas.getCAS().getTCAS();
+ return (CASMgr) aCas.getCAS().getTCAS();
}
// Tokenize text.
@@ -416,7 +415,7 @@
for (int i = 0; i < numDocs && docCount < max; i++) {
// System.out.println("Processing document: " + i);
// Set document text in first CAS.
- casMgr.setDocumentText((String) docs.get(i));
+ cas.setDocumentText((String) docs.get(i));
tokenize();
numTok = cas.getAnnotationIndex(tokenType).size();
@@ -425,7 +424,7 @@
// System.out.println("Serializing...");
cs = Serialization.serializeNoMetaData(cas);
- cas = Serialization.createTCAS(casMgr, cs);
+ cas = Serialization.createCAS(casMgr, cs);
assertTrue(numTok == cas.getAnnotationIndex(tokenType).size());
@@ -436,7 +435,7 @@
// System.out.println("Serializing...");
cs = Serialization.serializeNoMetaData(cas);
- cas = Serialization.createTCAS(casMgr, cs);
+ cas = Serialization.createCAS(casMgr, cs);
assertTrue(numTok == cas.getAnnotationIndex(tokenType).size());
assertTrue(numSent == cas.getAnnotationIndex(sentenceType).size());
@@ -445,7 +444,7 @@
// System.out.println("Serializing...");
cs = Serialization.serializeNoMetaData(cas);
- cas = Serialization.createTCAS(casMgr, cs);
+ cas = Serialization.createCAS(casMgr, cs);
assertTrue(numTok == cas.getAnnotationIndex(tokenType).size());
assertTrue(numSent == cas.getAnnotationIndex(sentenceType).size());
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/SerializationReinitTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/SerializationReinitTest.java?view=diff&rev=495414&r1=495413&r2=495414
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/SerializationReinitTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/SerializationReinitTest.java Thu Jan 11 14:41:42 2007
@@ -30,6 +30,7 @@
import junit.framework.TestCase;
+import org.apache.uima.cas.CAS;
import org.apache.uima.cas.CASException;
import org.apache.uima.cas.FSIndex;
import org.apache.uima.cas.FSIndexRepository;
@@ -82,9 +83,9 @@
public static final String[] STR_1_VALS = { "test1", "test2" };
- private TCASMgr casMgr;
+ private CASMgr casMgr;
- private TCAS cas;
+ private CAS cas;
private Type wordType;
@@ -114,7 +115,7 @@
public void setUp() throws Exception {
super.setUp();
casMgr = initCAS();
- cas = casMgr.getTCAS();
+ cas = (CASImpl)casMgr;
TypeSystem ts = cas.getTypeSystem();
wordType = ts.getType(WORD_TYPE);
@@ -146,7 +147,7 @@
}
// Initialize the first CAS.
- private static TCASMgr initCAS() throws TCASException {
+ private static CASMgr initCAS() throws TCASException {
// Create an initial CASMgr from the factory.
// CASMgr cas = CASFactory.createCAS();
// assert(tsa != null);
@@ -189,7 +190,7 @@
// assert(cas.getIndexRepositoryMgr().isCommitted());
// Create the default text Sofa and return TCAS view
- return (TCASMgr) aCas.getCAS().getTCAS();
+ return (CASMgr) aCas.getCAS().getTCAS();
}
public void testReset() {
@@ -389,7 +390,7 @@
for (int i = 0; i < numDocs && docCount < max; i++) {
// System.out.println("Processing document: " + i);
// Set document text in first CAS.
- casMgr.setDocumentText((String) docs.get(i));
+ cas.setDocumentText((String) docs.get(i));
tokenize();
numTok = cas.getAnnotationIndex(tokenType).size();
@@ -398,7 +399,7 @@
// System.out.println("Serializing...");
cs = Serialization.serializeCAS(cas);
- cas = Serialization.createTCAS(casMgr, cs);
+ cas = Serialization.createCAS(casMgr, cs);
assertTrue(numTok == cas.getAnnotationIndex(tokenType).size());
@@ -409,14 +410,14 @@
// System.out.println("Serializing...");
cs = Serialization.serializeCAS(cas);
- cas = Serialization.createTCAS(casMgr, cs);
+ cas = Serialization.createCAS(casMgr, cs);
assertTrue(numTok == cas.getAnnotationIndex(tokenType).size());
assertTrue(numSent == cas.getAnnotationIndex(sentenceType).size());
// System.out.println("Serializing...");
cs = Serialization.serializeCAS(cas);
- cas = Serialization.createTCAS(casMgr, cs);
+ cas = Serialization.createCAS(casMgr, cs);
assertTrue(numTok == cas.getAnnotationIndex(tokenType).size());
assertTrue(numSent == cas.getAnnotationIndex(sentenceType).size());
@@ -466,7 +467,7 @@
for (int i = 0; i < numDocs && docCount < max; i++) {
// System.out.println("Processing document: " + i);
// Set document text in first CAS.
- casMgr.setDocumentText((String) docs.get(i));
+ cas.setDocumentText((String) docs.get(i));
tokenize();
numTok = cas.getAnnotationIndex(tokenType).size();
@@ -480,7 +481,7 @@
CASMgr realCasMgr = CASFactory.createCAS();
realCasMgr.setCAS(((CASImpl) cas).getBaseCAS());
cas = ((CASImpl) realCasMgr).getTCAS();
- casMgr = (TCASMgr) cas;
+ casMgr = (CASMgr) cas;
assertTrue(numTok == cas.getAnnotationIndex(tokenType).size());
@@ -496,7 +497,7 @@
realCasMgr = CASFactory.createCAS();
realCasMgr.setCAS(((CASImpl) cas).getBaseCAS());
cas = ((CASImpl) realCasMgr).getTCAS();
- casMgr = (TCASMgr) cas;
+ casMgr = (CASMgr) cas;
assertTrue(numTok == cas.getAnnotationIndex(tokenType).size());
assertTrue(numSent == cas.getAnnotationIndex(sentenceType).size());
@@ -508,7 +509,7 @@
realCasMgr = CASFactory.createCAS();
realCasMgr.setCAS(((CASImpl) cas).getBaseCAS());
cas = ((CASImpl) realCasMgr).getTCAS();
- casMgr = (TCASMgr) cas;
+ casMgr = (CASMgr) cas;
assertTrue(numTok == cas.getAnnotationIndex(tokenType).size());
assertTrue(numSent == cas.getAnnotationIndex(sentenceType).size());
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeSystemReinitTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeSystemReinitTest.java?view=diff&rev=495414&r1=495413&r2=495414
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeSystemReinitTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeSystemReinitTest.java Thu Jan 11 14:41:42 2007
@@ -30,7 +30,6 @@
import org.apache.uima.cas.impl.CASCompleteSerializer;
import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.impl.Serialization;
-import org.apache.uima.cas.impl.TCASImpl;
import org.apache.uima.cas.text.TCAS;
import org.apache.uima.resource.metadata.TypeSystemDescription;
import org.apache.uima.resource.metadata.impl.TypeSystemDescription_impl;
@@ -56,7 +55,7 @@
CASCompleteSerializer ser = Serialization.serializeCASComplete((CASMgr) cas1);
TCAS tcas2 = CasCreationUtils.createTCas(new TypeSystemDescription_impl(), null, null);
- CASImpl cas2 = ((TCASImpl) tcas2).getBaseCAS();
+ CASImpl cas2 = ((CASImpl) tcas2).getBaseCAS();
tcas2.setDocumentText("bar");
// reinit