Tuesday, March 17, 2015

java code for the class Salat (islamic prayer) in general

The works of Dr. kais dukes, Dr. Said ghazzawi, and Dr. abdeldaeem kaheel inspired me to propose my own contribution to the scientific islamic community, here are some humble ideas:
 
Analyzing, modelling, designing and developing Islamic knowledge  Using Unified Modelling Language, Model Driven Engineering, and Object Oriented Programming


 As far as we are concerned in this paper, we propose to classify Islamic Knowledge into three categories:
1.       Holy Quran,
2.       Hadith,
3.       Saying of renowned Muslims.
In this paper, we will focus, only on the prophet Muhammad (pbuh) sayings (hadiths), as they provide us with important source of information, regarding our methodology.
In the following section, we present a new methodology for modeling hadiths, using what is called UML activity diagram.

A.  Activity Modelling for an activity hadith

In our methodology, we present several basic rules:
1.                     We decompose an activity (such as Salat), to many different sub-activities (such as rakâa). For example :
2.                     We decompose a sub-activity (such as rakâa), to many different actions (such as takbir, reading, rokôo, soujoud, joulouss, etc...). For example :
3.                     We decompose an action, or activity, or sub-activity into three components :
a.       Condition (IF)
b.       Result of the condition (Then),
c.        Alternative Result (Else).
First, we consider that a hadith that explains actions and activities of the prophet Muhammad (pbuh). The following hadith is the perfect illustration of the principle:
أنَّ فَهْدًا حَدَّثَنَا ، قَالَ : حَدَّثَنَا أَبُو غَسَّانَ ، قَالَ : حَدَّثَنَا زُهَيْرٌ ، قَالَ : حَدَّثَنَا أَبُو إِسْحَاقَ ، قَالَ : أَتَيْتُ الأَسْوَدَ بْنَ يَزِيدَ ، وَكَانَ لِي أَخًا وَصَدِيقًا ، فَقُلْتُ يَا أَبَا عَمْرٍو ، حَدِّثْنِي مَا حَدَّثَتْكَ عَائِشَةُ رَضِيَ اللَّهُ عَنْهَا أُمُّ الْمُؤْمِنِينَ ، عَنْ صَلاةِ رَسُولِ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ ، فَقَالَ : قَالَتْ : " كَانَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يَنَامُ أَوَّلَ اللَّيْلِ وَيُحْيِي آخِرَهُ ، ثُمَّ إِنْ كَانَتْ لَهُ حَاجَةٌ قَضَى حَاجَتَهُ ، ثُمَّ يَنَامُ قَبْلَ أَنْ يَمَسَّ مَاءً ، فَإِذَا كَانَ عِنْدَ النِّدَاءِ الأَوَّلِ ، وَثَبَ وَمَا قَالَتْ قَامَ فَأَفَاضَ عَلَيْهِ الْمَاءَ ، وَمَا قَالَتْ : اغْتَسَلَ وَأَنَا أَعْلَمُ مَا تُرِيدُ وَإِنْ كَانَ جُنُبًا تَوَضَّأَ وُضُوءَ الرَّجُلِ لِلصَّلاةِ "
From:
شرح معاني الآثار للطحاوي » بَابُ الْجُنُبِ يُرِيدُ النَّوْمَ أَوِ الأَكْلَ
First, we have to separate the activity statements from the rest of the Islamic text:
كَانَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يَنَامُ أَوَّلَ اللَّيْلِ وَيُحْيِي آخِرَهُ ، ثُمَّ إِنْ كَانَتْ لَهُ حَاجَةٌ قَضَى حَاجَتَهُ ، ثُمَّ يَنَامُ قَبْلَ أَنْ يَمَسَّ مَاءً ، فَإِذَا كَانَ عِنْدَ النِّدَاءِ الأَوَّلِ ، وَثَبَ وَمَا قَالَتْ قَامَ فَأَفَاضَ عَلَيْهِ الْمَاءَ ، وَمَا قَالَتْ : اغْتَسَلَ وَأَنَا أَعْلَمُ مَا تُرِيدُ وَإِنْ كَانَ جُنُبًا تَوَضَّأَ وُضُوءَ الرَّجُلِ لِلصَّلاةِ "
The highlighted text represents a judgment of the narrator, and could help understand the structure of the activities.
وَمَا قَالَتْ قَامَ فَأَفَاضَ عَلَيْهِ الْمَاءَ، وَمَا قَالَتْ: اغْتَسَلَ وَأَنَا أَعْلَمُ مَا تُرِيدُ
In this step, we try to differentiate between activity, sub-activities, and actions. For ease of comprehension, we give the letter (A) for activities, the acronym (Sub) for sub-activities, and the letter (a) for actions.
يَنَامُ أَوَّلَ اللَّيْلِ
Action
وَيُحْيِي آخِرَهُ
Activity
ثُمَّ إِنْ كَانَتْ لَهُ حَاجَةٌ
If condition
قَضَى حَاجَتَهُ
Then action
ثُمَّ يَنَام
Action
قَبْلَ أَنْ يَمَسَّ مَاءً
Condition (and action)
فَإِذَا كَانَ عِنْدَ النِّدَاءِ الأَوَّلِ
If condition
وَثَبَ
Then action
وَإِنْ كَانَ جُنُبًا
If condition
تَوَضَّأَ وُضُوءَ الرَّجُلِ لِلصَّلاةِ
Then Activity
For computer scientist, this structure is very likely an algorithm, which could be encoded in computer understandable language, please refer to discussions at the end of the paper.

B.  UML Activity Modelling for an activity hadith

Since the previous hadith focused on actions and activities, we choose to call it “activity hadith”. In consequence it should be modelled by a tool providing such possibilities; we present hereafter an example of hadith’s modelling using UML activity diagram.


In the same logic, i tried to code java class for islamic prayer, please read the complete code :)

package islamPillars.salat;
import islamAlgorithm.MuslimAlgorithm;
import Diplay.Generic;
import islamPillars.salat.Sounna.*;
import islamPillars.salat.Fard.*;
import tahara.Tahara;

public class Salat {
   
    static Generic G;
    static MuslimAlgorithm I;
   
    public static void FajrPrayer() {

        Generic.MessageToLoop("Adhan of al fajr ");
        //sleep management to wake UP
        Tahara.Ightissal();
        Tahara.Woudou2();
       
        AlFajr.AlFajr();

       
    }

    public static void SobhPrayer() {

        Generic.MessageToLoop("Jama3a ");
        AlSobh.AlSobh();
   

        Generic.MessageToLoop("Adhkar assabah ");
        Generic.MessageToLoop("Hidb Quran Reading ");

    }

    public static void DohaPrayer() {

        Generic.MessageToLoop("Time for Doha prayer ");   
        Tahara.Ightissal();
        Tahara.Woudou2();
        Generic.MessageToLoop("Salat al Doha ");

    }
   
    public static void DohrPrayer() {
   
        Generic.MessageToLoop("Adhan al Dohr ");
        Tahara.Ightissal();
        Tahara.Woudou2();
        Generic.MessageToLoop("Salat of Dohr ");

    }

    public static void AsrPrayer() {

    Generic.MessageToLoop("Adhan al Asr ");
    Tahara.Ightissal();
    Tahara.Woudou2();
    Generic.MessageToLoop("Salat al Asr ");
    Generic.MessageToLoop("Adhkar al massa2 ");
    }

    public static void MaghrebPrayer() {

    Generic.MessageToLoop("Adhan al Maghreb ");
    Tahara.Ightissal();
    Tahara.Woudou2();
    Generic.MessageToLoop("Salat al Maghreb ");
    Generic.MessageToLoop("Quran Hisb Reading ");
    }

    public static void IchaPrayer() {

    Generic.MessageToLoop("Adhan al Icha2 ");
    Tahara.Ightissal();
    Tahara.Woudou2();
    Generic.MessageToLoop("Salat al Icha2 ");
    }

}

No comments:

Post a Comment

Popular Posts