do string compression in StringCompressor instead of Tag
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user