add bar charts

This commit is contained in:
2020-01-19 10:35:07 +01:00
parent 1587046907
commit cf7e5ec968
35 changed files with 539 additions and 212 deletions

View File

@@ -33,4 +33,9 @@ public class GroupResult {
return result;
}
@Override
public String toString() {
return groupedBy.toString();
}
}

View File

@@ -27,4 +27,9 @@ public class Result {
public List<GroupResult> getGroups() {
return new ArrayList<>(groupResults);
}
@Override
public String toString() {
return groupResults.toString();
}
}

View File

@@ -14,11 +14,13 @@ import org.lucares.utils.byteencoder.VariableByteEncoder;
public class Tags implements Comparable<Tags> {
private static final String DEFAULT_GROUP = "<none>";
public static StringCompressor STRING_COMPRESSOR = null;
private static final byte[] EMPTY_BYTES = new byte[0];
public static final Tags EMPTY = new Tags();
private final List<Tag> tags;
private int hashCode = 0;
public Tags() {
tags = new ArrayList<>();
@@ -216,10 +218,12 @@ public class Tags implements Comparable<Tags> {
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((tags == null) ? 0 : tags.hashCode());
return result;
if (hashCode == 0) {
final int prime = 31;
final int result = 1;
hashCode = prime * result + ((tags == null) ? 0 : tags.hashCode());
}
return hashCode;
}
@Override
@@ -278,4 +282,19 @@ public class Tags implements Comparable<Tags> {
return result.toString();
}
public String asValueString() {
final StringBuilder result = new StringBuilder();
if (isEmpty()) {
result.append(DEFAULT_GROUP);
} else {
forEach((k, v) -> {
if (result.length() > 0) {
result.append(" / ");
}
result.append(v);
});
}
return result.toString();
}
}