/** * Add a secondary array element to the specified primary array * @param i1 The primary array index * @param value The element to set */ @Override public void add(int i1, CoreMetadata value) { super.add(i1, value); }
/** * Construct a list containing a specified number of primary and secondary elements. * * This may be used to specify e.g. the number of image series including all sub-resolutions. * * @param sizes The number of primary and secondary list elements; the array elements are the secondary element sizes. */ public MetadataList(int[] sizes) { for (int i : sizes) { add(i); } }
/** * Construct a list containing a specified number of primary and secondary elements. * * This may be used to specify e.g. the number of image series including all sub-resolutions. * * @param sizes The number of primary and secondary list elements; the array elements are the secondary element sizes. */ public MetadataList(int[] sizes) { for (int i : sizes) { add(i); } }
/** * Add a secondary array element to the specified primary array * @param i1 The primary array index * @param value The element to set */ @Override public void add(int i1, CoreMetadata value) { super.add(i1, value); }
/** * Construct a list containing a specified number of primary elements and a fixed number of secondary elements. * * This may be used to specify e.g. the number of image series with a fixed number of sub-resolutions. * * @param size1 The number of primary list elements * @param size2 The number of secondary level list elements */ public MetadataList(int size1, int size2) { for (int i = 0; i < size1; i++) { add(size2); } }
/** * Construct a list containing a specified number of primary elements and a fixed number of secondary elements. * * This may be used to specify e.g. the number of image series with a fixed number of sub-resolutions. * * @param size1 The number of primary list elements * @param size2 The number of secondary level list elements */ public MetadataList(int size1, int size2) { for (int i = 0; i < size1; i++) { add(size2); } }
@Test public void testACoreMetadatadd1() { MetadataList<Elem> list = new MetadataList<>(); for (int i = 0; i < 3; i++) { list.add(); } checkContainerSize(list, new int[] {0,0,0}); }
@Test public void testAdd2() { MetadataList<Elem> list = new MetadataList<>(); int[] sizes = new int[] { 6,2,1,5,9,2,1 }; for (int s : sizes) { list.add(s); } checkContainerSize(list, sizes); }
@Test(dataProvider = "itemlist") public void testCountsAppend(int[][] data, int[] expected) { MetadataList<Elem> list = new MetadataList<>(); for (int i = 0; i < data.length; i++) { list.add(); for (int j = 0; j < data[i].length; j++) { Elem e = new Elem(); e.value = data[i][j]; list.add(i, e); } } checkContainerSize(list, expected); checkContainer(list, data); }
@Test public void testAdd1() { MetadataList<Elem> list = new MetadataList<>(); for (int i = 0; i < 2; i++) { list.add(new Elem()); } checkContainerSize(list, new int[] {1,1}); }
@Test(dataProvider = "itemlist") public void testCopy(int[][] data, int[] expected) { MetadataList<Elem> list = new MetadataList<>(); for (int i = 0; i < data.length; i++) { list.add(); for (int j = 0; j < data[i].length; j++) { Elem e = new Elem(); e.value = data[i][j]; list.add(i, e); } } MetadataList<Elem> list2 = new MetadataList<>(list); checkContainerSize(list, expected); checkContainer(list, data); checkContainer(list2, data); }