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 2015/11/04 21:14:49 UTC
svn commit: r1712630 - in
/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main:
java/org/apache/uima/cas/ java/org/apache/uima/cas/impl/
java/org/apache/uima/jcas/ java/org/apache/uima/jcas/impl/
resources/org/apache/uima/ resources/org/apache/u...
Author: schor
Date: Wed Nov 4 20:14:48 2015
New Revision: 1712630
URL: http://svn.apache.org/viewvc?rev=1712630&view=rev
Log:
[UIMA-4663] have low level sets of FS features go through FeatureStructureImplC; update error messages, change FSClassRegistry loading to a 2 pass to allow getters/setters access to JCas cover class Java Classes, update the javaClass for a type when loading a JCas cover class, change many refs that get an FS from an ID to use the checked form
Modified:
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/CASException.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_singletype.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/LowLevelException.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/JCas.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/impl/JCasImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima/UIMAException_Messages.properties
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima/cas/impl/ll_runtimeException.properties
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/CASException.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/CASException.java?rev=1712630&r1=1712629&r2=1712630&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/CASException.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/CASException.java Wed Nov 4 20:14:48 2015
@@ -63,6 +63,9 @@ public class CASException extends UIMAEx
* feature {1}.
*/
public static final String JCAS_FEATURENOTFOUND_ERROR = "JCAS_FEATURENOTFOUND_ERROR";
+
+ /* Unable to find required {0} method for JCAS type {1} with {2} type of {3}. */
+ public static final String JCAS_GETTER_SETTER_MISSING = "JCAS_GETTER_SETTER_MISSING";
/**
* The JCAS range type {2} for feature {1} of type {0} does not match the CAS range type {3} for
@@ -75,6 +78,8 @@ public class CASException extends UIMAEx
/** Type system has not been committed; cannot create base index. */
public static final String MUST_COMMIT_TYPE_SYSTEM = "MUST_COMMIT_TYPE_SYSTEM";
+
+
public CASException() {
super();
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java?rev=1712630&r1=1712629&r2=1712630&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java Wed Nov 4 20:14:48 2015
@@ -1151,34 +1151,33 @@ public class CASImpl extends AbstractCas
* @param nbrOfConsecutive
*/
private void logFSUpdate(FeatureStructureImplC fs, FeatureImpl fi, int arrayIndexStart, int nbrOfConsecutive) {
- if (this.svd.trackingMark != null && !this.svd.trackingMark.isNew(fs.id())) {
- //log the FS
-
- //create or use last FsChange element
- FsChange change = null;
-
- final List<FsChange> changes = this.svd.modifiedPreexistingFSs;
- final int nbrOfChanges = changes.size();
- if (nbrOfChanges > 0) {
- change = changes.get(nbrOfChanges - 1); // get last element
- }
+
+ //log the FS
+
+ //create or use last FsChange element
+ FsChange change = null;
- // only create a new FsChange element if needed
- if (change.fs != fs) {
- this.svd.modifiedPreexistingFSs.add(change = new FsChange(fs));
+ final List<FsChange> changes = this.svd.modifiedPreexistingFSs;
+ final int nbrOfChanges = changes.size();
+ if (nbrOfChanges > 0) {
+ change = changes.get(nbrOfChanges - 1); // get last element
+ }
+
+ // only create a new FsChange element if needed
+ if (change.fs != fs) {
+ this.svd.modifiedPreexistingFSs.add(change = new FsChange(fs));
+ }
+
+ if (fi == null) {
+ if (arrayIndexStart < 0) {
+ throw new UIMARuntimeException(UIMARuntimeException.INTERNAL_ERROR);
}
-
- if (fi == null) {
- if (arrayIndexStart < 0) {
- throw new UIMARuntimeException(UIMARuntimeException.INTERNAL_ERROR);
- }
- change.addArrayData(arrayIndexStart, nbrOfConsecutive);
+ change.addArrayData(arrayIndexStart, nbrOfConsecutive);
+ } else {
+ if (fi.isInInt) {
+ change.addIntData(fi.getOffset());
} else {
- if (fi.isInInt) {
- change.addIntData(fi.getOffset());
- } else {
- change.addRefData(fi.getOffset());
- }
+ change.addRefData(fi.getOffset());
}
}
}
@@ -1271,26 +1270,26 @@ public class CASImpl extends AbstractCas
* @param i the index being updated
*/
public void maybeLogArrayUpdate(FeatureStructureImplC fs, FeatureImpl feat, int i) {
- if (this.svd.trackingMark != null) {
+ if (this.svd.trackingMark != null && !this.svd.trackingMark.isNew(fs.id())) {
this.logFSUpdate(fs, feat, 1, 1);
}
}
public void maybeLogUpdate(FeatureStructureImplC fs, FeatureImpl feat) {
- if (this.svd.trackingMark != null) {
+ if (this.svd.trackingMark != null && !this.svd.trackingMark.isNew(fs.id())) {
this.logFSUpdate(fs, feat);
}
}
public void maybeLogUpdateJFRI(FeatureStructureImplC fs, int jcasFieldRegistryIndex) {
- if (this.svd.trackingMark != null) {
+ if (this.svd.trackingMark != null && !this.svd.trackingMark.isNew(fs.id())) {
this.logFSUpdate(fs, getFeatFromJCasFieldRegistryIndex(jcasFieldRegistryIndex));
}
}
public void maybeLogUpdate(FeatureStructureImplC fs, int featCode) {
- if (this.svd.trackingMark != null) {
+ if (this.svd.trackingMark != null && !this.svd.trackingMark.isNew(fs.id())) {
this.logFSUpdate(fs, getTypeSystemImpl().getFeatureForCode(featCode));
}
}
@@ -1302,8 +1301,7 @@ public class CASImpl extends AbstractCas
*/
/**
- * This is the common point where low-level operations to set features come through
- * It implements the check for invalid feature setting and potentially the addback.
+ * low level setter
*
* @param fs the feature structure
* @param feat the feature to set
@@ -1311,16 +1309,20 @@ public class CASImpl extends AbstractCas
*/
public void setFeatureValue(FeatureStructureImplC fs, FeatureImpl feat, int value) {
- boolean wasRemoved = checkForInvalidFeatureSetting(fs, feat.getCode());
- fs._intData[feat.getAdjustedOffset()] = value;
- if (wasRemoved) {
- maybeAddback(fs);
- }
- maybeLogUpdate(fs, feat);
+ fs.setIntValue(feat, value);
+// boolean wasRemoved = checkForInvalidFeatureSetting(fs, feat.getCode());
+// fs._intData[feat.getAdjustedOffset()] = value;
+// if (wasRemoved) {
+// maybeAddback(fs);
+// }
+// maybeLogUpdate(fs, feat);
}
/**
* version for longs, uses two slots
+ * Only called from FeatureStructureImplC after determining
+ * there is no local field to use
+ * Is here because of of 3 calls to things in this class
* @param fs the feature structure
* @param feat the feature to set
* @param value -
@@ -1337,7 +1339,7 @@ public class CASImpl extends AbstractCas
}
/**
- * This is the common point where all operations to set features come through
+ * This is the common point where all low-level operations to set features come through
* It implements the check for invalid feature setting and potentially the addback.
* (String objects may be in keys)
* @param fs the feature structure
@@ -1346,27 +1348,28 @@ public class CASImpl extends AbstractCas
*/
public void setFeatureValue(FeatureStructureImplC fs, FeatureImpl feat, Object value) {
- boolean wasRemoved = checkForInvalidFeatureSetting(fs, feat.getCode());
- fs._refData[feat.getAdjustedOffset()] = value;
- if (wasRemoved) {
- maybeAddback(fs);
- }
- maybeLogUpdate(fs, feat);
+ fs.setRefValueCJ(feat, value);
+// boolean wasRemoved = checkForInvalidFeatureSetting(fs, feat.getCode());
+// fs._refData[feat.getAdjustedOffset()] = value;
+// if (wasRemoved) {
+// maybeAddback(fs);
+// }
+// maybeLogUpdate(fs, feat);
}
- /**
- * Set the value of a feature of a FS without checking for index corruption
- * (typically because the feature isn't one that can be used as a key, or
- * the context is one where the FS is being created, and is guaranteed not to be in any index (yet))
- *
- * @param fs The FS.
- * @param feat The feature.
- * @param value The new value for the feature.
- */
- void setFeatureValueNoIndexCorruptionCheck(FeatureStructureImplC fs, FeatureImpl feat, int value) {
- fs._intData[feat.getAdjustedOffset()] = value;
- maybeLogUpdate(fs, feat);
- }
+// /**
+// * Set the value of a feature of a FS without checking for index corruption
+// * (typically because the feature isn't one that can be used as a key, or
+// * the context is one where the FS is being created, and is guaranteed not to be in any index (yet))
+// *
+// * @param fs The FS.
+// * @param feat The feature.
+// * @param value The new value for the feature.
+// */
+// void setFeatureValueNoIndexCorruptionCheck(FeatureStructureImplC fs, FeatureImpl feat, int value) {
+// fs._intData[feat.getAdjustedOffset()] = value;
+// maybeLogUpdate(fs, feat);
+// }
/**
* Set the value of a feature of a FS without checking for index corruption
@@ -1378,31 +1381,32 @@ public class CASImpl extends AbstractCas
* @param value The new value for the feature.
*/
void setFeatureValueNoIndexCorruptionCheck(FeatureStructureImplC fs, FeatureImpl feat, Object value) {
- fs._refData[feat.getAdjustedOffset()] = value;
- maybeLogUpdate(fs, feat);
+ fs.setFeatureValueNoIndexCorruptionCheck(feat, value);
+// fs._refData[feat.getAdjustedOffset()] = value;
+// maybeLogUpdate(fs, feat);
}
- /**
- * Set the value of a feature in the FS without journaling
- * (because it's for a new FS above the mark)
- * @param fs The Feature Structure.
- * @param featOffset The offset
- * @param value The new value for the feature.
- */
- void setFeatureValueNotJournaled(FeatureStructureImplC fs, int featOffset, int value) {
- fs._intData[featOffset] = value;
- }
+// /**
+// * Set the value of a feature in the FS without journaling
+// * (because it's for a new FS above the mark)
+// * @param fs The Feature Structure.
+// * @param featOffset The offset
+// * @param value The new value for the feature.
+// */
+// void setFeatureValueNotJournaled(FeatureStructureImplC fs, int featOffset, int value) {
+// fs._intData[featOffset] = value;
+// }
- /**
- * Set the value of a feature in the FS without journaling
- * (because it's for a new FS above the mark)
- * @param fs The Feature Structure.
- * @param featOffset The offset
- * @param value The new value for the feature.
- */
- void setFeatureValueNotJournaled(FeatureStructureImplC fs, int featOffset, Object value) {
- fs._refData[featOffset] = value;
- }
+// /**
+// * Set the value of a feature in the FS without journaling
+// * (because it's for a new FS above the mark)
+// * @param fs The Feature Structure.
+// * @param featOffset The offset
+// * @param value The new value for the feature.
+// */
+// void setFeatureValueNotJournaled(FeatureStructureImplC fs, int featOffset, Object value) {
+// fs._refData[featOffset] = value;
+// }
public void setFeatureValue(int fsRef, int featureCode, int value) {
setFeatureValue(getFsFromId_checked(fsRef), getTypeSystemImpl().getFeatureForCode(featureCode), value);
@@ -2061,9 +2065,9 @@ public class CASImpl extends AbstractCas
return getFsFromId_checked(fsRef).getIntValue(getTypeSystemImpl().getFeatureForCode_checked(featureCode));
}
- public final int ll_getIntValueFeatOffset(int fsRef, int featureOffset) {
- return ll_getFSForRef(fsRef)._intData[featureOffset];
- }
+// public final int ll_getIntValueFeatOffset(int fsRef, int featureOffset) {
+// return ll_getFSForRef(fsRef)._intData[featureOffset];
+// }
public final float ll_getFloatValue(int fsRef, int featureCode) {
return getFsFromId_checked(fsRef).getFloatValue(getTypeSystemImpl().getFeatureForCode_checked(featureCode));
@@ -2073,17 +2077,17 @@ public class CASImpl extends AbstractCas
return getFsFromId_checked(fsRef).getStringValue(getTypeSystemImpl().getFeatureForCode_checked(featureCode));
}
- public final String ll_getStringValueFeatOffset(int fsRef, int featureOffset) {
- return (String) getFsFromId_checked(fsRef)._refData[featureOffset];
- }
+// public final String ll_getStringValueFeatOffset(int fsRef, int featureOffset) {
+// return (String) getFsFromId_checked(fsRef)._refData[featureOffset];
+// }
public final int ll_getRefValue(int fsRef, int featureCode) {
return getFsFromId_checked(fsRef).getFeatureValue(getTypeSystemImpl().getFeatureForCode_checked(featureCode)).id();
}
- public final int ll_getRefValueFeatOffset(int fsRef, int featureOffset) {
- return ((FeatureStructureImplC)getFsFromId_checked(fsRef)._refData[featureOffset]).id();
- }
+// public final int ll_getRefValueFeatOffset(int fsRef, int featureOffset) {
+// return ((FeatureStructureImplC)getFsFromId_checked(fsRef)._refData[featureOffset]).id();
+// }
public final int ll_getIntValue(int fsRef, int featureCode, boolean doTypeChecks) {
if (doTypeChecks) {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java?rev=1712630&r1=1712629&r2=1712630&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java Wed Nov 4 20:14:48 2015
@@ -167,8 +167,11 @@ public class FSClassRegistry {
assert (builtinClass != null); // builtin types must be present
// copy down to subtypes, if needed, done later
- jcasClassesInfoForBuiltins[ti.getCode()] = createJCasClassInfo(builtinClass, ti);
+ JCasClassInfo jcasClassInfo = createJCasClassInfo(builtinClass, ti);
+ jcasClassesInfoForBuiltins[ti.getCode()] = jcasClassInfo;
+ setupGetterSetter(ti, jcasClassInfo);
}
+
/** special handling for Sofa, a non-creatable type */
TypeImpl ti = tsi.getType(CAS.TYPE_NAME_SOFA);
jcasClassesInfoForBuiltins[ti.getCode()] = createJCasClassInfo(Sofa.class, ti);
@@ -214,7 +217,14 @@ public class FSClassRegistry {
*/
if (isDoUserJCasLoading) {
+ /**
+ * Two pass loading is needed.
+ * - The first one loads the JCas Cover Classes initializes everything except the getters and setters
+ * - The second pass updates the JCasClassInfo for the getters, and setters, which depend on
+ * having the TypeImpl' javaClass field be accurate (reflect any loaded JCas types)
+ */
maybeLoadJCasAndSubtypes(ts, ts.topType, jcasClassesInfo[TypeSystemImpl.topTypeCode]);
+ setupGettersSetters(ts, ts.topType, jcasClassesInfo);
}
// walk the type system and extract all the registry indexes
@@ -266,7 +276,7 @@ public class FSClassRegistry {
if (!isBuiltin) {
clazz = maybeLoadJCas(ti.getName(), ti.getClass().getClassLoader());
if (null != clazz && TOP.class.isAssignableFrom(clazz)) {
- jcasClassInfo = createJCasClassInfo(clazz, ti); // side effect - creates method handles for getters/setters
+ jcasClassInfo = createJCasClassInfo(clazz, ti);
ts.setJCasRegisteredType(Misc.getStaticIntField(clazz, "typeIndexID"), ti);
}
jcasClassesInfo[typecode] = jcasClassInfo; // sets new one or default one
@@ -276,6 +286,38 @@ public class FSClassRegistry {
maybeLoadJCasAndSubtypes(ts, subtype, jcasClassesInfo[typecode]);
}
}
+
+ private static void setupGettersSetters(TypeSystemImpl ts, TypeImpl ti, JCasClassInfo[] jci) {
+ boolean isBuiltin = BuiltinTypeKinds.creatableBuiltinJCas.contains(ti.getName());
+
+ if (!isBuiltin) {
+ setupGetterSetter(ti, jci[ti.getCode()]);
+ }
+
+ for (TypeImpl subtype : ti.getDirectSubtypes()) {
+ setupGettersSetters(ts, subtype, jci);
+ }
+ }
+
+ private static void setupGetterSetter(TypeImpl ti, JCasClassInfo jcasClassInfo) {
+
+ final Class<?> jcasClass = jcasClassInfo.jcasClass;
+
+ if (jcasClass.getName().equals(typeName2ClassName(ti.getName()))) { // skip if this type is using a superclass JCas class
+ for (FeatureImpl fi : ti.getMergedStaticFeaturesIntroducedByThisType()) {
+ if (!isFieldInClass(fi, jcasClass)) {
+ continue;
+ }
+ Object getter = createGetterOrSetter(jcasClass, fi, GETTER);
+ Object setter = createGetterOrSetter(jcasClass, fi, SETTER);
+
+ GetterSetter prev = jcasClassInfo.gettersAndSetters.put(fi.getShortName(), new GetterSetter(getter, setter));
+ if (prev != null) {
+ throw new CASRuntimeException(CASRuntimeException.INTERNAL_ERROR);
+ }
+ }
+ }
+ }
private static Class<?> maybeLoadJCas(String typeName, ClassLoader cl) {
Class<?> clazz = null;
@@ -412,9 +454,13 @@ public class FSClassRegistry {
return null;
}
// report missing setter or getter
- CASException casEx = new CASException(CASException.JCAS_FEATURENOTFOUND_ERROR,
- jcasClass.getName(),
- fi.getGetterSetterName(isGetter));
+ /* Unable to find required {0} method for JCAS type {1} with {2} type of {3}. */
+ CASException casEx = new CASException(CASException.JCAS_GETTER_SETTER_MISSING,
+ fi.getGetterSetterName(isGetter),
+ jcasClass.getName(),
+ isGetter ? "return" : "argument",
+ range.javaClass.getName()
+ );
ArrayList<Exception> es = errorSet.get();
if (es == null) {
es = new ArrayList<Exception>();
@@ -442,20 +488,9 @@ public class FSClassRegistry {
// static for setting up static builtin values
private static JCasClassInfo createJCasClassInfo(Class<?> jcasClass, TypeImpl ti) {
+ ti.setJavaClass(jcasClass);
JCasClassInfo jcasClassInfo = new JCasClassInfo(jcasClass, ti.getName().equals(CAS.TYPE_NAME_SOFA) ? null : createGenerator(jcasClass, ti));
-
- for (FeatureImpl fi : ti.getMergedStaticFeaturesIntroducedByThisType()) {
- if (!isFieldInClass(fi, jcasClass)) {
- continue;
- }
- Object getter = createGetterOrSetter(jcasClass, fi, GETTER);
- Object setter = createGetterOrSetter(jcasClass, fi, SETTER);
-
- GetterSetter prev = jcasClassInfo.gettersAndSetters.put(fi.getShortName(), new GetterSetter(getter, setter));
- if (prev != null) {
- throw new CASRuntimeException(CASRuntimeException.INTERNAL_ERROR);
- }
- }
+
return jcasClassInfo;
}
@@ -471,6 +506,7 @@ public class FSClassRegistry {
ArrayList<Exception> es = errorSet.get();
if (es != null) {
StringBuilder msg = new StringBuilder(100);
+ msg.append('\n');
for (Exception f : es) {
msg.append(f.getMessage());
msg.append('\n');
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java?rev=1712630&r1=1712629&r2=1712630&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java Wed Nov 4 20:14:48 2015
@@ -461,6 +461,25 @@ public class FeatureStructureImplC imple
}
}
+ public void setFeatureValueNoIndexCorruptionCheck(Feature feat, Object v) {
+ FeatureImpl fi = (FeatureImpl) feat;
+
+ if (fi.isInInt) {
+ /** Trying to access value of feature "{0}" as feature structure, but is primitive type. */
+ throw new CASRuntimeException(CASRuntimeException.PRIMITIVE_VAL_FEAT, feat.getName());
+ }
+ if (IS_ENABLE_RUNTIME_FEATURE_VALIDATION) featureValidation(feat);
+ if (IS_ENABLE_RUNTIME_FEATURE_VALUE_VALIDATION) featureValueValidation(feat, v);
+
+ Object setter = fi.getJCasSetter();
+ if (setter != null) {
+ ((JCas_setter_generic<Object>)setter).set(this, v);
+ } else {
+ _refData[fi.getAdjustedOffset()] = v;
+ _casView.maybeLogUpdate(this, fi.getCode());
+ }
+ }
+
@Override
public void setJavaObjectValue(Feature feat, Object v) {
if (v instanceof String) {
@@ -612,7 +631,7 @@ public class FeatureStructureImplC imple
return this._casView;
}
- protected CASImpl _casView() { // was package private 9-03
+ public CASImpl getCASImpl() { // was package private 9-03
return this._casView;
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java?rev=1712630&r1=1712629&r2=1712630&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java Wed Nov 4 20:14:48 2015
@@ -75,7 +75,7 @@ public class FsIndex_bag<T extends Featu
@SuppressWarnings("unchecked")
public final boolean insert(int fs) {
- return insert((T) casImpl.getFsFromId(fs));
+ return insert((T) casImpl.getFsFromId_checked(fs));
}
/**
@@ -134,7 +134,7 @@ public class FsIndex_bag<T extends Featu
}
boolean ll_contains(int fsAddr) {
- return contains(casImpl.getFsFromId(fsAddr));
+ return contains(casImpl.getFsFromId_checked(fsAddr));
}
/**
@@ -169,7 +169,7 @@ public class FsIndex_bag<T extends Featu
@Override
public boolean remove(int fsRef) {
- return deleteFS(casImpl.getFsFromId(fsRef));
+ return deleteFS(casImpl.getFsFromId_checked(fsRef));
}
public int hashCode() {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_singletype.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_singletype.java?rev=1712630&r1=1712629&r2=1712630&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_singletype.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_singletype.java Wed Nov 4 20:14:48 2015
@@ -111,7 +111,7 @@ public abstract class FsIndex_singletype
* @return true if something was removed, false if not found
*/
boolean remove(int fs) {
- return deleteFS(getCasImpl().getFsFromId(fs));
+ return deleteFS((T) getCasImpl().getFsFromId_checked(fs));
}
/**
@@ -196,7 +196,7 @@ public abstract class FsIndex_singletype
* @return 0 if equal, < 0 if fs1 < fs2, > 0 if fs1 > fs2
*/
public int compare(int fs1, int fs2) {
- return compare(casImpl.getFsFromId(fs1), casImpl.getFsFromId(fs2));
+ return compare(casImpl.getFsFromId_checked(fs1), casImpl.getFsFromId_checked(fs2));
}
/**
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/LowLevelException.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/LowLevelException.java?rev=1712630&r1=1712629&r2=1712630&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/LowLevelException.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/LowLevelException.java Wed Nov 4 20:14:48 2015
@@ -31,7 +31,7 @@ public class LowLevelException extends U
private static final String resource_file = "org.apache.uima.cas.impl.ll_runtimeException";
- /** Error in low-level CAS APIs: attempted heap access with invalid FS reference: {0}. */
+ /** Error in low-level CAS APIs: accessing FS with id {0}, but no such FS exists in this CAS. */
public static final String INVALID_FS_REF = "INVALID_FS_REF";
/**
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/JCas.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/JCas.java?rev=1712630&r1=1712629&r2=1712630&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/JCas.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/JCas.java Wed Nov 4 20:14:48 2015
@@ -81,20 +81,20 @@ public interface JCas extends AbstractCa
/**
* @return the FSIndexRepository object for this Cas
*/
- public abstract FSIndexRepository getFSIndexRepository();
+ FSIndexRepository getFSIndexRepository();
- public abstract LowLevelIndexRepository getLowLevelIndexRepository();
+ LowLevelIndexRepository getLowLevelIndexRepository();
/**
* @return the CAS object for this JCas instantiation
*/
- public abstract CAS getCas();
+ CAS getCas();
/* internal use */
- public abstract CASImpl getCasImpl();
+ CASImpl getCasImpl();
/* internal use */
- public abstract LowLevelCAS getLowLevelCas();
+ LowLevelCAS getLowLevelCas();
/**
* Given Foo.type, return the corresponding CAS Type object. This is useful in the methods which
@@ -104,19 +104,19 @@ public interface JCas extends AbstractCa
* index returned by Foo.type
* @return the CAS Java Type object for this CAS Type.
*/
- public abstract Type getCasType(int i);
+ Type getCasType(int i);
/*
* Internal use - looks up a type-name-string in the CAS type system and returns the Cas Type
* object. Throws CASException if the type isn't found
*/
- public abstract Type getRequiredType(String s) throws CASException;
+ Type getRequiredType(String s) throws CASException;
/*
* Internal use - look up a feature-name-string in the CAS type system and returns the Cas Feature
* object. Throws CASException if the feature isn't found
*/
- public abstract Feature getRequiredFeature(Type t, String s) throws CASException;
+ Feature getRequiredFeature(Type t, String s) throws CASException;
// /*
// * Internal Use - look up a feature-name-string in the CAS type system and returns the Cas Feature
@@ -125,17 +125,17 @@ public interface JCas extends AbstractCa
// * DE suffix means "Deferred Exception"
// */
//
-// public abstract Feature getRequiredFeatureDE(Type t, String s, String rangeName, boolean featOkTst);
+// Feature getRequiredFeatureDE(Type t, String s, String rangeName, boolean featOkTst);
// /*
// * Internal Use.
// */
-// public abstract void checkArrayBounds(int fsRef, int pos);
+// void checkArrayBounds(int fsRef, int pos);
//
// /*
// * Internal Use - throw missing feature exception at runtime.
// */
-// public void throwFeatMissing(String feat, String type);
+// void throwFeatMissing(String feat, String type);
//
/**
* @deprecated As of v2.0, use {#getView(String)}. From the view you can access the Sofa data, or
@@ -144,14 +144,14 @@ public interface JCas extends AbstractCa
* @return the Sofa
*/
@Deprecated
- public abstract Sofa getSofa(SofaID sofaID);
+ Sofa getSofa(SofaID sofaID);
/**
* Get the Sofa feature structure associated with this JCas view.
*
* @return The SofaFS associated with this JCas view.
*/
- public abstract Sofa getSofa();
+ Sofa getSofa();
/**
* Create a view and its underlying Sofa (subject of analysis). The view provides access to the
@@ -171,7 +171,7 @@ public interface JCas extends AbstractCa
* @throws CASException -
* if a View with this name already exists in this CAS
*/
- public abstract JCas createView(String sofaID) throws CASException;
+ JCas createView(String sofaID) throws CASException;
/**
* Create a JCas view for a Sofa.
@@ -182,7 +182,7 @@ public interface JCas extends AbstractCa
* @return The JCas view for the given Sofa.
* @throws CASException -
*/
- public abstract JCas getJCas(Sofa sofa) throws CASException;
+ JCas getJCas(Sofa sofa) throws CASException;
/**
* Gets the JCas-based interface to the Index Repository. Provides the same functionality
@@ -191,7 +191,7 @@ public interface JCas extends AbstractCa
*
* @return the JCas-based interface to the index repository
*/
- public abstract JFSIndexRepository getJFSIndexRepository();
+ JFSIndexRepository getJFSIndexRepository();
/**
* Gets the document annotation. The object returned from this method can be typecast to
@@ -205,7 +205,7 @@ public interface JCas extends AbstractCa
* @return The one instance of the DocumentAnnotation annotation.
* @see org.apache.uima.cas.CAS#getDocumentAnnotation
*/
- public abstract TOP getDocumentAnnotationFs();
+ TOP getDocumentAnnotationFs();
/**
* A constant for each cas which holds a 0-length instance. Since this can be a common value, we
@@ -215,7 +215,7 @@ public interface JCas extends AbstractCa
* @return 0-length instance of a StringArray
*/
- public abstract StringArray getStringArray0L();
+ StringArray getStringArray0L();
/**
* A constant for each cas which holds a 0-length instance. Since this can be a common value, we
@@ -224,7 +224,7 @@ public interface JCas extends AbstractCa
* the CAS is reset.
* @return 0-length instance of an IntegerArray
*/
- public abstract IntegerArray getIntegerArray0L();
+ IntegerArray getIntegerArray0L();
/**
* A constant for each cas which holds a 0-length instance. Since this can be a common value, we
@@ -232,7 +232,7 @@ public interface JCas extends AbstractCa
* updatable (it has no subfields). This is initialized lazily on first reference, and reset when
* the CAS is reset.
* @return 0-length instance of a FloatArray
- public abstract FloatArray getFloatArray0L();
+ FloatArray getFloatArray0L();
/**
* A constant for each cas which holds a 0-length instance. Since this can be a common value, we
@@ -241,7 +241,7 @@ public interface JCas extends AbstractCa
* the CAS is reset.
* @return 0-length instance of a FSArray
*/
- public abstract FSArray getFSArray0L();
+ FSArray getFSArray0L();
/**
* initialize the JCas for new Cas content. Not used, does nothing.
@@ -249,7 +249,7 @@ public interface JCas extends AbstractCa
* @deprecated not required, does nothing
*/
@Deprecated
- public abstract void processInit();
+ void processInit();
/**
* Get the view for a Sofa (subject of analysis). The view provides access to the Sofa data and
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/impl/JCasImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/impl/JCasImpl.java?rev=1712630&r1=1712629&r2=1712630&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/impl/JCasImpl.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/impl/JCasImpl.java Wed Nov 4 20:14:48 2015
@@ -25,7 +25,6 @@ package org.apache.uima.jcas.impl;
import java.io.InputStream;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
@@ -51,7 +50,6 @@ import org.apache.uima.cas.Type;
import org.apache.uima.cas.TypeSystem;
import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.impl.LowLevelCAS;
-import org.apache.uima.cas.impl.LowLevelException;
import org.apache.uima.cas.impl.LowLevelIndexRepository;
import org.apache.uima.cas.impl.TypeSystemImpl;
import org.apache.uima.cas.text.AnnotationIndex;
@@ -1179,4 +1177,5 @@ public class JCasImpl extends AbstractCa
return getFSIndexRepository().getIndex(label, getCasType(clazz));
}
+
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima/UIMAException_Messages.properties
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima/UIMAException_Messages.properties?rev=1712630&r1=1712629&r2=1712630&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima/UIMAException_Messages.properties (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima/UIMAException_Messages.properties Wed Nov 4 20:14:48 2015
@@ -519,6 +519,7 @@ CYCLE_IN_TYPE_ORDER = The types are adde
JCAS_INIT_ERROR = The JCas cannot be initialized. The following errors occurred: {0}
JCAS_TYPENOTFOUND_ERROR = Type information from the CAS cannot be accessed while initializing the JCas type {0}
JCAS_FEATURENOTFOUND_ERROR = Feature information from the CAS cannot be accessed while initializing the JCAS type {0} with feature {1}.
+JCAS_GETTER_SETTER_MISSING = Unable to find required {0} method for JCAS type {1} with {2} type of {3}.
JCAS_FEATURE_WRONG_TYPE = The JCAS range type {2} for feature {1} of type {0} does not match the CAS range type {3} for the feature.
TYPEORDER_UNKNOWN_TYPE = The type sort order cannot be built because type {0} is unknown.
MUST_COMMIT_TYPE_SYSTEM = Type system has not been committed. The base index cannot be created.
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima/cas/impl/ll_runtimeException.properties
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima/cas/impl/ll_runtimeException.properties?rev=1712630&r1=1712629&r2=1712630&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima/cas/impl/ll_runtimeException.properties (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima/cas/impl/ll_runtimeException.properties Wed Nov 4 20:14:48 2015
@@ -17,7 +17,7 @@
# * under the License.
# ***************************************************************
-INVALID_FS_REF = Error in low-level CAS APIs: attempted heap access with invalid FS reference: {0}.
+INVALID_FS_REF = Error in low-level CAS APIs: accessing FS with id {0}, but no such FS exists in this CAS.
VALUE_NOT_A_TYPE = Error in low-level CAS APIs: attempt to interpret heap value {0} at {1} as type code, but {0} is not a valid type code. This is likely caused by a bad FS reference.
INVALID_FEATURE_CODE = Error in low-level CAS APIs: {0} is not a valid feature code.
FEAT_DOM_ERROR = Error in low-level CAS APIs: type "{1}" (code: {0}) does not define feature "{3}" (code: {2}).