rename get to getString
This commit is contained in:
@@ -289,7 +289,7 @@ public class QueryCompletionIndex implements AutoCloseable {
|
|||||||
@Override
|
@Override
|
||||||
public String decode(final byte[] bytes) {
|
public String decode(final byte[] bytes) {
|
||||||
final long compressedString = VariableByteEncoder.decodeFirstValue(bytes);
|
final long compressedString = VariableByteEncoder.decodeFirstValue(bytes);
|
||||||
return stringCompressor.get((int) compressedString);
|
return stringCompressor.getString((int) compressedString);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -47,13 +47,13 @@ class TagEncoderDecoder implements EncoderDecoder<Tag> {
|
|||||||
result = stringCompressor.createTag("", "");
|
result = stringCompressor.createTag("", "");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
final String k = stringCompressor.get((int) compressedStrings.get(0));
|
final String k = stringCompressor.getString((int) compressedStrings.get(0));
|
||||||
result = stringCompressor.createTag(k, "");
|
result = stringCompressor.createTag(k, "");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
final String key = stringCompressor.get((int) compressedStrings.get(0));
|
final String key = stringCompressor.getString((int) compressedStrings.get(0));
|
||||||
final String value = stringCompressor.get((int) compressedStrings.get(1));
|
final String value = stringCompressor.getString((int) compressedStrings.get(1));
|
||||||
result = stringCompressor.createTag(key, value);
|
result = stringCompressor.createTag(key, value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class StringCompressor {
|
|||||||
return usip.computeIfAbsent(processedValue);
|
return usip.computeIfAbsent(processedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String get(final int integer) {
|
public String getString(final int integer) {
|
||||||
|
|
||||||
return usip.getKey(integer);
|
return usip.getKey(integer);
|
||||||
}
|
}
|
||||||
@@ -70,11 +70,11 @@ public class StringCompressor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getKeyAsString(final Tag tag) {
|
public String getKeyAsString(final Tag tag) {
|
||||||
return get(tag.getKey());
|
return getString(tag.getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValueAsString(final Tag tag) {
|
public String getValueAsString(final Tag tag) {
|
||||||
return get(tag.getValue());
|
return getString(tag.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Tags createAndAddToDictionary(final String key, final String value) {
|
public Tags createAndAddToDictionary(final String key, final String value) {
|
||||||
@@ -138,7 +138,7 @@ public class StringCompressor {
|
|||||||
result.append(DEFAULT_GROUP);
|
result.append(DEFAULT_GROUP);
|
||||||
} else {
|
} else {
|
||||||
for (final Tag tag : tags.toTags()) {
|
for (final Tag tag : tags.toTags()) {
|
||||||
final String value = get(tag.getValue());
|
final String value = getString(tag.getValue());
|
||||||
if (result.length() > 0) {
|
if (result.length() > 0) {
|
||||||
result.append(" / ");
|
result.append(" / ");
|
||||||
}
|
}
|
||||||
@@ -157,9 +157,9 @@ public class StringCompressor {
|
|||||||
result.append(", ");
|
result.append(", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
result.append(get(tag.getKey()));
|
result.append(getString(tag.getKey()));
|
||||||
result.append("=");
|
result.append("=");
|
||||||
result.append(get(tag.getValue()));
|
result.append(getString(tag.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.toString();
|
return result.toString();
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ public class Tags implements Comparable<Tags> {
|
|||||||
final int index = Collections.binarySearch(tags, needle, TagByKeyComparator.INSTANCE);
|
final int index = Collections.binarySearch(tags, needle, TagByKeyComparator.INSTANCE);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
final Tag tag = tags.get(index);
|
final Tag tag = tags.get(index);
|
||||||
return STRING_COMPRESSOR.get(tag.getValue());
|
return STRING_COMPRESSOR.getString(tag.getValue());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ public class Tags implements Comparable<Tags> {
|
|||||||
public Set<String> getKeys() {
|
public Set<String> getKeys() {
|
||||||
final TreeSet<String> result = new TreeSet<>();
|
final TreeSet<String> result = new TreeSet<>();
|
||||||
for (final Tag tag : tags) {
|
for (final Tag tag : tags) {
|
||||||
result.add(STRING_COMPRESSOR.get(tag.getKey()));
|
result.add(STRING_COMPRESSOR.getString(tag.getKey()));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class StringCompressorTest {
|
|||||||
|
|
||||||
final String value = "foo";
|
final String value = "foo";
|
||||||
final Integer intFoo = keyValueCompressor.putString(value);
|
final Integer intFoo = keyValueCompressor.putString(value);
|
||||||
final String actual = keyValueCompressor.get(intFoo);
|
final String actual = keyValueCompressor.getString(intFoo);
|
||||||
|
|
||||||
Assertions.assertEquals(value, actual);
|
Assertions.assertEquals(value, actual);
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ public class StringCompressorTest {
|
|||||||
{
|
{
|
||||||
final StringCompressor keyValueCompressor = StringCompressor.create(database);
|
final StringCompressor keyValueCompressor = StringCompressor.create(database);
|
||||||
|
|
||||||
keyValueCompressor.get(0);
|
keyValueCompressor.getString(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user