# Google Data APIs Client Library (1.43.0)

## com.google.api.gbase.client
Class AttributeHistogram

    java.lang.Object
      com.google.api.gbase.client.AttributeHistogram

All Implemented Interfaces:
  Extension

    public class AttributeHistogram

extends java.lang.Object
implements Extension

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: `GoogleBaseEntry.getGoogleBaseMetadata()`.getAttributeHistogram().

Nested Class Summary
`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 Summary
`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.

Method Summary
`void` `addValue(int count, java.lang.String stringRepresentation)` Adds a new value into the histogram.
`void` `generate(com.google.gdata.util.common.xml.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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AttributeHistogram

    public AttributeHistogram()

  Creates an unitialized AttributeHistogram.

### AttributeHistogram

    public AttributeHistogram(java.lang.String attributeName,
                              GoogleBaseAttributeType attributeType)

  Creates and initializes an AttributeHistogram.

  Parameters:
    `attributeName` - attribute name
    `attributeType` - attribute type

### AttributeHistogram

    public AttributeHistogram(GoogleBaseAttributeId attributeId)

  Creates and initializes an AttributeHistogram.

  Parameters:
    `attributeId` - attribute Id

Method Detail

### getAttributeName

    public java.lang.String getAttributeName()

  Gets the name of the attribute this histogram describes.

  Returns:
    attribute name

### getAttributeType

    public GoogleBaseAttributeType getAttributeType()

  Gets the type of the attribute this histogram describes.

  Returns:
    attribute type

### getAttributeId

    public GoogleBaseAttributeId getAttributeId()

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

  Returns:
    attribute id

### getTotalValueCount

    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())`

### getValues

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

### getValues

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

  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

### addValue

    public void addValue(int count,
                         java.lang.String stringRepresentation)

  Adds a new value into the histogram.

  Parameters:
    `count` - number of time the value was found
    `stringRepresentation` -
  Throws:
    `java.lang.IllegalArgumentException` - unless count is greater than 0
    `java.lang.NullPointerException` - if stringRepresentation is null

### setTotalValueCount

    public void setTotalValueCount(int count)

  Sets the total value count.

### setAttributeId

    public void setAttributeId(java.lang.String name,
                               GoogleBaseAttributeType type)

  Sets attribute name and type.

### setAttributeId

    public void setAttributeId(GoogleBaseAttributeId attributeId)

  Sets attribute name and type.

### generate

    public void generate(com.google.gdata.util.common.xml.XmlWriter w,
                         ExtensionProfile extProfile)
                  throws java.io.IOException

  Generates the XML representation for this tag.

  Specified by:
    `generate` in interface `Extension`
  Parameters:
    `w` - XML writer
    `extProfile` - extension profile
  Throws:
    `java.io.IOException` - thrown if there was an error writing to the XmlWriter

### getHandler

    public XmlParser.ElementHandler getHandler(ExtensionProfile extProfile,
                                               java.lang.String namespace,
                                               java.lang.String localName,
                                               org.xml.sax.Attributes attrs)
                                        throws ParseException,
                                               java.io.IOException

  Creates a handler for this gdata extension tag.

  Specified by:
    `getHandler` in interface `Extension`
  Parameters:
    `extProfile` - extension profile
    `namespace` - extension namespace
    `localName` - tag name, without the namespace prefix
    `attrs` - tag attributes
  Returns:
    an element handler
  Throws:
    `ParseException` - when an unexpected tag or badly-formatted XML is detected
    `java.io.IOException`