001
002/* First created by JCasGen Wed May 07 09:06:03 EDT 2014 */
003package org.cleartk.test.util.type;
004
005import org.apache.uima.jcas.JCas;
006import org.apache.uima.jcas.JCasRegistry;
007import org.apache.uima.cas.impl.CASImpl;
008import org.apache.uima.cas.impl.FSGenerator;
009import org.apache.uima.cas.FeatureStructure;
010import org.apache.uima.cas.impl.TypeImpl;
011import org.apache.uima.cas.Type;
012import org.apache.uima.cas.impl.FeatureImpl;
013import org.apache.uima.cas.Feature;
014import org.apache.uima.jcas.tcas.Annotation_Type;
015
016/** 
017 * Updated by JCasGen Wed May 07 09:06:03 EDT 2014
018 * @generated */
019public class Lemma_Type extends Annotation_Type {
020  /** @generated 
021   * @return the generator for this type
022   */
023  @Override
024  protected FSGenerator getFSGenerator() {return fsGenerator;}
025  /** @generated */
026  private final FSGenerator fsGenerator = 
027    new FSGenerator() {
028      public FeatureStructure createFS(int addr, CASImpl cas) {
029                         if (Lemma_Type.this.useExistingInstance) {
030                           // Return eq fs instance if already created
031                     FeatureStructure fs = Lemma_Type.this.jcas.getJfsFromCaddr(addr);
032                     if (null == fs) {
033                       fs = new Lemma(addr, Lemma_Type.this);
034                           Lemma_Type.this.jcas.putJfsFromCaddr(addr, fs);
035                           return fs;
036                     }
037                     return fs;
038        } else return new Lemma(addr, Lemma_Type.this);
039          }
040    };
041  /** @generated */
042  @SuppressWarnings ("hiding")
043  public final static int typeIndexID = Lemma.typeIndexID;
044  /** @generated 
045     @modifiable */
046  @SuppressWarnings ("hiding")
047  public final static boolean featOkTst = JCasRegistry.getFeatOkTst("org.cleartk.test.util.type.Lemma");
048 
049  /** @generated */
050  final Feature casFeat_value;
051  /** @generated */
052  final int     casFeatCode_value;
053  /** @generated
054   * @param addr low level Feature Structure reference
055   * @return the feature value 
056   */ 
057  public String getValue(int addr) {
058        if (featOkTst && casFeat_value == null)
059      jcas.throwFeatMissing("value", "org.cleartk.test.util.type.Lemma");
060    return ll_cas.ll_getStringValue(addr, casFeatCode_value);
061  }
062  /** @generated
063   * @param addr low level Feature Structure reference
064   * @param v value to set 
065   */    
066  public void setValue(int addr, String v) {
067        if (featOkTst && casFeat_value == null)
068      jcas.throwFeatMissing("value", "org.cleartk.test.util.type.Lemma");
069    ll_cas.ll_setStringValue(addr, casFeatCode_value, v);}
070    
071  
072 
073  /** @generated */
074  final Feature casFeat_testFS;
075  /** @generated */
076  final int     casFeatCode_testFS;
077  /** @generated
078   * @param addr low level Feature Structure reference
079   * @return the feature value 
080   */ 
081  public int getTestFS(int addr) {
082        if (featOkTst && casFeat_testFS == null)
083      jcas.throwFeatMissing("testFS", "org.cleartk.test.util.type.Lemma");
084    return ll_cas.ll_getRefValue(addr, casFeatCode_testFS);
085  }
086  /** @generated
087   * @param addr low level Feature Structure reference
088   * @param v value to set 
089   */    
090  public void setTestFS(int addr, int v) {
091        if (featOkTst && casFeat_testFS == null)
092      jcas.throwFeatMissing("testFS", "org.cleartk.test.util.type.Lemma");
093    ll_cas.ll_setRefValue(addr, casFeatCode_testFS, v);}
094    
095   /** @generated
096   * @param addr low level Feature Structure reference
097   * @param i index of item in the array
098   * @return value at index i in the array 
099   */
100  public String getTestFS(int addr, int i) {
101        if (featOkTst && casFeat_testFS == null)
102      jcas.throwFeatMissing("testFS", "org.cleartk.test.util.type.Lemma");
103    if (lowLevelTypeChecks)
104      return ll_cas.ll_getStringArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_testFS), i, true);
105    jcas.checkArrayBounds(ll_cas.ll_getRefValue(addr, casFeatCode_testFS), i);
106        return ll_cas.ll_getStringArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_testFS), i);
107  }
108   
109  /** @generated
110   * @param addr low level Feature Structure reference
111   * @param i index of item in the array
112   * @param v value to set
113   */ 
114  public void setTestFS(int addr, int i, String v) {
115        if (featOkTst && casFeat_testFS == null)
116      jcas.throwFeatMissing("testFS", "org.cleartk.test.util.type.Lemma");
117    if (lowLevelTypeChecks)
118      ll_cas.ll_setStringArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_testFS), i, v, true);
119    jcas.checkArrayBounds(ll_cas.ll_getRefValue(addr, casFeatCode_testFS), i);
120    ll_cas.ll_setStringArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_testFS), i, v);
121  }
122 
123
124
125
126  /** initialize variables to correspond with Cas Type and Features
127         * @generated
128         * @param jcas JCas
129         * @param casType Type 
130         */
131  public Lemma_Type(JCas jcas, Type casType) {
132    super(jcas, casType);
133    casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
134
135 
136    casFeat_value = jcas.getRequiredFeatureDE(casType, "value", "uima.cas.String", featOkTst);
137    casFeatCode_value  = (null == casFeat_value) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_value).getCode();
138
139 
140    casFeat_testFS = jcas.getRequiredFeatureDE(casType, "testFS", "uima.cas.StringArray", featOkTst);
141    casFeatCode_testFS  = (null == casFeat_testFS) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_testFS).getCode();
142
143  }
144}
145
146
147
148