Lines Matching refs:pattern

71  * with a default format pattern. You may modify the format pattern
78 * Date and time formats are specified by <em>date and time pattern</em>
80 * Within date and time pattern strings, unquoted letters from
82 * <code>'z'</code> are interpreted as pattern letters representing the
91 * The following pattern letters are defined (all other characters from
95 * <table border=0 cellspacing=3 cellpadding=0 summary="Chart shows pattern letters, date/time component, presentation, and examples.">
217 * For formatting, if the number of pattern letters is 4 or more,
221 * of pattern letters.<br><br></li>
223 * For formatting, the number of pattern letters is the minimum
225 * For parsing, the number of pattern letters is ignored unless
231 * <li>For formatting, if the number of pattern letters is 2, the year
234 * <li>For parsing, if the number of pattern letters is more than 2,
236 * digits. So using the pattern "MM/dd/yyyy", "01/11/12" parses to
238 * <li>For parsing with the abbreviated year pattern ("y" or "yy"),
242 * instance is created. For example, using a pattern of "MM/dd/yy" and a
251 * same pattern, as Jan 2, 3 AD. Likewise, "01/02/-3" is parsed as Jan 2, 4 BC.
254 * For both formatting and parsing, if the number of pattern
269 * If the number of pattern letters is 3 or more, the month is
307 * The number of pattern letters designates the format for both formatting
327 * produced. If the number of pattern letters is 1, any fraction of an hour
328 * is ignored. For example, if the pattern is {@code "X"} and the time zone is
334 * <p>If the number of pattern letters is 4 or more, {@link
337 * pattern}.
340 * pattern</em> strings. In these strings, the pattern letters described above
341 * may be replaced with other, locale dependent, pattern letters.
343 * other than the pattern letters; that's up to the client of the class.
435 * The pattern string of this formatter. This is always a non-localized
436 * pattern. May not be null. See class documentation for details.
439 private String pattern;
442 * Saved numberFormat and pattern.
460 * The compiled pattern.
465 * Tags for the compiled pattern.
535 * Constructs a <code>SimpleDateFormat</code> using the default pattern and
546 * Constructs a <code>SimpleDateFormat</code> using the given pattern and
552 * @param pattern the pattern describing the date and time format
553 * @exception NullPointerException if the given pattern is null
554 * @exception IllegalArgumentException if the given pattern is invalid
556 public SimpleDateFormat(String pattern)
558 this(pattern, Locale.getDefault(Locale.Category.FORMAT));
562 * Constructs a <code>SimpleDateFormat</code> using the given pattern and
568 * @param pattern the pattern describing the date and time format
570 * @exception NullPointerException if the given pattern or locale is null
571 * @exception IllegalArgumentException if the given pattern is invalid
573 public SimpleDateFormat(String pattern, Locale locale)
575 if (pattern == null || locale == null) {
580 this.pattern = pattern;
587 * Constructs a <code>SimpleDateFormat</code> using the given pattern and
590 * @param pattern the pattern describing the date and time format
592 * @exception NullPointerException if the given pattern or formatSymbols is null
593 * @exception IllegalArgumentException if the given pattern is invalid
595 public SimpleDateFormat(String pattern, DateFormatSymbols formatSymbols)
597 if (pattern == null || formatSymbols == null) {
601 this.pattern = pattern;
639 pattern = MessageFormat.format(dateTimePatterns[8], dateTimeArgs);
642 pattern = dateTimePatterns[timeStyle];
645 pattern = dateTimePatterns[dateStyle + 4];
656 // Verify and compile the given pattern.
657 compiledPattern = compile(pattern);
685 * Returns the compiled form of the given pattern. The syntax of
686 * the compiled pattern is:
732 * pattern characters. For example, if the given pattern is
736 * following the TagField. For example, if the given pattern is
741 * character in place of Length. For example, if the given pattern
745 * @exception NullPointerException if the given pattern is null
746 * @exception IllegalArgumentException if the given pattern is invalid
748 private char[] compile(String pattern) {
749 int length = pattern.length();
757 char c = pattern.charAt(i);
763 c = pattern.charAt(i + 1);
827 char d = pattern.charAt(j);
834 compiledPattern.append(pattern.charAt(i));
843 throw new IllegalArgumentException("Illegal pattern character " +
864 // Copy the compiled pattern to a char array
995 * given object, or if the Format's pattern string is invalid.
1022 // Map index into pattern character string to Calendar field number
1041 // Map index into pattern character string to DateFormat field number
1407 * pattern and the time zone value in {@code text}. Any {@code
1472 // Peek the next pattern to determine if we need to
1473 // obey the number of pattern letters for
1475 // digit text (e.g., "20010704") with a pattern which
1795 * @param ch the pattern character for the date field text to be parsed.
1796 * @param count the count of a pattern character.
1907 // If there are 3 or more YEAR pattern characters, this indicates
2176 // while pattern uses numeric style: M or MM.
2262 * Translates a pattern, mapping each character in the from string to the
2265 * @exception IllegalArgumentException if the given pattern is invalid
2267 private String translatePattern(String pattern, String from, String to) {
2270 for (int i = 0; i < pattern.length(); ++i) {
2271 char c = pattern.charAt(i);
2283 // to serialization compatibility. The pattern letters
2289 throw new IllegalArgumentException("Illegal pattern " +
2298 throw new IllegalArgumentException("Unfinished quote in pattern");
2303 * Returns a pattern string describing this date format.
2305 * @return a pattern string describing this date format.
2308 return pattern;
2312 * Returns a localized pattern string describing this date format.
2314 * @return a localized pattern string describing this date format.
2317 return translatePattern(pattern,
2323 * Applies the given pattern string to this date format.
2325 * @param pattern the new date and time pattern for this date format
2326 * @exception NullPointerException if the given pattern is null
2327 * @exception IllegalArgumentException if the given pattern is invalid
2329 public void applyPattern(String pattern)
2331 compiledPattern = compile(pattern);
2332 this.pattern = pattern;
2336 * Applies the given localized pattern string to this date format.
2338 * @param pattern a String to be mapped to the new date and time format
2339 * pattern for this format
2340 * @exception NullPointerException if the given pattern is null
2341 * @exception IllegalArgumentException if the given pattern is invalid
2343 public void applyLocalizedPattern(String pattern) {
2344 String p = translatePattern(pattern,
2348 this.pattern = p;
2394 return pattern.hashCode();
2409 return (pattern.equals(that.pattern)
2415 * pattern in the object is verified.
2417 * @exception InvalidObjectException if the pattern is invalid
2424 compiledPattern = compile(pattern);
2426 throw new InvalidObjectException("invalid pattern");