| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 |  | 
|  | 2 | import java.io.BufferedReader; | 
|  | 3 | import java.util.HashMap; | 
|  | 4 |  | 
|  | 5 | public 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 | } |