146 * Format with 1.5 : is 1+
147 * Format with 2 : is two
148 * Format with 2.1 : is more than 2.
149 * Format with NaN : is negative
150 * Format with +INF : is more than 2.
151 * }</pre>
152 * </blockquote>
153 *
154 * <h3><a id="synchronization">Synchronization</a></h3>
155 *
156 * <p>
157 * Choice formats are not synchronized.
158 * It is recommended to create separate format instances for each thread.
159 * If multiple threads access a format concurrently, it must be synchronized
160 * externally.
161 *
162 *
163 * @see DecimalFormat
164 * @see MessageFormat
165 * @author Mark Davis
166 */
167 public class ChoiceFormat extends NumberFormat {
168
169 // Proclaim serial compatibility with 1.1 FCS
170 private static final long serialVersionUID = 1795184449645032964L;
171
172 /**
173 * Sets the pattern.
174 * @param newPattern See the class description.
175 * @exception NullPointerException if {@code newPattern}
176 * is {@code null}
177 */
178 public void applyPattern(String newPattern) {
179 StringBuffer[] segments = new StringBuffer[2];
180 for (int i = 0; i < segments.length; ++i) {
181 segments[i] = new StringBuffer();
182 }
183 double[] newChoiceLimits = new double[30];
184 String[] newChoiceFormats = new String[30];
185 int count = 0;
|
146 * Format with 1.5 : is 1+
147 * Format with 2 : is two
148 * Format with 2.1 : is more than 2.
149 * Format with NaN : is negative
150 * Format with +INF : is more than 2.
151 * }</pre>
152 * </blockquote>
153 *
154 * <h3><a id="synchronization">Synchronization</a></h3>
155 *
156 * <p>
157 * Choice formats are not synchronized.
158 * It is recommended to create separate format instances for each thread.
159 * If multiple threads access a format concurrently, it must be synchronized
160 * externally.
161 *
162 *
163 * @see DecimalFormat
164 * @see MessageFormat
165 * @author Mark Davis
166 * @since 1.1
167 */
168 public class ChoiceFormat extends NumberFormat {
169
170 // Proclaim serial compatibility with 1.1 FCS
171 private static final long serialVersionUID = 1795184449645032964L;
172
173 /**
174 * Sets the pattern.
175 * @param newPattern See the class description.
176 * @exception NullPointerException if {@code newPattern}
177 * is {@code null}
178 */
179 public void applyPattern(String newPattern) {
180 StringBuffer[] segments = new StringBuffer[2];
181 for (int i = 0; i < segments.length; ++i) {
182 segments[i] = new StringBuffer();
183 }
184 double[] newChoiceLimits = new double[30];
185 String[] newChoiceFormats = new String[30];
186 int count = 0;
|