public class StringHistogram
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) IntHistogram |
hist |
Constructor and Description |
---|
StringHistogram(int buckets)
Create a new StringHistogram with a specified number of buckets.
|
Modifier and Type | Method and Description |
---|---|
void |
addValue(java.lang.String s)
Add a new value to thte histogram
|
double |
avgSelectivity() |
double |
estimateSelectivity(Predicate.Op op,
java.lang.String s)
Estimate the selectivity (as a double between 0 and 1) of the specified predicate over the specified string
|
(package private) int |
maxVal() |
(package private) int |
minVal() |
private int |
stringToInt(java.lang.String s) |
IntHistogram hist
public StringHistogram(int buckets)
Our implementation is written in terms of an IntHistogram by converting each String to an integer.
buckets
- the number of bucketsprivate int stringToInt(java.lang.String s)
int maxVal()
int minVal()
public void addValue(java.lang.String s)
public double estimateSelectivity(Predicate.Op op, java.lang.String s)
op
- The operation being applieds
- The string to apply op topublic double avgSelectivity()