Package ch.agent.t2

Examples of ch.agent.t2.T2Exception


    }

    @Override
    public DateTime scan(String value) throws T2DBException {
      try {
        return new DateTime(value);
      } catch (Exception e) {
        throw T2DBMsg.exception(e, D.D10107, value, ValueType.class.getName());
      }
    }
View Full Code Here


    }

    @Override
    public Day scan(String value) throws T2DBException {
      try {
        return new Day(value);
      } catch (Exception e) {
        throw T2DBMsg.exception(e, D.D10107, value, ValueType.class.getName());
      }
    }
View Full Code Here

   * @param expr a non-null day expression
   * @return a Day
   * @throws T2Exception
   */
  public static Day parseDay(String expr) throws T2Exception {
    return new Day(parseDay(expr, Day.DOMAIN, Adjustment.NONE));
  }
View Full Code Here

    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

    if (time.getTimeDomain().compareResolutionTo(Resolution.MONTH) > 0)
      throw T2Msg.exception(K.T1059, time.toString(), Resolution.MONTH.name());
    long y = time.getYear();
    int m = time.getMonth();
    int day = getDayByRank(y, m, dayName, rank);
    return day == 0 ? null : new Day(y, m, day);
  }
View Full Code Here

    int yearDay = getDayByRank(y, 0, dayName, rank);
    if (yearDay == 0)
      return null;
    else {
      int[] md = computeMonthAndDay(y, yearDay);
      return new Day(y, md[0], md[1]);
    }
  }
View Full Code Here

      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)
      week1Offset += 7;
    int dayOfPeriod = 1 + week1Offset + (workRank - 1) * 7;
    if (rank < 0) {
      if (dayOfPeriod > daysInPeriod)
View Full Code Here

        if (domain != null) {
          Exception cause = T2Msg.exception(K.T0007, domain.toString());
          throw T2Msg.runtimeException(K.T0001, cause);
        }
      }
      ExternalTimeFormat externalFormat = getExternalTimeFormat();
      if (externalFormat == null)
        externalFormat = DefaultExternalFormat.getInstance();
      domain = new TimeFactory(def, externalFormat);
      domains.put(def.getLabel(), (TimeFactory)domain);
    }
View Full Code Here

  private PreparedStatement select_range;
  private static final String SELECT_RANGE =
    "select min(date), max(date) from " + DB.VALUE_DOUBLE + " where series = ?";
  @Override
  public Range getRange(Series<Double> series) throws T2DBException {
    Range range = null;
    TimeDomain timeDomain = series.getTimeDomain();
    try {
      select_range = open(SELECT_RANGE, series, select_range);
      select_range.setInt(1, getId(series));
      ResultSet rs = select_range.executeQuery();
      if (rs.next()) {
        range = new Range(timeDomain.timeFromOffset(rs.getInt(1)), timeDomain.timeFromOffset(rs.getInt(2)));
        if (rs.wasNull())
          range = null;
      }
    } catch (Exception e) {
      throw T2DBJMsg.exception(e, J.J50122, series.getName(true));
    } finally {
      select_range = close(select_range);
    }
    if (range == null)
      range = new Range(series.getTimeDomain());
    return range;
  }
View Full Code Here

  }

  @Override
  public T getValue(TimeIndex time) throws T2Exception, T2DBException {
    checkTime(time);
    return getValues(new Range(time, time)).get(time);
  }
View Full Code Here

TOP

Related Classes of ch.agent.t2.T2Exception

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.