1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.hadoop.hbase.classification.tools;
19
20 import com.sun.javadoc.DocErrorReporter;
21
22 import java.util.ArrayList;
23 import java.util.List;
24
25 class StabilityOptions {
26 public static final String STABLE_OPTION = "-stable";
27 public static final String EVOLVING_OPTION = "-evolving";
28 public static final String UNSTABLE_OPTION = "-unstable";
29
30 public static Integer optionLength(String option) {
31 String opt = option.toLowerCase();
32 if (opt.equals(UNSTABLE_OPTION)) return 1;
33 if (opt.equals(EVOLVING_OPTION)) return 1;
34 if (opt.equals(STABLE_OPTION)) return 1;
35 return null;
36 }
37
38 public static void validOptions(String[][] options,
39 DocErrorReporter reporter) {
40 for (int i = 0; i < options.length; i++) {
41 String opt = options[i][0].toLowerCase();
42 if (opt.equals(UNSTABLE_OPTION)) {
43 RootDocProcessor.stability = UNSTABLE_OPTION;
44 } else if (opt.equals(EVOLVING_OPTION)) {
45 RootDocProcessor.stability = EVOLVING_OPTION;
46 } else if (opt.equals(STABLE_OPTION)) {
47 RootDocProcessor.stability = STABLE_OPTION;
48 }
49 }
50 }
51
52 public static String[][] filterOptions(String[][] options) {
53 List<String[]> optionsList = new ArrayList<String[]>();
54 for (int i = 0; i < options.length; i++) {
55 if (!options[i][0].equalsIgnoreCase(UNSTABLE_OPTION)
56 && !options[i][0].equalsIgnoreCase(EVOLVING_OPTION)
57 && !options[i][0].equalsIgnoreCase(STABLE_OPTION)) {
58 optionsList.add(options[i]);
59 }
60 }
61 String[][] filteredOptions = new String[optionsList.size()][];
62 int i = 0;
63 for (String[] option : optionsList) {
64 filteredOptions[i++] = option;
65 }
66 return filteredOptions;
67 }
68
69 }