diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/Assignment 2/src/ca/cosc3p91/a2/util/Print.java b/Assignment 2/src/ca/cosc3p91/a2/util/Print.java new file mode 100644 index 0000000..0cf0ac4 --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/util/Print.java @@ -0,0 +1,7 @@ +package ca.cosc3p91.a2.util; + +public class Print { + + + +} diff --git a/Assignment 2/src/ca/cosc3p91/a2/util/Time.java b/Assignment 2/src/ca/cosc3p91/a2/util/Time.java new file mode 100644 index 0000000..d006449 --- /dev/null +++ b/Assignment 2/src/ca/cosc3p91/a2/util/Time.java @@ -0,0 +1,48 @@ +package ca.cosc3p91.a2.util; + +public class Time { + + private long timeSeconds; + + protected Time(long timeSeconds) { + this.timeSeconds = timeSeconds; + } + + public Time offsetSeconds(long seconds){ + timeSeconds += seconds; + return this; + } + + public Time offsetMinutes(long minutes) { + return offsetSeconds(minutes * 60); + } + + public Time offsetHours(long hours) { + return offsetMinutes(hours * 60); + } + + public Time offsetDays(long days){ + return offsetHours(days * 24); + } + + public long get(){ + return timeSeconds; + } + + public static class FutureTime { + private final Time futureTime; + + public FutureTime(Time futureTime){ + this.futureTime = futureTime; + } + + public boolean occurred(){ + return getTime().timeSeconds >= futureTime.timeSeconds; + } + } + + public static Time getTime(){ + return new Time(System.currentTimeMillis() / 1000); + } + +}