Java Doc for UnitFormat.java in  » Science » jscience-4.3.1 » javax » measure » unit » 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 » Science » jscience 4.3.1 » javax.measure.unit 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.text.Format
      javax.measure.unit.UnitFormat

UnitFormat
abstract public class UnitFormat extends Format (Code)

This class provides the interface for formatting and parsing Unit units .

For all SI units, the 20 SI prefixes used to form decimal multiples and sub-multiples of SI units are recognized. NonSI units are directly recognized. For example:[code] Unit.valueOf("m°C").equals(SI.MILLI(SI.CELSIUS)) Unit.valueOf("kW").equals(SI.KILO(SI.WATT)) Unit.valueOf("ft").equals(SI.METER.multiply(0.3048))[/code]


author:
   Jean-Marie Dautelle
author:
   Eric Russell
version:
   1.3, August 29, 2006

Inner Class :protected static class DefaultFormat extends UnitFormat
Inner Class :protected static class ASCIIFormat extends DefaultFormat


Constructor Summary
protected  UnitFormat()
     Base constructor.

Method Summary
abstract public  voidalias(Unit unit, String alias)
     Attaches a system-wide alias to this unit.
abstract public  Appendableformat(Unit unit, Appendable appendable)
     Formats the specified unit.
final public  StringBufferformat(Object unit, StringBuffer toAppendTo, FieldPosition pos)
     Formats an unit and appends the resulting text to a given string buffer (implements java.text.Format).
Parameters:
  unit - the unit to format.
Parameters:
  toAppendTo - where the text is to be appended
Parameters:
  pos - the field position (not used).
public static  UnitFormatgetInstance()
     Returns the unit format for the default locale (format used by Unit.valueOf(CharSequence) Unit.valueOf(CharSequence) and Unit.toString Unit.toString() ).
public static  UnitFormatgetInstance(Locale inLocale)
     Returns the unit format for the specified locale.
public static  UnitFormatgetUCUMInstance()
     Returns the UCUM international unit format; this format uses characters range 0000-007F exclusively and is not locale-sensitive.
abstract public  booleanisValidIdentifier(String name)
     Indicates if the specified name can be used as unit identifier.
Parameters:
  name - the identifier to be tested.
abstract public  voidlabel(Unit unit, String label)
     Attaches a system-wide label to the specified unit.
final public  UnitparseObject(String source, ParsePosition pos)
     Parses the text from a string to produce an object (implements java.text.Format).
Parameters:
  source - the string source, part of which should be parsed.
Parameters:
  pos - the cursor position.
abstract public  Unit<? extends Quantity>parseProductUnit(CharSequence csq, ParsePosition pos)
     Parses a sequence of character to produce a unit or a rational product of unit.
abstract public  Unit<? extends Quantity>parseSingleUnit(CharSequence csq, ParsePosition pos)
     Parses a sequence of character to produce a single unit.


Constructor Detail
UnitFormat
protected UnitFormat()(Code)
Base constructor.




Method Detail
alias
abstract public void alias(Unit unit, String alias)(Code)
Attaches a system-wide alias to this unit. Multiple aliases may be attached to the same unit. Aliases are used during parsing to recognize different variants of the same unit. For example: [code] UnitFormat.getLocaleInstance().alias(METER.multiply(0.3048), "foot"); UnitFormat.getLocaleInstance().alias(METER.multiply(0.3048), "feet"); UnitFormat.getLocaleInstance().alias(METER, "meter"); UnitFormat.getLocaleInstance().alias(METER, "metre"); [/code] If the specified label is already associated to an unit the previous association is discarded or ignored.
Parameters:
  unit - the unit being aliased.
Parameters:
  alias - the alias attached to this unit.
throws:
  IllegalArgumentException - if the label is not a UnitFormat.isValidIdentifier(String) valid identifier.



format
abstract public Appendable format(Unit unit, Appendable appendable) throws IOException(Code)
Formats the specified unit.
Parameters:
  unit - the unit to format.
Parameters:
  appendable - the appendable destination.
throws:
  IOException - if an error occurs.



format
final public StringBuffer format(Object unit, StringBuffer toAppendTo, FieldPosition pos)(Code)
Formats an unit and appends the resulting text to a given string buffer (implements java.text.Format).
Parameters:
  unit - the unit to format.
Parameters:
  toAppendTo - where the text is to be appended
Parameters:
  pos - the field position (not used). toAppendTo



getInstance
public static UnitFormat getInstance()(Code)
Returns the unit format for the default locale (format used by Unit.valueOf(CharSequence) Unit.valueOf(CharSequence) and Unit.toString Unit.toString() ). the default unit format (locale sensitive).



getInstance
public static UnitFormat getInstance(Locale inLocale)(Code)
Returns the unit format for the specified locale. the unit format for the specified locale.



getUCUMInstance
public static UnitFormat getUCUMInstance()(Code)
Returns the UCUM international unit format; this format uses characters range 0000-007F exclusively and is not locale-sensitive. For example: kg.m/s2 the UCUM international format.



isValidIdentifier
abstract public boolean isValidIdentifier(String name)(Code)
Indicates if the specified name can be used as unit identifier.
Parameters:
  name - the identifier to be tested. true if the name specified can be used as label or alias for this format;false otherwise.



label
abstract public void label(Unit unit, String label)(Code)
Attaches a system-wide label to the specified unit. For example: [code] UnitFormat.getInstance().label(DAY.multiply(365), "year"); UnitFormat.getInstance().label(METER.multiply(0.3048), "ft"); [/code] If the specified label is already associated to an unit the previous association is discarded or ignored.
Parameters:
  unit - the unit being labelled.
Parameters:
  label - the new label for this unit.
throws:
  IllegalArgumentException - if the label is not a UnitFormat.isValidIdentifier(String) valid identifier.



parseObject
final public Unit parseObject(String source, ParsePosition pos)(Code)
Parses the text from a string to produce an object (implements java.text.Format).
Parameters:
  source - the string source, part of which should be parsed.
Parameters:
  pos - the cursor position. the corresponding unit or null if the string cannot be parsed.



parseProductUnit
abstract public Unit<? extends Quantity> parseProductUnit(CharSequence csq, ParsePosition pos) throws ParseException(Code)
Parses a sequence of character to produce a unit or a rational product of unit.
Parameters:
  csq - the CharSequence to parse.
Parameters:
  pos - an object holding the parsing index and error position. an Unit parsed from the character sequence.
throws:
  IllegalArgumentException - if the character sequence containsan illegal syntax.



parseSingleUnit
abstract public Unit<? extends Quantity> parseSingleUnit(CharSequence csq, ParsePosition pos) throws ParseException(Code)
Parses a sequence of character to produce a single unit.
Parameters:
  csq - the CharSequence to parse.
Parameters:
  pos - an object holding the parsing index and error position. an Unit parsed from the character sequence.
throws:
  IllegalArgumentException - if the character sequence does not contain a valid unit identifier.



Methods inherited from java.text.Format
public Object clone()(Code)(Java Doc)
final public String format(Object obj)(Code)(Java Doc)
abstract public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)(Code)(Java Doc)
public AttributedCharacterIterator formatToCharacterIterator(Object obj)(Code)(Java Doc)
abstract public Object parseObject(String source, ParsePosition pos)(Code)(Java Doc)
public Object parseObject(String source) throws ParseException(Code)(Java Doc)

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.