|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.zekr.common.resource.QuranLocation
public class QuranLocation
This data structure is the primitive structure of addressing somewhere in the Quran. Addressing is possible
by just having aya number and sura number.
Note that this class does not provide any range checking or explicit exception handling for performance
purposes.
Both sura and aya numbers are counted from 1.
Constructor Summary | |
---|---|
QuranLocation(int sura,
int aya)
No range check is performed. |
|
QuranLocation(java.lang.String location)
Loads a QuranLocation with the format sura#-aya#. |
Method Summary | |
---|---|
int |
compareTo(java.lang.Object location)
|
boolean |
equals(java.lang.Object obj)
|
int |
getAbsoluteAya()
Counts the aya number from the start of the Quran. |
int |
getAya()
|
IQuranLocation |
getNext()
Returns the next location (sura-aya pair). |
IQuranLocation |
getPrev()
Returns the previous location (sura-aya pair). |
int |
getSura()
|
java.lang.String |
getSuraName()
|
java.lang.String |
getSuraName(boolean localize)
|
boolean |
isValid()
|
static boolean |
isValidLocation(int suraNum,
int ayaNum)
Checks if the location (sura, aya) actually exists. |
static boolean |
isValidLocation(java.lang.String loc)
Checks if the given QuranLocation's compliant string is valid (is of the form of sura#-aya# and the location actually exists). |
void |
setAya(int aya)
|
void |
setSura(int sura)
|
java.lang.String |
toDetailedString()
Makes a string representation of this class as: sura(sura#) - aya# |
java.lang.String |
toSortableString()
Pads the sura/aya number so that all strings are of the same width and sortable. |
java.lang.String |
toString()
Makes a string representation of this class as: sura#-aya# |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public QuranLocation(int sura, int aya)
sura
- counted from 1aya
- counted from 1public QuranLocation(java.lang.String location)
location
is not of format sura#-aya#, an IllegalArgumentException
is thrown.
location
- Quran location to be parsed
java.lang.IllegalArgumentException
- if location
is not well-formed, ie. sura#-aya#Method Detail |
---|
public static boolean isValidLocation(java.lang.String loc)
loc
- the location string to be verified
true
if this is a valid Quran location, false
otherwise.public static boolean isValidLocation(int suraNum, int ayaNum)
true
if this is a valid Quran location, false
otherwise.public boolean isValid()
isValid
in interface IQuranLocation
public final int getAya()
getAya
in interface IQuranLocation
public final void setAya(int aya)
public final int getSura()
getSura
in interface IQuranLocation
public final void setSura(int sura)
public java.lang.String getSuraName()
getSuraName
in interface IQuranLocation
public java.lang.String getSuraName(boolean localize)
getSuraName
in interface IQuranLocation
localize
- specifies whether or not to localize sura name
localize
parameter is true).public IQuranLocation getNext()
IQuranLocation
getNext
in interface IQuranLocation
null
if there is nothingpublic IQuranLocation getPrev()
IQuranLocation
getPrev
in interface IQuranLocation
null
if there is nothingpublic java.lang.String toString()
IQuranLocation
toString
in interface IQuranLocation
toString
in class java.lang.Object
public java.lang.String toDetailedString()
public java.lang.String toSortableString()
IQuranLocation
toSortableString
in interface IQuranLocation
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int compareTo(java.lang.Object location)
compareTo
in interface java.lang.Comparable
public int getAbsoluteAya()
IQuranLocation
getAbsoluteAya
in interface IQuranLocation
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |