MCPcopy Create free account
hub / github.com/ReadyTalk/avian / Calendar

Class Calendar

classpath/java/util/Calendar.java:13–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11package java.util;
12
13public abstract class Calendar {
14 public static final int AM = 0;
15 public static final int AM_PM = 9;
16 public static final int DAY_OF_MONTH = 5;
17 public static final int DAY_OF_WEEK = 7;
18 public static final int HOUR = 10;
19 public static final int HOUR_OF_DAY = 11;
20 public static final int MINUTE = 12;
21 public static final int MONTH = 2;
22 public static final int PM = 1;
23 public static final int SECOND = 13;
24 public static final int YEAR = 1;
25
26 public static final int FIELD_COUNT = 17;
27
28 protected long time;
29 protected boolean isTimeSet;
30 protected int[] fields = new int[FIELD_COUNT];
31 protected boolean areFieldsSet;
32 protected boolean[] isSet = new boolean[FIELD_COUNT];
33
34 protected Calendar() { }
35
36 public static Calendar getInstance() {
37 return new MyCalendar(System.currentTimeMillis());
38 }
39
40 public int get(int field) {
41 return fields[field];
42 }
43
44 public void set(int field, int value) {
45 fields[field] = value;
46 }
47
48 public void set(int year, int month, int date) {
49 set(YEAR, year);
50 set(MONTH, month);
51 set(DAY_OF_MONTH, date);
52 }
53
54 public void setTime(Date date) {
55 time = date.getTime();
56 }
57
58 public Date getTime() {
59 return new Date(time);
60 }
61
62 public abstract void roll(int field, boolean up);
63 public abstract void add(int field, int amount);
64
65 public void roll(int field, int amount) {
66 boolean up = amount >= 0;
67 if (! up) {
68 amount = - amount;
69 }
70 for (int i = 0; i < amount; ++i) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected