public class

AttributeHistogram

extends Object
implements Extension
java.lang.Object
   ↳ com.google.api.gbase.client.AttributeHistogram

Class Overview

Histogram information for one attribute, described in an entry using attributes in the gm: namespace. Make sure the current feed is an histogram feed and then get the AttributeHistogram for the entry using: getGoogleBaseMetadata().getAttributeHistogram().

Summary

Nested Classes
class AttributeHistogram.UniqueValue A value, as a string, and the number of times the value appears in the result set for the current query. 
Fields
private GoogleBaseAttributeId attributeId
private int totalValueCount
private final List<AttributeHistogram.UniqueValue> values
Public Constructors
AttributeHistogram()
Creates an unitialized AttributeHistogram.
AttributeHistogram(String attributeName, GoogleBaseAttributeType attributeType)
Creates and initializes an AttributeHistogram.
AttributeHistogram(GoogleBaseAttributeId attributeId)
Creates and initializes an AttributeHistogram.
Public Methods
void addValue(int count, 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.
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, String namespace, String localName, 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.
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.
List<? extends AttributeHistogram.UniqueValue> getValues()
Gets a list of unique values for the attribute and the count for these values.
void setAttributeId(String name, GoogleBaseAttributeType type)
Sets attribute name and type.
void setAttributeId(GoogleBaseAttributeId attributeId)
Sets attribute name and type.
void setTotalValueCount(int count)
Sets the total value count.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.google.gdata.data.Extension

Fields

private GoogleBaseAttributeId attributeId

private int totalValueCount

private final List<AttributeHistogram.UniqueValue> values

Public Constructors

public AttributeHistogram ()

Creates an unitialized AttributeHistogram.

public AttributeHistogram (String attributeName, GoogleBaseAttributeType attributeType)

Creates and initializes an AttributeHistogram.

Parameters
attributeName Attribute name
attributeType Attribute type

public AttributeHistogram (GoogleBaseAttributeId attributeId)

Creates and initializes an AttributeHistogram.

Parameters
attributeId Attribute Id

Public Methods

public void addValue (int count, String stringRepresentation)

Adds a new value into the histogram.

Parameters
count Number of time the value was found
stringRepresentation
Throws
IllegalArgumentException unless count is greater than 0
NullPointerException if stringRepresentation is null

public void generate (XmlWriter w, ExtensionProfile extProfile)

Generates the XML representation for this tag.

Parameters
w XML writer
extProfile Extension profile
Throws
IOException thrown if there was an error writing to the XmlWriter

public GoogleBaseAttributeId getAttributeId ()

Gets the name and type of the attribute this histogram describes.

Returns
  • attribute id

public String getAttributeName ()

Gets the name of the attribute this histogram describes.

Returns
  • attribute name

public GoogleBaseAttributeType getAttributeType ()

Gets the type of the attribute this histogram describes.

Returns
  • attribute type

public XmlParser.ElementHandler getHandler (ExtensionProfile extProfile, String namespace, String localName, Attributes attrs)

Creates a handler for this gdata extension tag.

Parameters
extProfile
namespace
localName
attrs
Returns
  • an element handler
Throws
ParseException
IOException

public int getTotalValueCount ()

Gets the total number of values found for this attribute in the result set for the query. This is not the total number of unique values, just the number of times this attribute was set.

Returns
  • total number of values found for this attribute, always >= sum(getValues().getCount())

public 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.

Parameters
minimumCount Minimum number of times the value should have been encountered in the result set to matter
Returns
  • a list of values and the number of time they were found in the result set, never null

public List<? extends AttributeHistogram.UniqueValue> getValues ()

Gets a list of unique values for the attribute and the count for these values. Not all unique values might be available. For some types, no values are ever available.

Returns
  • a list of values and the number of time they were found in the result set, never null

public void setAttributeId (String name, GoogleBaseAttributeType type)

Sets attribute name and type.

Parameters
name
type

public void setAttributeId (GoogleBaseAttributeId attributeId)

Sets attribute name and type.

Parameters
attributeId

public void setTotalValueCount (int count)

Sets the total value count.

Parameters
count