|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.database.EntriesView
An EntriesView is a view into a FoundEntries object while a FoundEntries object is a view into a database. An EntriesView is effectively a set of indexes that identify a set of entries in the associated FoundEntries. An EntriesView is a better object to use when displaying or manipulating a set of DatabaseEntries because you can re-order an EntriesView any way you wish without affecting the sorted order of its source FoundEntries. Then, re-sorting the EntriesView becomes a simple task because it simply involves sorting the indexes within the view (which can be done very quickly since it does not need to access the database to do this).
| Field Summary | |
boolean |
allInclusive
|
| Constructor Summary | |
EntriesView(FoundEntries fe)
Create a new EntriesView for a FoundEntries, but which initially contains no data. |
|
| Method Summary | |
int |
add(DatabaseEntry de)
Add a new DatabaseEntry to the view (it is added to the end) and save it in the FoundEntries and database. |
int |
addData(Object data)
Add a new record to the view (it is added to the end) and save it in the FoundEntries and database. |
void |
addRange(int startIndex,
int endIndex)
Add a range of indexes to the EntriesView. |
void |
change()
Mark the FoundEntries as having been changed in some way. |
protected void |
changed(int oldIndex,
int newIndex)
|
void |
clear()
Clear the EntriesView. |
void |
closeLookup()
This is used with enableLookupMode() - it tells the database that data reading is complete and the underlying file may be closed. |
void |
delete(int indexInView)
Delete the record at the specified index from the database. |
protected void |
dispatchEvent(int type)
|
boolean |
enableLookupMode()
This method tells the database that it will be used for read-only lookups and that it can close its underlying file if it wishes - and later re-open it when lookups are done without re-reading the database info. |
void |
exclude(DatabaseEntry entry)
Exclude the entry from this view. |
void |
exclude(EntriesView other)
Exclude all the entries in the other view from this view. |
void |
exclude(int indexInFoundEntries)
Exclude the entry from this view. |
void |
excludeAt(int indexInView)
Exclude the entry form this view. |
EntriesView |
filter(Handle h,
Object searchData)
Filter all entries in the associated FoundEntries and add them to this EntriesView. |
EntriesView |
filter(Handle h,
Object searchData,
boolean hasWildCards)
Filter all entries in the associated FoundEntries and add them to this EntriesView. |
Handle |
filter(Object searchData)
Filter all entries in the associated FoundEntries and add them to this EntriesView, using a separate thread to do the filtering. |
Handle |
filter(Object searchData,
boolean hasWildCards)
Filter all entries in the associated FoundEntries and add them to this EntriesView, using a separate thread to do the filtering. |
DatabaseEntry |
get(int indexInView)
Get the DatabaseEntry at the specified index in the view. |
DatabaseEntry |
get(int indexInView,
DatabaseEntry de)
Get the DatabaseEntry at the specified index in the view. |
long |
getCurrentState()
Get the current changed state of the FoundEntries. |
Object |
getData(int indexInView)
Get the DatabaseEntry at the specified index in the view as a data object. |
Object |
getData(int indexInView,
Object dest)
Get the DatabaseEntry at the specified index in the view as a data object. |
EntriesView |
getEmptyView()
Use this if you used enableLookupMode() to get a new empty EntriesView for the same FoundEntries as this view. |
EventDispatcher |
getEventDispatcher()
Get the EventDispatcher for this view. |
FoundEntries |
getFoundEntries()
Get the FoundEntries for the view. |
void |
getFullFiew()
Refresh this EntriesView to view the entire source FoundEntries. |
int[] |
getIndexes()
Get the indexes of the entries in the FoundEntries in this view. |
IntArray |
getIndexes(IntArray destination)
Append all the indexes stored in this EntriesView into an IntArray. |
int[] |
getIndexesInFoundEntries()
Get all the indexes as an arry of ints. |
DatabaseEntry |
getNew()
Return a new DatabaseEntry for use with this database. |
boolean |
hasChangedSince(long previousState)
Return if the FoundEntries has changed since the previous state. |
int |
include(DatabaseEntry entry)
Include the specified entry in this view, but only if it is already included in its FoundEntries. |
void |
include(EntriesView other)
Include all the entries in the other view in this view. |
int |
include(int indexInFoundEntries)
Include the specified entry in this view. |
void |
includeAll(IntArray toAdd)
Add all the indexes - sorting this view before the add is done. |
int |
index(int indexInView)
This is the same as indexInFoundEntries(). |
int |
indexInFoundEntries(int indexInView)
This is the same as index(). |
int |
indexInView(DatabaseEntry de)
Find out the index of the specified entry in this view - if it exists in the view. |
int |
indexInView(int indexInFoundEntries)
Determine the index of the database entry in the View, based on its index in the FoundEntries. |
boolean |
isSorted(boolean descending)
Checks if the indexes in the EntriesView are sorted as per the sort criteria used by the source FoundEntries. |
void |
openLookup()
This is used with enableLookupMode() - it tells the database that data is about to be read in and if the underlying file is closed - then it should be re-opened and kept open until closeLookup() is called. |
void |
removeRange(int startIndex,
int endIndex)
Add a range of indexes from the EntriesView. |
Handle |
search(EntrySelector selector)
Search for entries in the associated FoundEntries and add them to this EntriesView, using a separate thread to do the searching. |
EntriesView |
search(Handle h,
EntrySelector selector)
Search for entries in the associated FoundEntries and add them to this EntriesView. |
EntriesView |
search(Handle h,
Object searchData)
Search for entries in the associated FoundEntries and add them to this EntriesView. |
EntriesView |
search(Handle h,
Object searchData,
boolean hasWildCards)
Search for entries in the associated FoundEntries and add them to this EntriesView. |
EntriesView |
search(Handle h,
ObjectFinder finder)
Search for entries in the associated FoundEntries and add them to this EntriesView. |
Handle |
search(Object searchData)
Search for entries in the associated FoundEntries and add them to this EntriesView, using a separate thread to do the searching. |
Handle |
search(Object searchData,
boolean hasWildCards)
Search for entries in the associated FoundEntries and add them to this EntriesView, using a separate thread to do the searching. |
Handle |
search(ObjectFinder finder)
Search for entries in the associated FoundEntries and add them to this EntriesView, using a separate thread to do the searching. |
void |
set(int indexInView,
DatabaseEntry de)
Change the database entry at the specified index. |
void |
setData(int indexInView,
Object data)
Change the database entry at the specified index. |
int |
size()
Return the number of indexes in the view. |
void |
sort(boolean descending)
Sort the indexes in the EntriesView. |
void |
store(int indexInView,
DatabaseEntry de)
Store the DatabaseEntry at the specified index without modifying any of its special synchronization fields. |
IntArray |
toRanges(IntArray dest)
Convert the indexes in this view to a sequence of ranges. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, toString |
| Field Detail |
public boolean allInclusive
| Constructor Detail |
public EntriesView(FoundEntries fe)
| Method Detail |
public boolean enableLookupMode()
throws IOException
Not all Databases may support this and if it does not, it will return false - although normal database operations will not be affected. In other words - if this method returns false, the application can continue as if it returned true - but its operations will not be optimized in this way.
IOException - if an IO error occurs.
public void openLookup()
throws IOException
IOException - if an IO error occurs.
public void closeLookup()
throws IOException
IOException - if an IO error occurs.public boolean isSorted(boolean descending)
public FoundEntries getFoundEntries()
public int[] getIndexes()
public IntArray getIndexes(IntArray destination)
destination - The destination IntArray. If it is null a new one is created and returned.
public void clear()
public void sort(boolean descending)
descending - true if you want it sorted in descending order.
public void addRange(int startIndex,
int endIndex)
startIndex - The first index into the FoundEntries.endIndex - The last index into the FoundEntries, which must be greater than or equal to startIndex.
public void removeRange(int startIndex,
int endIndex)
startIndex - The first index into the FoundEntries.endIndex - The last index into the FoundEntries, which must be greater than or equal to startIndex.public void includeAll(IntArray toAdd)
public EntriesView search(Handle h,
EntrySelector selector)
throws IOException,
IllegalArgumentException,
IllegalStateException
h - An optional handle that can be used to monitor and stop the search.selector - an object that is used to select which entries will be included in the results.
IOException
IllegalArgumentException
IllegalStateException
public EntriesView search(Handle h,
ObjectFinder finder)
throws IOException,
IllegalArgumentException,
IllegalStateException
h - An optional handle that can be used to monitor and stop the search.finder - an object that is used to select which entries will be included in the results.
IOException
IllegalArgumentException
IllegalStateException
public EntriesView search(Handle h,
Object searchData,
boolean hasWildCards)
throws IOException,
IllegalArgumentException,
IllegalStateException
h - An optional handle that can be used to monitor and stop the search.searchData - data used for the primary sort fields when searching.hasWildCards - set this true if the data contain wild card specifications (e.g. '*' characters for Strings).
IOException
IllegalArgumentException
IllegalStateException
public EntriesView search(Handle h,
Object searchData)
throws IOException,
IllegalArgumentException,
IllegalStateException
h - An optional handle that can be used to monitor and stop the search.searchData - data used for the primary sort fields when searching.
IOException
IllegalArgumentException
IllegalStateExceptionpublic Handle search(EntrySelector selector)
selector - an EntrySelector for selecting the entries.
public Handle search(ObjectFinder finder)
finder - an ObjectFinder for selecting the entries.
public Handle search(Object searchData,
boolean hasWildCards)
searchData - data used for the primary sort fields when searching.hasWildCards - set this true if the data contain wild card specifications (e.g. '*' characters for Strings).
public Handle search(Object searchData)
searchData - data used for the primary sort fields when searching.
public EntriesView filter(Handle h,
Object searchData)
throws IOException,
IllegalArgumentException,
IllegalStateException
h - An optional handle that can be used to monitor and stop the search.searchData - data used for the primary sort fields when searching.
IOException
IllegalArgumentException
IllegalStateException
public EntriesView filter(Handle h,
Object searchData,
boolean hasWildCards)
throws IOException,
IllegalArgumentException,
IllegalStateException
h - An optional handle that can be used to monitor and stop the search.searchData - data used for the primary sort fields when searching.hasWildCards - set this true if the data contain wild card specifications (e.g. '*' characters for Strings).
IOException
IllegalArgumentException
IllegalStateException
public Handle filter(Object searchData,
boolean hasWildCards)
throws IllegalArgumentException,
IllegalStateException
searchData - data used for the primary sort fields when searching.hasWildCards - set this true if the data contain wild card specifications (e.g. '*' characters for Strings).
IllegalArgumentException
IllegalStateException
public Handle filter(Object searchData)
throws IllegalArgumentException,
IllegalStateException
searchData - data used for the primary sort fields when searching.
IllegalArgumentException
IllegalStateExceptionpublic void getFullFiew()
public int size()
public DatabaseEntry get(int indexInView,
DatabaseEntry de)
throws IOException
indexInView - the index of the entry in this view.de - an optional destination DatabaseEntry.
IOException - if there was an error reading the entry.
public Object getData(int indexInView,
Object dest)
throws IOException
indexInView - the index of the entry in this view.dest - an optional destination object.
IOException - if there was an error reading the entry.
public DatabaseEntry get(int indexInView)
throws IOException
indexInView - the index of the entry in this view.
IOException - if there was an error reading the entry.
public Object getData(int indexInView)
throws IOException
indexInView - the index of the entry in this view.
IOException - if there was an error reading the entry.
public void set(int indexInView,
DatabaseEntry de)
throws IOException
indexInView - the index of the entry in this view.de - a database entry object containing the new data.
IOException - if there was an error writing the entry.
public void setData(int indexInView,
Object data)
throws IOException
indexInView - the index of the entry in this view.data - an object containing the new data.
IOException - if there was an error writing the entry.public DatabaseEntry getNew()
public void store(int indexInView,
DatabaseEntry de)
throws IOException
indexInView - the index of the entry in this view.de - a database entry object containing the new data.
IOException - if there was an error writing the entry.
public int add(DatabaseEntry de)
throws IOException
de - a DatabaseEntry object holding the data to be saved.
IOException
public int addData(Object data)
throws IOException
data - a data object holding the data to be saved.
IOException
public void delete(int indexInView)
throws IOException
indexInView - the index of the entry in the view.
IOExceptionpublic IntArray toRanges(IntArray dest)
protected void changed(int oldIndex,
int newIndex)
public int indexInView(DatabaseEntry de)
de - the entry to look for.
public int indexInView(int indexInFoundEntries)
indexInFoundEntries - The index of the record in the FoundEntries.
public int indexInFoundEntries(int indexInView)
public int index(int indexInView)
public int include(DatabaseEntry entry)
entry - the entry to include.
public int include(int indexInFoundEntries)
indexInFoundEntries - the index of the entry in the FoundEntries.
public void include(EntriesView other)
throws IllegalArgumentException
other - The other EntriesView
IllegalArgumentException - if the other EntriesView is not of the same FoundEntries.
public void exclude(EntriesView other)
throws IllegalArgumentException
other - The other EntriesView.
IllegalArgumentException - if the other EntriesView is not of the same FoundEntries.public void exclude(DatabaseEntry entry)
public void exclude(int indexInFoundEntries)
public void excludeAt(int indexInView)
indexInView - the index of the entry in this view.public int[] getIndexesInFoundEntries()
public EventDispatcher getEventDispatcher()
protected void dispatchEvent(int type)
public long getCurrentState()
public boolean hasChangedSince(long previousState)
public void change()
public EntriesView getEmptyView()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||