KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > saxon > number > Numberer


1 package net.sf.saxon.number;
2
3 /**
4   * Interface Numberer supports number formatting. There is a separate
5   * implementation for each language, e.g. Numberer_en for English.
6   * This supports the xsl:number element
7   * @author Michael H. Kay
8   */

9
10 public interface Numberer {
11
12     /**
13     * Format a number into a string
14     * @param number The number to be formatted
15     * @param picture The format token. This is a single component of the format attribute
16     * of xsl:number, e.g. "1", "01", "i", or "a"
17     * @param groupSize number of digits per group (0 implies no grouping)
18     * @param groupSeparator string to appear between groups of digits
19     * @param letterValue The letter-value specified to xsl:number: "alphabetic" or
20     * "traditional". Can also be an empty string or null.
21     * @param ordinal The value of the ordinal attribute specified to xsl:number
22     * The value "yes" indicates that ordinal numbers should be used; "" or null indicates
23     * that cardinal numbers
24     * @return the formatted number. Note that no errors are reported; if the request
25     * is invalid, the number is formatted as if the string() function were used.
26     */

27
28     public String JavaDoc format(long number,
29                          String JavaDoc picture,
30                          int groupSize,
31                          String JavaDoc groupSeparator,
32                          String JavaDoc letterValue,
33                          String JavaDoc ordinal);
34
35     /**
36      * Get a month name or abbreviation
37      * @param month The month number (1=January, 12=December)
38      * @param minWidth The minimum number of characters
39      * @param maxWidth The maximum number of characters
40      */

41
42     public String JavaDoc monthName(int month, int minWidth, int maxWidth);
43
44     /**
45      * Get a day name or abbreviation
46      * @param day The month number (1=Sunday, 7=Saturday)
47      * @param minWidth The minimum number of characters
48      * @param maxWidth The maximum number of characters
49      */

50
51     public String JavaDoc dayName(int day, int minWidth, int maxWidth);
52
53     /**
54      * Get an am/pm indicator
55      * @param minutes the minutes within the day
56      * @param minWidth minimum width of output
57      * @param maxWidth maximum width of output
58      * @return the AM or PM indicator
59      */

60
61     public String JavaDoc halfDayName(int minutes,
62                               int minWidth, int maxWidth);
63
64     /**
65      * Get an ordinal suffix for a particular component of a date/time.
66      * @param component the component specifier from a format-dateTime picture, for
67      * example "M" for the month or "D" for the day.
68      * @return a string that is acceptable in the ordinal attribute of xsl:number
69      * to achieve the required ordinal representation. For example, "-e" for the day component
70      * in German, to have the day represented as "dritte August".
71      */

72
73     public String JavaDoc getOrdinalSuffixForDateTime(String JavaDoc component);
74 }
75
76 //
77
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
78
// you may not use this file except in compliance with the License. You may obtain a copy of the
79
// License at http://www.mozilla.org/MPL/
80
//
81
// Software distributed under the License is distributed on an "AS IS" basis,
82
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
83
// See the License for the specific language governing rights and limitations under the License.
84
//
85
// The Original Code is: all this file.
86
//
87
// The Initial Developer of the Original Code is Michael H. Kay.
88
//
89
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
90
//
91
// Contributor(s): none.
92
//
93
Popular Tags