@Test public void testUsableFieldsRetrieval_WithRecords() throws Exception { MetadataElement elem = new MetadataElement("Records"); MetadataElement element1 = new MetadataElement("Records.1"); addAttributes(element1); elem.addElement(element1); MetadataElement element2 = new MetadataElement("Records.2"); addAttributes(element2); elem.addElement(element2); List<String> fieldNames = MetadataPlotSettings.retrieveUsableFieldNames(elem); assertEquals(3, fieldNames.size()); assertTrue(fieldNames.contains("singleValue")); assertTrue(fieldNames.contains("array")); assertTrue(fieldNames.contains("splittedArray")); assertTrue(!fieldNames.contains("string")); }
static List<String> retrieveUsableFieldNames(MetadataElement element) { int numRecords = getNumRecords(element); if (numRecords > 1) { return retrieveUsableFieldNames(element.getElements()[0]); } else { List<String> list = new ArrayList<>(); String[] attributeNames = element.getAttributeNames(); for (String fullAttribName : attributeNames) { String fieldName = getFieldName(fullAttribName); if (list.contains(fieldName)) { continue; } MetadataAttribute attribute = element.getAttribute(fullAttribName); if (isNumericType(attribute)) { list.add(fieldName); } } return list; } }
MetadataPlotSettings { static List<String> retrieveUsableFieldNames(MetadataElement element) { int numRecords = getNumRecords(element); if (numRecords > 1) { return retrieveUsableFieldNames(element.getElements()[0]); } else { List<String> list = new ArrayList<>(); String[] attributeNames = element.getAttributeNames(); for (String fullAttribName : attributeNames) { String fieldName = getFieldName(fullAttribName); if (list.contains(fieldName)) { continue; } MetadataAttribute attribute = element.getAttribute(fullAttribName); if (isNumericType(attribute)) { list.add(fieldName); } } return list; } } }
MetadataPlotSettings { static List<String> retrieveUsableFieldNames(MetadataElement element) { int numRecords = getNumRecords(element); if (numRecords > 1) { return retrieveUsableFieldNames(element.getElements()[0]); } else { List<String> list = new ArrayList<>(); String[] attributeNames = element.getAttributeNames(); for (String fullAttribName : attributeNames) { String fieldName = getFieldName(fullAttribName); if (list.contains(fieldName)) { continue; } MetadataAttribute attribute = element.getAttribute(fullAttribName); if (isNumericType(attribute)) { list.add(fieldName); } } return list; } } MetadataPlotSettings(); }
MetadataPlotSettings { static List<String> retrieveUsableFieldNames(MetadataElement element) { int numRecords = getNumRecords(element); if (numRecords > 1) { return retrieveUsableFieldNames(element.getElements()[0]); } else { List<String> list = new ArrayList<>(); String[] attributeNames = element.getAttributeNames(); for (String fullAttribName : attributeNames) { String fieldName = getFieldName(fullAttribName); if (list.contains(fieldName)) { continue; } MetadataAttribute attribute = element.getAttribute(fullAttribName); if (isNumericType(attribute)) { list.add(fieldName); } } return list; } } MetadataPlotSettings(); String getNameY1(); String getFieldY2(); int getRecordsPerPlot(); }
MetadataPlotSettings { static List<String> retrieveUsableFieldNames(MetadataElement element) { int numRecords = getNumRecords(element); if (numRecords > 1) { return retrieveUsableFieldNames(element.getElements()[0]); } else { List<String> list = new ArrayList<>(); String[] attributeNames = element.getAttributeNames(); for (String fullAttribName : attributeNames) { String fieldName = getFieldName(fullAttribName); if (list.contains(fieldName)) { continue; } MetadataAttribute attribute = element.getAttribute(fullAttribName); if (isNumericType(attribute)) { list.add(fieldName); } } return list; } } MetadataPlotSettings(); String getNameY1(); String getFieldY2(); int getRecordsPerPlot();  }