在做一个小项目时,我收到了一些我应该重写为 Objective-C 的 Java 代码(准确地说是 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
,但这并不是我真正想要的。
谢谢,任何帮助将不胜感激。:)