org.apache.pivot.wtk.content
Class NumericSpinnerData

java.lang.Object
  extended by org.apache.pivot.wtk.content.NumericSpinnerData
All Implemented Interfaces:
Iterable<Integer>, org.apache.pivot.collections.Collection<Integer>, org.apache.pivot.collections.List<Integer>, org.apache.pivot.collections.Sequence<Integer>

public class NumericSpinnerData
extends Object
implements org.apache.pivot.collections.List<Integer>

Spinner data model that presents a bounded list of integers. This is a lightweight class that spoofs the actual list data (no data is stored in the list).

The iterator returned by this class's iterator method is fail-fast: if the bounds of the enclosing spinner data change during iteration, a ConcurrentModificationException will be thrown.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.pivot.collections.List
org.apache.pivot.collections.List.ItemIterator<T>, org.apache.pivot.collections.List.ListListenerList<T>
 
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Sequence
org.apache.pivot.collections.Sequence.Tree<T>
 
Constructor Summary
NumericSpinnerData()
          Creates a new NumericSpinnerData instance bounded from Short.MIN_VALUE to Short.MAX_VALUE and an increment of one.
NumericSpinnerData(int lowerBound, int upperBound)
          Creates a new NumericSpinnerData with the specified bounded range and an increment of one.
NumericSpinnerData(int lowerBound, int upperBound, int increment)
          Creates a new NumericSpinnerData with the specified bounded range and increment.
 
Method Summary
 int add(Integer item)
           
 void clear()
           
 Integer get(int index)
           
 Comparator<Integer> getComparator()
           
 int getIncrement()
           
 int getLength()
           
 org.apache.pivot.util.ListenerList<org.apache.pivot.collections.ListListener<Integer>> getListListeners()
           
 int getLowerBound()
           
 int getUpperBound()
           
 int indexOf(Integer item)
           
 void insert(Integer item, int index)
           
 boolean isEmpty()
           
 Iterator<Integer> iterator()
           
 int remove(Integer item)
           
 org.apache.pivot.collections.Sequence<Integer> remove(int index, int count)
           
 void setComparator(Comparator<Integer> comparator)
           
 void setIncrement(int increment)
           
 void setLowerBound(int lowerBound)
           
 void setUpperBound(int upperBound)
           
 Integer update(int index, Integer item)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumericSpinnerData

public NumericSpinnerData()
Creates a new NumericSpinnerData instance bounded from Short.MIN_VALUE to Short.MAX_VALUE and an increment of one.


NumericSpinnerData

public NumericSpinnerData(int lowerBound,
                          int upperBound)
Creates a new NumericSpinnerData with the specified bounded range and an increment of one.


NumericSpinnerData

public NumericSpinnerData(int lowerBound,
                          int upperBound,
                          int increment)
Creates a new NumericSpinnerData with the specified bounded range and increment.

Method Detail

getLowerBound

public int getLowerBound()

setLowerBound

public void setLowerBound(int lowerBound)

getUpperBound

public int getUpperBound()

setUpperBound

public void setUpperBound(int upperBound)

getIncrement

public int getIncrement()

setIncrement

public void setIncrement(int increment)

add

public int add(Integer item)
Specified by:
add in interface org.apache.pivot.collections.List<Integer>
Specified by:
add in interface org.apache.pivot.collections.Sequence<Integer>

insert

public void insert(Integer item,
                   int index)
Specified by:
insert in interface org.apache.pivot.collections.List<Integer>
Specified by:
insert in interface org.apache.pivot.collections.Sequence<Integer>

update

public Integer update(int index,
                      Integer item)
Specified by:
update in interface org.apache.pivot.collections.List<Integer>
Specified by:
update in interface org.apache.pivot.collections.Sequence<Integer>

remove

public int remove(Integer item)
Specified by:
remove in interface org.apache.pivot.collections.Sequence<Integer>

remove

public org.apache.pivot.collections.Sequence<Integer> remove(int index,
                                                             int count)
Specified by:
remove in interface org.apache.pivot.collections.List<Integer>
Specified by:
remove in interface org.apache.pivot.collections.Sequence<Integer>

get

public Integer get(int index)
Specified by:
get in interface org.apache.pivot.collections.Sequence<Integer>

indexOf

public int indexOf(Integer item)
Specified by:
indexOf in interface org.apache.pivot.collections.Sequence<Integer>

clear

public void clear()
Specified by:
clear in interface org.apache.pivot.collections.Collection<Integer>
Specified by:
clear in interface org.apache.pivot.collections.List<Integer>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface org.apache.pivot.collections.Collection<Integer>

getLength

public int getLength()
Specified by:
getLength in interface org.apache.pivot.collections.List<Integer>
Specified by:
getLength in interface org.apache.pivot.collections.Sequence<Integer>

getComparator

public Comparator<Integer> getComparator()
Specified by:
getComparator in interface org.apache.pivot.collections.Collection<Integer>

setComparator

public void setComparator(Comparator<Integer> comparator)
Specified by:
setComparator in interface org.apache.pivot.collections.Collection<Integer>
Specified by:
setComparator in interface org.apache.pivot.collections.List<Integer>

iterator

public Iterator<Integer> iterator()
Specified by:
iterator in interface Iterable<Integer>

getListListeners

public org.apache.pivot.util.ListenerList<org.apache.pivot.collections.ListListener<Integer>> getListListeners()
Specified by:
getListListeners in interface org.apache.pivot.collections.List<Integer>