do tag to string conversion in StringCompressor instead of Tag

This commit is contained in:
2021-05-09 10:44:24 +02:00
parent 6dc335600e
commit 75857b553e
7 changed files with 22 additions and 30 deletions

View File

@@ -51,4 +51,12 @@ public class StringCompressor {
return new Tag(f, v);
}
public String getKeyAsString(final Tag tag) {
return get(tag.getKey());
}
public String getValueAsString(final Tag tag) {
return get(tag.getValue());
}
}

View File

@@ -38,21 +38,13 @@ public class Tag implements Comparable<Tag> {
return field;
}
public String getKeyAsString() {
return Tags.STRING_COMPRESSOR.get(field);
}
public int getValue() {
return value;
}
public String getValueAsString() {
return Tags.STRING_COMPRESSOR.get(value);
}
@Override
public String toString() {
return Tags.STRING_COMPRESSOR.get(field) + "=" + Tags.STRING_COMPRESSOR.get(value);
return field + "=" + value;
}
@Override

View File

@@ -207,15 +207,6 @@ public class Tags implements Comparable<Tags> {
return String.valueOf(tags);
}
public String toCsv() {
final List<String> tagsAsStrings = new ArrayList<>();
for (final Tag tag : tags) {
tagsAsStrings.add(tag.getKeyAsString() + "=" + tag.getValueAsString());
}
return String.join(",", tagsAsStrings);
}
@Override
public int hashCode() {
if (hashCode == 0) {