forked from AY1920S1-CS2103T-T09-4/main
-
Notifications
You must be signed in to change notification settings - Fork 1
/
StatsParseUtil.java
37 lines (31 loc) · 971 Bytes
/
StatsParseUtil.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package seedu.address.statistic;
import java.util.Calendar;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* utility class to check stats Input
*/
public class StatsParseUtil {
public static final Calendar MIN_DATE = new Calendar
.Builder()
.setInstant(new Date(Long.MIN_VALUE))
.build();
public static final Calendar MAX_DATE = new Calendar
.Builder()
.setInstant(new Date(Long.MAX_VALUE))
.build();
/**
* list of valid stat types
*/
private static final String regexList = "\\bPROFIT\\b|\\bCOST\\b|\\bREVENUE\\b";
/**
* Returns true if a given string is a valid Stat Type.
*/
public static boolean isValidStatType(String test) {
Pattern p = Pattern.compile(regexList);
Matcher m = p.matcher(test);
return m.find();
}
//generate-s s/PROFIT d1/2018.12.12 d2/2019.12.12
}