Skip to content

Commit 82bc044

Browse files
committed
moved era calculation to a central (algebra) class.
1 parent 7776f84 commit 82bc044

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/net/sharksystem/asap/ASAP.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
package net.sharksystem.asap;
22

33
public class ASAP {
4-
public static int nextEra(int workingEra) {
5-
if(workingEra == Integer.MAX_VALUE) {
6-
return 0;
7-
}
4+
public static final int INITIAL_ERA = 0;
5+
public static final int MAX_ERA = Integer.MAX_VALUE;
86

7+
static int nextEra(int workingEra) {
8+
if(workingEra == ASAP.MAX_ERA) {
9+
return ASAP.INITIAL_ERA;
10+
}
911
return workingEra+1;
1012
}
1113

12-
public static int previousEra(int workingEra) {
13-
if(workingEra == 0) {
14-
return Integer.MAX_VALUE;
14+
static int previousEra(int workingEra) {
15+
if(workingEra == ASAP.INITIAL_ERA) {
16+
return ASAP.MAX_ERA;
1517
}
16-
1718
return workingEra-1;
1819
}
1920
}

0 commit comments

Comments
 (0)