Examples of Sun


Examples of de.ailis.xadrian.data.Sun

                final Element element = (Element) item;
                final int percent = Integer.parseInt(element
                    .attributeValue("percent"));
                final int cycle = Integer.parseInt(element
                    .attributeValue("cycle"));
                final Sun suns = new Sun(this.game, percent, cycle);
                if (this.defaultSuns == null
                    || Boolean.parseBoolean(element
                        .attributeValue("default", "false")))
                    this.defaultSuns = suns;
                this.suns.add(suns);
View Full Code Here

Examples of de.ailis.xadrian.data.Sun

                this.maxX = Math.max(this.maxX, x);
                final int y = Integer.parseInt(element.attributeValue("y"));
                this.maxY = Math.max(this.maxY, y);
                final int planets = Integer.parseInt(element
                    .attributeValue("planets"));
                final Sun suns = sunsFactory.getSun(Integer.parseInt(element
                    .attributeValue("suns")));
                final Race race = raceFactory.getRace(element
                    .attributeValue("race"));
                final boolean core = Boolean.parseBoolean(element
                    .attributeValue("core"));
View Full Code Here

Examples of jodd.petite.tst5.Sun

    PetiteContainer pc = new PetiteContainer();

    pc.registerPetiteBean(Solar.class, null, null, null, false);
    pc.registerPetiteBean(Sun.class, null, null, null, false);

    Sun sun = pc.getBean(Sun.class);

    assertEquals("Sun{Earth}", sun.toString());
  }
View Full Code Here

Examples of jodd.petite.tst5.Sun

    PetiteContainer pc = new PetiteContainer();

    pc.registerPetiteBean(Solar3.class, null, null, null, false)// still needs to be a bean
    pc.registerPetiteBean(Sun.class, null, null, null, false);

    Sun sun = pc.getBean(Sun.class);

    assertEquals("Sun{Earth}", sun.toString());
  }
View Full Code Here

Examples of org.openhab.binding.astro.internal.model.Sun

   * Create or returns the instance of this class.
   */
  public static AstroContext getInstance() {
    if (instance == null) {
      instance = new AstroContext();
      instance.planets.put(PlanetName.SUN, new Sun());
      instance.planets.put(PlanetName.MOON, new Moon());
    }
    return instance;
  }
View Full Code Here

Examples of org.openhab.binding.astro.internal.model.Sun

  /**
   * Returns true, if the sun is up all day (no rise and set).
   */
  private boolean isSunUpAllDay(Calendar calendar, double latitude, double longitude) {
    Calendar cal = DateTimeUtils.truncateToMidnight(calendar);
    Sun sun = new Sun();
    for (int minutes = 0; minutes <= MINUTES_PER_DAY; minutes += CURVE_TIME_INTERVAL) {
      setSunPosition(calendar, latitude, longitude, sun);
      if (sun.getPosition().getElevation() < SUN_ANGLE) {
        return false;
      }
      cal.add(Calendar.MINUTE, CURVE_TIME_INTERVAL);
    }
    return true;
View Full Code Here

Examples of org.openhab.binding.astro.internal.model.Sun

    double jastro = getSunsetJulianDate(w3, m, lsun, lw, n);
    double jdark = getSunsetJulianDate(w4, m, lsun, lw, n);
    double jnau2 = getSunriseJulianDate(jtransit, jastro);
    double jastro2 = getSunriseJulianDate(jtransit, jdark);

    Sun sun = new Sun();
    sun.setAstroDawn(new Range(DateTimeUtils.toCalendar(jastro2), DateTimeUtils.toCalendar(jnau2)));
    sun.setAstroDusk(new Range(DateTimeUtils.toCalendar(jastro), DateTimeUtils.toCalendar(jdark)));

    if (onlyAstro) {
      return sun;
    }

    sun.setNoon(new Range(DateTimeUtils.toCalendar(jtransit), DateTimeUtils.toCalendar(jtransit
        + JD_ONE_MINUTE_FRACTION)));
    sun.setRise(new Range(DateTimeUtils.toCalendar(jrise), DateTimeUtils.toCalendar(jriseend)));
    sun.setSet(new Range(DateTimeUtils.toCalendar(jsetstart), DateTimeUtils.toCalendar(jset)));

    sun.setCivilDawn(new Range(DateTimeUtils.toCalendar(Jciv2), DateTimeUtils.toCalendar(jrise)));
    sun.setCivilDusk(new Range(DateTimeUtils.toCalendar(jset), DateTimeUtils.toCalendar(jnau)));

    sun.setNauticDawn(new Range(DateTimeUtils.toCalendar(jnau2), DateTimeUtils.toCalendar(Jciv2)));
    sun.setNauticDusk(new Range(DateTimeUtils.toCalendar(jnau), DateTimeUtils.toCalendar(jastro)));

    boolean isSunUpAllDay = isSunUpAllDay(calendar, latitude, longitude);

    // daylight
    Range daylightRange = new Range();
    if (sun.getRise().getStart() == null && sun.getRise().getEnd() == null) {
      if (isSunUpAllDay) {
        daylightRange = new Range(DateTimeUtils.truncateToMidnight(calendar),
            DateTimeUtils.truncateToMidnight(addDays(calendar, 1)));
      }
    } else {
      daylightRange = new Range(sun.getRise().getEnd(), sun.getSet().getStart());
    }
    sun.setDaylight(daylightRange);

    // morning night
    Sun sunYesterday = getSunInfo(addDays(calendar, -1), latitude, longitude, true);
    Range morningNightRange = null;
    if (sunYesterday.getAstroDusk().getEnd() != null
        && DateUtils.isSameDay(sunYesterday.getAstroDusk().getEnd(), calendar)) {
      morningNightRange = new Range(sunYesterday.getAstroDusk().getEnd(), sun.getAstroDawn().getStart());
    } else if (isSunUpAllDay) {
      morningNightRange = new Range();
    } else {
      morningNightRange = new Range(DateTimeUtils.truncateToMidnight(calendar), sun.getAstroDawn().getStart());
    }
    sun.setMorningNight(morningNightRange);

    // evening night
    Range eveningNightRange = null;
    if (sun.getAstroDusk().getEnd() != null && DateUtils.isSameDay(sun.getAstroDusk().getEnd(), calendar)) {
      eveningNightRange = new Range(sun.getAstroDusk().getEnd(), DateTimeUtils.truncateToMidnight(addDays(
          calendar, 1)));
    } else {
      eveningNightRange = new Range();
    }
    sun.setEveningNight(eveningNightRange);

    // night
    if (isSunUpAllDay) {
      sun.setNight(new Range());
    } else {
      Sun sunTomorrow = getSunInfo(addDays(calendar, 1), latitude, longitude, true);
      sun.setNight(new Range(sun.getAstroDusk().getEnd(), sunTomorrow.getAstroDawn().getStart()));
    }

    // eclipse
    SunEclipse eclipse = sun.getEclipse();
    MoonCalc mc = new MoonCalc();
View Full Code Here

Examples of org.openhab.binding.astro.internal.model.Sun

*/
public class SeasonJob extends AbstractBaseJob {

  @Override
  protected void executeJob(JobDataMap jobDataMap) {
    Sun sun = (Sun) context.getPlanet(PlanetName.SUN);

    SeasonCalc seasonCalc = new SeasonCalc();
    sun.setSeason(seasonCalc.getSeason(Calendar.getInstance(), context.getConfig().getLatitude()));

    planetPublisher.publish(PlanetName.SUN);
  }
View Full Code Here

Examples of org.openhab.binding.astro.internal.model.Sun

  protected void executeJob(JobDataMap jobDataMap) {
    Calendar now = Calendar.getInstance();

    // sun
    SunCalc sunCalc = new SunCalc();
    Sun sun = (Sun) context.getPlanet(PlanetName.SUN);
    sunCalc.setSunPosition(now, context.getConfig().getLatitude(), context.getConfig().getLongitude(), sun);
    planetPublisher.publish(PlanetName.SUN);

    // moon
    MoonCalc moonCalc = new MoonCalc();
View Full Code Here

Examples of org.openhab.binding.astro.internal.model.Sun

  protected void executeJob(JobDataMap jobDataMap) {
    Calendar now = Calendar.getInstance();

    // sun
    SunCalc sunCalc = new SunCalc();
    Sun sun = sunCalc.getSunInfo(now, context.getConfig().getLatitude(), context.getConfig().getLongitude());
    sunCalc.setSunPosition(now, context.getConfig().getLatitude(), context.getConfig().getLongitude(), sun);

    SunZodiacCalc zodiacCalc = new SunZodiacCalc();
    sun.setZodiac(zodiacCalc.getZodiac(now));

    SeasonCalc seasonCalc = new SeasonCalc();
    sun.setSeason(seasonCalc.getSeason(now, context.getConfig().getLatitude()));
    context.getJobScheduler().scheduleSeasonJob(sun.getSeason());

    context.setPlanet(PlanetName.SUN, sun);
    planetPublisher.publish(PlanetName.SUN);

    // moon
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.