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/01/19 14:08:20 UTC
svn commit: r497800 [7/10] - in /incubator/uima/uimaj/trunk/uimaj-core/src:
main/java/org/apache/uima/cas/ main/java/org/apache/uima/cas/impl/
main/java/org/apache/uima/jcas/cas/ main/java/org/apache/uima/jcas/impl/
main/resources/org/apache/uima/ main...
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=497800&r1=497799&r2=497800
==============================================================================
--- 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 Fri Jan 19 05:08:19 2007
@@ -35,191 +35,189 @@
*/
public class SofaFSImpl extends FeatureStructureImplC implements SofaFS {
- private static class SofaFSGenerator implements FSGenerator {
+ private static class SofaFSGenerator implements FSGenerator {
- private SofaFSGenerator() {
- super();
- }
+ private SofaFSGenerator() {
+ super();
+ }
- /**
+ /**
* @see org.apache.uima.cas.impl.FSGenerator#createFS(int, LowLevelCAS)
*/
- public FeatureStructure createFS(int addr, CASImpl cas) {
- return new SofaFSImpl(addr, cas);
- }
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ return new SofaFSImpl(addr, cas);
+ }
- }
+ }
- static FSGenerator getSofaFSGenerator() {
- return new SofaFSGenerator();
- }
+ static FSGenerator getSofaFSGenerator() {
+ return new SofaFSGenerator();
+ }
- public SofaFSImpl(int addr, CASImpl cas) {
- super(cas, addr);
- }
+ public SofaFSImpl(int addr, CASImpl cas) {
+ super(cas, addr);
+ }
- // IMPORTANT: Methods below here are duplicated in
- // org.apache.uima.jcas.cas.Sofa.
- // Any changes should be made in both places.
+ // IMPORTANT: Methods below here are duplicated in
+ // org.apache.uima.jcas.cas.Sofa.
+ // Any changes should be made in both places.
- /**
+ /**
* @see org.apache.uima.cas.ArrayFS#size() This method is duplicated in
* org.apache.uima.jcas.cas.Sofa. Any changes should be made in both places.
*/
- public void setLocalSofaData(FeatureStructure aFS) {
- final Feature arrayFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFAARRAY);
- if (isSofaDataSet()) {
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.SOFADATA_ALREADY_SET);
- e.addArgument("SetLocalSofaData()");
- throw e;
- }
- Type type = aFS.getType();
- if (!type.isArray()) {
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INAPPROP_TYPE);
- e.addArgument("Array FS");
- e.addArgument(type.getName());
- throw e;
- }
- if (!type.getName().equals(CAS.TYPE_NAME_BYTE_ARRAY)
- && !type.getName().equals(CAS.TYPE_NAME_DOUBLE_ARRAY)
- && !type.getName().equals(CAS.TYPE_NAME_FLOAT_ARRAY)
- && !type.getName().equals(CAS.TYPE_NAME_INTEGER_ARRAY)
- && !type.getName().equals(CAS.TYPE_NAME_LONG_ARRAY)
- && !type.getName().equals(CAS.TYPE_NAME_SHORT_ARRAY)) {
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INAPPROP_TYPE);
- e.addArgument("Byte/Float/Integer/Short/String/Long/Double Array");
- e.addArgument(type.getName());
- throw e;
- }
+ public void setLocalSofaData(FeatureStructure aFS) {
+ final Feature arrayFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFAARRAY);
+ if (isSofaDataSet()) {
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.SOFADATA_ALREADY_SET,
+ new String[] { "SetLocalSofaData(FeatureStructure)" });
+ throw e;
+ }
+ Type type = aFS.getType();
+ if (!type.isArray()) {
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INAPPROP_TYPE,
+ new String[] { "Array FS", type.getName() });
+ throw e;
+ }
+ if (!type.getName().equals(CAS.TYPE_NAME_BYTE_ARRAY)
+ && !type.getName().equals(CAS.TYPE_NAME_DOUBLE_ARRAY)
+ && !type.getName().equals(CAS.TYPE_NAME_FLOAT_ARRAY)
+ && !type.getName().equals(CAS.TYPE_NAME_INTEGER_ARRAY)
+ && !type.getName().equals(CAS.TYPE_NAME_LONG_ARRAY)
+ && !type.getName().equals(CAS.TYPE_NAME_SHORT_ARRAY)) {
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INAPPROP_TYPE,
+ new String[] { "Byte/Float/Integer/Short/String/Long/Double Array", type.getName() });
+ throw e;
+ }
- super.setFeatureValue(arrayFeat, aFS);
- }
+ super.setFeatureValue(arrayFeat, aFS);
+ }
- /**
+ /**
* @see org.apache.uima.cas.ArrayFS#size() This method is duplicated in
* org.apache.uima.jcas.cas.Sofa. Any changes should be made in both places.
*/
- public void setLocalSofaData(String aString) {
- final Feature stringFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFASTRING);
- if (isSofaDataSet()) {
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.SOFADATA_ALREADY_SET);
- e.addArgument("SetLocalSofaData()");
- throw e;
- }
- super.setStringValue(stringFeat, aString);
- // create or update the document annotation for this Sofa's view
- CAS view = this.casImpl.getView(this);
- ((CASImpl) view).updateDocumentAnnotation();
- }
+ public void setLocalSofaData(String aString) {
+ final Feature stringFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFASTRING);
+ if (isSofaDataSet()) {
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.SOFADATA_ALREADY_SET,
+ new String[] { "setLocalSofaData(String)" });
+ throw e;
+ }
+ super.setStringValue(stringFeat, aString);
+ // create or update the document annotation for this Sofa's view
+ CAS view = this.casImpl.getView(this);
+ ((CASImpl) view).updateDocumentAnnotation();
+ }
- /**
+ /**
* @see org.apache.uima.cas.ArrayFS#size() This method is duplicated in
* org.apache.uima.jcas.cas.Sofa. Any changes should be made in both places.
*/
- public void setRemoteSofaURI(String aURI) {
- final Feature uriFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFAURI);
-
- if (isSofaDataSet()) {
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.SOFADATA_ALREADY_SET);
- e.addArgument("setRemoteSofaURI()");
- throw e;
- }
- super.setStringValue(uriFeat, aURI);
- }
-
- private boolean isSofaDataSet() {
- final Feature uriFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFAURI);
- final Feature arrayFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFAARRAY);
- final Feature stringFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFASTRING);
-
- if (null != this.getStringValue(uriFeat) || null != this.getFeatureValue(arrayFeat)
- || null != this.getStringValue(stringFeat)) {
- return true;
- }
- return false;
- }
+ public void setRemoteSofaURI(String aURI) {
+ final Feature uriFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFAURI);
+
+ if (isSofaDataSet()) {
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.SOFADATA_ALREADY_SET,
+ new String[] { "setRemoteSofaURI(String)" });
+ throw e;
+ }
+ super.setStringValue(uriFeat, aURI);
+ }
+
+ private boolean isSofaDataSet() {
+ final Feature uriFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFAURI);
+ final Feature arrayFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFAARRAY);
+ final Feature stringFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFASTRING);
+
+ if (null != this.getStringValue(uriFeat) || null != this.getFeatureValue(arrayFeat)
+ || null != this.getStringValue(stringFeat)) {
+ return true;
+ }
+ return false;
+ }
- /**
+ /**
* @see org.apache.uima.cas.ArrayFS#size() This method is duplicated in
* org.apache.uima.jcas.cas.Sofa. Any changes should be made in both places.
*/
- public FeatureStructure getLocalFSData() {
- final Feature arrayFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFAARRAY);
- return this.getFeatureValue(arrayFeat);
- }
+ public FeatureStructure getLocalFSData() {
+ final Feature arrayFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFAARRAY);
+ return this.getFeatureValue(arrayFeat);
+ }
- /**
+ /**
* @see org.apache.uima.cas.ArrayFS#size() This method is duplicated in
* org.apache.uima.jcas.cas.Sofa. Any changes should be made in both places.
*/
- public String getLocalStringData() {
- final Feature stringFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFASTRING);
- return this.getStringValue(stringFeat);
- }
-
- // override setStringValue for SofaFS to not work!
- // This method is duplicated in org.apache.uima.jcas.cas.Sofa. Any changes
- // should be made in both places.
- public void setStringValue(Feature feat, String val) {
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.PROTECTED_SOFA_FEATURE);
- throw e;
- }
-
- // override setFeatureValue for SofaFS to not work!
- // This method is duplicated in org.apache.uima.jcas.cas.Sofa. Any changes
- // should be made in both places.
- public void setFeatureValue(Feature feat, FeatureStructure fs) {
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.PROTECTED_SOFA_FEATURE);
- throw e;
- }
-
- // This method is duplicated in org.apache.uima.jcas.cas.Sofa. Any changes
- // should be made in both places.
- public String getSofaMime() {
- final Feature mimeFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFAMIME);
- return this.casImpl.getLowLevelCAS().ll_getStringValue(super.addr,
- ((FeatureImpl) mimeFeat).getCode());
- }
-
- // This method is duplicated in org.apache.uima.jcas.cas.Sofa. Any changes
- // should be made in both places.
- public String getSofaURI() {
- final Feature uriFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFAURI);
- return this.casImpl.getLowLevelCAS().ll_getStringValue(super.addr,
- ((FeatureImpl) uriFeat).getCode());
- }
-
- // This method is duplicated in org.apache.uima.jcas.cas.Sofa. Any changes
- // should be made in both places.
- public int getSofaRef() {
- final Feature numFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFANUM);
- return this.casImpl.getLowLevelCAS().ll_getIntValue(super.addr,
- ((FeatureImpl) numFeat).getCode());
- }
-
- public InputStream getSofaDataStream() {
- return this.casImpl.getSofaDataStream(this);
- }
+ public String getLocalStringData() {
+ final Feature stringFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFASTRING);
+ return this.getStringValue(stringFeat);
+ }
+
+ // override setStringValue for SofaFS to not work!
+ // This method is duplicated in org.apache.uima.jcas.cas.Sofa. Any changes
+ // should be made in both places.
+ public void setStringValue(Feature feat, String val) {
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.PROTECTED_SOFA_FEATURE);
+ throw e;
+ }
+
+ // override setFeatureValue for SofaFS to not work!
+ // This method is duplicated in org.apache.uima.jcas.cas.Sofa. Any changes
+ // should be made in both places.
+ public void setFeatureValue(Feature feat, FeatureStructure fs) {
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.PROTECTED_SOFA_FEATURE);
+ throw e;
+ }
+
+ // This method is duplicated in org.apache.uima.jcas.cas.Sofa. Any changes
+ // should be made in both places.
+ public String getSofaMime() {
+ final Feature mimeFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFAMIME);
+ return this.casImpl.getLowLevelCAS().ll_getStringValue(super.addr,
+ ((FeatureImpl) mimeFeat).getCode());
+ }
+
+ // This method is duplicated in org.apache.uima.jcas.cas.Sofa. Any changes
+ // should be made in both places.
+ public String getSofaURI() {
+ final Feature uriFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFAURI);
+ return this.casImpl.getLowLevelCAS().ll_getStringValue(super.addr,
+ ((FeatureImpl) uriFeat).getCode());
+ }
+
+ // This method is duplicated in org.apache.uima.jcas.cas.Sofa. Any changes
+ // should be made in both places.
+ public int getSofaRef() {
+ final Feature numFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFANUM);
+ return this.casImpl.getLowLevelCAS().ll_getIntValue(super.addr,
+ ((FeatureImpl) numFeat).getCode());
+ }
+
+ public InputStream getSofaDataStream() {
+ return this.casImpl.getSofaDataStream(this);
+ }
- /**
+ /**
* @see org.apache.uima.cas.SofaFS#getSofaID(). This method is duplicated in
* org.apache.uima.jcas.cas.Sofa. Any changes should be made in both places.
*/
- public String getSofaID() {
- final Feature sofaIDFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFAID);
- return this.getStringValue(sofaIDFeat);
- }
+ public String getSofaID() {
+ final Feature sofaIDFeat = this.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFAID);
+ return this.getStringValue(sofaIDFeat);
+ }
}
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/FSList.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/FSList.java?view=diff&rev=497800&r1=497799&r2=497800
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/FSList.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/FSList.java Fri Jan 19 05:08:19 2007
@@ -25,53 +25,50 @@
public class FSList extends org.apache.uima.jcas.cas.TOP {
- public final static int typeIndexID = JCasRegistry.register(FSList.class);
+ public final static int typeIndexID = JCasRegistry.register(FSList.class);
- public final static int type = typeIndexID;
+ public final static int type = typeIndexID;
- public int getTypeIndexID() {
- return typeIndexID;
- }
-
- // Never called.
- protected FSList() {// Disable default constructor
- }
-
- /** Internal - Constructor used by generator */
- public FSList(int addr, TOP_Type type) {
- super(addr, type);
- }
-
- public FSList(JCas jcas) {
- super(jcas);
- }
-
- public TOP getNthElement(int i) {
- if (this instanceof EmptyFSList) {
- CASRuntimeException casEx = new CASRuntimeException(
- CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST);
- casEx.addArgument("EmptyFSList");
- throw casEx;
- }
- if (i < 0) {
- CASRuntimeException casEx = new CASRuntimeException(
- CASRuntimeException.JCAS_GET_NTH_NEGATIVE_INDEX);
- casEx.addArgument(new Integer(i).toString());
- throw casEx;
- }
- int originali = i;
- FSList cg = this;
- for (;; i--) {
- if (cg instanceof EmptyFSList) {
- CASRuntimeException casEx = new CASRuntimeException(
- CASRuntimeException.JCAS_GET_NTH_PAST_END);
- casEx.addArgument(new Integer(originali).toString());
- throw casEx;
- }
- NonEmptyFSList c = (NonEmptyFSList) cg;
- if (i == 0)
- return c.getHead();
- cg = c.getTail();
- }
- }
+ public int getTypeIndexID() {
+ return typeIndexID;
+ }
+
+ // Never called.
+ protected FSList() {// Disable default constructor
+ }
+
+ /** Internal - Constructor used by generator */
+ public FSList(int addr, TOP_Type type) {
+ super(addr, type);
+ }
+
+ public FSList(JCas jcas) {
+ super(jcas);
+ }
+
+ public TOP getNthElement(int i) {
+ if (this instanceof EmptyFSList) {
+ CASRuntimeException casEx = new CASRuntimeException(
+ CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST, new String[] { "EmptyFSList" });
+ throw casEx;
+ }
+ if (i < 0) {
+ CASRuntimeException casEx = new CASRuntimeException(
+ CASRuntimeException.JCAS_GET_NTH_NEGATIVE_INDEX, new String[] { Integer.toString(i) });
+ throw casEx;
+ }
+ int originali = i;
+ FSList cg = this;
+ for (;; i--) {
+ if (cg instanceof EmptyFSList) {
+ CASRuntimeException casEx = new CASRuntimeException(
+ CASRuntimeException.JCAS_GET_NTH_PAST_END, new String[] { Integer.toString(originali) });
+ throw casEx;
+ }
+ NonEmptyFSList c = (NonEmptyFSList) cg;
+ if (i == 0)
+ return c.getHead();
+ cg = c.getTail();
+ }
+ }
}
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/FloatList.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/FloatList.java?view=diff&rev=497800&r1=497799&r2=497800
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/FloatList.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/FloatList.java Fri Jan 19 05:08:19 2007
@@ -25,54 +25,51 @@
public class FloatList extends org.apache.uima.jcas.cas.TOP {
- public final static int typeIndexID = JCasRegistry.register(FloatList.class);
+ public final static int typeIndexID = JCasRegistry.register(FloatList.class);
- public final static int type = typeIndexID;
+ public final static int type = typeIndexID;
- public int getTypeIndexID() {
- return typeIndexID;
- }
-
- // Never called.
- protected FloatList() {// Disable default constructor
- }
-
- /** Internal - Constructor used by generator */
- public FloatList(int addr, TOP_Type type) {
- super(addr, type);
- }
-
- public FloatList(JCas jcas) {
- super(jcas);
- }
-
- public float getNthElement(int i) {
- if (this instanceof EmptyFloatList) {
- CASRuntimeException casEx = new CASRuntimeException(
- CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST);
- casEx.addArgument("EmptyFloatList");
- throw casEx;
- }
- if (i < 0) {
- CASRuntimeException casEx = new CASRuntimeException(
- CASRuntimeException.JCAS_GET_NTH_NEGATIVE_INDEX);
- casEx.addArgument(new Integer(i).toString());
- throw casEx;
- }
- int originali = i;
-
- FloatList cg = this;
- for (;; i--) {
- if (cg instanceof EmptyFloatList) {
- CASRuntimeException casEx = new CASRuntimeException(
- CASRuntimeException.JCAS_GET_NTH_PAST_END);
- casEx.addArgument(new Integer(originali).toString());
- throw casEx;
- }
- NonEmptyFloatList c = (NonEmptyFloatList) cg;
- if (i == 0)
- return c.getHead();
- cg = c.getTail();
- }
- }
+ public int getTypeIndexID() {
+ return typeIndexID;
+ }
+
+ // Never called.
+ protected FloatList() {// Disable default constructor
+ }
+
+ /** Internal - Constructor used by generator */
+ public FloatList(int addr, TOP_Type type) {
+ super(addr, type);
+ }
+
+ public FloatList(JCas jcas) {
+ super(jcas);
+ }
+
+ public float getNthElement(int i) {
+ if (this instanceof EmptyFloatList) {
+ CASRuntimeException casEx = new CASRuntimeException(
+ CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST, new String[] { "EmptyFloatList" });
+ throw casEx;
+ }
+ if (i < 0) {
+ CASRuntimeException casEx = new CASRuntimeException(
+ CASRuntimeException.JCAS_GET_NTH_NEGATIVE_INDEX, new String[] {Integer.toString(i)});
+ throw casEx;
+ }
+ int originali = i;
+
+ FloatList cg = this;
+ for (;; i--) {
+ if (cg instanceof EmptyFloatList) {
+ CASRuntimeException casEx = new CASRuntimeException(
+ CASRuntimeException.JCAS_GET_NTH_PAST_END, new String[] {Integer.toString(originali)});
+ throw casEx;
+ }
+ NonEmptyFloatList c = (NonEmptyFloatList) cg;
+ if (i == 0)
+ return c.getHead();
+ cg = c.getTail();
+ }
+ }
}
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/IntegerList.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/IntegerList.java?view=diff&rev=497800&r1=497799&r2=497800
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/IntegerList.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/IntegerList.java Fri Jan 19 05:08:19 2007
@@ -25,53 +25,50 @@
public class IntegerList extends org.apache.uima.jcas.cas.TOP {
- public final static int typeIndexID = JCasRegistry.register(IntegerList.class);
+ public final static int typeIndexID = JCasRegistry.register(IntegerList.class);
- public final static int type = typeIndexID;
+ public final static int type = typeIndexID;
- public int getTypeIndexID() {
- return typeIndexID;
- }
-
- // Never called.
- protected IntegerList() { // Disable default constructor
- }
-
- /** Internal - Constructor used by generator */
- public IntegerList(int addr, TOP_Type type) {
- super(addr, type);
- }
-
- public IntegerList(JCas jcas) {
- super(jcas);
- }
-
- public int getNthElement(int i) {
- if (this instanceof EmptyIntegerList) {
- CASRuntimeException casEx = new CASRuntimeException(
- CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST);
- casEx.addArgument("EmptyIntegerList");
- throw casEx;
- }
- if (i < 0) {
- CASRuntimeException casEx = new CASRuntimeException(
- CASRuntimeException.JCAS_GET_NTH_NEGATIVE_INDEX);
- casEx.addArgument(new Integer(i).toString());
- throw casEx;
- }
- int originali = i;
- IntegerList cg = this;
- for (;; i--) {
- if (cg instanceof EmptyIntegerList) {
- CASRuntimeException casEx = new CASRuntimeException(
- CASRuntimeException.JCAS_GET_NTH_PAST_END);
- casEx.addArgument(new Integer(originali).toString());
- throw casEx;
- }
- NonEmptyIntegerList c = (NonEmptyIntegerList) cg;
- if (i == 0)
- return c.getHead();
- cg = c.getTail();
- }
- }
+ public int getTypeIndexID() {
+ return typeIndexID;
+ }
+
+ // Never called.
+ protected IntegerList() { // Disable default constructor
+ }
+
+ /** Internal - Constructor used by generator */
+ public IntegerList(int addr, TOP_Type type) {
+ super(addr, type);
+ }
+
+ public IntegerList(JCas jcas) {
+ super(jcas);
+ }
+
+ public int getNthElement(int i) {
+ if (this instanceof EmptyIntegerList) {
+ CASRuntimeException casEx = new CASRuntimeException(
+ CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST, new String[] { "EmptyIntegerList" });
+ throw casEx;
+ }
+ if (i < 0) {
+ CASRuntimeException casEx = new CASRuntimeException(
+ CASRuntimeException.JCAS_GET_NTH_NEGATIVE_INDEX, new String[] { Integer.toString(i) });
+ throw casEx;
+ }
+ int originali = i;
+ IntegerList cg = this;
+ for (;; i--) {
+ if (cg instanceof EmptyIntegerList) {
+ CASRuntimeException casEx = new CASRuntimeException(
+ CASRuntimeException.JCAS_GET_NTH_PAST_END, new String[] { Integer.toString(originali) });
+ throw casEx;
+ }
+ NonEmptyIntegerList c = (NonEmptyIntegerList) cg;
+ if (i == 0)
+ return c.getHead();
+ cg = c.getTail();
+ }
+ }
}
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=497800&r1=497799&r2=497800
==============================================================================
--- 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 Fri Jan 19 05:08:19 2007
@@ -37,228 +37,228 @@
* Updated by JCasGen Fri Apr 29 16:05:04 EDT 2005
*/
public class Sofa extends TOP implements SofaFS {
- /**
+ /**
* @generated
* @ordered
*/
- public final static int typeIndexID = JCasRegistry.register(Sofa.class);
+ public final static int typeIndexID = JCasRegistry.register(Sofa.class);
- /**
+ /**
* @generated
* @ordered
*/
- public final static int type = typeIndexID;
+ public final static int type = typeIndexID;
- /** @generated */
- public int getTypeIndexID() {
- return typeIndexID;
- }
+ /** @generated */
+ public int getTypeIndexID() {
+ return typeIndexID;
+ }
- /**
+ /**
* Never called. Disable default constructor
*
* @generated
*/
- protected Sofa() {
- }
+ protected Sofa() {
+ }
- /**
+ /**
* Internal - constructor used by generator
*
* @generated
*/
- public Sofa(int addr, TOP_Type type) {
- super(addr, type);
- readObject();
- }
-
- /**
- * @deprecated As of v2.0, use {@link JCasImpl#createView(String)} to create a view, which will also
- * create the Sofa for that view.
- */
- public Sofa(JCas jcas, SofaID ID, String mimeType) {
- super(jcas);
- final CASImpl casImpl = jcasType.casImpl;
- casImpl.addSofa(casImpl.createFS(this.addr), ID.getSofaID(), mimeType);
- }
+ public Sofa(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /**
+ * @deprecated As of v2.0, use {@link JCasImpl#createView(String)} to create a view, which will
+ * also create the Sofa for that view.
+ */
+ public Sofa(JCas jcas, SofaID ID, String mimeType) {
+ super(jcas);
+ final CASImpl casImpl = jcasType.casImpl;
+ casImpl.addSofa(casImpl.createFS(this.addr), ID.getSofaID(), mimeType);
+ }
- /**
+ /**
* <!-- begin-user-doc --> Write your own initialization here <!-- end-user-doc -->
*
* @generated modifiable
*/
- private void readObject() {
- }
+ private void readObject() {
+ }
- // *--------------*
- // * Feature: sofaNum
+ // *--------------*
+ // * Feature: sofaNum
- /**
+ /**
* getter for sofaNum - gets
*
* @generated
*/
- public int getSofaNum() {
- if (Sofa_Type.featOkTst && ((Sofa_Type) jcasType).casFeat_sofaNum == null)
- this.jcasType.jcas.throwFeatMissing("sofaNum", "uima.cas.Sofa");
- return jcasType.ll_cas.ll_getIntValue(addr, ((Sofa_Type) jcasType).casFeatCode_sofaNum);
- }
+ public int getSofaNum() {
+ if (Sofa_Type.featOkTst && ((Sofa_Type) jcasType).casFeat_sofaNum == null)
+ this.jcasType.jcas.throwFeatMissing("sofaNum", "uima.cas.Sofa");
+ return jcasType.ll_cas.ll_getIntValue(addr, ((Sofa_Type) jcasType).casFeatCode_sofaNum);
+ }
- // *--------------*
- // * Feature: sofaID
+ // *--------------*
+ // * Feature: sofaID
- /**
+ /**
* getter for sofaID - gets
*
* @generated
*/
- public String getSofaID() {
- if (Sofa_Type.featOkTst && ((Sofa_Type) jcasType).casFeat_sofaID == null)
- this.jcasType.jcas.throwFeatMissing("sofaID", "uima.cas.Sofa");
- return jcasType.ll_cas.ll_getStringValue(addr, ((Sofa_Type) jcasType).casFeatCode_sofaID);
- }
+ public String getSofaID() {
+ if (Sofa_Type.featOkTst && ((Sofa_Type) jcasType).casFeat_sofaID == null)
+ this.jcasType.jcas.throwFeatMissing("sofaID", "uima.cas.Sofa");
+ return jcasType.ll_cas.ll_getStringValue(addr, ((Sofa_Type) jcasType).casFeatCode_sofaID);
+ }
- // *--------------*
- // * Feature: mimeType
+ // *--------------*
+ // * Feature: mimeType
- /**
+ /**
* getter for mimeType - gets
*
* @generated
*/
- public String getMimeType() {
- if (Sofa_Type.featOkTst && ((Sofa_Type) jcasType).casFeat_mimeType == null)
- this.jcasType.jcas.throwFeatMissing("mimeType", "uima.cas.Sofa");
- return jcasType.ll_cas.ll_getStringValue(addr, ((Sofa_Type) jcasType).casFeatCode_mimeType);
- }
+ public String getMimeType() {
+ if (Sofa_Type.featOkTst && ((Sofa_Type) jcasType).casFeat_mimeType == null)
+ this.jcasType.jcas.throwFeatMissing("mimeType", "uima.cas.Sofa");
+ return jcasType.ll_cas.ll_getStringValue(addr, ((Sofa_Type) jcasType).casFeatCode_mimeType);
+ }
- // IMPORTANT: Methods below here are duplicated in SofaFSImpl. If they are
- // changed here they must be changed in SofaFSImpl as well.
+ // IMPORTANT: Methods below here are duplicated in SofaFSImpl. If they are
+ // changed here they must be changed in SofaFSImpl as well.
- /**
+ /**
* @see org.apache.uima.cas.SofaFS#setLocalSofaData(FeatureStructure) This method is duplicated in
* SofaFSImpl. Any changes should be made in both places.
*/
- public void setLocalSofaData(FeatureStructure aFS) {
- final Feature arrayFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFAARRAY);
- if (isSofaDataSet()) {
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.SOFADATA_ALREADY_SET);
- e.addArgument("SetLocalSofaData()");
- throw e;
- }
- super.setFeatureValue(arrayFeat, aFS);
- }
+ public void setLocalSofaData(FeatureStructure aFS) {
+ final Feature arrayFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFAARRAY);
+ if (isSofaDataSet()) {
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.SOFADATA_ALREADY_SET,
+ new String[] { "setLocalSofaData()" });
+ throw e;
+ }
+ super.setFeatureValue(arrayFeat, aFS);
+ }
- /**
+ /**
* @see org.apache.uima.cas.SofaFS#setLocalSofaData(String) This method is duplicated in
* SofaFSImpl. Any changes should be made in both places.
*/
- public void setLocalSofaData(String aString) {
- final Feature stringFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFASTRING);
- if (isSofaDataSet()) {
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.SOFADATA_ALREADY_SET);
- e.addArgument("SetLocalSofaData()");
- throw e;
- }
- super.setStringValue(stringFeat, aString);
- // create or update the document annotation for this Sofa's view
- CAS view = this.getCASImpl().getView(this);
- ((CASImpl) view).updateDocumentAnnotation();
- }
+ public void setLocalSofaData(String aString) {
+ final Feature stringFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFASTRING);
+ if (isSofaDataSet()) {
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.SOFADATA_ALREADY_SET,
+ new String[] { "setLocalSofaData()" });
+ throw e;
+ }
+ super.setStringValue(stringFeat, aString);
+ // create or update the document annotation for this Sofa's view
+ CAS view = this.getCASImpl().getView(this);
+ ((CASImpl) view).updateDocumentAnnotation();
+ }
- /**
+ /**
* @see org.apache.uima.cas.SofaFS#getLocalFSData() This method is duplicated in SofaFSImpl. Any
* changes should be made in both places.
*/
- public FeatureStructure getLocalFSData() {
- final Feature arrayFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFAARRAY);
- return this.getFeatureValue(arrayFeat);
- }
+ public FeatureStructure getLocalFSData() {
+ final Feature arrayFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFAARRAY);
+ return this.getFeatureValue(arrayFeat);
+ }
- /**
+ /**
* @see org.apache.uima.cas.SofaFS#getLocalStringData() This method is duplicated in SofaFSImpl.
* Any changes should be made in both places.
*/
- public String getLocalStringData() {
- final Feature stringFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFASTRING);
- return this.getStringValue(stringFeat);
- }
+ public String getLocalStringData() {
+ final Feature stringFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFASTRING);
+ return this.getStringValue(stringFeat);
+ }
- /**
+ /**
* @see org.apache.uima.cas.SofaFS#setRemoteSofaURI(String) This method is duplicated in
* SofaFSImpl. Any changes should be made in both places.
*/
- public void setRemoteSofaURI(String aURI) {
- final Feature uriFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFAURI);
- if (isSofaDataSet()) {
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.SOFADATA_ALREADY_SET);
- e.addArgument("setRemoteSofaURI()");
- throw e;
- }
- super.setStringValue(uriFeat, aURI);
- }
-
- private boolean isSofaDataSet() {
- final Feature uriFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFAURI);
- final Feature arrayFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFAARRAY);
- final Feature stringFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFASTRING);
-
- if (null != this.getStringValue(uriFeat) || null != this.getFeatureValue(arrayFeat)
- || null != this.getStringValue(stringFeat)) {
- return true;
- }
- return false;
- }
-
- // override setStringValue for SofaFS to not work!
- // This method is duplicated in SofaFSImpl. Any changes should be made in both places.
- public void setStringValue(Feature feat, String val) {
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.PROTECTED_SOFA_FEATURE);
- throw e;
- }
-
- // override setFeatureValue for SofaFS to not work!
- // This method is duplicated in SofaFSImpl. Any changes should be made in both places.
- public void setFeatureValue(Feature feat, FeatureStructure fs) {
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.PROTECTED_SOFA_FEATURE);
- throw e;
- }
-
- // This method is duplicated in SofaFSImpl. Any changes should be made in both places.
- public String getSofaMime() {
- final Feature mimeFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFAMIME);
- return jcasType.casImpl.getLowLevelCAS().ll_getStringValue(super.addr,
- ((FeatureImpl) mimeFeat).getCode());
- }
-
- // This method is duplicated in SofaFSImpl. Any changes should be made in both places.
- public String getSofaURI() {
- final Feature uriFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFAURI);
- return jcasType.casImpl.getLowLevelCAS().ll_getStringValue(super.addr,
- ((FeatureImpl) uriFeat).getCode());
- }
-
- // This method is duplicated in SofaFSImpl. Any changes should be made in both places.
- public int getSofaRef() {
- final Feature numFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
- CAS.FEATURE_FULL_NAME_SOFANUM);
- return jcasType.casImpl.getLowLevelCAS().ll_getIntValue(super.addr,
- ((FeatureImpl) numFeat).getCode());
- }
-
- public InputStream getSofaDataStream() {
- return jcasType.casImpl.getSofaDataStream(this);
- }
+ public void setRemoteSofaURI(String aURI) {
+ final Feature uriFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFAURI);
+ if (isSofaDataSet()) {
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.SOFADATA_ALREADY_SET,
+ new String[] { "setRemoteSofaURI()" });
+ throw e;
+ }
+ super.setStringValue(uriFeat, aURI);
+ }
+
+ private boolean isSofaDataSet() {
+ final Feature uriFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFAURI);
+ final Feature arrayFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFAARRAY);
+ final Feature stringFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFASTRING);
+
+ if (null != this.getStringValue(uriFeat) || null != this.getFeatureValue(arrayFeat)
+ || null != this.getStringValue(stringFeat)) {
+ return true;
+ }
+ return false;
+ }
+
+ // override setStringValue for SofaFS to not work!
+ // This method is duplicated in SofaFSImpl. Any changes should be made in both places.
+ public void setStringValue(Feature feat, String val) {
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.PROTECTED_SOFA_FEATURE);
+ throw e;
+ }
+
+ // override setFeatureValue for SofaFS to not work!
+ // This method is duplicated in SofaFSImpl. Any changes should be made in both places.
+ public void setFeatureValue(Feature feat, FeatureStructure fs) {
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.PROTECTED_SOFA_FEATURE);
+ throw e;
+ }
+
+ // This method is duplicated in SofaFSImpl. Any changes should be made in both places.
+ public String getSofaMime() {
+ final Feature mimeFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFAMIME);
+ return jcasType.casImpl.getLowLevelCAS().ll_getStringValue(super.addr,
+ ((FeatureImpl) mimeFeat).getCode());
+ }
+
+ // This method is duplicated in SofaFSImpl. Any changes should be made in both places.
+ public String getSofaURI() {
+ final Feature uriFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFAURI);
+ return jcasType.casImpl.getLowLevelCAS().ll_getStringValue(super.addr,
+ ((FeatureImpl) uriFeat).getCode());
+ }
+
+ // This method is duplicated in SofaFSImpl. Any changes should be made in both places.
+ public int getSofaRef() {
+ final Feature numFeat = jcasType.casImpl.getTypeSystem().getFeatureByFullName(
+ CAS.FEATURE_FULL_NAME_SOFANUM);
+ return jcasType.casImpl.getLowLevelCAS().ll_getIntValue(super.addr,
+ ((FeatureImpl) numFeat).getCode());
+ }
+
+ public InputStream getSofaDataStream() {
+ return jcasType.casImpl.getSofaDataStream(this);
+ }
}
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/StringList.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/StringList.java?view=diff&rev=497800&r1=497799&r2=497800
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/StringList.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/StringList.java Fri Jan 19 05:08:19 2007
@@ -25,55 +25,52 @@
public class StringList extends org.apache.uima.jcas.cas.TOP {
- public final static int typeIndexID = JCasRegistry.register(StringList.class);
+ public final static int typeIndexID = JCasRegistry.register(StringList.class);
- public final static int type = typeIndexID;
+ public final static int type = typeIndexID;
- public int getTypeIndexID() {
- return typeIndexID;
- }
-
- // Never called.
- protected StringList() { // Disable default constructor
- }
-
- /** Internal - Constructor used by generator */
- public StringList(int addr, TOP_Type type) {
- super(addr, type);
- }
-
- public StringList(JCas jcas) {
- super(jcas);
- }
-
- public String getNthElement(int i) {
- if (this instanceof EmptyStringList) {
- CASRuntimeException casEx = new CASRuntimeException(
- CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST);
- casEx.addArgument("EmptyStringList");
- throw casEx;
- }
-
- if (i < 0) {
- CASRuntimeException casEx = new CASRuntimeException(
- CASRuntimeException.JCAS_GET_NTH_NEGATIVE_INDEX);
- casEx.addArgument(new Integer(i).toString());
- throw casEx;
- }
-
- int originali = i;
- StringList cg = this;
- for (;; i--) {
- if (cg instanceof EmptyStringList) {
- CASRuntimeException casEx = new CASRuntimeException(
- CASRuntimeException.JCAS_GET_NTH_PAST_END);
- casEx.addArgument(new Integer(originali).toString());
- throw casEx;
- }
- NonEmptyStringList c = (NonEmptyStringList) cg;
- if (i == 0)
- return c.getHead();
- cg = c.getTail();
- }
- }
+ public int getTypeIndexID() {
+ return typeIndexID;
+ }
+
+ // Never called.
+ protected StringList() { // Disable default constructor
+ }
+
+ /** Internal - Constructor used by generator */
+ public StringList(int addr, TOP_Type type) {
+ super(addr, type);
+ }
+
+ public StringList(JCas jcas) {
+ super(jcas);
+ }
+
+ public String getNthElement(int i) {
+ if (this instanceof EmptyStringList) {
+ CASRuntimeException casEx = new CASRuntimeException(
+ CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST, new String[] { "EmptyStringList" });
+ throw casEx;
+ }
+
+ if (i < 0) {
+ CASRuntimeException casEx = new CASRuntimeException(
+ CASRuntimeException.JCAS_GET_NTH_NEGATIVE_INDEX, new String[] { Integer.toString(i) });
+ throw casEx;
+ }
+
+ int originali = i;
+ StringList cg = this;
+ for (;; i--) {
+ if (cg instanceof EmptyStringList) {
+ CASRuntimeException casEx = new CASRuntimeException(
+ CASRuntimeException.JCAS_GET_NTH_PAST_END, new String[] { Integer.toString(originali) });
+ throw casEx;
+ }
+ NonEmptyStringList c = (NonEmptyStringList) cg;
+ if (i == 0)
+ return c.getHead();
+ cg = c.getTail();
+ }
+ }
}
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=497800&r1=497799&r2=497800
==============================================================================
--- 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 Fri Jan 19 05:08:19 2007
@@ -37,126 +37,126 @@
*/
public class TOP extends FeatureStructureImpl {
- /**
+ /**
* Each cover class when loaded sets an index. Used in the JCas typeArray to go from the cover
* class or class instance to the corresponding instance of the _Type class
*/
- public final static int typeIndexID = JCasRegistry.register(TOP.class);
+ public final static int typeIndexID = JCasRegistry.register(TOP.class);
- public final static int type = typeIndexID;
+ public final static int type = typeIndexID;
- /**
+ /**
* used to obtain reference to the TOP_Type instance
*
* @return the type array index
*/
- // can't be factored - refs locally defined field
- public int getTypeIndexID() {
- return typeIndexID;
- }
+ // can't be factored - refs locally defined field
+ public int getTypeIndexID() {
+ return typeIndexID;
+ }
- /*
+ /*
* Note this class doesn't extend FeatureStructureImpl because that would add one more slot (the
* casImpl ref) to every instance.
*/
- /** used to reference the corresponding TOP_Type instance */
- public final TOP_Type jcasType;
+ /** used to reference the corresponding TOP_Type instance */
+ public final TOP_Type jcasType;
- /** used to reference the corresponding Cas instance */
- protected final int addr;
+ /** used to reference the corresponding Cas instance */
+ protected final int addr;
- // This constructor is never called .
- // Have to set "final" values to avoid compile errors
- protected TOP() {
- jcasType = null;
- addr = 0;
- throw new RuntimeException("Internal Error: TOP() constructor should never be called.");
- }
+ // This constructor is never called .
+ // Have to set "final" values to avoid compile errors
+ protected TOP() {
+ jcasType = null;
+ addr = 0;
+ throw new RuntimeException("Internal Error: TOP() constructor should never be called.");
+ }
- /**
+ /**
* (Internal) make a new instance of TOP, linking it with a pre-existing Cas FeatureStructure
* object. Note: this function invoked via the generator in TOP_Type whenever the CAS needs to
* make a java instance
*/
- public TOP(int addr, TOP_Type jcasType) {
- this.addr = addr;
- this.jcasType = jcasType;
- }
+ public TOP(int addr, TOP_Type jcasType) {
+ this.addr = addr;
+ this.jcasType = jcasType;
+ }
- /**
+ /**
* (Internal) create a new instance of TOP (or subclass of TOP) in Java and Cas, and make them
* correspond.
*/
- public TOP(JCas jcas) {
- this.jcasType = jcas.getType(getTypeIndexID());
- if (null == jcasType) {
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.JCAS_TYPE_NOT_IN_CAS);
- e.addArgument(this.getClass().getName());
- throw e;
- }
- this.addr = jcasType.ll_cas.ll_createFS(jcasType.casTypeCode);
- jcas.putJfsFromCaddr(addr, this);
- CAS cas = jcas.getCas();
- if (((CASImpl) cas).isAnnotationType(jcasType.casTypeCode)) {
- ((CASImpl) cas).setSofaFeat(addr, ((CASImpl) cas).getSofaRef());
- }
- }
-
- /** add the corresponding FeatureStructure to all Cas indexes */
- public void addToIndexes() {
- addToIndexes(jcasType.jcas);
- }
-
- public void addToIndexes(JCas jcas) {
- jcas.getCas().addFsToIndexes(this);
- }
-
- /** remove the corresponding FeatureStructure from all Cas indexes */
- public void removeFromIndexes() {
- removeFromIndexes(jcasType.jcas);
- }
-
- public void removeFromIndexes(JCas jcas) {
- jcas.getLowLevelIndexRepository().ll_removeFS(this.addr);
- }
+ public TOP(JCas jcas) {
+ this.jcasType = jcas.getType(getTypeIndexID());
+ if (null == jcasType) {
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.JCAS_TYPE_NOT_IN_CAS,
+ new String[] { this.getClass().getName() });
+ throw e;
+ }
+ this.addr = jcasType.ll_cas.ll_createFS(jcasType.casTypeCode);
+ jcas.putJfsFromCaddr(addr, this);
+ CAS cas = jcas.getCas();
+ if (((CASImpl) cas).isAnnotationType(jcasType.casTypeCode)) {
+ ((CASImpl) cas).setSofaFeat(addr, ((CASImpl) cas).getSofaRef());
+ }
+ }
+
+ /** add the corresponding FeatureStructure to all Cas indexes */
+ public void addToIndexes() {
+ addToIndexes(jcasType.jcas);
+ }
+
+ public void addToIndexes(JCas jcas) {
+ jcas.getCas().addFsToIndexes(this);
+ }
+
+ /** remove the corresponding FeatureStructure from all Cas indexes */
+ public void removeFromIndexes() {
+ removeFromIndexes(jcasType.jcas);
+ }
+
+ public void removeFromIndexes(JCas jcas) {
+ jcas.getLowLevelIndexRepository().ll_removeFS(this.addr);
+ }
- /*
+ /*
* functions needed to to implement the FeatureStructure interface Note we don't simply implement
* this class as a subclass of FeatureStructureImpl because that would add one more slot to every
* instance
*/
- public int getAddress() {
- return this.addr;
- }
-
- public CASImpl getCASImpl() {
- return jcasType.casImpl;
- }
-
- public CAS getCAS() {
- return jcasType.casImpl;
- }
-
- public LowLevelCAS getLowLevelCas() {
- return jcasType.casImpl;
- }
-
- public boolean equals(Object o) {
- if (o == null) {
- return false;
- }
- if (!(o instanceof TOP))
- return false;
- TOP fs = (TOP) o;
- if ((this.addr == fs.addr) && (this.jcasType.casImpl == fs.jcasType.casImpl)) {
- return true;
- }
- return false;
- }
-
- public int hashCode() {
- return this.addr;
- }
+ public int getAddress() {
+ return this.addr;
+ }
+
+ public CASImpl getCASImpl() {
+ return jcasType.casImpl;
+ }
+
+ public CAS getCAS() {
+ return jcasType.casImpl;
+ }
+
+ public LowLevelCAS getLowLevelCas() {
+ return jcasType.casImpl;
+ }
+
+ public boolean equals(Object o) {
+ if (o == null) {
+ return false;
+ }
+ if (!(o instanceof TOP))
+ return false;
+ TOP fs = (TOP) o;
+ if ((this.addr == fs.addr) && (this.jcasType.casImpl == fs.jcasType.casImpl)) {
+ return true;
+ }
+ return false;
+ }
+
+ public int hashCode() {
+ return this.addr;
+ }
}
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/TOP_Type.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/TOP_Type.java?view=diff&rev=497800&r1=497799&r2=497800
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/TOP_Type.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/TOP_Type.java Fri Jan 19 05:08:19 2007
@@ -37,165 +37,165 @@
public class TOP_Type {
- /**
+ /**
* each cover class when loaded sets an index. used in the JCas typeArray to go from the cover
* class or class instance to the corresponding instance of the _Type class
*/
- public final static int typeIndexID = TOP.typeIndexID;
+ public final static int typeIndexID = TOP.typeIndexID;
- // public final static int type = typeIndexID;
+ // public final static int type = typeIndexID;
- /**
+ /**
* used to obtain reference to the TOP_Type instance
*
* @return the type array index
*/
- public int getTypeIndexID() {
- return typeIndexID;
- }
+ public int getTypeIndexID() {
+ return typeIndexID;
+ }
- /** the Cas Type associated with this Java Cas Model class */
- public final Type casType; // JCas may refer to it?
+ /** the Cas Type associated with this Java Cas Model class */
+ public final Type casType; // JCas may refer to it?
- public final int casTypeCode; // public so getters/setters in another package can see
+ public final int casTypeCode; // public so getters/setters in another package can see
- /** reference to the Java Cas root */
- public final JCas jcas; // public so _type generators can find it
+ /** reference to the Java Cas root */
+ public final JCas jcas; // public so _type generators can find it
- /** ref to CAS for faster getters/setters */
- public final CASImpl casImpl;
+ /** ref to CAS for faster getters/setters */
+ public final CASImpl casImpl;
- public final LowLevelCAS ll_cas;
+ public final LowLevelCAS ll_cas;
- // switch this to true if debugging wanted
- final protected boolean lowLevelTypeChecks; // if true check int type
+ // switch this to true if debugging wanted
+ final protected boolean lowLevelTypeChecks; // if true check int type
- final protected boolean lowLevelArrayBoundChecks;
+ final protected boolean lowLevelArrayBoundChecks;
- // next has to be public to be visible to inner class?
- final public boolean useExistingInstance; // if true, implements reuse of existing instance
+ // next has to be public to be visible to inner class?
+ final public boolean useExistingInstance; // if true, implements reuse of existing instance
- // generator used by the CAS system when it needs to make a new instance
- /**
+ // generator used by the CAS system when it needs to make a new instance
+ /**
* This generator can be set up to either get the identical Java object (if it exists) or just
* make a new one. If making a new one - the java object made cannot contain any other data
* (because updates won't be reflected). Each class generated by JCasGen either does this (if it
* has additional java fields imbedded) or not.
*/
- // protected because field shared by all subtypes
- // next field no longer needed except for backwards compatibility
- // new subtypes of TOP_Type use <class-name>.this instead
- protected final TOP_Type instanceOf_Type; // allow ref to this in inner class
-
- protected FSGenerator getFSGenerator() {
- return fsGenerator;
- }
-
- private FSGenerator fsGenerator = new FSGenerator() {
- public FeatureStructure createFS(int addr, CASImpl cas) {
- if (TOP_Type.this.useExistingInstance) {
- // Return eq fs instance if already created
- FeatureStructure fs = TOP_Type.this.jcas.getJfsFromCaddr(addr);
- if (null == fs) {
- fs = new TOP(addr, TOP_Type.this);
- TOP_Type.this.jcas.putJfsFromCaddr(addr, fs);
- return fs;
- }
- return fs;
- } else
- return new TOP(addr, TOP_Type.this);
- }
- };
-
- // cas.getKnownJCas().getType(TOP.typeIndexID));}
-
- // private static final String casTypeName = CAS.TYPE_NAME_TOP;
- // private String jTypeName = CAS.TYPE_NAME_TOP;
- // protected String getCasTypeName() {return casTypeName;}
- // protected String getJTypeName() {return jTypeName;}
+ // protected because field shared by all subtypes
+ // next field no longer needed except for backwards compatibility
+ // new subtypes of TOP_Type use <class-name>.this instead
+ protected final TOP_Type instanceOf_Type; // allow ref to this in inner class
+
+ protected FSGenerator getFSGenerator() {
+ return fsGenerator;
+ }
+
+ private FSGenerator fsGenerator = new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (TOP_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = TOP_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new TOP(addr, TOP_Type.this);
+ TOP_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else
+ return new TOP(addr, TOP_Type.this);
+ }
+ };
+
+ // cas.getKnownJCas().getType(TOP.typeIndexID));}
+
+ // private static final String casTypeName = CAS.TYPE_NAME_TOP;
+ // private String jTypeName = CAS.TYPE_NAME_TOP;
+ // protected String getCasTypeName() {return casTypeName;}
+ // protected String getJTypeName() {return jTypeName;}
- /**
+ /**
* protected constructor - disable default constructor - never called.
*/
- protected TOP_Type() { // block default new operator
- instanceOf_Type = null;
- jcas = null;
- casTypeCode = 0;
- casType = null;
- casImpl = null;
- lowLevelTypeChecks = false;
- lowLevelArrayBoundChecks = false;
- throw new RuntimeException("Internal Error-this constructor should never be called.");
- }
+ protected TOP_Type() { // block default new operator
+ instanceOf_Type = null;
+ jcas = null;
+ casTypeCode = 0;
+ casType = null;
+ casImpl = null;
+ lowLevelTypeChecks = false;
+ lowLevelArrayBoundChecks = false;
+ throw new RuntimeException("Internal Error-this constructor should never be called.");
+ }
- /**
+ /**
* Internal - this constructor is called when new CAS creates corresponding jcas instance. During
* this process, all the types defined in the CAS are used to see if there are any corresponding
* jcas type defs defined. If so, they are loaded. This constructor is called via its being the
* superclass of classes being loaded.
*/
- // constructor execution order: 1: super, 2: instance expr, 3: body
- public TOP_Type(JCas jcas, Type casType) {
- this(jcas, casType, true);
- }
+ // constructor execution order: 1: super, 2: instance expr, 3: body
+ public TOP_Type(JCas jcas, Type casType) {
+ this(jcas, casType, true);
+ }
- /**
+ /**
* DO NOT USE - for backwards compatibility only.
*/
- // constructor execution order: 1: super, 2: instance expr, 3: body
- protected TOP_Type(JCas jcas, Type casType, boolean installGenerator) {
- this.jcas = jcas;
- this.casImpl = jcas.getCasImpl();
- this.ll_cas = this.casImpl;
- this.casType = casType;
- this.instanceOf_Type = this;
- this.casTypeCode = ((TypeImpl) this.casType).getCode();
- this.lowLevelTypeChecks = false;
- this.lowLevelArrayBoundChecks = false;
- this.useExistingInstance = true;
-
- // Add generator to CASImpl for this type
- // NOTE Getter used for FSGenerator to get the subtype instance value
- // NOTE Above comment is irrelevant - because this call has to be in
- // every subclass, because at the time this executes in TOP_Type,
- // it is because the subclass invoked it via super(x,y), and the
- // subclass's instance vars haven't yet been set
- // Solution: every superClass that could be instantiated (TOP is not one of them)
- // during the super calls will incorrectly set the generator for the casType, but
- // this is OK because after the supers all run, the bottom one runs and sets it correctly.
-
- if (installGenerator) {
- ((CASImpl) ll_cas).getFSClassRegistry().addGeneratorForType((TypeImpl) this.casType,
- getFSGenerator());
- }
- }
-
- // ************ No Object support ********************
- protected void checkType(int inst) {
- if (!casImpl.getTypeSystemImpl().subsumes(casTypeCode, casImpl.getHeapValue(inst)))
- invalidTypeArg(inst);
- }
-
- protected void invalidTypeArg(int inst) {
- CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INAPPROP_TYPE);
- e.addArgument(casType.getName());
- e.addArgument(casImpl.getTypeSystemImpl().getType(casImpl.getHeapValue(inst)).getName());
- throw e;
- }
-
- /** add the corresponding FeatureStructure to all Cas indexes */
- public void addToIndexes(int inst) {
- jcas.getLowLevelIndexRepository().ll_addFS(inst);
- }
-
- /** remove the corresponding FeatureStructure from all Cas indexes */
- public void removeFromIndexes(int inst) {
- jcas.getLowLevelIndexRepository().ll_removeFS(inst);
- }
-
- public int noObjCreate() {
- return casImpl.createTempFS(casTypeCode);
- }
+ // constructor execution order: 1: super, 2: instance expr, 3: body
+ protected TOP_Type(JCas jcas, Type casType, boolean installGenerator) {
+ this.jcas = jcas;
+ this.casImpl = jcas.getCasImpl();
+ this.ll_cas = this.casImpl;
+ this.casType = casType;
+ this.instanceOf_Type = this;
+ this.casTypeCode = ((TypeImpl) this.casType).getCode();
+ this.lowLevelTypeChecks = false;
+ this.lowLevelArrayBoundChecks = false;
+ this.useExistingInstance = true;
+
+ // Add generator to CASImpl for this type
+ // NOTE Getter used for FSGenerator to get the subtype instance value
+ // NOTE Above comment is irrelevant - because this call has to be in
+ // every subclass, because at the time this executes in TOP_Type,
+ // it is because the subclass invoked it via super(x,y), and the
+ // subclass's instance vars haven't yet been set
+ // Solution: every superClass that could be instantiated (TOP is not one of them)
+ // during the super calls will incorrectly set the generator for the casType, but
+ // this is OK because after the supers all run, the bottom one runs and sets it correctly.
+
+ if (installGenerator) {
+ ((CASImpl) ll_cas).getFSClassRegistry().addGeneratorForType((TypeImpl) this.casType,
+ getFSGenerator());
+ }
+ }
+
+ // ************ No Object support ********************
+ protected void checkType(int inst) {
+ if (!casImpl.getTypeSystemImpl().subsumes(casTypeCode, casImpl.getHeapValue(inst)))
+ invalidTypeArg(inst);
+ }
+
+ protected void invalidTypeArg(int inst) {
+ CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INAPPROP_TYPE,
+ new String[] { casType.getName(),
+ this.casImpl.getTypeSystemImpl().getType(casImpl.getHeapValue(inst)).getName() });
+ throw e;
+ }
+
+ /** add the corresponding FeatureStructure to all Cas indexes */
+ public void addToIndexes(int inst) {
+ jcas.getLowLevelIndexRepository().ll_addFS(inst);
+ }
+
+ /** remove the corresponding FeatureStructure from all Cas indexes */
+ public void removeFromIndexes(int inst) {
+ jcas.getLowLevelIndexRepository().ll_removeFS(inst);
+ }
+
+ public int noObjCreate() {
+ return casImpl.createTempFS(casTypeCode);
+ }
}