Package ch.agent.t2.time

Examples of ch.agent.t2.time.Month


    if (month == 0) {
      month = 1;
      daysInPeriod = isLeap(year) ? 366 : 365;
    } else
      daysInPeriod = daysInMonth(year, month);
    TimeIndex t = new Day(year, month, 1);
    DayOfWeek firstOfPeriod = t.getDayOfWeek();
    int workRank = rank;
    if (workRank < 0)
      workRank = max; // try the max
    int week1Offset = name.ordinal() - firstOfPeriod.ordinal();
    if (week1Offset < 0)
View Full Code Here


      int compareResols = getTimeDomain().getResolution().compareTo(otherTime.getTimeDomain().getResolution());
      if (compareResols == 0) {
        // convert  both to unrestricted domain
        TimeDomainDefinition def = new TimeDomainDefinition(null, getTimeDomain().getResolution(), 0L);
        TimeDomain unrestrictedDomain = TimeDomainManager.getFactory().get(def, true);
        TimeIndex converted = convertOrThrowRTE(unrestrictedDomain, this);
        TimeIndex otherConverted = convertOrThrowRTE(unrestrictedDomain, otherTime);
        return converted.compareTo(otherConverted);
      } else if (compareResols < 0) {
        // convert  both to highest resolution
        TimeDomainDefinition def = new TimeDomainDefinition(null, otherTime.getTimeDomain().getResolution(), 0L);
        TimeDomain unrestrictedDomain = TimeDomainManager.getFactory().get(def, true);
        TimeIndex converted = convertOrThrowRTE(unrestrictedDomain, this);
        return converted.compareTo(otherTime);
      } else {
        // convert  both to highest resolution
        TimeDomainDefinition def = new TimeDomainDefinition(null, getTimeDomain().getResolution(), 0L);
        TimeDomain unrestrictedDomain = TimeDomainManager.getFactory().get(def, true);
        TimeIndex otherConverted = convertOrThrowRTE(unrestrictedDomain, otherTime);
        return compareTo(otherConverted);
      }
    }
  }
View Full Code Here

  }
 
  public void test_02() {
    try {
      UpdatableSeries<Double> s = db.getUpdatableSeries(SERIES, true).typeCheck(Double.class);
      TimeIndex t = s.getTimeDomain().time("2011-03-08");
      s.scanValue(t, "42");
      assertEquals(42.0, s.getValue(t));
    } catch (Exception e) {
      fail(e.toString());
    }
View Full Code Here

  }
 
  public void test_03() {
    try {
      Series<Double> s = db.getUpdatableSeries(SERIES, true).typeCheck(Double.class);
      TimeIndex t = s.getTimeDomain().time("2011-03-08");
      assertEquals(Double.NaN, s.getValue(t));
    } catch (Exception e) {
      fail(e.toString());
    }
  }
View Full Code Here

  }
 
  public void test_04() {
    try {
      UpdatableSeries<Double> s = db.getUpdatableSeries(SERIES, true).typeCheck(Double.class);
      TimeIndex t = s.getTimeDomain().time("2011-03-08");
      s.scanValue(t, "42");
      s.applyUpdates();
      assertEquals(42.0, s.getValue(t));
    } catch (Exception e) {
      fail(e.toString());
View Full Code Here

  }
 
  public void test_05() {
    try {
      Series<Double> s = db.getUpdatableSeries(SERIES, true).typeCheck(Double.class);
      TimeIndex t = s.getTimeDomain().time("2011-03-08");
      assertEquals(42.0, s.getValue(t));
      assertFalse(s.getSurrogate().inConstruction());
    } catch (Exception e) {
      fail(e.toString());
    }
View Full Code Here

  public void test_06() {
    try {
      if (getContext().isTransactional()) {
        db.rollback();
        Series<Double> s = db.getUpdatableSeries(SERIES, true).typeCheck(Double.class);
        TimeIndex t = s.getTimeDomain().time("2011-03-08");
        assertEquals(Double.NaN, s.getValue(t));
        assertTrue(s.getSurrogate().inConstruction());
      }
    } catch (Exception e) {
      fail(e.toString());
View Full Code Here

  public void test_07() {
    try {
      UpdatableSeries<Double> s = db.getUpdatableSeries(SERIES, true).typeCheck(Double.class);
      if (getContext().isTransactional())
        assertTrue(s.getSurrogate().inConstruction());
      TimeIndex t = s.getTimeDomain().time("2011-03-08");
      s.scanValue(t, "42");
      assertEquals(42., s.getValue(t));
      s.applyUpdates();
      db.commit();
      assertEquals(42.0, s.getValue(t));
View Full Code Here

 
  public void test_08() {
    try {
      db.rollback();
      Series<Double> s = db.getUpdatableSeries(SERIES, true).typeCheck(Double.class);
      TimeIndex t = s.getTimeDomain().time("2011-03-08");
      assertEquals(42.0, s.getValue(t));
    } catch (Exception e) {
      fail(e.toString());
    }
  }
View Full Code Here

  }

  public void test_10() {
    try {
      UpdatableSeries<Double> s = db.getUpdatableSeries(SERIES, true).typeCheck(Double.class);
      TimeIndex t = s.getTimeDomain().time("2011-03-08");
      s.scanValue(t, "42");
      s.applyUpdates();
      ((UpdatableChronicle) s.getChronicle()).applyUpdates();
      assertEquals(42.0, s.getValue(t));
    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of ch.agent.t2.time.Month

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.