ObjectType
- the type of the objectspublic interface ConditionsObjectCollection<ObjectType extends ConditionsObject> extends Iterable<ObjectType>, DatabaseObject
Modifier and Type | Method and Description |
---|---|
boolean |
add(ObjectType object)
Add an object to the collection.
|
void |
addAll(ConditionsObjectCollection<ObjectType> collection)
Add all objects to the collection.
|
void |
clear()
Clear the objects from this collection and reset its ID.
|
boolean |
contains(Object object)
Return
true if collection contains this object. |
ObjectType |
get(int index)
Get an object by index.
|
int |
getCollectionId()
Get the collection ID.
|
void |
loadCsv(File file)
Load collection from a CSV file.
|
void |
setCollectionId(int collectionId)
Set the collection ID.
|
int |
size()
Get the size of the collection.
|
void |
sort(Comparator<ObjectType> comparator)
Sort the collection in place.
|
ConditionsObjectCollection<ObjectType> |
sorted(Comparator<ObjectType> comparator)
Get a sorted copy of the collection, leaving the original in place.
|
void |
writeCsv(File file)
Write the collection contents to a text file.
|
forEach, iterator, spliterator
delete, getTableMetaData, insert, isNew, select, setConnection, setTableMetaData, update
boolean add(ObjectType object) throws ConditionsObjectException
object
- the object to add to the collectiontrue
if object was added successfullyConditionsObjectException
- if there was an error adding the objectvoid addAll(ConditionsObjectCollection<ObjectType> collection)
collection
- the source collection with objects to addvoid clear()
This has no effect on the underlying database values.
boolean contains(Object object)
true
if collection contains this object.object
- the object to checktrue
if the collection contains the objectObjectType get(int index)
index
- the index of the objectint getCollectionId()
void loadCsv(File file) throws IOException, FileNotFoundException, ConditionsObjectException
file
- the input CSV fileIOException
- if there is an error closing the readerFileNotFoundException
- if the input file does not existConditionsObjectException
- if there is an error creating a conditions objectvoid setCollectionId(int collectionId)
collectionId
- the new collection IDint size()
void sort(Comparator<ObjectType> comparator)
comparator
- the comparison operator to use for sortingConditionsObjectCollection<ObjectType> sorted(Comparator<ObjectType> comparator)
comparator
- the comparison operator to usevoid writeCsv(File file) throws IOException
file
- the output text fileIOException
Copyright © 2019. All rights reserved.