net.sf.zekr.common.resource
Class QuranText

java.lang.Object
  extended by net.sf.zekr.common.resource.AbstractQuranText
      extended by net.sf.zekr.common.resource.QuranText
All Implemented Interfaces:
IQuranText

public class QuranText
extends AbstractQuranText

This class is a repository for the whole quran text. All public methods act as 1-relative arrays. This class acts as a pool for two types of Quran text file: "simple" and "uthmani".

Author:
Mohsen Saboorian

Field Summary
 
Fields inherited from interface net.sf.zekr.common.resource.IQuranText
SIMPLE_MODE, UTHMANI_MODE
 
Constructor Summary
protected QuranText(int textType)
          The private constructor, which loads the whole Quran text from file into memory (quranText).
 
Method Summary
 java.lang.String get(int absoluteAyaNum)
          Returns the requested absolute aya.
 java.lang.String get(int suraNum, int ayaNum)
          Returns the requested aya.
 java.lang.String getBismillah(int suraNum)
          Return Bismillah (the beginning part of suras).
 java.lang.String[][] getFullText()
           
static QuranText getInstance()
           
static QuranText getInstance(int mode)
           
 int getMode()
          Return Quran text mode.
This method should only be implemented in subclasses which are aimed for Quran text.
static QuranText getSimpleTextInstance()
           
 java.lang.String[] getSura(int suraNum)
          Returns the requested sura as an array of strings.
Note: no range check is performed.
 TranslationData getTranslationData()
          This method should only be implemented in subclasses which are aimed for Quran translation.
static QuranText getUthmaniTextInstance()
           
 java.lang.String toString()
           
 
Methods inherited from class net.sf.zekr.common.resource.AbstractQuranText
get
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QuranText

protected QuranText(int textType)
             throws java.io.IOException
The private constructor, which loads the whole Quran text from file into memory (quranText).

Parameters:
textType - can be either UTHMANI_MODE or SIMPLE_MODE
Throws:
java.io.IOException
Method Detail

getInstance

public static QuranText getInstance()
                             throws java.io.IOException
Returns:
either simple or Uthmani Quran text based on the current theme
Throws:
java.io.IOException

getInstance

public static QuranText getInstance(int mode)
                             throws java.io.IOException
Parameters:
mode -
Returns:
either simple or uthmani Quran text based on the current theme
Throws:
java.io.IOException

getSimpleTextInstance

public static QuranText getSimpleTextInstance()
                                       throws java.io.IOException
Returns:
simple Quran text instance
Throws:
java.io.IOException

getUthmaniTextInstance

public static QuranText getUthmaniTextInstance()
                                        throws java.io.IOException
Returns:
Uthmani Quran text instance
Throws:
java.io.IOException

getMode

public int getMode()
Description copied from interface: IQuranText
Return Quran text mode.
This method should only be implemented in subclasses which are aimed for Quran text.

Returns:
UTHMANI_MODE or SIMPLE_MODE

get

public java.lang.String get(int suraNum,
                            int ayaNum)
Description copied from interface: IQuranText
Returns the requested aya.

Parameters:
suraNum - the sura number counted from 1
ayaNum - the aya number counted from 1
Returns:
returns ayaNumth aya of the suraNumth sura of the Quran.

get

public java.lang.String get(int absoluteAyaNum)
Description copied from interface: IQuranText
Returns the requested absolute aya.

Parameters:
absoluteAyaNum - absolute sura number counted from 1
Returns:
returns the requested aya

getSura

public java.lang.String[] getSura(int suraNum)
Description copied from interface: IQuranText
Returns the requested sura as an array of strings.
Note: no range check is performed.

Parameters:
suraNum - indicates the sura number (which is counted from 1)
Returns:
a String array of the sura (#suraNum) ayas.

getFullText

public java.lang.String[][] getFullText()
Returns:
Full text of the Quran/translation text as a 2D array.

getTranslationData

public TranslationData getTranslationData()
Description copied from interface: IQuranText
This method should only be implemented in subclasses which are aimed for Quran translation.

Returns:
translation data

getBismillah

public java.lang.String getBismillah(int suraNum)
Description copied from interface: IQuranText
Return Bismillah (the beginning part of suras).

Parameters:
suraNum - sura number (1-based)
Returns:
Bismillah part

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object