# IntSetStat (vilya 1.3 API)
Date: 2011-04-06

## com.threerings.stats.data
Class IntSetStat

    java.lang.Object
      com.threerings.stats.data.Stat
          com.threerings.stats.data.SetStat<Integer>
              com.threerings.stats.data.IntSetStat

All Implemented Interfaces:
  com.threerings.io.Streamable, com.threerings.presents.dobj.DSet.Entry, Cloneable

    public class IntSetStat

extends SetStat<Integer>

Used to track a statistic comprised of a bounded set of integers.

Nested Class Summary

Nested classes/interfaces inherited from class com.threerings.stats.data.Stat
`Stat.AuxDataSource, Stat.Type`

Nested classes/interfaces inherited from interface com.threerings.io.Streamable
`com.threerings.io.Streamable.Closure`

Constructor Summary
`IntSetStat()` Constructs a new IntSetStat that will store up to 255 ints.
`IntSetStat(int maxSize)` Constructs a new IntSetStat that will store up to maxSize ints.

Method Summary
`boolean` `add(Integer key)` Adds the specified int to this set.
`boolean` `contains(Integer key)` Returns true if the specified int is contained in this set.
`void` `persistTo(com.threerings.io.ObjectOutputStream out, Stat.AuxDataSource aux)` Serializes this instance for storage in the item database.
`int` `size()` Returns the number of values stored in the set.
`void` `unpersistFrom(com.threerings.io.ObjectInputStream in, Stat.AuxDataSource aux)` Unserializes this item from data obtained from the item database.
`String` `valueToString()` Derived statistics must override this method and render their value to a string.

Methods inherited from class com.threerings.stats.data.Stat
`clone, getCode, getKey, getModCount, getType, getType, initType, isModified, setModCount, setModified, toString`

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

Constructor Detail

### IntSetStat

    public IntSetStat()

  Constructs a new IntSetStat that will store up to 255 ints.

### IntSetStat

    public IntSetStat(int maxSize)

  Constructs a new IntSetStat that will store up to maxSize ints.

  Parameters:
    `maxSize` - the maximum number of ints to store in the IntSetStat. Must be <= 255.

Method Detail

### size

    public int size()

  Returns the number of values stored in the set.

  Specified by:
    `size` in class `SetStat<Integer>`

### contains

    public boolean contains(Integer key)

  Returns true if the specified int is contained in this set.

  Specified by:
    `contains` in class `SetStat<Integer>`

### add

    public boolean add(Integer key)

  Adds the specified int to this set.

  Specified by:
    `add` in class `SetStat<Integer>`
  Returns:
    true if the int was newly added, false if it was already contained in the set, or if the set is full.

### persistTo

    public void persistTo(com.threerings.io.ObjectOutputStream out,
                          Stat.AuxDataSource aux)
                   throws IOException

  Description copied from class: `Stat`
  Serializes this instance for storage in the item database. Derived classes must override this method to implement persistence.

  Specified by:
    `persistTo` in class `Stat`
  Throws:
    `IOException`

### unpersistFrom

    public void unpersistFrom(com.threerings.io.ObjectInputStream in,
                              Stat.AuxDataSource aux)
                       throws IOException,
                              ClassNotFoundException

  Description copied from class: `Stat`
  Unserializes this item from data obtained from the item database. Derived classes must override this method to implement persistence.

  Specified by:
    `unpersistFrom` in class `Stat`
  Throws:
    `IOException`
    `ClassNotFoundException`

### valueToString

    public String valueToString()

  Description copied from class: `Stat`
  Derived statistics must override this method and render their value to a string. Used by `Stat.toString()` and to display the value in game.

  Specified by:
    `valueToString` in class `Stat`

Copyright © 2011. All Rights Reserved.