Package ch.agent.t2.time

Examples of ch.agent.t2.time.DateTime


  }
 
  public void testGetFirstValue_1() {
    try {
      Series<Double> s = makeSeries(makeTimeSeries());
      TimeIndex t = s.getTimeDomain().time("2011-06-01");
      assertEquals(201106.01, s.getFirstObservation(t).getValue());
    } catch (Exception e) {
      fail(e.toString());
    }
  }
View Full Code Here


  }
 
  public void testGetFirstValue_2() {
    try {
      Series<Double> s = makeSeries(makeTimeSeries());
      TimeIndex t = s.getTimeDomain().time("2011-05-31");
      assertEquals(201106.01, s.getFirstObservation(t).getValue());
    } catch (Exception e) {
      fail(e.toString());
    }
  }
View Full Code Here

  }
 
  public void testGetFirstValue_3() {
    try {
      Series<Double> s = makeSeries(makeTimeSeries());
      TimeIndex t = s.getTimeDomain().time("2011-07-31");
      assertNull(s.getFirstObservation(t));
    } catch (Exception e) {
      fail(e.toString());
    }
  }
View Full Code Here

  }
 
  public void testGetLastValue_4() {
    try {
      Series<Double> s = makeSeries(makeTimeSeries2());
      TimeIndex t = s.getTimeDomain().time("2011-06-04");
      assertEquals(201106.02,  s.getLastObservation(t).getValue());
    } catch (Exception e) {
      fail(e.toString());
    }
  }
View Full Code Here

  }
 
  public void testGetLastValue_5() {
    try {
      Series<Double> s = makeSeries(makeTimeSeries2());
      TimeIndex t = s.getTimeDomain().time("2011-05-31");
      assertEquals(201105.31,  s.getLastObservation(t).getValue());
    } catch (Exception e) {
      fail(e.toString());
    }
  }
View Full Code Here

  }
 
  public void testGetFirstValue_4() {
    try {
      Series<Double> s = makeSeries(makeTimeSeries2());
      TimeIndex t = s.getTimeDomain().time("2011-06-01");
      assertEquals(201106.01,  s.getFirstObservation(t).getValue());
    } catch (Exception e) {
      fail(e.toString());
    }
  }
View Full Code Here

  }
 
  public void testGetFirstValue_5() {
    try {
      Series<Double> s = makeSeries(makeTimeSeries2());
      TimeIndex t = s.getTimeDomain().time("2011-06-03");
      assertEquals(201106.30,  s.getFirstObservation(t).getValue());
    } catch (Exception e) {
      fail(e.toString());
    }
  }
View Full Code Here

  public void testLargeGap_2() {
    try {
      // first get the maximum allowed allowed gap
      Series<Double> s = makeSeriesWithGap("2011-05-01", "2011-05-02");
      int maxGap = s.getValues(null).asIndexable().getMaxGap();
      TimeIndex date1 = s.getFirstObservation(null).getTime();
      TimeIndex date2 = date1.add(maxGap + 2); // the maximum allowed gap
     
      Series<Double> s2 = makeSeriesWithGap(date1.toString(), date2.toString());
      // force non-sparse time series (should fail because it creates a gap too large by 1)
      s2.getValues(null).asIndexable();
    } catch (Exception e) {
      fail(e.toString());
    }
View Full Code Here

  public void testLargeGap_3() {
    try {
      // first get the maximum allowed allowed gap
      Series<Double> s = makeSeriesWithGap("2011-05-01", "2011-05-02");
      int maxGap = s.getValues(null).asIndexable().getMaxGap();
      TimeIndex date1 = s.getFirstObservation(null).getTime();
      TimeIndex date2 = date1.add(maxGap + 2 + 1); // a gap too large by 1
     
      Series<Double> s2 = makeSeriesWithGap(date1.toString(), date2.toString());
      // force non-sparse time series (should fail because it creates a gap too large by 1)
      s2.getValues(null).asIndexable();
      expectException();
    } catch (Exception e) {
      assertException(e, K.T5019);
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

TOP

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

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.