ParameterChecker.java revision e09fd9e819c23dc90bca68375645e15544861330
1
2import java.io.BufferedReader;
3import java.util.HashMap;
4
5public class ParameterChecker {
6
7    HashMap<String,String[]> map = new HashMap<String,String[]>();
8
9    public ParameterChecker(BufferedReader reader) throws Exception {
10        String s;
11        while ((s = reader.readLine()) != null) {
12            String[] tokens = s.split("\\s");
13            map.put(tokens[0], tokens);
14        }
15    }
16
17    public String[] getChecks(String functionName) {
18        String[] checks = map.get(functionName);
19        if (checks == null &&
20            (functionName.endsWith("fv") ||
21             functionName.endsWith("xv") ||
22             functionName.endsWith("iv"))) {
23            functionName = functionName.substring(0, functionName.length() - 2);
24            checks = map.get(functionName);
25        }
26        return checks;
27    }
28}
29