do string compression in StringCompressor instead of Tag

This commit is contained in:
2021-05-09 10:37:35 +02:00
parent 36ccc57db6
commit 6dc335600e
9 changed files with 51 additions and 47 deletions

View File

@@ -39,4 +39,16 @@ public class StringCompressor {
return integer != null ? integer : -1;
}
/**
* Create a new {@link Tag} for the given field and value.
*
* @param field the field
* @param value the value
*/
public Tag createTag(final String field, final String value) {
final int f = field != null ? Tags.STRING_COMPRESSOR.getIfPresent(field) : -1;
final int v = value != null ? Tags.STRING_COMPRESSOR.getIfPresent(value) : -1;
return new Tag(f, v);
}
}

View File

@@ -22,17 +22,6 @@ public class Tag implements Comparable<Tag> {
this.value = value;
}
/**
* Create a new {@link Tag} for the given field and value.
*
* @param field the field
* @param value the value
*/
public Tag(final String field, final String value) {
this.field = field != null ? Tags.STRING_COMPRESSOR.getIfPresent(field) : -1;
this.value = value != null ? Tags.STRING_COMPRESSOR.getIfPresent(value) : -1;
}
@Override
public int compareTo(final Tag o) {

View File

@@ -7,7 +7,6 @@ import java.util.LinkedHashMap;
import java.util.Map;
import org.lucares.pdb.api.StringCompressor;
import org.lucares.pdb.api.Tag;
import org.lucares.pdb.api.Tags;
import org.lucares.pdb.api.TagsBuilder;
import org.lucares.pdb.api.UniqueStringIntegerPairs;
@@ -74,7 +73,7 @@ public class MemoryScale {
}
private static Object createTag() {
return new Tag("", "");
return Tags.STRING_COMPRESSOR.createTag("", "");
}
private static Object createTags0() {