abstract class AbstractStatsValues<T> extends java.lang.Object implements StatsValues
StatsValues
that provides the default behavior
for most StatsValues implementations.
There are very few requirements placed on what statistics concrete implementations should collect, with the only required
statistics being the minimum and maximum values.Modifier and Type | Field and Description |
---|---|
protected long |
count |
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,StatsValues>> |
facets |
private static java.lang.String |
FACETS |
protected FieldType |
fieldType |
protected T |
max |
protected T |
min |
protected long |
missing |
Modifier | Constructor and Description |
---|---|
protected |
AbstractStatsValues(FieldType fieldType) |
Modifier and Type | Method and Description |
---|---|
void |
accumulate(NamedList stv)
Accumulate the values based on those in the given NamedList
|
void |
accumulate(java.lang.String value)
Accumulate the values based on the given value
|
void |
accumulate(java.lang.String value,
int count)
Accumulate the values based on the given value
|
void |
addFacet(java.lang.String facetName,
java.util.Map<java.lang.String,StatsValues> facetValues)
Adds the facet statistics for the facet with the given name
|
void |
addMissing(int count)
Updates the statistics when multiple documents are missing a value
|
protected abstract void |
addTypeSpecificStats(NamedList<java.lang.Object> res)
Add any type specific statistics to the given NamedList
|
NamedList<?> |
getStatsValues()
Translates the values into a NamedList representation
|
void |
missing()
Updates the statistics when a document is missing a value
|
protected abstract T |
toTypedValue(java.lang.String value)
Converts the String value to a value associated with the specific StatsValues implementation
|
protected abstract void |
updateMinMax(T min,
T max)
Updates the minimum and maximum statistics based on the given values
|
protected abstract void |
updateTypeSpecificStats(NamedList stv)
Updates the type specific statistics based on the values in the given list
|
protected abstract void |
updateTypeSpecificStats(T value)
Updates the type specific statistics based on the given value
|
protected abstract void |
updateTypeSpecificStats(T value,
int count)
Updates the type specific statistics based on the given value
|
private static final java.lang.String FACETS
protected FieldType fieldType
protected T max
protected T min
protected long missing
protected long count
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,StatsValues>> facets
protected AbstractStatsValues(FieldType fieldType)
public void accumulate(NamedList stv)
accumulate
in interface StatsValues
stv
- NamedList whose values will be used to accumulate the current valuespublic void accumulate(java.lang.String value)
accumulate
in interface StatsValues
value
- Value to use to accumulate the current valuespublic void accumulate(java.lang.String value, int count)
accumulate
in interface StatsValues
value
- Value to use to accumulate the current valuescount
- number of times to accumulate this valuepublic void missing()
missing
in interface StatsValues
public void addMissing(int count)
addMissing
in interface StatsValues
count
- number of times to count a missing valuepublic void addFacet(java.lang.String facetName, java.util.Map<java.lang.String,StatsValues> facetValues)
addFacet
in interface StatsValues
facetName
- Name of the facetfacetValues
- Facet statistics on a per facet value basispublic NamedList<?> getStatsValues()
getStatsValues
in interface StatsValues
protected abstract void updateMinMax(T min, T max)
min
- Value that the current minimum should be updated againstmax
- Value that the current maximum should be updated againstprotected abstract void updateTypeSpecificStats(T value)
value
- Value the statistics should be updated againstprotected abstract void updateTypeSpecificStats(T value, int count)
value
- Value the statistics should be updated againstcount
- Number of times the value is being accumulatedprotected abstract void updateTypeSpecificStats(NamedList stv)
stv
- List containing values the current statistics should be updated againstprotected abstract T toTypedValue(java.lang.String value)
value
- String value to convertprotected abstract void addTypeSpecificStats(NamedList<java.lang.Object> res)
res
- NamedList to add the type specific statistics too