001 002/* First created by JCasGen Wed May 07 09:15:21 EDT 2014 */ 003package org.cleartk.syntax.constituent.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.cleartk.score.type.ScoredAnnotation_Type; 015 016/** 017 * Updated by JCasGen Wed May 07 09:15:21 EDT 2014 018 * @generated */ 019public class TreebankNode_Type extends ScoredAnnotation_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 (TreebankNode_Type.this.useExistingInstance) { 030 // Return eq fs instance if already created 031 FeatureStructure fs = TreebankNode_Type.this.jcas.getJfsFromCaddr(addr); 032 if (null == fs) { 033 fs = new TreebankNode(addr, TreebankNode_Type.this); 034 TreebankNode_Type.this.jcas.putJfsFromCaddr(addr, fs); 035 return fs; 036 } 037 return fs; 038 } else return new TreebankNode(addr, TreebankNode_Type.this); 039 } 040 }; 041 /** @generated */ 042 @SuppressWarnings ("hiding") 043 public final static int typeIndexID = TreebankNode.typeIndexID; 044 /** @generated 045 @modifiable */ 046 @SuppressWarnings ("hiding") 047 public final static boolean featOkTst = JCasRegistry.getFeatOkTst("org.cleartk.syntax.constituent.type.TreebankNode"); 048 049 /** @generated */ 050 final Feature casFeat_nodeType; 051 /** @generated */ 052 final int casFeatCode_nodeType; 053 /** @generated 054 * @param addr low level Feature Structure reference 055 * @return the feature value 056 */ 057 public String getNodeType(int addr) { 058 if (featOkTst && casFeat_nodeType == null) 059 jcas.throwFeatMissing("nodeType", "org.cleartk.syntax.constituent.type.TreebankNode"); 060 return ll_cas.ll_getStringValue(addr, casFeatCode_nodeType); 061 } 062 /** @generated 063 * @param addr low level Feature Structure reference 064 * @param v value to set 065 */ 066 public void setNodeType(int addr, String v) { 067 if (featOkTst && casFeat_nodeType == null) 068 jcas.throwFeatMissing("nodeType", "org.cleartk.syntax.constituent.type.TreebankNode"); 069 ll_cas.ll_setStringValue(addr, casFeatCode_nodeType, v);} 070 071 072 073 /** @generated */ 074 final Feature casFeat_nodeValue; 075 /** @generated */ 076 final int casFeatCode_nodeValue; 077 /** @generated 078 * @param addr low level Feature Structure reference 079 * @return the feature value 080 */ 081 public String getNodeValue(int addr) { 082 if (featOkTst && casFeat_nodeValue == null) 083 jcas.throwFeatMissing("nodeValue", "org.cleartk.syntax.constituent.type.TreebankNode"); 084 return ll_cas.ll_getStringValue(addr, casFeatCode_nodeValue); 085 } 086 /** @generated 087 * @param addr low level Feature Structure reference 088 * @param v value to set 089 */ 090 public void setNodeValue(int addr, String v) { 091 if (featOkTst && casFeat_nodeValue == null) 092 jcas.throwFeatMissing("nodeValue", "org.cleartk.syntax.constituent.type.TreebankNode"); 093 ll_cas.ll_setStringValue(addr, casFeatCode_nodeValue, v);} 094 095 096 097 /** @generated */ 098 final Feature casFeat_leaf; 099 /** @generated */ 100 final int casFeatCode_leaf; 101 /** @generated 102 * @param addr low level Feature Structure reference 103 * @return the feature value 104 */ 105 public boolean getLeaf(int addr) { 106 if (featOkTst && casFeat_leaf == null) 107 jcas.throwFeatMissing("leaf", "org.cleartk.syntax.constituent.type.TreebankNode"); 108 return ll_cas.ll_getBooleanValue(addr, casFeatCode_leaf); 109 } 110 /** @generated 111 * @param addr low level Feature Structure reference 112 * @param v value to set 113 */ 114 public void setLeaf(int addr, boolean v) { 115 if (featOkTst && casFeat_leaf == null) 116 jcas.throwFeatMissing("leaf", "org.cleartk.syntax.constituent.type.TreebankNode"); 117 ll_cas.ll_setBooleanValue(addr, casFeatCode_leaf, v);} 118 119 120 121 /** @generated */ 122 final Feature casFeat_parent; 123 /** @generated */ 124 final int casFeatCode_parent; 125 /** @generated 126 * @param addr low level Feature Structure reference 127 * @return the feature value 128 */ 129 public int getParent(int addr) { 130 if (featOkTst && casFeat_parent == null) 131 jcas.throwFeatMissing("parent", "org.cleartk.syntax.constituent.type.TreebankNode"); 132 return ll_cas.ll_getRefValue(addr, casFeatCode_parent); 133 } 134 /** @generated 135 * @param addr low level Feature Structure reference 136 * @param v value to set 137 */ 138 public void setParent(int addr, int v) { 139 if (featOkTst && casFeat_parent == null) 140 jcas.throwFeatMissing("parent", "org.cleartk.syntax.constituent.type.TreebankNode"); 141 ll_cas.ll_setRefValue(addr, casFeatCode_parent, v);} 142 143 144 145 /** @generated */ 146 final Feature casFeat_children; 147 /** @generated */ 148 final int casFeatCode_children; 149 /** @generated 150 * @param addr low level Feature Structure reference 151 * @return the feature value 152 */ 153 public int getChildren(int addr) { 154 if (featOkTst && casFeat_children == null) 155 jcas.throwFeatMissing("children", "org.cleartk.syntax.constituent.type.TreebankNode"); 156 return ll_cas.ll_getRefValue(addr, casFeatCode_children); 157 } 158 /** @generated 159 * @param addr low level Feature Structure reference 160 * @param v value to set 161 */ 162 public void setChildren(int addr, int v) { 163 if (featOkTst && casFeat_children == null) 164 jcas.throwFeatMissing("children", "org.cleartk.syntax.constituent.type.TreebankNode"); 165 ll_cas.ll_setRefValue(addr, casFeatCode_children, v);} 166 167 /** @generated 168 * @param addr low level Feature Structure reference 169 * @param i index of item in the array 170 * @return value at index i in the array 171 */ 172 public int getChildren(int addr, int i) { 173 if (featOkTst && casFeat_children == null) 174 jcas.throwFeatMissing("children", "org.cleartk.syntax.constituent.type.TreebankNode"); 175 if (lowLevelTypeChecks) 176 return ll_cas.ll_getRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_children), i, true); 177 jcas.checkArrayBounds(ll_cas.ll_getRefValue(addr, casFeatCode_children), i); 178 return ll_cas.ll_getRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_children), i); 179 } 180 181 /** @generated 182 * @param addr low level Feature Structure reference 183 * @param i index of item in the array 184 * @param v value to set 185 */ 186 public void setChildren(int addr, int i, int v) { 187 if (featOkTst && casFeat_children == null) 188 jcas.throwFeatMissing("children", "org.cleartk.syntax.constituent.type.TreebankNode"); 189 if (lowLevelTypeChecks) 190 ll_cas.ll_setRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_children), i, v, true); 191 jcas.checkArrayBounds(ll_cas.ll_getRefValue(addr, casFeatCode_children), i); 192 ll_cas.ll_setRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_children), i, v); 193 } 194 195 196 /** @generated */ 197 final Feature casFeat_nodeTags; 198 /** @generated */ 199 final int casFeatCode_nodeTags; 200 /** @generated 201 * @param addr low level Feature Structure reference 202 * @return the feature value 203 */ 204 public int getNodeTags(int addr) { 205 if (featOkTst && casFeat_nodeTags == null) 206 jcas.throwFeatMissing("nodeTags", "org.cleartk.syntax.constituent.type.TreebankNode"); 207 return ll_cas.ll_getRefValue(addr, casFeatCode_nodeTags); 208 } 209 /** @generated 210 * @param addr low level Feature Structure reference 211 * @param v value to set 212 */ 213 public void setNodeTags(int addr, int v) { 214 if (featOkTst && casFeat_nodeTags == null) 215 jcas.throwFeatMissing("nodeTags", "org.cleartk.syntax.constituent.type.TreebankNode"); 216 ll_cas.ll_setRefValue(addr, casFeatCode_nodeTags, v);} 217 218 /** @generated 219 * @param addr low level Feature Structure reference 220 * @param i index of item in the array 221 * @return value at index i in the array 222 */ 223 public String getNodeTags(int addr, int i) { 224 if (featOkTst && casFeat_nodeTags == null) 225 jcas.throwFeatMissing("nodeTags", "org.cleartk.syntax.constituent.type.TreebankNode"); 226 if (lowLevelTypeChecks) 227 return ll_cas.ll_getStringArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_nodeTags), i, true); 228 jcas.checkArrayBounds(ll_cas.ll_getRefValue(addr, casFeatCode_nodeTags), i); 229 return ll_cas.ll_getStringArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_nodeTags), i); 230 } 231 232 /** @generated 233 * @param addr low level Feature Structure reference 234 * @param i index of item in the array 235 * @param v value to set 236 */ 237 public void setNodeTags(int addr, int i, String v) { 238 if (featOkTst && casFeat_nodeTags == null) 239 jcas.throwFeatMissing("nodeTags", "org.cleartk.syntax.constituent.type.TreebankNode"); 240 if (lowLevelTypeChecks) 241 ll_cas.ll_setStringArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_nodeTags), i, v, true); 242 jcas.checkArrayBounds(ll_cas.ll_getRefValue(addr, casFeatCode_nodeTags), i); 243 ll_cas.ll_setStringArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_nodeTags), i, v); 244 } 245 246 247 248 249 /** initialize variables to correspond with Cas Type and Features 250 * @generated 251 * @param jcas JCas 252 * @param casType Type 253 */ 254 public TreebankNode_Type(JCas jcas, Type casType) { 255 super(jcas, casType); 256 casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator()); 257 258 259 casFeat_nodeType = jcas.getRequiredFeatureDE(casType, "nodeType", "uima.cas.String", featOkTst); 260 casFeatCode_nodeType = (null == casFeat_nodeType) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_nodeType).getCode(); 261 262 263 casFeat_nodeValue = jcas.getRequiredFeatureDE(casType, "nodeValue", "uima.cas.String", featOkTst); 264 casFeatCode_nodeValue = (null == casFeat_nodeValue) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_nodeValue).getCode(); 265 266 267 casFeat_leaf = jcas.getRequiredFeatureDE(casType, "leaf", "uima.cas.Boolean", featOkTst); 268 casFeatCode_leaf = (null == casFeat_leaf) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_leaf).getCode(); 269 270 271 casFeat_parent = jcas.getRequiredFeatureDE(casType, "parent", "org.cleartk.syntax.constituent.type.TreebankNode", featOkTst); 272 casFeatCode_parent = (null == casFeat_parent) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_parent).getCode(); 273 274 275 casFeat_children = jcas.getRequiredFeatureDE(casType, "children", "uima.cas.FSArray", featOkTst); 276 casFeatCode_children = (null == casFeat_children) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_children).getCode(); 277 278 279 casFeat_nodeTags = jcas.getRequiredFeatureDE(casType, "nodeTags", "uima.cas.StringArray", featOkTst); 280 casFeatCode_nodeTags = (null == casFeat_nodeTags) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_nodeTags).getCode(); 281 282 } 283} 284 285 286 287