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, DocErrorReporter reporter) {
39 for (int i = 0; i < options.length; i++) {
40 String opt = options[i][0].toLowerCase();
41 if (opt.equals(UNSTABLE_OPTION)) {
42 RootDocProcessor.stability = UNSTABLE_OPTION;
43 } else if (opt.equals(EVOLVING_OPTION)) {
44 RootDocProcessor.stability = EVOLVING_OPTION;
45 } else if (opt.equals(STABLE_OPTION)) {
46 RootDocProcessor.stability = STABLE_OPTION;
47 }
48 }
49 }
50
51 public static String[][] filterOptions(String[][] options) {
52 List<String[]> optionsList = new ArrayList<String[]>();
53 for (int i = 0; i < options.length; i++) {
54 if (!options[i][0].equalsIgnoreCase(UNSTABLE_OPTION)
55 && !options[i][0].equalsIgnoreCase(EVOLVING_OPTION)
56 && !options[i][0].equalsIgnoreCase(STABLE_OPTION)) {
57 optionsList.add(options[i]);
58 }
59 }
60 String[][] filteredOptions = new String[optionsList.size()][];
61 int i = 0;
62 for (String[] option : optionsList) {
63 filteredOptions[i++] = option;
64 }
65 return filteredOptions;
66 }
67
68 }