Package qurtext.domain

Examples of qurtext.domain.Section


  public void initSectionVerses(int chapterNo, int verseNo) {
    translationParser= new TranslationParser("WEB-INF/quran.txt");
    PersistenceManager pm = PMF.get().getPersistenceManager();
    try {
      Section section = getSection(chapterNo, verseNo, pm);

      JSONObject verses = getYaqbVerse(section);
          Verse previousVerse=null;
          String previousTransliteration="";;
      for (int i=section.getStartVerse();i<=section.getEndVerse();i++) {
        JSONObject versions=verses.getJSONObject("" + section.getChapterNo() + ":" + i);
        String arabic = getTanzilText(section.getChapterNo(), i);
        String transliteration = versions.getString("Transliteration");
        transliteration=transliteration.replaceAll("[A][A]", "'");
        transliteration=transliteration.replaceAll("[<][b][>]", "<s>");
        transliteration=transliteration.replaceAll("[ ][<][/][b][>]", "</s>");
        transliteration=transliteration.replaceAll("[<][/][b][>]", "</s>");
        transliteration=transliteration.replaceAll("[<][s][t][r][o][n][g][>]", "<s>");
        transliteration=transliteration.replaceAll("[<][/][s][t][r][o][n][g][>]", "</s>");
        String token="" + section.getChapterNo() + ":" + i;
        String translation = versions.getString(TRANSLATOR);
        if ("Free_Minds".equals(TRANSLATOR)) {
          translation=translationParser.getTranslations().get(token).trim();
        }
        TreeSet<String> topicList = translationParser.getVerseTopics().get(token);
        String topics = flattenStringCollection(topicList);
        transliteration = repairShiftedTransliteration(arabic,
            transliteration);
        Verse verse=section.getVerse(chapterNo,i);
        if (null==verse) {
          verse=new Verse();
          section.addVerse(verse);
        }
        verse.setChapterNo(chapterNo);
        verse.setVerseNo(i);
        verse.setText(arabic);
        verse.setUthmani(getTanzilUthmani(section.getChapterNo(), i));
        verse.setTransliteration(transliteration);
        verse.setTranslation(translation);
        verse.setTopics(topics);
        pm.makePersistent(verse);
        if (previousTransliteration.equals(transliteration)) {//suspicious;
View Full Code Here


  }

  @SuppressWarnings("unchecked")
  private Section getSection(int chapterNo, int verseNo, PersistenceManager pm) {
    String query = "select from " + Section.class.getName() + " where chapterNo==" + chapterNo + " && startVerse==" + verseNo;
    Section section1 = ((Collection<Section>) pm.newQuery(query)
        .execute()).iterator().next();
    return section1;
  }
View Full Code Here

          initialChapterMap.put(i,chapter);
        }
        for (int i=0;i<sections.length;i++) {
          int[] sectionData=sections[i];
          Chapter chapter=initialChapterMap.get(sectionData[0]);
          Section section = chapter.getSection(sectionData[1]);
          if (null==section) {
            section=new Section();
            chapter.addSection(section);
          }
          section.setSectionNo(i);
          section.setChapterNo(chapter.getChapterNo());
          section.setStartVerse(sectionData[1]);
          section.setEndVerse(sectionData[2]);
          pm.makePersistent(section);
        }
      }
      Chapter chapter=initialChapterMap.get(start);
      if (null==chapter)
View Full Code Here

    if (result!=null) return result;
    String[] location=start.split("[:]");
    int chapterNo=Integer.valueOf(location[0]);
    int verseNo=Integer.valueOf(location[1]);
    if (chapterNo==114 && verseNo==6) return null;//truly end
    Section section=sectionFactory.getSection(chapterNo, verseNo+1);
    if (null==section) section=sectionFactory.getSection(chapterNo+1, 1);   
    return ""+section.getChapterNo()+":"+section.getStartVerse()+":0";
  }
View Full Code Here

TOP

Related Classes of qurtext.domain.Section

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.