Class ListModel<T>
java.lang.Object
com.blackrook.gui.model.indexed.ListModel<T>
- Type Parameters:
T- the object type to use.
- All Implemented Interfaces:
IndexedModel<T>
A model that uses a list backing.
- Author:
- Matthew Tropiano
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetIndexByValue(T value) Returns a specific index number of a value in this model.getValueByIndex(int index) Returns the value at a specific index number in this model.booleanisEmpty()intsize()
-
Constructor Details
-
ListModel
Creates a new list model using a set of objects.- Parameters:
objects- the objects to put in the list.
-
ListModel
-
-
Method Details
-
getValueByIndex
Description copied from interface:IndexedModelReturns the value at a specific index number in this model. If this index number is invalid, this returns null.- Specified by:
getValueByIndexin interfaceIndexedModel<T>- Parameters:
index- the desired index.- Returns:
- the corresponding value, or null if not found.
-
getIndexByValue
Description copied from interface:IndexedModelReturns a specific index number of a value in this model. If the value is not in this model, this returns -1.- Specified by:
getIndexByValuein interfaceIndexedModel<T>- Parameters:
value- the desired value.- Returns:
- the corresponding index, or -1 if not found.
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceIndexedModel<T>- Returns:
- true if this contains no values, false otherwise.
-
size
public int size()- Specified by:
sizein interfaceIndexedModel<T>- Returns:
- the amount of values in this model.
-