Lines Matching defs:pattern

81  * <p>A <code>DecimalFormat</code> comprises a <em>pattern</em> and a set of
82 * <em>symbols</em>. The pattern may be set directly using
85 * the <code>NumberFormat</code> factory methods, the pattern and symbols are
127 * <p>A <code>DecimalFormat</code> pattern contains a positive and negative
136 * pattern. That means that <code>"#,##0.0#;(#)"</code> produces precisely
153 * 1,0000,0000. If you supply a pattern with multiple grouping characters, the
160 * <p>Many characters in a pattern are taken literally; they are matched during
232 * If present in a pattern, the monetary decimal separator
251 * notation <em>only via a pattern</em>; there is currently no factory method
252 * that creates a scientific notation format. In a pattern, the exponent
261 * from the pattern. This allows patterns such as <code>"0.###E0 m/s"</code>.
272 * e.g., <code>"##0.#####E0"</code>. Using this pattern, the number 12345
381 * Creates a DecimalFormat using the default pattern and symbols
397 // try to get the pattern from the cache
398 String pattern = cachedLocaleData.get(def);
399 if (pattern == null) { /* cache miss */
400 // Get the pattern for the default locale.
403 pattern = all[0];
405 cachedLocaleData.putIfAbsent(def, pattern);
410 applyPattern(pattern, false);
415 * Creates a DecimalFormat using the given pattern and the symbols
424 * @param pattern A non-localized pattern string.
425 * @exception NullPointerException if <code>pattern</code> is null
426 * @exception IllegalArgumentException if the given pattern is invalid.
432 public DecimalFormat(String pattern) {
435 applyPattern(pattern, false);
440 * Creates a DecimalFormat using the given pattern and symbols.
450 * @param pattern a non-localized pattern string
453 * @exception IllegalArgumentException if the given pattern is invalid
460 public DecimalFormat (String pattern, DecimalFormatSymbols symbols) {
463 applyPattern(pattern, false);
1010 // The exponent is output using the pattern-specified minimum
1566 // "x" with pattern "#0.00" (return index and error index both 0)
1567 // parse "$" with pattern "$#0.00". (return index 0 and error
1952 * Synthesizes a pattern string that represents the current state
1961 * Synthesizes a localized pattern string that represents the current
1970 * Expand the affix pattern strings into the expanded affix strings. If any
1971 * affix pattern string is null, do not expand it. This method should be
1997 * Expand an affix pattern into an affix string. All characters in the
1998 * pattern are literal unless prefixed by QUOTE. The following characters
2004 * itself at the end of the pattern.
2006 * @param pattern the non-null, possibly empty pattern
2008 * @return the expanded equivalent of pattern
2010 private String expandAffix(String pattern, StringBuffer buffer) {
2012 for (int i=0; i<pattern.length(); ) {
2013 char c = pattern.charAt(i++);
2015 c = pattern.charAt(i++);
2018 if (i<pattern.length() &&
2019 pattern.charAt(i) == CURRENCY_SIGN) {
2043 * Expand an affix pattern into an array of FieldPositions describing
2044 * how the pattern would be expanded.
2046 * pattern are literal unless prefixed by QUOTE. The following characters
2052 * itself at the end of the pattern.
2054 * @param pattern the non-null, possibly empty pattern
2057 private FieldPosition[] expandAffix(String pattern) {
2060 for (int i=0; i<pattern.length(); ) {
2061 char c = pattern.charAt(i++);
2065 c = pattern.charAt(i++);
2069 if (i<pattern.length() &&
2070 pattern.charAt(i) == CURRENCY_SIGN) {
2122 * Appends an affix pattern to the given StringBuffer, quoting special
2123 * characters as needed. Uses the internal affix pattern, if that exists,
2124 * or the literal affix, if the internal affix pattern is null. The
2125 * appended string will generate the same affix pattern (or literal affix)
2129 * @param affixPattern a pattern such as posPrefixPattern; may be null
2133 * @param localized true if the appended pattern should contain localized
2134 * pattern characters; otherwise, non-localized pattern chars are appended
2222 * Does the real work of generating a pattern. */
2283 * Apply the given pattern to this Format object. A pattern is a
2291 * For negative numbers, use a second pattern, separated by a semicolon
2298 * these are presumed to be set in the positive pattern.
2300 * @exception NullPointerException if <code>pattern</code> is null
2301 * @exception IllegalArgumentException if the given pattern is invalid.
2303 public void applyPattern(String pattern) {
2304 applyPattern(pattern, false);
2308 * Apply the given pattern to this Format object. The pattern
2309 * is assumed to be in a localized notation. A pattern is a
2317 * For negative numbers, use a second pattern, separated by a semicolon
2324 * these are presumed to be set in the positive pattern.
2326 * @exception NullPointerException if <code>pattern</code> is null
2327 * @exception IllegalArgumentException if the given pattern is invalid.
2329 public void applyLocalizedPattern(String pattern) {
2330 applyPattern(pattern, true);
2334 * Does the real work of applying a pattern.
2336 private void applyPattern(String pattern, boolean localized) {
2362 // Two variables are used to record the subrange of the pattern
2364 // second pattern (the one representing negative numbers) to ensure
2370 for (int j = 1; j >= 0 && start < pattern.length(); --j) {
2380 // the section of the pattern with digits, decimal separator,
2391 for (int pos = start; pos < pattern.length(); ++pos) {
2392 char ch = pattern.charAt(pos);
2402 if ((pos+1) < pattern.length() &&
2403 pattern.charAt(pos+1) == QUOTE) {
2427 boolean doubled = (pos + 1) < pattern.length() &&
2428 pattern.charAt(pos + 1) == CURRENCY_SIGN;
2441 if ((pos+1) < pattern.length() &&
2442 pattern.charAt(pos+1) == QUOTE) {
2453 // in the second pattern (j == 0).
2456 ch + "' in pattern \"" + pattern + '"');
2459 pos = pattern.length();
2466 throw new IllegalArgumentException("Too many percent/per mille characters in pattern \"" +
2467 pattern + '"');
2474 throw new IllegalArgumentException("Too many percent/per mille characters in pattern \"" +
2475 pattern + '"');
2494 // processing the first sub-pattern, we just record its
2509 // to occur in the pattern ####0000.####, and we record the
2527 throw new IllegalArgumentException("Unexpected '0' in pattern \"" +
2528 pattern + '"');
2538 throw new IllegalArgumentException("Multiple decimal separators in pattern \"" +
2539 pattern + '"');
2542 } else if (pattern.regionMatches(pos, exponent, 0, exponent.length())){
2545 "symbols in pattern \"" + pattern + '"');
2551 // of the pattern, then jump into phase 2.
2553 while (pos < pattern.length() &&
2554 pattern.charAt(pos) == zeroDigit) {
2563 "pattern \"" + pattern + '"');
2582 // Handle patterns with no '0' pattern character. These patterns
2610 throw new IllegalArgumentException("Malformed pattern \"" +
2611 pattern + '"');
2646 if (pattern.length() == 0) {
2654 // If there was no negative pattern, or if the negative pattern is
2655 // identical to the positive pattern, then prepend the minus sign to
2656 // the positive pattern to form the negative pattern.
2920 * <p>Stream versions older than 2 will not have the affix pattern variables
2996 * The prefix pattern for non-negative numbers. This variable corresponds
2999 * <p>This pattern is expanded by the method <code>expandAffix()</code> to
3013 * The suffix pattern for non-negative numbers. This variable corresponds
3024 * The prefix pattern for negative numbers. This variable corresponds
3035 * The suffix pattern for negative numbers. This variable corresponds
3251 * CURRENCY_SIGN is seen in a pattern, then the decimal separator is