Package ch.agent.t2.time

Examples of ch.agent.t2.time.TimeIndex


  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

  }

  public void test_21() {
    try {
      UpdatableSeries<Double> s = db.getUpdatableSeries(SERIES, true).typeCheck(Double.class);
      TimeIndex t = s.getTimeDomain().time("2011-03-08");
      s.scanValue(t, "42.01");
      s.applyUpdates();
      db.commit();
      Chronicle chronicle = db.getChronicle(CHRONICLE, true);
      Series<Double>[] ss = chronicle.getSeries(new String[]{"test", "test4"}, Double.class, true);
View Full Code Here

  }
 
  public void test_22() {
    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();
      db.commit();
      Chronicle chronicle = db.getChronicle(CHRONICLE, true);
      chronicle.getSeries(new String[]{"test", "test2", "test4"}, Double.class, true);
View Full Code Here

  }
 
  public void test_23() {
    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();
      db.commit();
      Chronicle chronicle = db.getChronicle(CHRONICLE, false);
      Series<Double>[] ss = chronicle.getSeries(new String[]{"test", "test2", "test4"}, Double.class, false);
View Full Code Here

  }

  public void test_24() {
    try {
      UpdatableSeries<Double> s = db.getSeries(SERIES, true).edit().typeCheck(Double.class);
      TimeIndex t = s.getTimeDomain().time("2011-03-08");
      assertEquals(42.0, s.getValue(t));
      t = s.getTimeDomain().time("2011-03-14");
      s.scanValue(t, "51.3");
      s.scanValue(t.add(2), "55");
      s.applyUpdates();
      if (DUMP)
        System.out.println(t.getTimeDomain() + " " + s.getRange());
      assertEquals(9, s.getRange().getSize());
      if (DUMP)
        System.out.println(s.getValues(null));
      boolean done = s.setRange(new Range(t.getTimeDomain(), "2011-03-12", "2011-03-17", Adjustment.NONE));
      if (DUMP)
        System.out.println(s.getValues(null));
      assertFalse(done);
      done = s.setRange(new Range(t.getTimeDomain(), "2011-03-12", "2011-03-16", Adjustment.NONE));
      s.applyUpdates();
      if (DUMP)
        System.out.println(s.getValues(null));
      assertEquals(3, s.getRange().getSize());
      done = s.setRange(null);
View Full Code Here

        select_first_double2.setInt(2, sid);
        rs = select_first_double2.executeQuery();
      }
      if (rs.next()) {
        TimeDomain dom = time == null ? series.getTimeDomain() : time.getTimeDomain();
        TimeIndex t = dom.timeFromOffset(rs.getInt(1));
        obs = new Observation<Double>(t, rs.getDouble(2));
      }
    } catch (Exception e) {
        throw T2DBMsg.exception(e, E.E50123, series.getName(true), time.toString());
    } finally {
View Full Code Here

        select_last_double2.setInt(2, sid);
        rs = select_last_double2.executeQuery();
      }
      if (rs.next()) {
        TimeDomain dom = time == null ? series.getTimeDomain() : time.getTimeDomain();
        TimeIndex t = dom.timeFromOffset(rs.getInt(1));
        obs = new Observation<Double>(t, rs.getDouble(2));
      }
    } catch (Exception e) {
        throw T2DBMsg.exception(e, E.E50124, series.getName(true), time.toString());
    } finally {
View Full Code Here

    TimeDomain contextDomain = context.getTimeDomain();
    if (beginExpr == null) {
      return new Range(contextDomain);
    } else {
      // be more permissive with context and fix ranges invalidated by conversion
      TimeIndex begin = beginExpr.getDate(context);
      TimeIndex end = endExpr.getDate(context);
      if (begin == null || end == null) // (consequence of empty context range when context needed)
        return new Range(contextDomain);
      else if (begin.compareTo(end) > 0 && (beginExpr.needContext() || endExpr.needContext()))
        return new Range(contextDomain);
      else {
View Full Code Here

TOP

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

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.