1 /* |
1 /* |
2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
69 |
69 |
70 /** |
70 /** |
71 * Get the value for an option. |
71 * Get the value for an option. |
72 */ |
72 */ |
73 public String get(Option option) { |
73 public String get(Option option) { |
74 return values.get(option.text); |
74 return values.get(option.primaryName); |
75 } |
75 } |
76 |
76 |
77 /** |
77 /** |
78 * Get the boolean value for an option, patterned after Boolean.getBoolean, |
78 * Get the boolean value for an option, patterned after Boolean.getBoolean, |
79 * essentially will return true, iff the value exists and is set to "true". |
79 * essentially will return true, iff the value exists and is set to "true". |
99 |
99 |
100 /** |
100 /** |
101 * Check if the value for an option has been set. |
101 * Check if the value for an option has been set. |
102 */ |
102 */ |
103 public boolean isSet(Option option) { |
103 public boolean isSet(Option option) { |
104 return (values.get(option.text) != null); |
104 return (values.get(option.primaryName) != null); |
105 } |
105 } |
106 |
106 |
107 /** |
107 /** |
108 * Check if the value for a choice option has been set to a specific value. |
108 * Check if the value for a choice option has been set to a specific value. |
109 */ |
109 */ |
110 public boolean isSet(Option option, String value) { |
110 public boolean isSet(Option option, String value) { |
111 return (values.get(option.text + value) != null); |
111 return (values.get(option.primaryName + value) != null); |
112 } |
112 } |
113 |
113 |
114 /** |
114 /** |
115 * Check if the value for an undocumented option has not been set. |
115 * Check if the value for an undocumented option has not been set. |
116 */ |
116 */ |
120 |
120 |
121 /** |
121 /** |
122 * Check if the value for an option has not been set. |
122 * Check if the value for an option has not been set. |
123 */ |
123 */ |
124 public boolean isUnset(Option option) { |
124 public boolean isUnset(Option option) { |
125 return (values.get(option.text) == null); |
125 return (values.get(option.primaryName) == null); |
126 } |
126 } |
127 |
127 |
128 /** |
128 /** |
129 * Check if the value for a choice option has not been set to a specific value. |
129 * Check if the value for a choice option has not been set to a specific value. |
130 */ |
130 */ |
131 public boolean isUnset(Option option, String value) { |
131 public boolean isUnset(Option option, String value) { |
132 return (values.get(option.text + value) == null); |
132 return (values.get(option.primaryName + value) == null); |
133 } |
133 } |
134 |
134 |
135 public void put(String name, String value) { |
135 public void put(String name, String value) { |
136 values.put(name, value); |
136 values.put(name, value); |
137 } |
137 } |
138 |
138 |
139 public void put(Option option, String value) { |
139 public void put(Option option, String value) { |
140 values.put(option.text, value); |
140 values.put(option.primaryName, value); |
141 } |
141 } |
142 |
142 |
143 public void putAll(Options options) { |
143 public void putAll(Options options) { |
144 values.putAll(options.values); |
144 values.putAll(options.values); |
145 } |
145 } |