001 002/* First created by JCasGen Wed May 07 09:15:21 EDT 2014 */ 003package org.cleartk.score.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:15:21 EDT 2014 018 * @generated */ 019public class ScoredAnnotation_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 (ScoredAnnotation_Type.this.useExistingInstance) { 030 // Return eq fs instance if already created 031 FeatureStructure fs = ScoredAnnotation_Type.this.jcas.getJfsFromCaddr(addr); 032 if (null == fs) { 033 fs = new ScoredAnnotation(addr, ScoredAnnotation_Type.this); 034 ScoredAnnotation_Type.this.jcas.putJfsFromCaddr(addr, fs); 035 return fs; 036 } 037 return fs; 038 } else return new ScoredAnnotation(addr, ScoredAnnotation_Type.this); 039 } 040 }; 041 /** @generated */ 042 @SuppressWarnings ("hiding") 043 public final static int typeIndexID = ScoredAnnotation.typeIndexID; 044 /** @generated 045 @modifiable */ 046 @SuppressWarnings ("hiding") 047 public final static boolean featOkTst = JCasRegistry.getFeatOkTst("org.cleartk.score.type.ScoredAnnotation"); 048 049 /** @generated */ 050 final Feature casFeat_score; 051 /** @generated */ 052 final int casFeatCode_score; 053 /** @generated 054 * @param addr low level Feature Structure reference 055 * @return the feature value 056 */ 057 public double getScore(int addr) { 058 if (featOkTst && casFeat_score == null) 059 jcas.throwFeatMissing("score", "org.cleartk.score.type.ScoredAnnotation"); 060 return ll_cas.ll_getDoubleValue(addr, casFeatCode_score); 061 } 062 /** @generated 063 * @param addr low level Feature Structure reference 064 * @param v value to set 065 */ 066 public void setScore(int addr, double v) { 067 if (featOkTst && casFeat_score == null) 068 jcas.throwFeatMissing("score", "org.cleartk.score.type.ScoredAnnotation"); 069 ll_cas.ll_setDoubleValue(addr, casFeatCode_score, v);} 070 071 072 073 074 075 /** initialize variables to correspond with Cas Type and Features 076 * @generated 077 * @param jcas JCas 078 * @param casType Type 079 */ 080 public ScoredAnnotation_Type(JCas jcas, Type casType) { 081 super(jcas, casType); 082 casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator()); 083 084 085 casFeat_score = jcas.getRequiredFeatureDE(casType, "score", "uima.cas.Double", featOkTst); 086 casFeatCode_score = (null == casFeat_score) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_score).getCode(); 087 088 } 089} 090 091 092 093