Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
157 changes: 157 additions & 0 deletions Ponomar/Bible.java
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,25 @@ public String getAbbrev(String Id) {

return (String) abbrev.get(Id);
}
public String getAbbrevLoc(String Id) {
//Id = Id.replace(' ', '_'); //THIS CAN BE AVOIDED IF THE DEFINITIONS ARE CHANGED

//INITIALISE TO THE DEFAULT BIBLE FOR THE GIVEN LANGUAGE
//ADDED Y.S. TO ALLOW FOR MULTILINGUAL AND ALL BIBLE READING

LanguagePack getLang = new LanguagePack(Analyse.dayInfo);
//curversion = getLang.Phrases.get("BibleV").toString();
//System.out.println("Bible: " + curversion);
String abbLink=getLang.Phrases.get("BibleBooks").toString();
String[] splitkey = abbLink.split("/,");
OrderedHashtable abbrevs=new OrderedHashtable();
for (int k = 0; k < splitkey.length; k++)
{
String[] splitsy=splitkey[k].split("=");
abbrevs.put(splitsy[0].replace("_"," "),splitsy[1]);
}
return (String) abbrevs.get(Id);
}

private String formatPassage(String newPassage) {
//System.out.println("Hello there, passage: "+newPassage);
Expand Down Expand Up @@ -829,6 +848,85 @@ private String formatPassage(String newPassage) {
}
return newPassage;
}
private String formatPassageLoc(String newPassage) {
//System.out.println("Hello there, passage: "+newPassage);
//We first need to specify all the parameters for the readings
LanguagePack getLang = new LanguagePack(Analyse.dayInfo);
String ChapterNameILoc = getLang.Phrases.get("ChapterNI").toString();
String ChapterNL= getLang.Phrases.get("ChapterNo").toString();
String[] ChapterNumberLoc=ChapterNL.split(",");
String VerseNL= getLang.Phrases.get("VerseNo").toString();
String[] VerseNumberLoc=VerseNL.split(",");
String CVSepLoc= getLang.Phrases.get("CVSep").toString();
String DurationLoc=getLang.Phrases.get("Duration").toString();
String SelectionSeparatorLoc=getLang.Phrases.get("SelectionSeparator").toString();

if (newPassage.indexOf(":") == -1) {
// just a chapter specification, e.g. Gen_1
int d = (int) Integer.parseInt(newPassage);
String ChapterNameF = ChapterNameILoc.replace("^NN", ChapterNumberLoc[d]);
newPassage = ChapterNameF;
return newPassage;
} else {
// e.g. 2:11-3:2, 5, 13-14, 17-4:1
String[] parts = newPassage.split(",");

for (int j = 0; j < parts.length; j++) {

//e.g. 2:11-3:2 or 13-14 or 5 or 4:5
if (parts[j].indexOf("-") == -1) {
// the example of 5 or 4:5; replicate
if (parts[j].indexOf(":") == -1) {
//System.out.println("Testing the parsing function: Integer: "+Integer.toString(obtainNumber(parts[j]))+" Fraction: "+obtainPart(parts[j]));
parts[j] = VerseNumberLoc[obtainNumber(parts[j])]+obtainPartLoc(parts[j]);
} else {

//System.out.println("Testing the parsing function: Integer: "+Integer.toString(obtainNumber(parts[j]))+" Fraction: "+obtainPart(parts[j]));
int verse = (int) +obtainNumber(parts[j].split(":")[1]);
int chapter = (int) Integer.parseInt(parts[j].split(":")[0]);
parts[j] = ChapterNumberLoc[chapter] + CVSepLoc + VerseNumberLoc[verse]+obtainPartLoc(parts[j].split(":")[1]);
}
} else {
String[] sections = parts[j].split("-");


for (int k = 0; k < sections.length; k++) {

if (sections[k].indexOf(":") == -1) {

// E.g. 13 or 5
//System.out.println("Testing the parsing function: Integer: "+Integer.toString(obtainNumber(sections[k]))+" Fraction: "+obtainPart(sections[k]));
sections[k] = VerseNumberLoc[obtainNumber(sections[k])]+obtainPartLoc(sections[k]);

} else {
//System.out.println("Hello midpoint + " + sections[k] + " "+sections[k]);
//System.out.println(sections[k].split(":")[1]);
int verse = (int) +obtainNumber(sections[k].split(":")[1]);
//System.out.println(verse);
int chapter = (int) Integer.parseInt(sections[k].split(":")[0]);
//System.out.println(chapter);
sections[k] = ChapterNumberLoc[chapter] + CVSepLoc + VerseNumberLoc[verse]+obtainPartLoc(sections[k].split(":")[1]);
}
//System.out.println(sections[k] + "testing parts: "+parts[j]);
if (k == 0) {
parts[j] = sections[k];
} else {
parts[j] = parts[j] + DurationLoc + sections[k];
}

}
}
//RECONSTRUCT THE GIVEN READING PART
if (j == 0) {
newPassage = parts[j];
} else {
newPassage = newPassage + SelectionSeparatorLoc + parts[j];
}
}
//System.out.println("Hello end");
}
return newPassage;
}

public String getHyperlink(String reading) {
//THIS FUNCTION CREATES THE HYPERLINK FOR BIBLE READINGS
Expand Down Expand Up @@ -857,6 +955,38 @@ public String getHyperlink(String reading) {
output += headerA + "</A>";
return output;
}

public String getHyperlinkLoc(String reading) {
//THIS FUNCTION CREATES THE HYPERLINK FOR BIBLE READINGS
//CREATED Y.S. 2008/12/11 n.s.
if (reading.length()<1)
{
return "";
}

LanguagePack getLang = new LanguagePack(Analyse.dayInfo);
curversion = getLang.Phrases.get("BibleV").toString();
// System.out.println(getLang.Phrases);

try {
BufferedReader frf = new BufferedReader(new InputStreamReader(new FileInputStream(bmlfile), "UTF8"));
QDParser.parse(this, frf);
} catch (Exception e) {
System.out.println(captions[8] + e.toString());
}

String[] parts = reading.split("_");
//TODO: get rid of these string operations. They are bad, and take up too much CPU time
String passage = parts[1].replaceAll(" ", "");
String output = "<A Href=reading#" + parts[0].replace(' ', '_') + "#" + passage + ">";
String abbreviation=getLang.Phrases.get("AbbrevFormat").toString();
//System.out.println("Abbreviation sought: "+parts[0]);
String headerA = abbreviation.replace("^NAME", getAbbrevLoc(parts[0]));
headerA = headerA.replace("^CNN", formatPassageLoc(passage));

output += headerA + "</A>";
return output;
}

public String[] parseReadings(String newBook, String newPassage, boolean RedStuff) {
//RedStuff IS A BOOLEAN THAT DETERMINES WHETHER OR NOT ANY OF THE READ COMMENTS IN THE BIBLE READINGS ARE RETAINED!
Expand Down Expand Up @@ -1081,6 +1211,33 @@ private String obtainPart(String verse)
return verse.substring(size-1);
}
}

private String obtainPartLoc(String verse)
{
//Allows us to separate the part after the number from the number in the case that
//we are dealing with part of a verse, for example 29a or 30b, where the verse is 29 and the part is a.
LanguagePack getLang = new LanguagePack(Analyse.dayInfo);
String[] halfVerseLoc=getLang.Phrases.get("Parts").toString().split(",");

int size=verse.length();
//System.out.println("Testing obtainpart: "+verse.substring(size-1));
if (Character.isDigit(verse.charAt(size-1)))
{
return "";
}else
{
String part=verse.substring(size-1);
if (part.equals("a")){
return halfVerseLoc[0];
}else if (part.equals("b")){
return halfVerseLoc[1];
}else if (part.equals("c")){
return halfVerseLoc[2];
}

return verse.substring(size-1);
}
}

public static void main(String[] argz) {
//DEBUG MODE
Expand Down
1 change: 1 addition & 0 deletions Ponomar/Commemoration.java
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ public void endElement(String elem)
public void text(String text)
{
textR=text;
//System.out.println(textR);
}
public String getGrammar(String value)
{
Expand Down
1 change: 1 addition & 0 deletions Ponomar/Commemoration1.java
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ public void endElement(String elem) {
}*/
//System.out.println("In endElement, I saw the following elements: "+elem);
if (textR != null) {
textR = textR.replace("\n", "").replace("\r", "");
value.put("text", textR);
}
if (ServiceInfo.containsKey(Location1)) {
Expand Down
6 changes: 5 additions & 1 deletion Ponomar/Day.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ public String getCommsHyper() {
String NameF = CCom.getName();

if (output.length()>0 && NameF.length()>0){
//System.out.println(output);
output+=CSep;
}

Expand Down Expand Up @@ -260,7 +261,7 @@ public String getCommsHyper() {
output+=Rank0Format.replace("^NF",NameF);
//Note: \u00A0 is a nonbreaking space.
}
if (CCom.checkLife()){
if (CCom.checkLife() || CCom.checkPropers()){
output += "</A>";
}
if (Tone != -1){
Expand Down Expand Up @@ -427,6 +428,9 @@ public OrderedHashtable getRH(String Node, String Type) {


}
public Vector getCommemorations(){
return OrderedCommemorations;
}

public static void main(String[] argz) {
ParameterValues.dayInfo = new OrderedHashtable();
Expand Down
3 changes: 2 additions & 1 deletion Ponomar/Days.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public void readDay(String FileName) //throws IOException
catch (Exception e)
{
e.printStackTrace();
}
}
System.out.println(Location+FileName);
}

public void startDocument()
Expand Down
24 changes: 12 additions & 12 deletions Ponomar/DivineLiturgy1.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void endElement(String elem) {
public void text(String text) {
}

public String Readings(OrderedHashtable readingsIn, String ReadingType, JDate today) {
public String Readings(OrderedHashtable readingsIn, String ReadingType, JDate2 today) {
/********************************************************
SINCE I HAVE CORRECTED THE SCRIPTURE READINGS IN THE MAIN FILE, I CAN NOW PRECEDE WITH A BETTER VERSION OF THIS PROGRAMME!
********************************************************/
Expand Down Expand Up @@ -188,10 +188,10 @@ public String Readings(OrderedHashtable readingsIn, String ReadingType, JDate to
Information3.dayInfo.put("doy", today.getDoy());
Information3.dayInfo.put("dRank","0");
//System.out.println("Case II: Testing the StringOp files: In StringOp, doy = "+StringOp.dayInfo.get("doy").toString()+" In Information3, doy = "+Information3.dayInfo.get("doy").toString()+" In Transfers, doy = "+Transfers.dayInfo.get("doy"));
nday = (int) JDate.difference(today, Paschalion.getPascha(today.getYear()));
int ndayP = (int) JDate.difference(today, Paschalion.getPascha(today.getYear() - 1));
nday = (int) JDate2.difference(today, Paschalion.getPascha(today.getYear(),today.getCalendar2()));
int ndayP = (int) JDate2.difference(today, Paschalion.getPascha(today.getYear() - 1,today.getCalendar2()));
//REQUIRED FOR LUCAN JUMP CALCULATIONS! ADDED 2008/05/17 n.s.
int ndayF = (int) JDate.difference(today, Paschalion.getPascha(today.getYear() + 1));
int ndayF = (int) JDate2.difference(today, Paschalion.getPascha(today.getYear() + 1,today.getCalendar2()));
Information3.dayInfo.put("nday", nday);
Information3.dayInfo.put("ndayP", ndayP);
Information3.dayInfo.put("ndayF", ndayF);
Expand Down Expand Up @@ -235,10 +235,10 @@ public String Readings(OrderedHashtable readingsIn, String ReadingType, JDate to
Information3.dayInfo.put("dow", today.getDayOfWeek());
Information3.dayInfo.put("doy", today.getDoy());
Information3.dayInfo.put("dRank","0");
nday = (int) JDate.difference(today, Paschalion.getPascha(today.getYear()));
int ndayP = (int) JDate.difference(today, Paschalion.getPascha(today.getYear() - 1));
nday = (int) JDate2.difference(today, Paschalion.getPascha(today.getYear(),today.getCalendar2()));
int ndayP = (int) JDate2.difference(today, Paschalion.getPascha(today.getYear() - 1,today.getCalendar2()));
//REQUIRED FOR LUCAN JUMP CALCULATIONS! ADDED 2008/05/17 n.s.
int ndayF = (int) JDate.difference(today, Paschalion.getPascha(today.getYear() + 1));
int ndayF = (int) JDate2.difference(today, Paschalion.getPascha(today.getYear() + 1,today.getCalendar2()));
Information3.dayInfo.put("nday", nday);
Information3.dayInfo.put("ndayP", ndayP);
Information3.dayInfo.put("ndayF", ndayF);
Expand Down Expand Up @@ -328,11 +328,11 @@ public String Readings(OrderedHashtable readingsIn, String ReadingType, JDate to
return format(dailyVf, dailyRf, dailyTf);
}

private OrderedHashtable getReadings(JDate today, String readingType) {
private OrderedHashtable getReadings(JDate2 today, String readingType) {
String filename = "";
int lineNumber = 0;

int nday = (int) JDate.difference(today, Paschalion.getPascha(today.getYear()));
int nday = (int) JDate2.difference(today, Paschalion.getPascha(today.getYear(),today.getCalendar2()));

//I COPIED THIS FROM THE Main.java FILE BY ALEKS WITH MY MODIFICATIONS (Y.S.)
//FROM HERE UNTIL
Expand All @@ -342,8 +342,8 @@ private OrderedHashtable getReadings(JDate today, String readingType) {
} else if (nday < -70) {
// WE HAVE NOT YET REACHED THE LENTEN TRIODION
filename = pentecostarionFileName;
JDate lastPascha = Paschalion.getPascha(today.getYear() - 1);
lineNumber = (int) JDate.difference(today, lastPascha) + 1;
JDate2 lastPascha = Paschalion.getPascha(today.getYear() - 1,today.getCalendar2());
lineNumber = (int) JDate2.difference(today, lastPascha) + 1;
} else {
// WE ARE AFTER PASCHA AND BEFORE THE END OF THE YEAR
filename = pentecostarionFileName;
Expand Down Expand Up @@ -547,7 +547,7 @@ public String format(Vector vectV, Vector vectR, Vector vectT) {
Enumeration e3 = vectV.elements();
for (int k = 0; k < vectV.size(); k++) {
String reading = (String) vectV.get(k);
output += ShortForm.getHyperlink(reading);
output += ShortForm.getHyperlinkLoc(reading);

if ((Integer) vectR.get(k) == -2 ) {
if (vectV.size()>1){
Expand Down
Loading