org.joda.time.Instant.get()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(205)

本文整理了Java中org.joda.time.Instant.get()方法的一些代码示例,展示了Instant.get()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instant.get()方法的具体详情如下:
包路径:org.joda.time.Instant
类名称:Instant
方法名:get

Instant.get介绍

[英]Gets the chronology of the instant, which is ISO in the UTC zone.

This method returns ISOChronology#getInstanceUTC() which corresponds to the definition of the Java epoch 1970-01-01T00:00:00Z.
[中]获取瞬间的时间顺序,它是UTC区域中的ISO。
此方法返回与Java epoch 1970-01-01T00:00:00Z的定义相对应的等时学#getInstanceUTC()。

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

public static Partial getPartial(Instant t, Partial p)
{
 Partial res = new Partial(p);
 for (int i = 0; i < p.size(); i++) {
  res = res.withField(p.getFieldType(i), t.get(p.getFieldType(i)));
 }
 return res;
}

代码示例来源:origin: powertac/powertac-server

int indexOfShift (Instant time)
{
 int hour = time.get(DateTimeFieldType.hourOfDay());
 int day = time.get(DateTimeFieldType.dayOfWeek());
 return hour + (day - 1) * HOURS_DAY;
}

代码示例来源:origin: powertac/powertac-server

private Instant getNextSunday ()
{
 Instant result = getNowInstant();
 int hour = result.get(DateTimeFieldType.hourOfDay());
 if (hour > 0)
  result = result.plus((24 - hour) * TimeService.HOUR);
 int day = result.get(DateTimeFieldType.dayOfWeek());
 result = result.plus((7 - day) * TimeService.DAY);
 return result;
}

代码示例来源:origin: org.opencds.cqf/cql-engine

if (leftInstant.get(DateTime.getField(i)) < rightInstant.get(DateTime.getField(i)))
  else if (leftInstant.get(DateTime.getField(i)) > rightInstant.get(DateTime.getField(i)))
return leftInstant.get(DateTime.getField(idx)) <= rightInstant.get(DateTime.getField(idx));

代码示例来源:origin: org.opencds.cqf/cql-engine

if (leftInstant.get(DateTime.getField(i)) > rightInstant.get(DateTime.getField(i)))
  else if (leftInstant.get(DateTime.getField(i)) < rightInstant.get(DateTime.getField(i)))
return leftInstant.get(DateTime.getField(idx)) >= rightInstant.get(DateTime.getField(idx));

代码示例来源:origin: org.opencds.cqf/cql-engine

if (leftTemporal.getJodaDateTime().toInstant().get(DateTime.getField(i))
    != rightTemporal.getJodaDateTime().toInstant().get(DateTime.getField(i)))

代码示例来源:origin: edu.stanford.nlp/stanford-corenlp

public static Partial getPartial(Instant t, Partial p)
{
 Partial res = new Partial(p);
 for (int i = 0; i < p.size(); i++) {
  res = res.withField(p.getFieldType(i), t.get(p.getFieldType(i)));
 }
 return res;
}

代码示例来源:origin: edu.stanford.nlp/corenlp

public static Partial getPartial(Instant t, Partial p)
{
 Partial res = new Partial(p);
 for (int i = 0; i < p.size(); i++) {
  res = res.withField(p.getFieldType(i), t.get(p.getFieldType(i)));
 }
 return res;
}

代码示例来源:origin: com.guokr/stan-cn-com

public static Partial getPartial(Instant t, Partial p)
{
 Partial res = new Partial(p);
 for (int i = 0; i < p.size(); i++) {
  res = res.withField(p.getFieldType(i), t.get(p.getFieldType(i)));
 }
 return res;
}

代码示例来源:origin: powertac/powertac-server

double[] getPrices ()
{
 if (null != this.prices)
  return prices;
 double nhc = getNominalHourlyConsumption();
 prices = new double[profileSize];
 double cumulativeUsage = 0.0;
 Instant start =
   service.getTimeslotRepo().currentTimeslot().getStartInstant();
 for (int i = 0; i < profileSize; i++) {
  Instant when = start.plus(i * TimeService.HOUR);
  if (when.get(DateTimeFieldType.hourOfDay()) == 0) {
   cumulativeUsage = 0.0;
  }
  prices[i] =
    tariff.getUsageCharge(when, nhc, cumulativeUsage) / nhc;
  cumulativeUsage += nhc;
 }
 return prices;
}

代码示例来源:origin: org.opencds.cqf/cql-engine

Instant rightInstant = rightTemporal.getJodaDateTime().toInstant();
for (int i = 0; i < idx; i++) {
  if (leftInstant.get(DateTime.getField(i)) > rightInstant.get(DateTime.getField(i))) {
    return false;
  else if (leftInstant.get(DateTime.getField(i)) < rightInstant.get(DateTime.getField(i))) {
    return true;
return leftInstant.get(DateTime.getField(idx)) < rightInstant.get(DateTime.getField(idx));

代码示例来源:origin: org.opencds.cqf/cql-engine

public Integer compare(BaseTemporal other, Boolean forSort) {
  boolean differentPrecisions = this.getPartial().size() != other.getPartial().size();
  int size;
  if (differentPrecisions) {
    size = this.getPartial().size() > other.getPartial().size() ? other.getPartial().size() : this.getPartial().size();
  }
  else {
    size = this.getPartial().size();
  }
  if (!isDateTime) {
    size += 3;
  }
  Instant left = this.jodaDateTime.toInstant();
  Instant right = other.jodaDateTime.toInstant();
  for (int i = 0; i < size; ++i) {
    if (left.get(DateTime.getField(i)) > right.get(DateTime.getField(i))) {
      return 1;
    }
    else if (left.get(DateTime.getField(i)) < right.get(DateTime.getField(i))) {
      return -1;
    }
  }
  if (differentPrecisions) {
    return forSort ? (this.getPartial().size() > other.getPartial().size() ? 1 : -1) : null;
  }
  return 0;
}

代码示例来源:origin: org.opencds.cqf/cql-engine

Instant rightInstant = rightTemporal.getJodaDateTime().toInstant();
for (int i = 0; i < idx; i++) {
  if (leftInstant.get(DateTime.getField(i)) < rightInstant.get(DateTime.getField(i))) {
    return false;
  else if (leftInstant.get(DateTime.getField(i)) > rightInstant.get(DateTime.getField(i))) {
    return true;
return leftInstant.get(DateTime.getField(idx)) > rightInstant.get(DateTime.getField(idx));

代码示例来源:origin: org.opencds.cqf/cql-engine

public static Integer between(org.joda.time.DateTime leftDateTime, org.joda.time.DateTime rightDateTime, int idx) {
  Integer ret = 0;
  Instant leftInstant = leftDateTime.toInstant();
  Instant rightInstant = rightDateTime.toInstant();
  switch(idx) {
    case 0: ret = Years.yearsBetween(leftDateTime.toInstant(), rightDateTime.toInstant()).getYears();
      break;
    case 1: ret = Months.monthsBetween(leftDateTime.toInstant(), rightDateTime.toInstant()).getMonths();
      break;
    case 2: ret = Days.daysBetween(leftDateTime.toInstant(), rightDateTime.toInstant()).getDays();
      break;
    case 3: ret = Hours.hoursBetween(leftDateTime.toInstant(), rightDateTime.toInstant()).getHours();
      break;
    case 4: ret = Minutes.minutesBetween(leftDateTime.toInstant(), rightDateTime.toInstant()).getMinutes();
      break;
    case 5: ret = Seconds.secondsBetween(leftDateTime.toInstant(), rightDateTime.toInstant()).getSeconds();
      break;
    case 7: ret = Days.daysBetween(leftDateTime.toInstant(), rightDateTime.toInstant()).getDays() / 7;
  }
  if (idx < 6) {
    while (++idx < 7) {
      if (leftInstant.get(DateTime.getField(idx)) > rightInstant.get(DateTime.getField(idx))) {
        ret += 1;
        break;
      }
    }
  }
  return ret;
}

相关文章