Login | Register
My pages Projects Community openCollabNet

The Tigris site will receive a major upgrade the evening of Monday, December 1, beginning at 8:30 pm PST. Downtime is projected to be about ten hours. Further details in the announcement


jmt.application.elements
Interface ElementSetModel


public interface ElementSetModel

Describes a element set model warping a element set using a mutateable index array.

It can be filtered with a Filter instance and can be sorted by providing a comparator.

Author:
Martin Kersten

Method Summary
 void filter(ElementSetModelFilter filter)
          Removes all non-accepted Element instances from the current model.
 Element get(int index)
          Returns the element at the given index.
 int getIndex(int index)
          Returns the index in the set described by the models index.
 ElementSet getSet()
          Returns the set used by the element set model.
 void reset()
          Resets the index array.
 void reverse()
          Reverses the order of the elements by reversing the index array.
 int size()
          Returns the actual size of the SetModel.
 void sort(ElementSetModelComparator comparator)
          Sorts the set model using the comparator.
 void xchange(int index1, int index2)
          Xchange the elements.
 

Method Detail

filter

public void filter(ElementSetModelFilter filter)
Removes all non-accepted Element instances from the current model.

Parameters:
filter - The filter accepting the elements

get

public Element get(int index)
Returns the element at the given index.

Parameters:
index - The index of the element to return
Returns:
The element at the given index.

getIndex

public int getIndex(int index)
Returns the index in the set described by the models index.

Parameters:
index - The model index of the element
Returns:
The index of the elemnt in the set.

getSet

public ElementSet getSet()
Returns the set used by the element set model.

Returns:
The set used by this instance.

reset

public void reset()
Resets the index array.

This method is used to reset to a unfiltered non-sorted state.


reverse

public void reverse()
Reverses the order of the elements by reversing the index array.


xchange

public void xchange(int index1,
                    int index2)
Xchange the elements.

Parameters:
index1 - The index of the first element
index2 - The index of the second element

size

public int size()
Returns the actual size of the SetModel.

Returns:
The actual size of the model

sort

public void sort(ElementSetModelComparator comparator)
Sorts the set model using the comparator. Only Element instances will be compared.

Parameters:
comparator - The comparator to use for sorting.