com.blogspot.applications4android.comicreader.core
Class ComicClassList

java.lang.Object
  extended by com.blogspot.applications4android.comicreader.core.ComicClassList

public class ComicClassList
extends java.lang.Object

Class which manages the list of comics


Field Summary
static java.lang.String CLASSES
          json file containing the list of supported classes
static java.lang.String SELECTED
          json file containing the list of selected classes
static int SORT_ALPHABETICAL
          sorting in ASCII order
static int SORT_EDITORIAL_LAST
          sorting with editorial comics at the last
static int SORT_IGNORE_ARTICLES
          sorting in ASCII order but ignoring the articles
static int SORT_MOST_UNREAD_FIRST
          sorting in most unread strips order
static int SORT_NEWEST_FIRST
          sorting in newly added first order
static int SORT_SELECTED_FIRST
          sorting in selected first order
 
Constructor Summary
ComicClassList(AssetManager mgr)
          Constructor
ComicClassList(AssetManager mgr, java.lang.String path)
          Constructor
ComicClassList(AssetManager mgr, java.lang.String path, java.io.File selected)
          Constructor
 
Method Summary
 ComicClass getComicClassFromIndex(int idx)
          get the comic class object from the index
 Comic getComicFromIndex(int idx)
          Get the comic object from the index
 Comic getComicFromTitle(java.lang.String title)
          Get the comic object from the title
 int getComicIndexFromTitle(java.lang.String title)
          Return the index of the comic in the list from its title
 Comic getNextComic(java.lang.String title)
          Get the comic next to the one wrt the input title
 Comic getNextMyComic(java.lang.String title)
          Get the comic next to the one wrt the input title
 java.lang.String getPackage()
          Gets the package to which all the classes belong to
 Comic getPreviousComic(java.lang.String title)
          Get the comic previous to the one wrt the input title
 Comic getPreviousMyComic(java.lang.String title)
          Get the comic previous to the one wrt the input title
 int[] getSelectedComicList()
          Returns the list of selected comic indices
 boolean isSelected(int idx)
          Tells whether the comic in the current index is selected or not
 int length()
          Gets the number of comics in the list
 int numSelected()
          Number of comics selected so far
 java.io.File selectedFile()
          File which stores the list of selected comics
 void setAllSelected(boolean value)
          Set all the comics to be selected
 void setSelected(java.lang.String title, boolean value)
          Set the comic to be selected
 void sortClasses(int type)
          Sort the classes according to the pre-defined types
 void storeSelected()
          Store the selected comics into the json file
 void toggleSelected(int idx)
          Toggle the select bit for the given comic
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASSES

public static final java.lang.String CLASSES
json file containing the list of supported classes

See Also:
Constant Field Values

SELECTED

public static final java.lang.String SELECTED
json file containing the list of selected classes

See Also:
Constant Field Values

SORT_ALPHABETICAL

public static final int SORT_ALPHABETICAL
sorting in ASCII order

See Also:
Constant Field Values

SORT_IGNORE_ARTICLES

public static final int SORT_IGNORE_ARTICLES
sorting in ASCII order but ignoring the articles

See Also:
Constant Field Values

SORT_EDITORIAL_LAST

public static final int SORT_EDITORIAL_LAST
sorting with editorial comics at the last

See Also:
Constant Field Values

SORT_NEWEST_FIRST

public static final int SORT_NEWEST_FIRST
sorting in newly added first order

See Also:
Constant Field Values

SORT_SELECTED_FIRST

public static final int SORT_SELECTED_FIRST
sorting in selected first order

See Also:
Constant Field Values

SORT_MOST_UNREAD_FIRST

public static final int SORT_MOST_UNREAD_FIRST
sorting in most unread strips order

See Also:
Constant Field Values
Constructor Detail

ComicClassList

public ComicClassList(AssetManager mgr)
               throws java.io.IOException,
                      JSONException,
                      ComicNotFoundException
Constructor

Parameters:
mgr - the asset manager
Throws:
JSONException
java.io.IOException
ComicNotFoundException

ComicClassList

public ComicClassList(AssetManager mgr,
                      java.lang.String path)
               throws java.io.IOException,
                      JSONException,
                      ComicNotFoundException
Constructor

Parameters:
mgr - asset manager
path - path to json file wrt assets
Throws:
JSONException
java.io.IOException
ComicNotFoundException

ComicClassList

public ComicClassList(AssetManager mgr,
                      java.lang.String path,
                      java.io.File selected)
               throws java.io.IOException,
                      JSONException,
                      ComicNotFoundException
Constructor

Parameters:
mgr - asset manager
path - path to json file wrt assets
selected - file containing the list of selected comics
Throws:
JSONException
java.io.IOException
ComicNotFoundException
Method Detail

getPackage

public java.lang.String getPackage()
Gets the package to which all the classes belong to

Returns:
package name

length

public int length()
Gets the number of comics in the list

Returns:
number of comics

sortClasses

public void sortClasses(int type)
                 throws ComicSortException
Sort the classes according to the pre-defined types

Parameters:
type - sorting type
Throws:
ComicSortException

getComicClassFromIndex

public ComicClass getComicClassFromIndex(int idx)
                                  throws ComicNotFoundException
get the comic class object from the index

Parameters:
idx - index
Returns:
comic class object
Throws:
ComicNotFoundException

getComicFromIndex

public Comic getComicFromIndex(int idx)
                        throws ComicNotFoundException
Get the comic object from the index

Parameters:
idx - comic index
Returns:
comic object
Throws:
ComicNotFoundException

getComicFromTitle

public Comic getComicFromTitle(java.lang.String title)
                        throws ComicNotFoundException
Get the comic object from the title

Parameters:
title - comic english name
Returns:
comic object
Throws:
ComicNotFoundException

getNextComic

public Comic getNextComic(java.lang.String title)
                   throws ComicNotFoundException
Get the comic next to the one wrt the input title

Parameters:
title - comic english name
Returns:
comic object
Throws:
ComicNotFoundException

getNextMyComic

public Comic getNextMyComic(java.lang.String title)
                     throws ComicNotFoundException
Get the comic next to the one wrt the input title

Parameters:
title - comic english name
Returns:
comic object
Throws:
ComicNotFoundException

getPreviousComic

public Comic getPreviousComic(java.lang.String title)
                       throws ComicNotFoundException
Get the comic previous to the one wrt the input title

Parameters:
title - comic english name
Returns:
comic object
Throws:
ComicNotFoundException

getPreviousMyComic

public Comic getPreviousMyComic(java.lang.String title)
                         throws ComicNotFoundException
Get the comic previous to the one wrt the input title

Parameters:
title - comic english name
Returns:
comic object
Throws:
ComicNotFoundException

getComicIndexFromTitle

public int getComicIndexFromTitle(java.lang.String title)
Return the index of the comic in the list from its title

Parameters:
title - comic english name
Returns:
index if found, else -1

getSelectedComicList

public int[] getSelectedComicList()
Returns the list of selected comic indices

Returns:
list

setSelected

public void setSelected(java.lang.String title,
                        boolean value)
                 throws ComicNotFoundException
Set the comic to be selected

Parameters:
title - comic english name
value - true if it is to be selected
Throws:
ComicNotFoundException

isSelected

public boolean isSelected(int idx)
                   throws ComicNotFoundException
Tells whether the comic in the current index is selected or not

Parameters:
idx - index
Returns:
true if it is selected
Throws:
ComicNotFoundException

toggleSelected

public void toggleSelected(int idx)
                    throws ComicNotFoundException
Toggle the select bit for the given comic

Parameters:
idx - comic index
Throws:
ComicNotFoundException

setAllSelected

public void setAllSelected(boolean value)
Set all the comics to be selected

Parameters:
value - true if it is to be selected

numSelected

public int numSelected()
Number of comics selected so far

Returns:
number

storeSelected

public void storeSelected()
                   throws java.io.IOException,
                          ComicSDCardFull
Store the selected comics into the json file

Throws:
java.io.IOException
ComicSDCardFull

selectedFile

public java.io.File selectedFile()
File which stores the list of selected comics

Returns:
file