public class AttributeHistogram extends java.lang.Object implements Extension
GoogleBaseEntry.getGoogleBaseMetadata()
.getAttributeHistogram().Modifier and Type | Class and Description |
---|---|
static class |
AttributeHistogram.UniqueValue
A value, as a string, and the number of times the value appears
in the result set for the current query.
|
Constructor and Description |
---|
AttributeHistogram()
Creates an unitialized AttributeHistogram.
|
AttributeHistogram(GoogleBaseAttributeId attributeId)
Creates and initializes an AttributeHistogram.
|
AttributeHistogram(java.lang.String attributeName,
GoogleBaseAttributeType attributeType)
Creates and initializes an AttributeHistogram.
|
Modifier and Type | Method and Description |
---|---|
void |
addValue(int count,
java.lang.String stringRepresentation)
Adds a new value into the histogram.
|
void |
generate(XmlWriter w,
ExtensionProfile extProfile)
Generates the XML representation for this tag.
|
GoogleBaseAttributeId |
getAttributeId()
Gets the name and type of the attribute this histogram describes.
|
java.lang.String |
getAttributeName()
Gets the name of the attribute this histogram describes.
|
GoogleBaseAttributeType |
getAttributeType()
Gets the type of the attribute this histogram describes.
|
XmlParser.ElementHandler |
getHandler(ExtensionProfile extProfile,
java.lang.String namespace,
java.lang.String localName,
org.xml.sax.Attributes attrs)
Creates a handler for this gdata extension tag.
|
int |
getTotalValueCount()
Gets the total number of values found for this attribute in
the result set for the query.
|
java.util.List<? extends AttributeHistogram.UniqueValue> |
getValues()
Gets a list of unique values for the attribute and
the count for these values.
|
java.util.List<? extends AttributeHistogram.UniqueValue> |
getValues(int minimumCount)
Gets a list of unique values for the attribute and the count
of these values, for values repeated at least a certain number
of times.
|
void |
setAttributeId(GoogleBaseAttributeId attributeId)
Sets attribute name and type.
|
void |
setAttributeId(java.lang.String name,
GoogleBaseAttributeType type)
Sets attribute name and type.
|
void |
setTotalValueCount(int count)
Sets the total value count.
|
public AttributeHistogram()
public AttributeHistogram(java.lang.String attributeName, GoogleBaseAttributeType attributeType)
attributeName
- attribute nameattributeType
- attribute typepublic AttributeHistogram(GoogleBaseAttributeId attributeId)
attributeId
- attribute Idpublic java.lang.String getAttributeName()
public GoogleBaseAttributeType getAttributeType()
public GoogleBaseAttributeId getAttributeId()
public int getTotalValueCount()
>= sum(getValues().getCount())
public java.util.List<? extends AttributeHistogram.UniqueValue> getValues()
public java.util.List<? extends AttributeHistogram.UniqueValue> getValues(int minimumCount)
minimumCount
- minimum number of times the value should
have been encountered in the result set to matterpublic void addValue(int count, java.lang.String stringRepresentation)
count
- number of time the value was foundstringRepresentation
- java.lang.IllegalArgumentException
- unless count is greater than 0java.lang.NullPointerException
- if stringRepresentation is nullpublic void setTotalValueCount(int count)
public void setAttributeId(java.lang.String name, GoogleBaseAttributeType type)
public void setAttributeId(GoogleBaseAttributeId attributeId)
public void generate(XmlWriter w, ExtensionProfile extProfile) throws java.io.IOException
public XmlParser.ElementHandler getHandler(ExtensionProfile extProfile, java.lang.String namespace, java.lang.String localName, org.xml.sax.Attributes attrs) throws ParseException, java.io.IOException
getHandler
in interface Extension
extProfile
- extension profilenamespace
- extension namespacelocalName
- tag name, without the namespace prefixattrs
- tag attributesParseException
- when an unexpected tag or badly-formatted
XML is detectedjava.io.IOException