Overview | Package | Class | Tree | Deprecated | Index | Help
| SNMP Stack 5_1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uk.co.westhawk.visual
Class GraphDataSet

    java.lang.Object
      |
      +--uk.co.westhawk.visual.GraphDataSet

public class GraphDataSet
extends java.lang.Object

The class GraphDataSet holds the int data, representing a line on a Graph.

Only a fixed number of elements will be saved, that is called the capacity. The oldest value is removed each time the capacity would overflow.

The capacity can not be change dynamically, only via the constructor.

Version:
  $Revision: 1.7 $ $Date: 2006/01/17 17:43:54 $
Author:
  Birgit Arkesteijn
See Also:
  `Graph`, `BareGraph`

Constructor Summary
`GraphDataSet()` The default constructor.
`GraphDataSet(int cap)` The constructor with the capacity.

Method Summary
`void` | `addElement(int v)` Adds a value to the data set.
`void` | `addPropertyChangeListener(java.beans.PropertyChangeListener l)` Add a property change listener.
`protected void` | `firePropertyChange(java.lang.String property, java.lang.Object old_v, java.lang.Object new_v)` Fire a property event.
`int` | `getCapacity()` Returns the capacity.
`int` | `getSize()` Returns the current number of elements.
`int[]` | `getValues()` Returns the values of this data set.
`void` | `removePropertyChangeListener(java.beans.PropertyChangeListener l)` Remove a property change listener.

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

Constructor Detail

### GraphDataSet

    public GraphDataSet()

  The default constructor. The capacity will be by default 100.

### GraphDataSet

    public GraphDataSet(int cap)

  The constructor with the capacity.

Parameters:
  `cap` - the capacity of this data set

Method Detail

### getCapacity

    public int getCapacity()

  Returns the capacity. The capacity is the number of elements that this data set can hold.

  Returns:
    the capacity

### getSize

    public int getSize()

  Returns the current number of elements. This is always less or equal to the capacity.

  Returns:
    the size

### addElement

    public void addElement(int v)

  Adds a value to the data set. If the capacity is reached, the oldest value will be removed.

  The oldest value will always the first element, the newest value always the last element. This methods fires a propertyChangeEvent.

  Parameters:
    `v` - the new element (int)

### getValues

    public int[] getValues()

  Returns the values of this data set. The length of this array will always be the capacity. To get the actual number, call getSize().

  Returns:
    all the elements
  See Also:
    `getSize()`, `getCapacity()`

### addPropertyChangeListener

    public void addPropertyChangeListener(java.beans.PropertyChangeListener l)

  Add a property change listener. This methods fires a propertyChangeEvent.

  See Also:
    `removePropertyChangeListener(java.beans.PropertyChangeListener)`

### removePropertyChangeListener

    public void removePropertyChangeListener(java.beans.PropertyChangeListener l)

  Remove a property change listener.

  See Also:
    `addPropertyChangeListener(java.beans.PropertyChangeListener)`

### firePropertyChange

    protected void firePropertyChange(java.lang.String property,
                                      java.lang.Object old_v,
                                      java.lang.Object new_v)

  Fire a property event. This is done each time a new element is added and when adding a listener.

  Parameters:
    `property` - this will be Values
    `old_v` - this is not used
    `new_v` - the new (added) value as Integer
  See Also:
    `removePropertyChangeListener(java.beans.PropertyChangeListener)`, `addPropertyChangeListener(java.beans.PropertyChangeListener)`, `PropertyChangeEvent`, `PropertyChangeListener`

Overview | Package | Class | Tree | Deprecated | Index | Help
| SNMP Stack 5_1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD