001 002/* First created by JCasGen Wed May 07 09:15:21 EDT 2014 */ 003package org.cleartk.syntax.dependency.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 DependencyNode_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 (DependencyNode_Type.this.useExistingInstance) { 030 // Return eq fs instance if already created 031 FeatureStructure fs = DependencyNode_Type.this.jcas.getJfsFromCaddr(addr); 032 if (null == fs) { 033 fs = new DependencyNode(addr, DependencyNode_Type.this); 034 DependencyNode_Type.this.jcas.putJfsFromCaddr(addr, fs); 035 return fs; 036 } 037 return fs; 038 } else return new DependencyNode(addr, DependencyNode_Type.this); 039 } 040 }; 041 /** @generated */ 042 @SuppressWarnings ("hiding") 043 public final static int typeIndexID = DependencyNode.typeIndexID; 044 /** @generated 045 @modifiable */ 046 @SuppressWarnings ("hiding") 047 public final static boolean featOkTst = JCasRegistry.getFeatOkTst("org.cleartk.syntax.dependency.type.DependencyNode"); 048 049 /** @generated */ 050 final Feature casFeat_HeadRelations; 051 /** @generated */ 052 final int casFeatCode_HeadRelations; 053 /** @generated 054 * @param addr low level Feature Structure reference 055 * @return the feature value 056 */ 057 public int getHeadRelations(int addr) { 058 if (featOkTst && casFeat_HeadRelations == null) 059 jcas.throwFeatMissing("HeadRelations", "org.cleartk.syntax.dependency.type.DependencyNode"); 060 return ll_cas.ll_getRefValue(addr, casFeatCode_HeadRelations); 061 } 062 /** @generated 063 * @param addr low level Feature Structure reference 064 * @param v value to set 065 */ 066 public void setHeadRelations(int addr, int v) { 067 if (featOkTst && casFeat_HeadRelations == null) 068 jcas.throwFeatMissing("HeadRelations", "org.cleartk.syntax.dependency.type.DependencyNode"); 069 ll_cas.ll_setRefValue(addr, casFeatCode_HeadRelations, v);} 070 071 /** @generated 072 * @param addr low level Feature Structure reference 073 * @param i index of item in the array 074 * @return value at index i in the array 075 */ 076 public int getHeadRelations(int addr, int i) { 077 if (featOkTst && casFeat_HeadRelations == null) 078 jcas.throwFeatMissing("HeadRelations", "org.cleartk.syntax.dependency.type.DependencyNode"); 079 if (lowLevelTypeChecks) 080 return ll_cas.ll_getRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_HeadRelations), i, true); 081 jcas.checkArrayBounds(ll_cas.ll_getRefValue(addr, casFeatCode_HeadRelations), i); 082 return ll_cas.ll_getRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_HeadRelations), i); 083 } 084 085 /** @generated 086 * @param addr low level Feature Structure reference 087 * @param i index of item in the array 088 * @param v value to set 089 */ 090 public void setHeadRelations(int addr, int i, int v) { 091 if (featOkTst && casFeat_HeadRelations == null) 092 jcas.throwFeatMissing("HeadRelations", "org.cleartk.syntax.dependency.type.DependencyNode"); 093 if (lowLevelTypeChecks) 094 ll_cas.ll_setRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_HeadRelations), i, v, true); 095 jcas.checkArrayBounds(ll_cas.ll_getRefValue(addr, casFeatCode_HeadRelations), i); 096 ll_cas.ll_setRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_HeadRelations), i, v); 097 } 098 099 100 /** @generated */ 101 final Feature casFeat_ChildRelations; 102 /** @generated */ 103 final int casFeatCode_ChildRelations; 104 /** @generated 105 * @param addr low level Feature Structure reference 106 * @return the feature value 107 */ 108 public int getChildRelations(int addr) { 109 if (featOkTst && casFeat_ChildRelations == null) 110 jcas.throwFeatMissing("ChildRelations", "org.cleartk.syntax.dependency.type.DependencyNode"); 111 return ll_cas.ll_getRefValue(addr, casFeatCode_ChildRelations); 112 } 113 /** @generated 114 * @param addr low level Feature Structure reference 115 * @param v value to set 116 */ 117 public void setChildRelations(int addr, int v) { 118 if (featOkTst && casFeat_ChildRelations == null) 119 jcas.throwFeatMissing("ChildRelations", "org.cleartk.syntax.dependency.type.DependencyNode"); 120 ll_cas.ll_setRefValue(addr, casFeatCode_ChildRelations, v);} 121 122 /** @generated 123 * @param addr low level Feature Structure reference 124 * @param i index of item in the array 125 * @return value at index i in the array 126 */ 127 public int getChildRelations(int addr, int i) { 128 if (featOkTst && casFeat_ChildRelations == null) 129 jcas.throwFeatMissing("ChildRelations", "org.cleartk.syntax.dependency.type.DependencyNode"); 130 if (lowLevelTypeChecks) 131 return ll_cas.ll_getRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_ChildRelations), i, true); 132 jcas.checkArrayBounds(ll_cas.ll_getRefValue(addr, casFeatCode_ChildRelations), i); 133 return ll_cas.ll_getRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_ChildRelations), i); 134 } 135 136 /** @generated 137 * @param addr low level Feature Structure reference 138 * @param i index of item in the array 139 * @param v value to set 140 */ 141 public void setChildRelations(int addr, int i, int v) { 142 if (featOkTst && casFeat_ChildRelations == null) 143 jcas.throwFeatMissing("ChildRelations", "org.cleartk.syntax.dependency.type.DependencyNode"); 144 if (lowLevelTypeChecks) 145 ll_cas.ll_setRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_ChildRelations), i, v, true); 146 jcas.checkArrayBounds(ll_cas.ll_getRefValue(addr, casFeatCode_ChildRelations), i); 147 ll_cas.ll_setRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_ChildRelations), i, v); 148 } 149 150 151 152 153 /** initialize variables to correspond with Cas Type and Features 154 * @generated 155 * @param jcas JCas 156 * @param casType Type 157 */ 158 public DependencyNode_Type(JCas jcas, Type casType) { 159 super(jcas, casType); 160 casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator()); 161 162 163 casFeat_HeadRelations = jcas.getRequiredFeatureDE(casType, "HeadRelations", "uima.cas.FSArray", featOkTst); 164 casFeatCode_HeadRelations = (null == casFeat_HeadRelations) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_HeadRelations).getCode(); 165 166 167 casFeat_ChildRelations = jcas.getRequiredFeatureDE(casType, "ChildRelations", "uima.cas.FSArray", featOkTst); 168 casFeatCode_ChildRelations = (null == casFeat_ChildRelations) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_ChildRelations).getCode(); 169 170 } 171} 172 173 174 175