org.apache.uima.jcas.cas.FSArray Java Examples
The following examples show how to use
org.apache.uima.jcas.cas.FSArray.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TRExReader.java From ambiverse-nlu with Apache License 2.0 | 6 votes |
private <K extends Constituent> K getConstituent(TAnnotation constituent, Class<K> clazz, JCas jCas) { Constituent result = getInstancedConstitient(jCas, constituent, clazz); if(constituent.boundaries != null) { result.setExplicit(true); result.setBegin(constituent.boundaries[0]); result.setEnd(constituent.boundaries[1]); } result.setUri(constituent.uri); List<Token> tokens = JCasUtil.selectCovered(jCas, Token.class, result.getBegin(), result.getEnd()); FSArray array = new FSArray(jCas, tokens.size()); for (int i = 0; i < tokens.size(); i++) { array.set(i, tokens.get(i)); } array.addToIndexes(); result.setTokens(array); jCas.addFsToIndexes(clazz.cast(result)); return clazz.cast(result); }
Example #2
Source File: FSArrayListTest.java From uima-uimaj with Apache License 2.0 | 6 votes |
public void testBasic() { FSArrayList<Token> al = new FSArrayList<>(jcas); Token t1 = new Token(jcas); Token t2 = new Token(jcas); al.add(t1); al.add(t2); al.remove(t1); assertEquals(1, al.size()); Iterator<Token> it = al.iterator(); Token k = null; while (it.hasNext()) { assertNotNull(k = it.next()); } assertNotNull(k); al._save_fsRefs_to_cas_data(); FSArray fa = (FSArray) al.getFeatureValue(al.getType().getFeatureByBaseName("fsArray")); assertNotNull(fa); assertEquals(fa.get(0), k); }
Example #3
Source File: FSHashSetTest.java From uima-uimaj with Apache License 2.0 | 6 votes |
private void basic(FSHashSet<Token> s) { FSHashSet<Token> set = s; Token t1 = new Token(jcas); Token t2 = new Token(jcas); set.add(t1); set.add(t2); set.remove(t1); assertEquals(1, set.size()); Iterator<Token> it = set.iterator(); Token k = null; while (it.hasNext()) { assertNotNull(k = it.next()); } assertNotNull(k); set._save_fsRefs_to_cas_data(); FSArray fa = (FSArray) set.getFeatureValue(set.getType().getFeatureByBaseName("fsArray")); assertNotNull(fa); assertEquals(fa.get(0), k); }
Example #4
Source File: PubmedDatabaseCRTest.java From bluima with Apache License 2.0 | 6 votes |
@Test public void testAuthors() throws Exception { // http://www.ncbi.nlm.nih.gov/pubmed/?term=1&report=xml&format=text CollectionReader cr = createReader(PubmedDatabaseCR.class, BlueUima.PARAM_BETWEEN, new int[] { 0, 1 }, BlueUima.PARAM_SKIP_EMPTY_DOCS, false); String[] lastNames = { "Makar", "McMartin", "Palese", "Tephly" }; String[] foreNames = { "A B", "K E", "M", "T R" }; // AB___A B___Makar__-__KE___K // E___McMartin__-__M___M___Palese__-__TR___T R___Tephly for (JCas jCas : asList(cr)) { Header header = JCasUtil.selectSingle(jCas, Header.class); FSArray authors = header.getAuthors(); for (int i = 0; i < authors.size(); i++) { AuthorInfo a = (AuthorInfo) authors.get(i); assertEquals(foreNames[i], a.getForeName()); assertEquals(lastNames[i], a.getLastName()); } assertEquals("1976-01-16", header.getCopyright()); } }
Example #5
Source File: WordNetLemmatizerTest.java From baleen with Apache License 2.0 | 6 votes |
@Test public void testAddsLemmaToExistingLemmas() throws UIMAException, ResourceInitializationException { jCas.setDocumentText("Is this working?"); final WordToken s = new WordToken(jCas); s.setBegin(jCas.getDocumentText().indexOf("working")); s.setEnd(s.getBegin() + "working".length()); s.setPartOfSpeech("VERB"); s.setLemmas(new FSArray(jCas, 1)); final WordLemma existingLemma = new WordLemma(jCas); existingLemma.setPartOfSpeech("existing"); existingLemma.setLemmaForm("existing"); s.setLemmas(0, existingLemma); s.addToIndexes(); processJCas("wordnet", wordnetErd); final List<WordToken> out = new ArrayList<>(JCasUtil.select(jCas, WordToken.class)); assertEquals(existingLemma, out.get(0).getLemmas(0)); assertEquals("work", out.get(0).getLemmas(1).getLemmaForm()); }
Example #6
Source File: WordNetLemmatizer.java From baleen with Apache License 2.0 | 6 votes |
@Override protected void doProcess(JCas jCas) throws AnalysisEngineProcessException { for (final WordToken t : JCasUtil.select(jCas, WordToken.class)) { int lemmas = t.getLemmas() == null ? 0 : t.getLemmas().size(); final String text = t.getCoveredText(); final POS pos = WordNetUtils.toPos(t.getPartOfSpeech()); if (pos != null) { final Optional<IndexWord> lookupWord = wordnet.lookupWord(pos, text); if (lookupWord.isPresent()) { FSArray fsArray = new FSArray(jCas, lemmas + 1); if (lemmas > 0) { copyExistingLemmas(t, fsArray); } t.setLemmas(fsArray); final WordLemma wordLemma = new WordLemma(jCas); wordLemma.setLemmaForm(lookupWord.get().getLemma()); t.setLemmas(lemmas, wordLemma); } } } }
Example #7
Source File: WordNetLemmatizer.java From baleen with Apache License 2.0 | 5 votes |
private void copyExistingLemmas(final WordToken t, FSArray fsArray) { int i = 0; for (FeatureStructure fs : t.getLemmas().toArray()) { fsArray.set(i, fs); i++; } }
Example #8
Source File: AllAnnotationsJsonConsumerTest.java From baleen with Apache License 2.0 | 5 votes |
@Before public void setup() throws IOException { jCas.setDocumentText(TEXT); tempDirectory = Files.createTempDirectory(AllAnnotationsJsonConsumerTest.class.getSimpleName()); tempDirectory.toFile().deleteOnExit(); DocumentAnnotation documentAnnotation = (DocumentAnnotation) jCas.getDocumentAnnotationFs(); documentAnnotation.setSourceUri(SOURCEURI); Paragraph paragraph1 = new Paragraph(jCas); paragraph1.setBegin(0); paragraph1.setDepth(1); paragraph1.setEnd(52); paragraph1.addToIndexes(); Person entity1 = new Person(jCas); entity1.setBegin(70); entity1.setEnd(73); entity1.setValue("cat"); entity1.addToIndexes(); Event event = new Event(jCas); event.setBegin(53); event.setEnd(105); event.setArguments(new StringArray(jCas, 2)); event.setArguments(0, "cat"); event.setArguments(1, "dog"); event.setEntities(new FSArray(jCas, 1)); event.setEntities(0, entity1); event.addToIndexes(); }
Example #9
Source File: CasSerializerSupport.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Enqueues all FS reachable from an FSArray. * * @param addr * Address of an FSArray */ private void enqueueFSArrayElements(FSArray fsArray) throws SAXException { for (TOP elem : fsArray._getTheArray()) { if (elem != null) { enqueueFsAndMaybeFeatures(elem); } } }
Example #10
Source File: BlueCasUtil.java From bluima with Apache License 2.0 | 5 votes |
public static String getSinglePosTag(Token t) { FSArray posTag = t.getPosTag(); if (posTag != null && posTag.size() > 0) { return ((POSTag) posTag.get(0)).getValue(); } return null; }
Example #11
Source File: EnsureTokensHaveLemmaAndPOS.java From bluima with Apache License 2.0 | 5 votes |
/** Convenience method to set POS tag */ public static void setPosTags(Token token, JCas jcas, String... posTags) { FSArray slots = new FSArray(jcas, posTags.length); for (int i = 0; i < posTags.length; i++) { POSTag posTag = new POSTag(jcas); posTag.setValue(posTags[i]); posTag.addToIndexes(); slots.set(i, posTag); } token.setPosTag(slots); }
Example #12
Source File: MaltParser.java From baleen with Apache License 2.0 | 5 votes |
/** * Gets the lemma. * * @param token the token * @return the lemma */ private String getLemma(final WordToken token) { final FSArray array = token.getLemmas(); if (array == null || array.size() == 0) { return "_"; } else { return ((WordLemma) array.get(0)).getLemmaForm(); } }
Example #13
Source File: JCasUtilTest.java From uima-uimafit with Apache License 2.0 | 5 votes |
@SuppressWarnings({ "rawtypes", "unchecked" }) @Test public void testSelectOnArrays() throws Exception { String text = "Rot wood cheeses dew?"; tokenBuilder.buildTokens(jCas, text); Collection<TOP> allFS = select(jCas, TOP.class); FSArray allFSArray = new FSArray(jCas, allFS.size()); int i = 0; for (FeatureStructure fs : allFS) { allFSArray.set(i, fs); i++; } // Print what is expected // for (FeatureStructure fs : allFS) { // System.out.println("Type: " + fs.getType().getName() + "]"); // } // System.out.println("Tokens: [" + toText(select(jCas, Token.class)) + "]"); // Document Annotation, one sentence and 4 tokens. assertEquals(6, allFS.size()); assertEquals(toText(select(jCas, Token.class)), toText(select(allFSArray, Token.class))); assertEquals(toText((Iterable) select(jCas, Token.class)), toText((Iterable) select(allFSArray, Token.class))); }
Example #14
Source File: XmiCompare.java From uima-uimaj with Apache License 2.0 | 5 votes |
private List<Runnable> sortFSArray(String typename, String featurename, CASImpl cas) { TypeSystem ts = cas.getTypeSystem(); Type type = ts.getType(typename); Feature feat = ts.getFeatureByFullName(typename + ":" + featurename); return cas.select(type).allViews().map(fs -> cc.sortFSArray((FSArray)fs.getFeatureValue(feat))).collect(Collectors.toList()); }
Example #15
Source File: JCasTest.java From uima-uimaj with Apache License 2.0 | 5 votes |
public void testFSArrayAPI() { FSArray sa = new FSArray<>(jcas, 2); TOP fs1 = new TOP(jcas); TOP fs2 = new TOP(jcas); TOP[] values = {fs1, fs2}; sa.copyFromArray(values, 0, 0, 2); int i = 0; sa.iterator(); for (Object s : sa) { assert(s.equals(values[i++])); } }
Example #16
Source File: XmiCasDeserializer.java From uima-uimaj with Apache License 2.0 | 5 votes |
private void finalizeFSArrayRefValue(int xmiId, FSArray fsArray, int index) throws XCASParsingException { TOP tgtFs = maybeGetFsForXmiId(xmiId); if (null == tgtFs && xmiId != 0) { // https://issues.apache.org/jira/browse/UIMA-5446 if (!lenient) { throw createException(XCASParsingException.UNKNOWN_ID, Integer.toString(xmiId)); } else { // the array element may be out of typesystem. In that case set it // to null, but record the id so we can add it back on next serialization. this.sharedData.addOutOfTypeSystemArrayElement(fsArray, index, xmiId); fsArray.set(index, null); } } else { fsArray.set(index, tgtFs); } }
Example #17
Source File: FeatureStructureImplC.java From uima-uimaj with Apache License 2.0 | 5 votes |
private boolean isOkArray(TypeImpl range, Object v) { if (v == null) { return true; } final int rangeTypeCode = range.getCode(); /* The assignment is stricter than the Java rules - must match */ switch (rangeTypeCode) { case TypeSystemConstants.booleanArrayTypeCode: return v instanceof BooleanArray; case TypeSystemConstants.byteArrayTypeCode: return v instanceof ByteArray; case TypeSystemConstants.shortArrayTypeCode: return v instanceof ShortArray; case TypeSystemConstants.intArrayTypeCode: return v instanceof IntegerArray; case TypeSystemConstants.floatArrayTypeCode: return v instanceof FloatArray; case TypeSystemConstants.longArrayTypeCode: return v instanceof LongArray; case TypeSystemConstants.doubleArrayTypeCode: return v instanceof DoubleArray; case TypeSystemConstants.stringArrayTypeCode: return v instanceof StringArray; // case TypeSystemConstants.javaObjectArrayTypeCode: // return v instanceof JavaObjectArray; case TypeSystemConstants.fsArrayTypeCode: return v instanceof FSArray; } // it is possible that the array has a special type code corresponding to a type "someUserType"[] // meaning an array of some user type. UIMA implements these as instances of FSArray (I think) if (!(v instanceof FSArray)) { return false; } return true; }
Example #18
Source File: MMAXAnnotation.java From bluima with Apache License 2.0 | 4 votes |
/** setter for attributeList - sets List of attributes of the MMAX annotation. * @generated * @param v value to set into the feature */ public void setAttributeList(FSArray v) { if (MMAXAnnotation_Type.featOkTst && ((MMAXAnnotation_Type)jcasType).casFeat_attributeList == null) jcasType.jcas.throwFeatMissing("attributeList", "de.julielab.jules.types.mmax.MMAXAnnotation"); jcasType.ll_cas.ll_setRefValue(addr, ((MMAXAnnotation_Type)jcasType).casFeatCode_attributeList, jcasType.ll_cas.ll_getFSRef(v));}
Example #19
Source File: ConceptMention.java From bluima with Apache License 2.0 | 4 votes |
/** getter for resourceEntryList - gets * @generated * @return value of the feature */ public FSArray getResourceEntryList() { if (ConceptMention_Type.featOkTst && ((ConceptMention_Type)jcasType).casFeat_resourceEntryList == null) jcasType.jcas.throwFeatMissing("resourceEntryList", "de.julielab.jules.types.ConceptMention"); return (FSArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((ConceptMention_Type)jcasType).casFeatCode_resourceEntryList)));}
Example #20
Source File: ListItem.java From bluima with Apache License 2.0 | 4 votes |
/** setter for itemList - sets items of the next level (sub-items) * @generated * @param v value to set into the feature */ public void setItemList(FSArray v) { if (ListItem_Type.featOkTst && ((ListItem_Type)jcasType).casFeat_itemList == null) jcasType.jcas.throwFeatMissing("itemList", "de.julielab.jules.types.ListItem"); jcasType.ll_cas.ll_setRefValue(addr, ((ListItem_Type)jcasType).casFeatCode_itemList, jcasType.ll_cas.ll_getFSRef(v));}
Example #21
Source File: MongoPatternSaverTest.java From baleen with Apache License 2.0 | 4 votes |
@Test public void test() throws AnalysisEngineProcessException { jCas.setDocumentText("The cow jumps over the moon."); final Entity cow = new Person(jCas); cow.setBegin(4); cow.setEnd(7); cow.addToIndexes(jCas); final Entity moon = new Location(jCas); moon.setBegin(23); moon.setEnd(27); moon.addToIndexes(jCas); final WordToken jumps = new WordToken(jCas); jumps.setBegin(8); jumps.setEnd(8 + "jumps".length()); jumps.setPartOfSpeech("VB"); final WordLemma jumpLemma = new WordLemma(jCas); jumpLemma.setLemmaForm("jump"); jumps.setLemmas(new FSArray(jCas, 1)); jumps.setLemmas(0, jumpLemma); jumps.addToIndexes(); final Pattern pattern = new Pattern(jCas); pattern.setBegin(8); pattern.setBegin(22); pattern.setWords(new FSArray(jCas, 1)); pattern.setWords(0, jumps); pattern.setSource(cow); pattern.setTarget(moon); pattern.addToIndexes(); ae.process(jCas); final MongoCollection<Document> collection = sfr.getDB().getCollection("test"); Assert.assertEquals(1, collection.count()); final Document object = collection.find().first(); final Document source = (Document) object.get("source"); final Document target = (Document) object.get("target"); final List<?> words = (List<?>) object.get("words"); Assert.assertEquals("cow", source.get("text")); Assert.assertEquals("uk.gov.dstl.baleen.types.common.Person", source.get("type")); Assert.assertEquals("moon", target.get("text")); Assert.assertEquals("uk.gov.dstl.baleen.types.semantic.Location", target.get("type")); Assert.assertEquals(1, words.size()); final Document word = (Document) words.get(0); Assert.assertEquals("jumps", word.get("text")); Assert.assertEquals("VB", word.get("pos")); Assert.assertEquals("jump", word.get("lemma")); }
Example #22
Source File: OntClassMention.java From bluima with Apache License 2.0 | 4 votes |
/** setter for matchedTokens - sets List of tokens the ontology class mention is comprised of. * @generated * @param v value to set into the feature */ public void setMatchedTokens(FSArray v) { if (OntClassMention_Type.featOkTst && ((OntClassMention_Type)jcasType).casFeat_matchedTokens == null) jcasType.jcas.throwFeatMissing("matchedTokens", "de.julielab.jules.types.OntClassMention"); jcasType.ll_cas.ll_setRefValue(addr, ((OntClassMention_Type)jcasType).casFeatCode_matchedTokens, jcasType.ll_cas.ll_getFSRef(v));}
Example #23
Source File: DictTerm.java From bluima with Apache License 2.0 | 4 votes |
/** getter for matchedTokens - gets * @generated * @return value of the feature */ public FSArray getMatchedTokens() { if (DictTerm_Type.featOkTst && ((DictTerm_Type)jcasType).casFeat_matchedTokens == null) jcasType.jcas.throwFeatMissing("matchedTokens", "org.apache.uima.conceptMapper.DictTerm"); return (FSArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((DictTerm_Type)jcasType).casFeatCode_matchedTokens)));}
Example #24
Source File: SourceFile.java From bluima with Apache License 2.0 | 4 votes |
/** setter for documents - sets * @generated * @param v value to set into the feature */ public void setDocuments(FSArray v) { if (SourceFile_Type.featOkTst && ((SourceFile_Type)jcasType).casFeat_documents == null) jcasType.jcas.throwFeatMissing("documents", "de.julielab.jules.types.ace.SourceFile"); jcasType.ll_cas.ll_setRefValue(addr, ((SourceFile_Type)jcasType).casFeatCode_documents, jcasType.ll_cas.ll_getFSRef(v));}
Example #25
Source File: Entity.java From bluima with Apache License 2.0 | 4 votes |
/** getter for entity_mentions - gets * @generated * @return value of the feature */ public FSArray getEntity_mentions() { if (Entity_Type.featOkTst && ((Entity_Type)jcasType).casFeat_entity_mentions == null) jcasType.jcas.throwFeatMissing("entity_mentions", "de.julielab.jules.types.ace.Entity"); return (FSArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((Entity_Type)jcasType).casFeatCode_entity_mentions)));}
Example #26
Source File: EventFactoryTest.java From baleen with Apache License 2.0 | 4 votes |
@Test public void returnsEventWhenEventMention() throws UIMAException { when(document.text()).thenReturn(Option.apply("Baleen was here!")); when(document.sentences()).thenReturn(new Sentence[] {sentence}); when(sentence.startOffsets()).thenReturn(new int[] {0, 7, 11, 15}); when(sentence.endOffsets()).thenReturn(new int[] {6, 10, 15, 16}); JCas jCas = JCasFactory.createJCas(); jCas.setDocumentText("Baleen was here!"); Person person = Annotations.createPerson(jCas, 0, 6, "Baleen"); Location location = Annotations.createLocation(jCas, 11, 15, "here", null); Annotations.createWordTokens(jCas); TextBoundMention textEventMention = new TextBoundMention("was", new Interval(1, 2), 0, document, true, "me"); TextBoundMention textPersonMention = new TextBoundMention("Baleen", new Interval(0, 1), 0, document, true, "me"); TextBoundMention textLocationMention = new TextBoundMention("here", new Interval(2, 3), 0, document, true, "me"); String label = "test"; Map<String, Seq<Mention>> arguments = new HashMap<String, Seq<Mention>>(); arguments.put("person", JavaConversions.asScalaBuffer(ImmutableList.of(textPersonMention))); arguments.put("location", JavaConversions.asScalaBuffer(ImmutableList.of(textLocationMention))); scala.collection.immutable.Map<String, Seq<Mention>> argumentsMap = JavaConverters.mapAsScalaMapConverter(arguments) .asScala() .toMap(Predef.<Tuple2<String, Seq<Mention>>>conforms()); EventMention mention = new EventMention(label, textEventMention, argumentsMap, 0, document, true, "me"); EventFactory factory = new EventFactory(jCas); Optional<Event> create = factory.create(mention); assertTrue(create.isPresent()); Event event = create.get(); assertEquals(0, event.getBegin()); assertEquals(15, event.getEnd()); assertEquals("Baleen was here", event.getValue()); assertEquals(label, event.getEventType().get(0)); FSArray tokens = event.getTokens(); assertEquals(1, tokens.size()); assertEquals("was", ((WordToken) tokens.get(0)).getCoveredText()); StringArray args = event.getArguments(); assertEquals(2, args.size()); assertEquals("person", event.getArguments().get(0)); assertEquals("location", event.getArguments().get(1)); FSArray entities = event.getEntities(); assertEquals(2, entities.size()); assertEquals(person, entities.get(0)); assertEquals(location, entities.get(1)); }
Example #27
Source File: BioVerb.java From bluima with Apache License 2.0 | 4 votes |
/** setter for matchedTokens - sets * @generated * @param v value to set into the feature */ public void setMatchedTokens(FSArray v) { if (BioVerb_Type.featOkTst && ((BioVerb_Type)jcasType).casFeat_matchedTokens == null) jcasType.jcas.throwFeatMissing("matchedTokens", "ch.epfl.bbp.uima.types.BioVerb"); jcasType.ll_cas.ll_setRefValue(addr, ((BioVerb_Type)jcasType).casFeatCode_matchedTokens, jcasType.ll_cas.ll_getFSRef(v));}
Example #28
Source File: Event.java From bluima with Apache License 2.0 | 4 votes |
/** setter for causes_event - sets * @generated * @param v value to set into the feature */ public void setCauses_event(FSArray v) { if (Event_Type.featOkTst && ((Event_Type)jcasType).casFeat_causes_event == null) jcasType.jcas.throwFeatMissing("causes_event", "ch.epfl.bbp.uima.genia.Event"); jcasType.ll_cas.ll_setRefValue(addr, ((Event_Type)jcasType).casFeatCode_causes_event, jcasType.ll_cas.ll_getFSRef(v));}
Example #29
Source File: BinaryCasSerDes.java From uima-uimaj with Apache License 2.0 | 4 votes |
/** * Doing updates for delta cas for existing objects. * Cases: * - item in heap-stored-array = update the corresponding item in the FS * - non-ref in feature slot - update the corresponding feature * - ref (to long/double value, to string) * -- these always reference entries in long/string tables that are new (above the line) * -- these have already been deserialized * - ref (to main heap) - can update this directly * NOTE: entire aux arrays never have their refs to the aux heaps updated, for * arrays of boolean, byte, short, long, double * NOTE: Slot updates for FS refs always point to addr which are in the addr2fs table or are 0 (null), * because if the ref is to a new one, those have been already deserialized by this point, and * if the ref is to a below-the-line one, those are already put into the addr2fs table * @param bds - helper data * @param slotAddr - the main heap slot addr being updated * @param slotValue - the new value */ private void updateHeapSlot(BinDeserSupport bds, int slotAddr, int slotValue, Int2ObjHashMap<TOP, TOP> addr2fs) { TOP fs = bds.fs; TypeImpl type = fs._getTypeImpl(); if (type.isArray()) { // only heap stored arrays have mod updates. final int hsai = slotAddr - bds.fsStartAddr - arrayContentOffset; // heap stored array index switch(type.getComponentSlotKind()) { // heap stored arrays case Slot_Int: ((IntegerArray)fs).set(hsai, slotValue); break; case Slot_Float: ((FloatArray)fs).set(hsai, CASImpl.int2float(slotValue)); break; case Slot_StrRef: ((StringArray)fs).set(hsai, stringHeap.getStringForCode(slotValue)); break; case Slot_HeapRef:((FSArray )fs).set(hsai, addr2fs.get(slotValue)); break; default: Misc.internalError(); } // end of switch for component type of arrays } else { // end of arrays // is plain fs with fields final int offset0 = slotAddr - bds.fsStartAddr - 1; // 0 based offset of feature, -1 for type code word FeatureImpl feat = type.getFeatureImpls()[offset0]; SlotKind slotKind = feat.getSlotKind(); switch(slotKind) { case Slot_Boolean: case Slot_Byte: case Slot_Short: case Slot_Int: case Slot_Float: fs._setIntLikeValue(slotKind, feat, slotValue); break; case Slot_LongRef: fs.setLongValue(feat, longHeap.getHeapValue(slotValue)); break; case Slot_DoubleRef: fs.setDoubleValue(feat, CASImpl.long2double(longHeap.getHeapValue(slotValue))); break; case Slot_StrRef: { String s = stringHeap.getStringForCode(slotValue); if (updateStringFeature(fs, feat, s, null)) { fs.setStringValue(feat, stringHeap.getStringForCode(slotValue)); } break; } case Slot_HeapRef: fs.setFeatureValue(feat, addr2fs.get(slotValue)); break; default: Misc.internalError(); } } }
Example #30
Source File: Concept.java From bluima with Apache License 2.0 | 4 votes |
/** setter for mentions - sets * @generated * @param v value to set into the feature */ public void setMentions(FSArray v) { if (Concept_Type.featOkTst && ((Concept_Type)jcasType).casFeat_mentions == null) jcasType.jcas.throwFeatMissing("mentions", "de.julielab.jules.types.Concept"); jcasType.ll_cas.ll_setRefValue(addr, ((Concept_Type)jcasType).casFeatCode_mentions, jcasType.ll_cas.ll_getFSRef(v));}