有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

Objective中的java时间段

在做一个小项目时,我收到了一些Java代码,我应该将其重写为Objective-C(准确地说是iPhone)。我遇到了这段代码:

public class Period {
  private org.joda.time.Period jodaPeriod;
  public Period(org.joda.time.Period jodaPeriod) {
    Validate.isTrue(PeriodType.standard().equals(jodaPeriod.getPeriodType()),
            "The jodaPeriod argument must be a standard type period");
    this.jodaPeriod = jodaPeriod;
  }

  public Period(int months) {
    this(new org.joda.time.Period(months / 12, months % 12, 0, 0, 0, 0, 0, 0));
  }

  public Period(int years, int months) {
    this(new org.joda.time.Period(years, months, 0, 0, 0, 0, 0, 0));
  }
  //some other code
}

经过快速研究,我掌握了JodaTime period的基本知识,但我仍然不知道如何在Objective-C中做到这一点。我读过CMTime,但这并不是我真正想要的

谢谢你,任何帮助都将不胜感激。:)


共 (0) 个答案