com.innovativeastrosolutions.astrosoftcore.util.MuhurthaHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of AstrosoftCore Show documentation
Show all versions of AstrosoftCore Show documentation
https://github.com/erajasekar/AstrosoftCore
The newest version!
/**
* MuhurthaHelper.java
* Created On 2005, Oct 15, 2005 5:09:03 PM
* @author Rajasekar E.
*/
package com.innovativeastrosolutions.astrosoftcore.util;
import java.util.EnumMap;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.innovativeastrosolutions.astrosoftcore.beans.Interval;
import com.innovativeastrosolutions.astrosoftcore.beans.MuhurthaBean;
import com.innovativeastrosolutions.astrosoftcore.consts.Ayanamsa;
import com.innovativeastrosolutions.astrosoftcore.consts.MuhurthaRank;
import com.innovativeastrosolutions.astrosoftcore.consts.Planet;
/**
* Helper class for computing muhurtha.
*/
public class MuhurthaHelper {
private static final Logger log = Logger.getLogger(MuhurthaHelper.class.getName());
private EnumMap > tLongitudes;
private TransitHelper transitHelper;
public MuhurthaHelper(EnumMap >longs, Options options){
tLongitudes = longs;
transitHelper = new SwissHelper(options.getOption(Option.Ayanamsa, Ayanamsa.class)).getTransitHelper(Planet.Moon);
}
public void setTransitLongitudes(EnumMap > longs) {
tLongitudes = longs;
}
//TODO: Make this to run in seperate thread.
public List getTransists(Interval period) {
List mTransists = new java.util.ArrayList();
for(MuhurthaRank r : tLongitudes.keySet()) {
for(Interval tLongitude : tLongitudes.get(r)) {
double startJT = period.getStart();
double endJT = period.getEnd();
//System.out.println("S -> " + SweDate.getDate(startJT));
//System.out.println("E -> "+ SweDate.getDate(endJT));
while (startJT <= endJT) {
//System.out.println("Period " + new Interval(startJT,endJT));
//System.out.println("startJT " + startJT);
//System.out.println("endJT " + endJT);
try {
/*tc.setOffset(tLongitude.getStart());
double transitStart = sw.getTransitUT(tc, startJT, false);
tc.setOffset(tLongitude.getEnd());
double transitEnd = sw.getTransitUT(tc, transitStart, false);*/
//System.out.println("tLongitude.getStart() " + tLongitude);
double transitStart = transitHelper.getTransit(tLongitude.getStart(), startJT);
double transitEnd = transitHelper.getTransit(tLongitude.getEnd(), transitStart);
//System.out.println("transitStart " + transitStart + " - " + tLongitude.getStart());
//System.out.println("transitEnd " + transitEnd+ " - " + tLongitude.getEnd());
if (transitStart <= endJT ) {
MuhurthaBean mTransit = new MuhurthaBean(new Interval(transitStart, transitEnd),tLongitude , r);
mTransists.add(mTransit);
}
startJT = transitEnd ;//+ 0.1;
}catch(swisseph.SwissephException ex){
log.log(Level.SEVERE, "Exception in calculating transists " , ex);
};
}
}
}
return mTransists;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy