Commit 2eee9b94 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

function returns list instead of modifying parameter

parent c2e88a2f
......@@ -152,8 +152,8 @@ public class ColorSchemaReader {
String[] columns = line.split("\t");
Map<ColorSchemaColumn, Integer> schemaColumns = new HashMap<>();
List<Pair<MiriamType, Integer>> customIdentifiers = new ArrayList<>();
parseColumns(columns, schemaColumns, customIdentifiers, ColorSchemaType.GENETIC_VARIANT);
List<Pair<MiriamType, Integer>> customIdentifiers = parseColumns(columns, schemaColumns,
ColorSchemaType.GENETIC_VARIANT);
Integer colorColumn = schemaColumns.get(ColorSchemaColumn.COLOR);
Integer contigColumn = schemaColumns.get(ColorSchemaColumn.CONTIG);
if (contigColumn == null) {
......@@ -481,8 +481,7 @@ public class ColorSchemaReader {
String[] columns = line.split("\t");
Map<ColorSchemaColumn, Integer> schemaColumns = new HashMap<>();
List<Pair<MiriamType, Integer>> customIdentifiers = new ArrayList<>();
parseColumns(columns, schemaColumns, customIdentifiers, ColorSchemaType.GENERIC);
List<Pair<MiriamType, Integer>> customIdentifiers = parseColumns(columns, schemaColumns, ColorSchemaType.GENERIC);
Integer valueColumn = schemaColumns.get(ColorSchemaColumn.VALUE);
Integer colorColumn = schemaColumns.get(ColorSchemaColumn.COLOR);
......@@ -680,8 +679,9 @@ public class ColorSchemaReader {
* @throws InvalidColorSchemaException
* thrown when the list of column headers contain invalid value
*/
public void parseColumns(String[] columns, Map<ColorSchemaColumn, Integer> schemaColumns,
List<Pair<MiriamType, Integer>> customIdentifiers, ColorSchemaType type) throws InvalidColorSchemaException {
public List<Pair<MiriamType, Integer>> parseColumns(String[] columns, Map<ColorSchemaColumn, Integer> schemaColumns,
ColorSchemaType type) throws InvalidColorSchemaException {
List<Pair<MiriamType, Integer>> result = new ArrayList<>();
Map<String, MiriamType> acceptableIdentifiers = new HashMap<>();
Map<String, MiriamType> deprecatedIdentifiers = new HashMap<>();
for (MiriamType miriamType : MiriamType.values()) {
......@@ -701,9 +701,9 @@ public class ColorSchemaReader {
}
if (!found) {
if (acceptableIdentifiers.keySet().contains(columns[i].toLowerCase())) {
customIdentifiers.add(new Pair<>(acceptableIdentifiers.get(columns[i].toLowerCase()), i));
result.add(new Pair<>(acceptableIdentifiers.get(columns[i].toLowerCase()), i));
} else if (deprecatedIdentifiers.keySet().contains(columns[i].toLowerCase())) {
customIdentifiers.add(new Pair<>(deprecatedIdentifiers.get(columns[i].toLowerCase()), i));
result.add(new Pair<>(deprecatedIdentifiers.get(columns[i].toLowerCase()), i));
} else {
String columnNames = "";
for (ColorSchemaColumn schemaColumn : ColorSchemaColumn.values()) {
......@@ -719,6 +719,7 @@ public class ColorSchemaReader {
}
}
}
return result;
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment