net.sf.zekr.engine.translation
Class TranslationData

java.lang.Object
  extended by net.sf.zekr.common.resource.AbstractQuranText
      extended by net.sf.zekr.engine.translation.TranslationData
All Implemented Interfaces:
IQuranText, Signable

public class TranslationData
extends AbstractQuranText
implements Signable

Author:
Mohsen Saboorian

Field Summary
 java.io.File archiveFile
           
 java.lang.String delimiter
          Line delimiter String (each line contains an aya)
 java.lang.String direction
          Text direction: ltr or rtl
 java.lang.String encoding
          String encoding
 java.lang.String file
          Text file name
 java.lang.String id
          Translation Id.
 java.util.Locale locale
          Language (locale) Id (e.g.
 java.lang.String localizedName
          Translation localized name
 java.lang.String name
          Translation English name
 byte[] signature
          signature of the text file
 boolean verified
           
 java.lang.String version
          descriptor version
 
Fields inherited from interface net.sf.zekr.engine.common.Signable
AUTHENTIC, NOT_AUTHENTIC, UNKNOWN
 
Fields inherited from interface net.sf.zekr.common.resource.IQuranText
SIMPLE_MODE, UTHMANI_MODE
 
Constructor Summary
TranslationData()
           
 
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)
          This method always returns the first aya of sura 1 (Al-Fatiha).
 java.lang.String getDirection()
           
 java.lang.String[][] getFullText()
           
 java.lang.String getId()
           
 java.util.Locale getLocale()
           
 int getMode()
          Return Quran text mode.
This method should only be implemented in subclasses which are aimed for Quran text.
 byte[] getSignature()
           
 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.
 int getVerificationResult()
           
 void load()
          Loads the tranalation data file, if not already loaded.
 java.lang.String toString()
           
 java.lang.String toText()
           
 void unload()
          Unloads the content of translation in order to let Java free more memory.
 boolean verify()
          Verify the zip archive and close the zip file handle finally.
 
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
 

Field Detail

id

public java.lang.String id
Translation Id.


name

public java.lang.String name
Translation English name


localizedName

public java.lang.String localizedName
Translation localized name


locale

public java.util.Locale locale
Language (locale) Id (e.g. en_US)


direction

public java.lang.String direction
Text direction: ltr or rtl


encoding

public java.lang.String encoding
String encoding


delimiter

public java.lang.String delimiter
Line delimiter String (each line contains an aya)


archiveFile

public java.io.File archiveFile

file

public java.lang.String file
Text file name


signature

public byte[] signature
signature of the text file


verified

public boolean verified

version

public java.lang.String version
descriptor version

Constructor Detail

TranslationData

public TranslationData()
Method Detail

get

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

Specified by:
get in interface IQuranText
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.

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.

Specified by:
getSura in interface IQuranText
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()
Specified by:
getFullText in interface IQuranText
Returns:
Full text of the Quran/translation text as a 2D array.

toString

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

load

public void load()
          throws TranslationException
Loads the tranalation data file, if not already loaded.

Throws:
TranslationException

unload

public void unload()
Unloads the content of translation in order to let Java free more memory.


verify

public boolean verify()
               throws java.io.IOException
Verify the zip archive and close the zip file handle finally.

Returns:
true if translation verified, false otherwise.
Throws:
java.io.IOException

get

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

Specified by:
get in interface IQuranText
Parameters:
absoluteAyaNum - absolute sura number counted from 1
Returns:
returns the requested aya

getTranslationData

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

Specified by:
getTranslationData in interface IQuranText
Returns:
translation data

getBismillah

public java.lang.String getBismillah(int suraNum)
This method always returns the first aya of sura 1 (Al-Fatiha).

Specified by:
getBismillah in interface IQuranText
Parameters:
suraNum - sura number, counted from 1
Returns:
sura 1, aya 1

toText

public java.lang.String toText()

getDirection

public java.lang.String getDirection()

getLocale

public java.util.Locale getLocale()

getId

public java.lang.String getId()

getSignature

public byte[] getSignature()
Specified by:
getSignature in interface Signable
Returns:
signature

getVerificationResult

public int getVerificationResult()
Specified by:
getVerificationResult in interface Signable
Returns:
Signable.UNKNOWN if verification is not done yet, AUTHENTIC if verification is done and document is authentic and NOT_AUTHENTIC if document is not authentic.

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.

Specified by:
getMode in interface IQuranText
Returns:
Quran text mode: IQuranText.SIMPLE_MODE or IQuranText.UTHMANI_MODE.