public class OptimizeStrings extends Object
Constructor and Description |
---|
OptimizeStrings(boolean doMeasurement) |
OptimizeStrings(boolean doMeasurement,
int splitSize) |
Modifier and Type | Method and Description |
---|---|
void |
add(String s)
null strings not added
0 length strings added
|
void |
add(String[] sa) |
int |
getCommonStringIndex(int index) |
String[] |
getCommonStrings()
The list of common strings
|
int |
getIndexOrSeqIndex(String s) |
int |
getOffset(int i) |
long |
getOffset(String s) |
long |
getSavedCharsExact()
The number of characters saved - for statistical reporting only
|
long |
getSavedCharsSubstr() |
String |
getString(String s)
return a string which is made as a substring of the common string
|
String[] |
getStringArray(String[] sai) |
int |
getStringIndex(String s) |
void |
optimize()
Fully checking indexof for every new string is prohibitively expensive We
do a partial check - only checking if a string is a substring of the
previous one
|
void |
updateStringArray(String[] sa) |
public OptimizeStrings(boolean doMeasurement)
public OptimizeStrings(boolean doMeasurement, int splitSize)
public long getSavedCharsExact()
public long getSavedCharsSubstr()
public String[] getCommonStrings()
public void add(String s)
s
- -public void add(String[] sa)
public int getStringIndex(String s)
public int getIndexOrSeqIndex(String s)
s
- must not be nullpublic String getString(String s)
s
- -public long getOffset(String s)
public int getOffset(int i)
public int getCommonStringIndex(int index)
index
- an index (not offset) to the sorted strings,public void updateStringArray(String[] sa)
public void optimize()
Copyright © 2006–2021 The Apache Software Foundation. All rights reserved.