File | Date | Author | Commit |
---|---|---|---|
nbproject | 2015-05-07 |
![]() |
[d8af6b] Initial commit following redesign |
src | 2015-05-11 |
![]() |
[d3eb87] Revised package-info with new links to LibriVox... |
LICENSE.md | 2015-05-08 |
![]() |
[f12979] Create LICENSE.md |
README.md | 2015-05-11 |
![]() |
[08eb4b] Update README.md |
build.xml | 2015-05-07 |
![]() |
[d8af6b] Initial commit following redesign |
A Java SE 8 class library for simple, automatic, in-memory NoSQL composite-indexing of a standard Collection of objects
See complete end-user Javadocs documentation here: http://bit.ly/indexedCollection
Gist usage example here: https://gist.github.com/dvimont/4f0e11c79efb775bc893
Complete JavaFX desktop application which makes extensive use of IndexedCollection is here: https://github.com/dvimont/LibriVoxExplorer
This package extends the standard Java collections framework to provide the IndexedCollection class, which offers simple, automatic, in-memory NoSQL composite-indexing of a standard Collection of objects -- For example, if an application has a class called Book which contains attribute classes Author, Genre, and Title, an IndexedCollection of Book objects may be (a) indexed automatically via programmer-specified CompositeIndexes such as Genre/Title, Author/Title, Genre/Author/Title, etc., and may then be (b) queried in a NoSQL manner using the IndexedCollection#getValues method.
Additionally, an IndexedCollection automatically provides natural-order unique indexing of each qualified attribute class that is an index component in any CompositeIndex (e.g., the Author class or the Genre class in the example cited above), allowing for direct querying for natural-ordered unique lists of those attributes (e.g., a natural-ordered* unique list of Authors or of Genres) using the IndexedCollection#getAttributeValues method.
*For more information on "natural ordering" please see the Comparable interface documentation.
**A qualified attribute class is an attribute class of the IndexedCollection's masterClass which is accessible via at least one of the masterClass's "get" methods -- either a get method that returns a single attribute object, or one that returns a standard Collection of attribute objects.
USAGE EXAMPLE (construct an IndexedCollection with three CompositeIndexes and submit queries to it):
//-- CONSTRUCT IndexedCollection --//
IndexedCollection<Book> indexedCollection
= new IndexedCollection<>
(Book.class, getMyRandomOrderBookList(),
new CompositeIndex<>
(Book.class, "Books by Title",
Book.Title.class),
new CompositeIndex<>
(Book.class, "Books by Author/Title",
Author.class, Book.Title.class),
new CompositeIndex<>
(Book.class, "Books by Genre/Author/Title",
Genre.class, Author.class, Book.Title.class) );
//-- QUERY IndexedCollection --//
System.out.println("Books in TITLE order\n------------");
for (Book book : indexedCollection.getValues(Book.class, Book.Title.class)) {
System.out.println(book); }
System.out.println("Books grouped by AUTHOR, in TITLE order\n------------");
for (Comparable author : indexedCollection.getAttributeValues(Author.class)) {
System.out.println("Books by " + author + "\n------");
for (Book book : indexedCollection.getValues
(Book.class, author, Book.Title.class)) {
System.out.println(book); } }
System.out.println("BOOKS grouped by GENRE, in AUTHOR order\n------------");
for (Comparable genre : indexedCollection.getAttributeValues(Genre.class)) {
System.out.println("Books in <" + genre + "> genre, ordered by author\n------");
for (Book book : indexedCollection.getValuesSuppressConsecutiveDuplicates
(Book.class, genre, Author.class)) {
System.out.println(book); } }
Go to the complete (compilable/runnable) Gist usage example here: https://gist.github.com/dvimont/4f0e11c79efb775bc893