org.argouml.uml.util
Class SortedListModel
java.lang.Object
javax.swing.AbstractListModel
org.argouml.uml.util.SortedListModel
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Iterable, java.util.Collection, javax.swing.ListModel
public class SortedListModel
- extends javax.swing.AbstractListModel
- implements java.util.Collection
A ListModel which keeps the list in sorted order. Many, but not all, of the
methods from the java.util.List are implemented. Those which are obey its
contract.
This is a low performance implementation designed for use with small lists
(such as typically appear in the GUI). It does a linear search of the
set for any indexed operations (e.g. getElementAt(int)).
- See Also:
- Serialized Form
| Fields inherited from class javax.swing.AbstractListModel |
listenerList |
|
Method Summary |
boolean |
add(java.lang.Object obj)
|
boolean |
addAll(java.util.Collection c)
|
void |
clear()
|
boolean |
contains(java.lang.Object elem)
|
boolean |
containsAll(java.util.Collection c)
|
java.lang.Object |
get(int index)
Returns the component at the specified index. |
java.lang.Object |
getElementAt(int index)
Returns the component at the specified index. |
int |
getSize()
Returns the number of components in this list. |
int |
indexOf(java.lang.Object o)
|
boolean |
isEmpty()
|
java.util.Iterator |
iterator()
|
boolean |
remove(java.lang.Object obj)
|
boolean |
removeAll(java.util.Collection c)
|
boolean |
retainAll(java.util.Collection c)
|
int |
size()
|
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] a)
|
java.lang.String |
toString()
|
| Methods inherited from class javax.swing.AbstractListModel |
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
equals, hashCode |
SortedListModel
public SortedListModel()
getSize
public int getSize()
- Returns the number of components in this list.
This method is identical to size, which implements the
List interface defined in the 1.2 Collections framework.
This method exists in conjunction with setSize so that
size is identifiable as a JavaBean property.
- Specified by:
getSize in interface javax.swing.ListModel
- Returns:
- the number of components in this list
- See Also:
size()
getElementAt
public java.lang.Object getElementAt(int index)
- Returns the component at the specified index.
Note: Although this method is not deprecated, the preferred
method to use is get(int), which implements the
List interface defined in the 1.2 Collections framework.
- Specified by:
getElementAt in interface javax.swing.ListModel
- Parameters:
index - an index into this list
- Returns:
- the component at the specified index
- Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index
is negative or greater than the current size of this
list- See Also:
get(int)
get
public java.lang.Object get(int index)
- Returns the component at the specified index.
- Parameters:
index - an index into this list
- Returns:
- the component at the specified index
- Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index
is negative or greater than the current size of this
list
indexOf
public int indexOf(java.lang.Object o)
- Parameters:
o - object to search for
- Returns:
- index of object or -1 if not found
- See Also:
List.indexOf(Object)
size
public int size()
- Specified by:
size in interface java.util.Collection
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface java.util.Collection
contains
public boolean contains(java.lang.Object elem)
- Specified by:
contains in interface java.util.Collection
add
public boolean add(java.lang.Object obj)
- Specified by:
add in interface java.util.Collection
addAll
public boolean addAll(java.util.Collection c)
- Specified by:
addAll in interface java.util.Collection
remove
public boolean remove(java.lang.Object obj)
- Specified by:
remove in interface java.util.Collection
removeAll
public boolean removeAll(java.util.Collection c)
- Specified by:
removeAll in interface java.util.Collection
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
toArray
public java.lang.Object[] toArray()
- Specified by:
toArray in interface java.util.Collection
toArray
public java.lang.Object[] toArray(java.lang.Object[] a)
- Specified by:
toArray in interface java.util.Collection
clear
public void clear()
- Specified by:
clear in interface java.util.Collection
containsAll
public boolean containsAll(java.util.Collection c)
- Specified by:
containsAll in interface java.util.Collection
iterator
public java.util.Iterator iterator()
- Specified by:
iterator in interface java.lang.Iterable- Specified by:
iterator in interface java.util.Collection
retainAll
public boolean retainAll(java.util.Collection c)
- Specified by:
retainAll in interface java.util.Collection