/* First created by JCasGen Tue Feb 03 15:17:25 GMT 2015 */ //Dstl (c) Crown Copyright 2017 package uk.gov.dstl.baleen.types.metadata; import org.apache.uima.cas.Feature; import org.apache.uima.cas.FeatureStructure; import org.apache.uima.cas.Type; import org.apache.uima.cas.impl.CASImpl; import org.apache.uima.cas.impl.FSGenerator; import org.apache.uima.cas.impl.FeatureImpl; import org.apache.uima.cas.impl.TypeImpl; import org.apache.uima.jcas.JCas; import org.apache.uima.jcas.JCasRegistry; import uk.gov.dstl.baleen.types.BaleenAnnotation_Type; /** Metadata associated with the document * Updated by JCasGen Tue Apr 12 12:06:57 BST 2016 * @generated */ public class Metadata_Type extends BaleenAnnotation_Type { /** @generated * @return the generator for this type */ @Override protected FSGenerator getFSGenerator() {return fsGenerator;} /** @generated */ private final FSGenerator fsGenerator = new FSGenerator() { public FeatureStructure createFS(int addr, CASImpl cas) { if (Metadata_Type.this.useExistingInstance) { // Return eq fs instance if already created FeatureStructure fs = Metadata_Type.this.jcas.getJfsFromCaddr(addr); if (null == fs) { fs = new Metadata(addr, Metadata_Type.this); Metadata_Type.this.jcas.putJfsFromCaddr(addr, fs); return fs; } return fs; } else return new Metadata(addr, Metadata_Type.this); } }; /** @generated */ @SuppressWarnings ("hiding") public final static int typeIndexID = Metadata.typeIndexID; /** @generated @modifiable */ @SuppressWarnings ("hiding") public final static boolean featOkTst = JCasRegistry.getFeatOkTst("uk.gov.dstl.baleen.types.metadata.Metadata"); /** @generated */ final Feature casFeat_key; /** @generated */ final int casFeatCode_key; /** @generated * @param addr low level Feature Structure reference * @return the feature value */ public String getKey(int addr) { if (featOkTst && casFeat_key == null) jcas.throwFeatMissing("key", "uk.gov.dstl.baleen.types.metadata.Metadata"); return ll_cas.ll_getStringValue(addr, casFeatCode_key); } /** @generated * @param addr low level Feature Structure reference * @param v value to set */ public void setKey(int addr, String v) { if (featOkTst && casFeat_key == null) jcas.throwFeatMissing("key", "uk.gov.dstl.baleen.types.metadata.Metadata"); ll_cas.ll_setStringValue(addr, casFeatCode_key, v);} /** @generated */ final Feature casFeat_value; /** @generated */ final int casFeatCode_value; /** @generated * @param addr low level Feature Structure reference * @return the feature value */ public String getValue(int addr) { if (featOkTst && casFeat_value == null) jcas.throwFeatMissing("value", "uk.gov.dstl.baleen.types.metadata.Metadata"); return ll_cas.ll_getStringValue(addr, casFeatCode_value); } /** @generated * @param addr low level Feature Structure reference * @param v value to set */ public void setValue(int addr, String v) { if (featOkTst && casFeat_value == null) jcas.throwFeatMissing("value", "uk.gov.dstl.baleen.types.metadata.Metadata"); ll_cas.ll_setStringValue(addr, casFeatCode_value, v);} /** initialize variables to correspond with Cas Type and Features * @generated * @param jcas JCas * @param casType Type */ public Metadata_Type(JCas jcas, Type casType) { super(jcas, casType); casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator()); casFeat_key = jcas.getRequiredFeatureDE(casType, "key", "uima.cas.String", featOkTst); casFeatCode_key = (null == casFeat_key) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_key).getCode(); casFeat_value = jcas.getRequiredFeatureDE(casType, "value", "uima.cas.String", featOkTst); casFeatCode_value = (null == casFeat_value) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_value).getCode(); } }