当前位置: 首页>>代码示例>>Java>>正文


Java Minutes.minutes方法代码示例

本文整理汇总了Java中org.joda.time.Minutes.minutes方法的典型用法代码示例。如果您正苦于以下问题:Java Minutes.minutes方法的具体用法?Java Minutes.minutes怎么用?Java Minutes.minutes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.joda.time.Minutes的用法示例。


在下文中一共展示了Minutes.minutes方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import org.joda.time.Minutes; //导入方法依赖的package包/类
@Override
public Object create(Object request, SpecimenContext context) {

    if (!(request instanceof SpecimenType)) {
        return new NoSpecimen();
    }

    SpecimenType type = (SpecimenType) request;
    if (!BaseSingleFieldPeriod.class.isAssignableFrom(type.getRawType())) {
        return new NoSpecimen();
    }

    Duration duration = (Duration) context.resolve(Duration.class);
    if (type.equals(Seconds.class)) return Seconds.seconds(Math.max(1, (int) duration.getStandardSeconds()));
    if (type.equals(Minutes.class)) return Minutes.minutes(Math.max(1, (int) duration.getStandardMinutes()));
    if (type.equals(Hours.class)) return Hours.hours(Math.max(1, (int) duration.getStandardHours()));

    if (type.equals(Days.class)) return Days.days(Math.max(1, (int) duration.getStandardDays()));
    if (type.equals(Weeks.class)) return Weeks.weeks(Math.max(1, (int) duration.getStandardDays() / 7));
    if (type.equals(Months.class)) return Months.months(Math.max(1, (int) duration.getStandardDays() / 30));
    if (type.equals(Years.class)) return Years.years(Math.max(1, (int) duration.getStandardDays() / 365));

    return new NoSpecimen();
}
 
开发者ID:FlexTradeUKLtd,项目名称:jfixture,代码行数:25,代码来源:BaseSingleFieldPeriodRelay.java

示例2: findUtilizationsWithResolution_repeats_the_previous_utilization_at_resolution_intervals

import org.joda.time.Minutes; //导入方法依赖的package包/类
@Test
public void findUtilizationsWithResolution_repeats_the_previous_utilization_at_resolution_intervals() {
    DateTime start = new DateTime(2000, 1, 1, 12, 0);
    DateTime end = start.plusHours(1);
    Minutes resolution = Minutes.minutes(30);

    Utilization u1 = newUtilization(facilityId, start.minusHours(1), 100, 100);
    utilizationDao.insertUtilizations(asList(u1));
    UtilizationKey utilizationKey = u1.getUtilizationKey();

    List<Utilization> results = utilizationDao.findUtilizationsWithResolution(utilizationKey, start, end, resolution);
    assertThat(results).containsExactly(
            newUtilization(facilityId, start, 100, 100),
            newUtilization(facilityId, start.plus(resolution), 100, 100),
            newUtilization(facilityId, end, 100, 100));
}
 
开发者ID:HSLdevcom,项目名称:parkandrideAPI,代码行数:17,代码来源:UtilizationDaoTest.java

示例3: findUtilizationsWithResolution_availability_is_updated_when_there_are_new_utilizations

import org.joda.time.Minutes; //导入方法依赖的package包/类
@Test
public void findUtilizationsWithResolution_availability_is_updated_when_there_are_new_utilizations() {
    DateTime start = new DateTime(2000, 1, 1, 12, 0);
    DateTime end = start.plusHours(1);
    Minutes resolution = Minutes.minutes(30);

    Utilization u1 = newUtilization(facilityId, start, 100, 100);
    Utilization u2 = newUtilization(facilityId, start.plus(resolution), 200, 200);
    utilizationDao.insertUtilizations(asList(u1, u2));
    UtilizationKey utilizationKey = u1.getUtilizationKey();

    List<Utilization> results = utilizationDao.findUtilizationsWithResolution(utilizationKey, start, end, resolution);
    assertThat(results).containsExactly(
            newUtilization(facilityId, start, 100, 100),
            newUtilization(facilityId, start.plus(resolution), 200, 200),
            newUtilization(facilityId, end, 200, 200));
}
 
开发者ID:HSLdevcom,项目名称:parkandrideAPI,代码行数:18,代码来源:UtilizationDaoTest.java

示例4: parsePeriodString

import org.joda.time.Minutes; //导入方法依赖的package包/类
public static ReadablePeriod parsePeriodString(String periodStr) {
  ReadablePeriod period;
  char periodUnit = periodStr.charAt(periodStr.length() - 1);
  if (periodUnit == 'n') {
    return null;
  }

  int periodInt =
      Integer.parseInt(periodStr.substring(0, periodStr.length() - 1));
  switch (periodUnit) {
  case 'M':
    period = Months.months(periodInt);
    break;
  case 'w':
    period = Weeks.weeks(periodInt);
    break;
  case 'd':
    period = Days.days(periodInt);
    break;
  case 'h':
    period = Hours.hours(periodInt);
    break;
  case 'm':
    period = Minutes.minutes(periodInt);
    break;
  case 's':
    period = Seconds.seconds(periodInt);
    break;
  default:
    throw new IllegalArgumentException("Invalid schedule period unit '"
        + periodUnit);
  }

  return period;
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:36,代码来源:Schedule.java

示例5: parsePeriodString

import org.joda.time.Minutes; //导入方法依赖的package包/类
public static ReadablePeriod parsePeriodString(String periodStr) {
  ReadablePeriod period;
  char periodUnit = periodStr.charAt(periodStr.length() - 1);
  if (periodStr.equals("null") || periodUnit == 'n') {
    return null;
  }

  int periodInt =
      Integer.parseInt(periodStr.substring(0, periodStr.length() - 1));
  switch (periodUnit) {
  case 'y':
    period = Years.years(periodInt);
    break;
  case 'M':
    period = Months.months(periodInt);
    break;
  case 'w':
    period = Weeks.weeks(periodInt);
    break;
  case 'd':
    period = Days.days(periodInt);
    break;
  case 'h':
    period = Hours.hours(periodInt);
    break;
  case 'm':
    period = Minutes.minutes(periodInt);
    break;
  case 's':
    period = Seconds.seconds(periodInt);
    break;
  default:
    throw new IllegalArgumentException("Invalid schedule period unit '"
        + periodUnit);
  }

  return period;
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:39,代码来源:Utils.java

示例6: resolve

import org.joda.time.Minutes; //导入方法依赖的package包/类
public LocalDateTime resolve(LocalDateTime base) {
  if (this.duration==null || this.durationUnit==null) {
    return null;
  }

  ReadablePeriod period = null;
  if (DAYS.equals(durationUnit)) {
    period = Days.days(getDurationAsInt());
  } else if (WEEKS.equals(durationUnit)) {
    period = Weeks.weeks(getDurationAsInt());
  } else if (HOURS.equals(durationUnit)) {
    period = Hours.hours(getDurationAsInt());
  } else if (MONTHS.equals(durationUnit)) {
    period = Months.months(getDurationAsInt());
  } else if (YEARS.equals(durationUnit)) {
    period = Years.years(getDurationAsInt());
  } else if (MINUTES.equals(durationUnit)) {
    period = Minutes.minutes(getDurationAsInt());
  } else {
    return null;
  }

  LocalDateTime time = base.plus(period);
  
  if (atHour!=null) {
    LocalDateTime atTime = time.withTime(atHour, atMinute!=null ? atMinute : 0, 0, 0);
    if (atTime.isBefore(time)) {
      time = atTime.plusDays(1);
    } else {
      time = atTime;
    }
  } else if (isDayResolutionOrBigger()) {
    time = time.withTime(23, 59, 59, 999);
  }
  
  return time;
}
 
开发者ID:effektif,项目名称:effektif,代码行数:38,代码来源:AfterRelativeTime.java

示例7: parsePeriodString

import org.joda.time.Minutes; //导入方法依赖的package包/类
public static ReadablePeriod parsePeriodString(String periodStr) {
	ReadablePeriod period;
	char periodUnit = periodStr.charAt(periodStr.length() - 1);
	if (periodUnit == 'n') {
		return null;
	}

	int periodInt = Integer.parseInt(periodStr.substring(0,
			periodStr.length() - 1));
	switch (periodUnit) {
	case 'M':
		period = Months.months(periodInt);
		break;
	case 'w':
		period = Weeks.weeks(periodInt);
		break;
	case 'd':
		period = Days.days(periodInt);
		break;
	case 'h':
		period = Hours.hours(periodInt);
		break;
	case 'm':
		period = Minutes.minutes(periodInt);
		break;
	case 's':
		period = Seconds.seconds(periodInt);
		break;
	default:
		throw new IllegalArgumentException("Invalid schedule period unit '"
				+ periodUnit);
	}

	return period;
}
 
开发者ID:zhizhounq,项目名称:azkaban-customization,代码行数:36,代码来源:Schedule.java

示例8: parsePeriodString

import org.joda.time.Minutes; //导入方法依赖的package包/类
public static ReadablePeriod parsePeriodString(String periodStr) {
	ReadablePeriod period;
	char periodUnit = periodStr.charAt(periodStr.length() - 1);
	if (periodStr.equals("null") || periodUnit == 'n') {
		return null;
	}

	int periodInt = Integer.parseInt(periodStr.substring(0,
			periodStr.length() - 1));
	switch (periodUnit) {
	case 'y':
		period = Years.years(periodInt);
		break;
	case 'M':
		period = Months.months(periodInt);
		break;
	case 'w':
		period = Weeks.weeks(periodInt);
		break;
	case 'd':
		period = Days.days(periodInt);
		break;
	case 'h':
		period = Hours.hours(periodInt);
		break;
	case 'm':
		period = Minutes.minutes(periodInt);
		break;
	case 's':
		period = Seconds.seconds(periodInt);
		break;
	default:
		throw new IllegalArgumentException("Invalid schedule period unit '"
				+ periodUnit);
	}

	return period;
}
 
开发者ID:zhizhounq,项目名称:azkaban-customization,代码行数:39,代码来源:Utils.java

示例9: findUtilizationsWithResolution_when_there_are_no_utilizations

import org.joda.time.Minutes; //导入方法依赖的package包/类
@Test
public void findUtilizationsWithResolution_when_there_are_no_utilizations() {
    DateTime start = new DateTime(2000, 1, 1, 12, 0);
    DateTime end = start.plusHours(1);
    Minutes resolution = Minutes.minutes(30);

    Utilization dummy = newUtilization(facilityId, start, 100, 100);
    UtilizationKey utilizationKey = dummy.getUtilizationKey();

    List<Utilization> results = utilizationDao.findUtilizationsWithResolution(utilizationKey, start, end, resolution);
    assertThat(results).isEmpty();
}
 
开发者ID:HSLdevcom,项目名称:parkandrideAPI,代码行数:13,代码来源:UtilizationDaoTest.java

示例10: findUtilizationsWithResolution_when_the_first_utilization_is_within_the_range

import org.joda.time.Minutes; //导入方法依赖的package包/类
@Test
public void findUtilizationsWithResolution_when_the_first_utilization_is_within_the_range() {
    DateTime start = new DateTime(2000, 1, 1, 12, 0);
    DateTime end = start.plusHours(1);
    Minutes resolution = Minutes.minutes(30);

    Utilization u1 = newUtilization(facilityId, start.plusMinutes(15), 100, 100);
    utilizationDao.insertUtilizations(asList(u1));
    UtilizationKey utilizationKey = u1.getUtilizationKey();

    List<Utilization> results = utilizationDao.findUtilizationsWithResolution(utilizationKey, start, end, resolution);
    assertThat(results).containsExactly(
            newUtilization(facilityId, start.plus(resolution), 100, 100),
            newUtilization(facilityId, end, 100, 100));
}
 
开发者ID:HSLdevcom,项目名称:parkandrideAPI,代码行数:16,代码来源:UtilizationDaoTest.java

示例11: setValue

import org.joda.time.Minutes; //导入方法依赖的package包/类
@Override
public void setValue(Object value) {
    if (value == null || value instanceof Minutes) {
        super.setValue(value);
    } else if (value instanceof Number) {
        super.setValue(Minutes.minutes(abs(((Number) value).intValue())));
    } else {
        throw new IllegalArgumentException("Invalid value " + value);
    }
}
 
开发者ID:griffon-legacy,项目名称:griffon-scaffolding-plugin,代码行数:11,代码来源:MinutesValue.java

示例12: updateSchedules

import org.joda.time.Minutes; //导入方法依赖的package包/类
public void updateSchedules(Reportal report, ScheduleManager scheduleManager,
    User user, Flow flow) throws ScheduleManagerException {
  // Clear previous schedules
  removeSchedules(scheduleManager);
  // Add new schedule
  if (schedule) {
    int hour =
        (Integer.parseInt(scheduleHour) % 12)
            + (scheduleAmPm.equalsIgnoreCase("pm") ? 12 : 0);
    int minute = Integer.parseInt(scheduleMinute) % 60;
    DateTimeZone timeZone =
        scheduleTimeZone.equalsIgnoreCase("UTC") ? DateTimeZone.UTC
            : DateTimeZone.getDefault();
    DateTime firstSchedTime =
        DateTimeFormat.forPattern("MM/dd/yyyy").withZone(timeZone)
            .parseDateTime(scheduleDate);
    firstSchedTime =
        firstSchedTime.withHourOfDay(hour).withMinuteOfHour(minute)
            .withSecondOfMinute(0).withMillisOfSecond(0);

    ReadablePeriod period = null;
    if (scheduleRepeat) {
      int intervalQuantity = Integer.parseInt(scheduleIntervalQuantity);

      if (scheduleInterval.equals("y")) {
        period = Years.years(intervalQuantity);
      } else if (scheduleInterval.equals("m")) {
        period = Months.months(intervalQuantity);
      } else if (scheduleInterval.equals("w")) {
        period = Weeks.weeks(intervalQuantity);
      } else if (scheduleInterval.equals("d")) {
        period = Days.days(intervalQuantity);
      } else if (scheduleInterval.equals("h")) {
        period = Hours.hours(intervalQuantity);
      } else if (scheduleInterval.equals("M")) {
        period = Minutes.minutes(intervalQuantity);
      }
    }

    ExecutionOptions options = new ExecutionOptions();
    options.getFlowParameters().put("reportal.execution.user",
        user.getUserId());
    options.getFlowParameters().put("reportal.title", report.title);
    options.getFlowParameters().put("reportal.render.results.as.html",
        report.renderResultsAsHtml ? "true" : "false");
    options.setMailCreator(ReportalMailCreator.REPORTAL_MAIL_CREATOR);

    long endScheduleTime = report.endSchedule == null ?
        DEFAULT_SCHEDULE_END_EPOCH_TIME: parseDateToEpoch(report.endSchedule);

    logger.info("This report scheudle end time is " + endScheduleTime);

    scheduleManager.scheduleFlow(-1, project.getId(), project.getName(),
        flow.getId(), "ready", firstSchedTime.getMillis(), endScheduleTime,
        firstSchedTime.getZone(), period, DateTime.now().getMillis(),
        firstSchedTime.getMillis(), firstSchedTime.getMillis(),
        user.getUserId(), options, null);
  }
}
 
开发者ID:azkaban,项目名称:azkaban-plugins,代码行数:60,代码来源:Reportal.java

示例13: fromNonNullString

import org.joda.time.Minutes; //导入方法依赖的package包/类
@Override
public Minutes fromNonNullString(String s) {
    return Minutes.minutes(Integer.parseInt(s));
}
 
开发者ID:JadiraOrg,项目名称:jadira,代码行数:5,代码来源:IntegerColumnMinutesMapper.java

示例14: fromNonNullValue

import org.joda.time.Minutes; //导入方法依赖的package包/类
@Override
public Minutes fromNonNullValue(Integer value) {
    return Minutes.minutes(value);
}
 
开发者ID:JadiraOrg,项目名称:jadira,代码行数:5,代码来源:IntegerColumnMinutesMapper.java


注:本文中的org.joda.time.Minutes.minutes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。