年龄Age的计算(可以精确到1岁3个月10天)
摘要:
import java.text.SimpleDateFormat/** * 年龄对象(3岁、3个月、30天) */class Age { Integer age AgeUnit unit Integer year Integer month Integer day Age() { } Age(int age) { this.age = age unit = AgeUnit.YearOfAge } Age(String str) { def regular = /^(\d+)(\S+)?/ if (!(str ==~ regular)) { throw new IllegalArgumentE 阅读全文
posted @ 2011-06-28 21:45 飞飞狐 阅读(679) 评论(2) 推荐(0) 编辑