Java Doc for FractionFormat.java in  » Science » Apache-commons-math-1.1 » org » apache » commons » math » fraction » 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 » Apache commons math 1.1 » org.apache.commons.math.fraction 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.text.Format
      org.apache.commons.math.fraction.FractionFormat

All known Subclasses:   org.apache.commons.math.fraction.ProperFractionFormat,
FractionFormat
public class FractionFormat extends Format implements Serializable(Code)
Formats a Fraction number in proper format or improper format. The number format for each of the whole number, numerator and, denominator can be configured.
since:
   1.1
version:
   $Revision: 348519 $ $Date: 2005-11-23 12:12:18 -0700 (Wed, 23 Nov 2005) $



Constructor Summary
public  FractionFormat()
     Create an improper formatting instance with the default number format for the numerator and denominator.
public  FractionFormat(NumberFormat format)
     Create an improper formatting instance with a custom number format for both the numerator and denominator.
public  FractionFormat(NumberFormat numeratorFormat, NumberFormat denominatorFormat)
     Create an improper formatting instance with a custom number format for the numerator and a custom number format for the denominator.

Method Summary
public  StringBufferformat(Fraction fraction, StringBuffer toAppendTo, FieldPosition pos)
     Formats a Fraction object to produce a string.
public  StringBufferformat(Object obj, StringBuffer toAppendTo, FieldPosition pos)
     Formats a object to produce a string.
public static  StringformatFraction(Fraction f)
     This static method calls formatFraction() on a default instance of FractionFormat.
public static  Locale[]getAvailableLocales()
     Get the set of locales for which complex formats are available.
protected static  NumberFormatgetDefaultNumberFormat()
     Create a default number format.
public  NumberFormatgetDenominatorFormat()
     Access the denominator format.
public static  FractionFormatgetImproperInstance()
     Returns the default complex format for the current locale.
public static  FractionFormatgetImproperInstance(Locale locale)
     Returns the default complex format for the given locale.
Parameters:
  locale - the specific locale used by the format.
public  NumberFormatgetNumeratorFormat()
     Access the numerator format.
public static  FractionFormatgetProperInstance()
     Returns the default complex format for the current locale.
public static  FractionFormatgetProperInstance(Locale locale)
     Returns the default complex format for the given locale.
Parameters:
  locale - the specific locale used by the format.
public  Fractionparse(String source)
     Parses a string to produce a Fraction object.
public  Fractionparse(String source, ParsePosition pos)
     Parses a string to produce a Fraction object.
protected static  voidparseAndIgnoreWhitespace(String source, ParsePosition pos)
     Parses source until a non-whitespace character is found.
Parameters:
  source - the string to parse
Parameters:
  pos - input/ouput parsing parameter.
protected static  charparseNextCharacter(String source, ParsePosition pos)
     Parses source until a non-whitespace character is found.
Parameters:
  source - the string to parse
Parameters:
  pos - input/ouput parsing parameter.
public  ObjectparseObject(String source, ParsePosition pos)
     Parses a string to produce a object.
Parameters:
  source - the string to parse
Parameters:
  pos - input/ouput parsing parameter.
public  voidsetDenominatorFormat(NumberFormat format)
     Modify the denominator format.
public  voidsetNumeratorFormat(NumberFormat format)
     Modify the numerator format.


Constructor Detail
FractionFormat
public FractionFormat()(Code)
Create an improper formatting instance with the default number format for the numerator and denominator.



FractionFormat
public FractionFormat(NumberFormat format)(Code)
Create an improper formatting instance with a custom number format for both the numerator and denominator.
Parameters:
  format - the custom format for both the numerator and denominator.



FractionFormat
public FractionFormat(NumberFormat numeratorFormat, NumberFormat denominatorFormat)(Code)
Create an improper formatting instance with a custom number format for the numerator and a custom number format for the denominator.
Parameters:
  numeratorFormat - the custom format for the numerator.
Parameters:
  denominatorFormat - the custom format for the denominator.




Method Detail
format
public StringBuffer format(Fraction fraction, StringBuffer toAppendTo, FieldPosition pos)(Code)
Formats a Fraction object to produce a string. The fraction is output in improper format.
Parameters:
  fraction - the object to format.
Parameters:
  toAppendTo - where the text is to be appended
Parameters:
  pos - On input: an alignment field, if desired. On output: theoffsets of the alignment field the value passed in as toAppendTo.



format
public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)(Code)
Formats a object to produce a string. obj must be either a Fraction object or a Number object. Any other type of object will result in an IllegalArgumentException being thrown.
Parameters:
  obj - the object to format.
Parameters:
  toAppendTo - where the text is to be appended
Parameters:
  pos - On input: an alignment field, if desired. On output: theoffsets of the alignment field the value passed in as toAppendTo.
See Also:   java.text.Format.format(java.lang.Objectjava.lang.StringBufferjava.text.FieldPosition)
throws:
  IllegalArgumentException - is obj is not a valid type.



formatFraction
public static String formatFraction(Fraction f)(Code)
This static method calls formatFraction() on a default instance of FractionFormat.
Parameters:
  f - Fraction object to format A formatted fraction in proper form.



getAvailableLocales
public static Locale[] getAvailableLocales()(Code)
Get the set of locales for which complex formats are available. This is the same set as the NumberFormat set. available complex format locales.



getDefaultNumberFormat
protected static NumberFormat getDefaultNumberFormat()(Code)
Create a default number format. The default number format is based on NumberFormat.getNumberInstance(java.util.Locale) with the only customizing is the maximum number of fraction digits, which is set to 0. the default number format.



getDenominatorFormat
public NumberFormat getDenominatorFormat()(Code)
Access the denominator format. the denominator format.



getImproperInstance
public static FractionFormat getImproperInstance()(Code)
Returns the default complex format for the current locale. the default complex format.



getImproperInstance
public static FractionFormat getImproperInstance(Locale locale)(Code)
Returns the default complex format for the given locale.
Parameters:
  locale - the specific locale used by the format. the complex format specific to the given locale.



getNumeratorFormat
public NumberFormat getNumeratorFormat()(Code)
Access the numerator format. the numerator format.



getProperInstance
public static FractionFormat getProperInstance()(Code)
Returns the default complex format for the current locale. the default complex format.



getProperInstance
public static FractionFormat getProperInstance(Locale locale)(Code)
Returns the default complex format for the given locale.
Parameters:
  locale - the specific locale used by the format. the complex format specific to the given locale.



parse
public Fraction parse(String source) throws ParseException(Code)
Parses a string to produce a Fraction object.
Parameters:
  source - the string to parse the parsed Fraction object.
exception:
  ParseException - if the beginning of the specified stringcannot be parsed.



parse
public Fraction parse(String source, ParsePosition pos)(Code)
Parses a string to produce a Fraction object. This method expects the string to be formatted as an improper fraction.
Parameters:
  source - the string to parse
Parameters:
  pos - input/ouput parsing parameter. the parsed Fraction object.



parseAndIgnoreWhitespace
protected static void parseAndIgnoreWhitespace(String source, ParsePosition pos)(Code)
Parses source until a non-whitespace character is found.
Parameters:
  source - the string to parse
Parameters:
  pos - input/ouput parsing parameter. On output, posholds the index of the next non-whitespace character.



parseNextCharacter
protected static char parseNextCharacter(String source, ParsePosition pos)(Code)
Parses source until a non-whitespace character is found.
Parameters:
  source - the string to parse
Parameters:
  pos - input/ouput parsing parameter. the first non-whitespace character.



parseObject
public Object parseObject(String source, ParsePosition pos)(Code)
Parses a string to produce a object.
Parameters:
  source - the string to parse
Parameters:
  pos - input/ouput parsing parameter. the parsed object.
See Also:   java.text.Format.parseObject(java.lang.Stringjava.text.ParsePosition)



setDenominatorFormat
public void setDenominatorFormat(NumberFormat format)(Code)
Modify the denominator format.
Parameters:
  format - the new denominator format value.
throws:
  IllegalArgumentException - if format isnull.



setNumeratorFormat
public void setNumeratorFormat(NumberFormat format)(Code)
Modify the numerator format.
Parameters:
  format - the new numerator format value.
throws:
  IllegalArgumentException - if format isnull.



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.