Java Doc for DateTimePatternGenerator.java in  » Internationalization-Localization » icu4j » com » ibm » icu » text » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Internationalization Localization » icu4j » com.ibm.icu.text 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.ibm.icu.text.DateTimePatternGenerator

DateTimePatternGenerator
public class DateTimePatternGenerator implements Freezable,Cloneable(Code)
This class provides flexible generation of date format patterns, like "yy-MM-dd". The user can build up the generator by adding successive patterns. Once that is done, a query can be made using a "skeleton", which is a pattern which just includes the desired fields and lengths. The generator will return the "best fit" pattern corresponding to that skeleton.

The main method people will use is getBestPattern(String skeleton), since normally this class is pre-built with data from a particular locale. However, generators can be built directly from other data as well.

Issue: may be useful to also have a function that returns the list of fields in a pattern, in order, since we have that internally. That would be useful for getting the UI order of field elements.


Inner Class :final public static class PatternInfo
Inner Class :public static class VariableField
Inner Class :public static class FormatParser

Field Summary
final public static  intDAY
    
final public static  intDAYPERIOD
    
final public static  intDAY_OF_WEEK_IN_MONTH
    
final public static  intDAY_OF_YEAR
    
final public static  intERA
    
final public static  intFRACTIONAL_SECOND
    
final public static  intHOUR
    
final public static  intMINUTE
    
final public static  intMONTH
    
final public static  intQUARTER
    
final public static  intSECOND
    
final public static  intTYPE_LIMIT
    
final public static  intWEEKDAY
    
final public static  intWEEK_OF_MONTH
    
final public static  intWEEK_OF_YEAR
    
final public static  intYEAR
    
final public static  intZONE
    
static  TransliteratorfromHex
    

Constructor Summary
protected  DateTimePatternGenerator()
    

Method Summary
public  DateTimePatternGeneratoradd(String pattern, boolean override, PatternInfo returnInfo)
     Adds a pattern to the generator.
public  Objectclone()
    
public  ObjectcloneAsThawed()
    
public  Objectfreeze()
    
public  StringgetAppendItemFormats(int field)
     Getter corresponding to setAppendItemFormats.
public  StringgetAppendItemNames(int field)
     Getter corresponding to setAppendItemNames.
public  StringgetBaseSkeleton(String pattern)
     Utility to return a unique base skeleton from a given pattern.
public  SetgetBaseSkeletons(Set result)
    
public  StringgetBestPattern(String skeleton)
     Return the best pattern matching the input skeleton.
public  StringgetDateTimeFormat()
     Getter corresponding to setDateTimeFormat.
public  StringgetDecimal()
     Getter corresponding to setDecimal.
public  StringgetFields(String pattern)
    
public static  DateTimePatternGeneratorgetInstance()
     Construct a flexible generator according to data for a given locale.
public static  DateTimePatternGeneratorgetInstance(ULocale uLocale)
     Construct a flexible generator according to data for a given locale.
public  CollectiongetRedundants(Collection output)
     Redundant patterns are those which if removed, make no difference in the resulting getBestPattern values.
public  StringgetSkeleton(String pattern)
     Utility to return a unique skeleton from a given pattern.
public  MapgetSkeletons(Map result)
     Return a list of all the skeletons (in canonical form) from this class, and the patterns that they map to.
Parameters:
  result - an output Map in which to place the mapping from skeleton topattern.
public  booleanisFrozen()
    
public static  booleanisSingleField(String skeleton)
    
public static  DateTimePatternGeneratornewInstance()
     Create empty generator, to be constructed with add(...) etc.
public  StringreplaceFieldTypes(String pattern, String skeleton)
     Adjusts the field types (width and subtype) of a pattern to match what is in a skeleton.
public  voidsetAppendItemFormats(int field, String value)
     An AppendItem format is a pattern used to append a field if there is no good match.
public  voidsetAppendItemNames(int field, String value)
     Sets the names of fields, eg "era" in English for ERA.
public  voidsetDateTimeFormat(String dateTimeFormat)
     The date time format is a message format pattern used to compose date and time patterns.
public  voidsetDecimal(String decimal)
     The decimal value is used in formatting fractions of seconds.

Field Detail
DAY
final public static int DAY(Code)



DAYPERIOD
final public static int DAYPERIOD(Code)



DAY_OF_WEEK_IN_MONTH
final public static int DAY_OF_WEEK_IN_MONTH(Code)



DAY_OF_YEAR
final public static int DAY_OF_YEAR(Code)



ERA
final public static int ERA(Code)



FRACTIONAL_SECOND
final public static int FRACTIONAL_SECOND(Code)



HOUR
final public static int HOUR(Code)



MINUTE
final public static int MINUTE(Code)



MONTH
final public static int MONTH(Code)



QUARTER
final public static int QUARTER(Code)



SECOND
final public static int SECOND(Code)



TYPE_LIMIT
final public static int TYPE_LIMIT(Code)



WEEKDAY
final public static int WEEKDAY(Code)



WEEK_OF_MONTH
final public static int WEEK_OF_MONTH(Code)



WEEK_OF_YEAR
final public static int WEEK_OF_YEAR(Code)



YEAR
final public static int YEAR(Code)



ZONE
final public static int ZONE(Code)



fromHex
static Transliterator fromHex(Code)




Constructor Detail
DateTimePatternGenerator
protected DateTimePatternGenerator()(Code)
Only for use by subclasses




Method Detail
add
public DateTimePatternGenerator add(String pattern, boolean override, PatternInfo returnInfo)(Code)
Adds a pattern to the generator. If the pattern has the same skeleton as an existing pattern, and the override parameter is set, then the previous value is overriden. Otherwise, the previous value is retained. In either case, the conflicting information is returned in PatternInfo.

Note that single-field patterns (like "MMM") are automatically added, and don't need to be added explicitly!
Parameters:
  override - when existing values are to be overridden use true, otherwiseuse false.




clone
public Object clone()(Code)
Boilerplate



cloneAsThawed
public Object cloneAsThawed()(Code)
Boilerplate for Freezable



freeze
public Object freeze()(Code)
Boilerplate for Freezable



getAppendItemFormats
public String getAppendItemFormats(int field)(Code)
Getter corresponding to setAppendItemFormats. Values below 0 or at or above TYPE_LIMIT are illegal arguments.
Parameters:
  field - append pattern for field



getAppendItemNames
public String getAppendItemNames(int field)(Code)
Getter corresponding to setAppendItemNames. Values below 0 or at or above TYPE_LIMIT are illegal arguments.
Parameters:
  field - name for field



getBaseSkeleton
public String getBaseSkeleton(String pattern)(Code)
Utility to return a unique base skeleton from a given pattern. This is the same as the skeleton, except that differences in length are minimized so as to only preserve the difference between string and numeric form. So for example, both "MMM-dd" and "d/MMM" produce the skeleton "MMMd" (notice the single d).
Parameters:
  pattern - Input pattern, such as "dd/MMM" skeleton, such as "MMMdd"



getBaseSkeletons
public Set getBaseSkeletons(Set result)(Code)
Return a list of all the base skeletons (in canonical form) from this class



getBestPattern
public String getBestPattern(String skeleton)(Code)
Return the best pattern matching the input skeleton. It is guaranteed to have all of the fields in the skeleton.
Parameters:
  skeleton - The skeleton is a pattern containing only the variable fields.For example, "MMMdd" and "mmhh" are skeletons.



getDateTimeFormat
public String getDateTimeFormat()(Code)
Getter corresponding to setDateTimeFormat. pattern



getDecimal
public String getDecimal()(Code)
Getter corresponding to setDecimal. string corresponding to the decimal point



getFields
public String getFields(String pattern)(Code)
internal routine
Parameters:
  pattern - field value



getInstance
public static DateTimePatternGenerator getInstance()(Code)
Construct a flexible generator according to data for a given locale.



getInstance
public static DateTimePatternGenerator getInstance(ULocale uLocale)(Code)
Construct a flexible generator according to data for a given locale.
Parameters:
  uLocale -



getRedundants
public Collection getRedundants(Collection output)(Code)
Redundant patterns are those which if removed, make no difference in the resulting getBestPattern values. This method returns a list of them, to help check the consistency of the patterns used to build this generator.
Parameters:
  output - stores the redundant patterns that are removed. To get thesein internal order, supply a LinkedHashSet. If null, acollection is allocated. the collection with added elements.



getSkeleton
public String getSkeleton(String pattern)(Code)
Utility to return a unique skeleton from a given pattern. For example, both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd".
Parameters:
  pattern - Input pattern, such as "dd/MMM" skeleton, such as "MMMdd"



getSkeletons
public Map getSkeletons(Map result)(Code)
Return a list of all the skeletons (in canonical form) from this class, and the patterns that they map to.
Parameters:
  result - an output Map in which to place the mapping from skeleton topattern. If you want to see the internal order being used,supply a LinkedHashMap. If the input value is null, then aLinkedHashMap is allocated.

Issue: an alternate API would be to just return a list ofthe skeletons, and then have a separate routine to get fromskeleton to pattern. the input Map containing the values.




isFrozen
public boolean isFrozen()(Code)
Boilerplate for Freezable



isSingleField
public static boolean isSingleField(String skeleton)(Code)
Determines whether a skeleton contains a single field
Parameters:
  skeleton - true or not



newInstance
public static DateTimePatternGenerator newInstance()(Code)
Create empty generator, to be constructed with add(...) etc.



replaceFieldTypes
public String replaceFieldTypes(String pattern, String skeleton)(Code)
Adjusts the field types (width and subtype) of a pattern to match what is in a skeleton. That is, if you supply a pattern like "d-M H:m", and a skeleton of "MMMMddhhmm", then the input pattern is adjusted to be "dd-MMMM hh:mm". This is used internally to get the best match for the input skeleton, but can also be used externally.
Parameters:
  pattern - input pattern
Parameters:
  skeleton - pattern adjusted to match the skeleton fields widths andsubtypes.



setAppendItemFormats
public void setAppendItemFormats(int field, String value)(Code)
An AppendItem format is a pattern used to append a field if there is no good match. For example, suppose that the input skeleton is "GyyyyMMMd", and there is no matching pattern internally, but there is a pattern matching "yyyyMMMd", say "d-MM-yyyy". Then that pattern is used, plus the G. The way these two are conjoined is by using the AppendItemFormat for G (era). So if that value is, say "{0}, {1}" then the final resulting pattern is "d-MM-yyyy, G".

There are actually three available variables: {0} is the pattern so far, {1} is the element we are adding, and {2} is the name of the element.

This reflects the way that the CLDR data is organized.
Parameters:
  field - such as ERA
Parameters:
  value - pattern, such as "{0}, {1}"




setAppendItemNames
public void setAppendItemNames(int field, String value)(Code)
Sets the names of fields, eg "era" in English for ERA. These are only used if the corresponding AppendItemFormat is used, and if it contains a {2} variable.

This reflects the way that the CLDR data is organized.
Parameters:
  field -
Parameters:
  value -




setDateTimeFormat
public void setDateTimeFormat(String dateTimeFormat)(Code)
The date time format is a message format pattern used to compose date and time patterns. The default value is "{0} {1}", where {0} will be replaced by the date pattern and {1} will be replaced by the time pattern.

This is used when the input skeleton contains both date and time fields, but there is not a close match among the added patterns. For example, suppose that this object was created by adding "dd-MMM" and "hh:mm", and its datetimeFormat is the default "{0} {1}". Then if the input skeleton is "MMMdhmm", there is not an exact match, so the input skeleton is broken up into two components "MMMd" and "hmm". There are close matches for those two skeletons, so the result is put together with this pattern, resulting in "d-MMM h:mm".
Parameters:
  dateTimeFormat - message format pattern, here {0} will be replaced by the datepattern and {1} will be replaced by the time pattern.




setDecimal
public void setDecimal(String decimal)(Code)
The decimal value is used in formatting fractions of seconds. If the skeleton contains fractional seconds, then this is used with the fractional seconds. For example, suppose that the input pattern is "hhmmssSSSS", and the best matching pattern internally is "H:mm:ss", and the decimal string is ",". Then the resulting pattern is modified to be "H:mm:ss,SSSS"
Parameters:
  decimal -



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.