@Test public void testToFSArrayFeatureStructure() { FSArray nullArray = UimaTypesUtils.toFSArray(jCas, (FeatureStructure) null); assertNotNull(nullArray); assertEquals(1, nullArray.size()); FSArray emptyArray = UimaTypesUtils.toFSArray(jCas); assertNotNull(emptyArray); assertEquals(0, emptyArray.size()); Entity e = new Entity(jCas); FSArray fullArray = UimaTypesUtils.toFSArray(jCas, e); assertNotNull(fullArray); assertEquals(1, fullArray.size()); assertSame(e, fullArray.get(0)); }
public static FSArray toFSArray(JCas jCas, Collection<? extends FeatureStructure> collection) { if (collection == null || collection.isEmpty()) { return new FSArray(jCas, 0); } else { FSArray array = new FSArray(jCas, collection.size()); int i = 0; for (FeatureStructure fs : collection) { array.set(i, fs); i++; } return array; } }
UimaTypesUtils { public static FSArray toFSArray(JCas jCas, Collection<? extends FeatureStructure> collection) { if (collection == null || collection.isEmpty()) { return new FSArray(jCas, 0); } else { FSArray array = new FSArray(jCas, collection.size()); int i = 0; for (FeatureStructure fs : collection) { array.set(i, fs); i++; } return array; } } }
UimaTypesUtils { public static FSArray toFSArray(JCas jCas, Collection<? extends FeatureStructure> collection) { if (collection == null || collection.isEmpty()) { return new FSArray(jCas, 0); } else { FSArray array = new FSArray(jCas, collection.size()); int i = 0; for (FeatureStructure fs : collection) { array.set(i, fs); i++; } return array; } } private  UimaTypesUtils(); }
UimaTypesUtils { public static FSArray toFSArray(JCas jCas, Collection<? extends FeatureStructure> collection) { if (collection == null || collection.isEmpty()) { return new FSArray(jCas, 0); } else { FSArray array = new FSArray(jCas, collection.size()); int i = 0; for (FeatureStructure fs : collection) { array.set(i, fs); i++; } return array; } } private  UimaTypesUtils(); static StringArray toArray(JCas jCas, Collection<String> collection); static String[] toArray(StringArray array); @SuppressWarnings("unchecked") static List<T> toList(FSArray array); static List<String> toList(StringArray array); static FSArray toFSArray(JCas jCas, Collection<? extends FeatureStructure> collection); static FSArray toFSArray(JCas jCas, FeatureStructure... fses); }
UimaTypesUtils { public static FSArray toFSArray(JCas jCas, Collection<? extends FeatureStructure> collection) { if (collection == null || collection.isEmpty()) { return new FSArray(jCas, 0); } else { FSArray array = new FSArray(jCas, collection.size()); int i = 0; for (FeatureStructure fs : collection) { array.set(i, fs); i++; } return array; } } private  UimaTypesUtils(); static StringArray toArray(JCas jCas, Collection<String> collection); static String[] toArray(StringArray array); @SuppressWarnings("unchecked") static List<T> toList(FSArray array); static List<String> toList(StringArray array); static FSArray toFSArray(JCas jCas, Collection<? extends FeatureStructure> collection); static FSArray toFSArray(JCas jCas, FeatureStructure... fses);  }