Java Doc for NFSubstitution.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.NFSubstitution

NFSubstitution
abstract class NFSubstitution (Code)
An abstract class defining protocol for substitutions. A substitution is a section of a rule that inserts text into the rule's rule text based on some part of the number being formatted.
author:
   Richard Gillam


Field Summary
 DecimalFormatnumberFormat
     The DecimalFormat this substitution uses to format its result, or null.
 intpos
    
 NFRuleSetruleSet
     The rule set this substitution uses to format its result, or null.

Constructor Summary
 NFSubstitution(int pos, NFRuleSet ruleSet, RuleBasedNumberFormat formatter, String description)
     Base constructor for substitutions.

Method Summary
abstract public  doublecalcUpperBound(double oldUpperBound)
     Calculates an upper bound when searching for a rule that matches this substitution.
abstract public  doublecomposeRuleValue(double newRuleValue, double oldRuleValue)
     Derives a new value from the two values passed in.
public  NumberdoParse(String text, ParsePosition parsePosition, double baseValue, double upperBound, boolean lenientParse)
     Parses a string using the rule set or DecimalFormat belonging to this substitution.
public  voiddoSubstitution(long number, StringBuffer toInsertInto, int pos)
     Performs a mathematical operation on the number, formats it using either ruleSet or decimalFormat, and inserts the result into toInsertInto.
public  voiddoSubstitution(double number, StringBuffer toInsertInto, int pos)
     Performs a mathematical operation on the number, formats it using either ruleSet or decimalFormat, and inserts the result into toInsertInto.
public  booleanequals(Object that)
    
final public  intgetPos()
     Returns the substitution's position in the rule that owns it.
public  booleanisModulusSubstitution()
     Returns true if this is a modulus substitution.
public  booleanisNullSubstitution()
     Returns true if this is a null substitution.
public static  NFSubstitutionmakeSubstitution(int pos, NFRule rule, NFRule rulePredecessor, NFRuleSet ruleSet, RuleBasedNumberFormat formatter, String description)
     Parses the description, creates the right kind of substitution, and initializes it based on the description.
public  voidsetDivisor(int radix, int exponent)
     Set's the substitution's divisor.
public  StringtoString()
     Returns a textual description of the substitution A textual description of the substitution.
abstract  chartokenChar()
     Returns the character used in the textual representation of substitutions of this type.
abstract public  longtransformNumber(long number)
     Subclasses override this function to perform some kind of mathematical operation on the number.
abstract public  doubletransformNumber(double number)
     Subclasses override this function to perform some kind of mathematical operation on the number.

Field Detail
numberFormat
DecimalFormat numberFormat(Code)
The DecimalFormat this substitution uses to format its result, or null. (Either this or ruleSet has to be non-null.)



pos
int pos(Code)
The substitution's position in the rule text of the rule that owns it



ruleSet
NFRuleSet ruleSet(Code)
The rule set this substitution uses to format its result, or null. (Either this or numberFormat has to be non-null.)




Constructor Detail
NFSubstitution
NFSubstitution(int pos, NFRuleSet ruleSet, RuleBasedNumberFormat formatter, String description)(Code)
Base constructor for substitutions. This constructor sets up the fields which are common to all substitutions.
Parameters:
  pos - The substitution's position in the owning rule's ruletext
Parameters:
  ruleSet - The rule set that owns this substitution
Parameters:
  formatter - The RuleBasedNumberFormat that owns this substitution
Parameters:
  description - The substitution descriptor (i.e., the textinside the token characters)




Method Detail
calcUpperBound
abstract public double calcUpperBound(double oldUpperBound)(Code)
Calculates an upper bound when searching for a rule that matches this substitution. Rules with base values greater than or equal to upperBound are not considered.
Parameters:
  oldUpperBound - The current upper-bound setting. The newupper bound can't be any higher.



composeRuleValue
abstract public double composeRuleValue(double newRuleValue, double oldRuleValue)(Code)
Derives a new value from the two values passed in. The two values are typically either the base values of two rules (the one containing the substitution and the one matching the substitution) or partial parse results derived in some other way. The operation is generally the inverse of the operation performed by transformNumber().
Parameters:
  newRuleValue - The value produced by matching this substitution
Parameters:
  oldRuleValue - The value that was passed to the substitutionby the rule that owns it A third value derived from the other two, representing apartial parse result



doParse
public Number doParse(String text, ParsePosition parsePosition, double baseValue, double upperBound, boolean lenientParse)(Code)
Parses a string using the rule set or DecimalFormat belonging to this substitution. If there's a match, a mathematical operation (the inverse of the one used in formatting) is performed on the result of the parse and the value passed in and returned as the result. The parse position is updated to point to the first unmatched character in the string.
Parameters:
  text - The string to parse
Parameters:
  parsePosition - On entry, ignored, but assumed to be 0.On exit, this is updated to point to the first unmatchedcharacter (or 0 if the substitution didn't match)
Parameters:
  baseValue - A partial parse result that should becombined with the result of this parse
Parameters:
  upperBound - When searching the rule set for a rulematching the string passed in, only rules with base valueslower than this are considered
Parameters:
  lenientParse - If true and matching against rules fails,the substitution will also try matching the text againstnumerals using a default-costructed NumberFormat. If false,no extra work is done. (This value is false whenever theformatter isn't in lenient-parse mode, but is also falseunder some conditions even when the formatter _is_ inlenient-parse mode.) If there's a match, this is the result of composingbaseValue with whatever was returned from matching thecharacters. This will be either a Long or a Double. If there'sno match this is new Long(0) (not null), and parsePositionis left unchanged.



doSubstitution
public void doSubstitution(long number, StringBuffer toInsertInto, int pos)(Code)
Performs a mathematical operation on the number, formats it using either ruleSet or decimalFormat, and inserts the result into toInsertInto.
Parameters:
  number - The number being formatted.
Parameters:
  toInsertInto - The string we insert the result into
Parameters:
  pos - The position in toInsertInto where the owning rule'srule text begins (this value is added to this substitution'sposition to determine exactly where to insert the new text)



doSubstitution
public void doSubstitution(double number, StringBuffer toInsertInto, int pos)(Code)
Performs a mathematical operation on the number, formats it using either ruleSet or decimalFormat, and inserts the result into toInsertInto.
Parameters:
  number - The number being formatted.
Parameters:
  toInsertInto - The string we insert the result into
Parameters:
  pos - The position in toInsertInto where the owning rule'srule text begins (this value is added to this substitution'sposition to determine exactly where to insert the new text)



equals
public boolean equals(Object that)(Code)
Compares two substitutions for equality
Parameters:
  The - substitution to compare this one to true if the two substitutions are functionally equivalent



getPos
final public int getPos()(Code)
Returns the substitution's position in the rule that owns it. The substitution's position in the rule that owns it.



isModulusSubstitution
public boolean isModulusSubstitution()(Code)
Returns true if this is a modulus substitution. (We didn't do this with instanceof partially because it causes source files to proliferate and partially because we have to port this to C++.) true if this object is an instance of ModulusSubstitution



isNullSubstitution
public boolean isNullSubstitution()(Code)
Returns true if this is a null substitution. (We didn't do this with instanceof partially because it causes source files to proliferate and partially because we have to port this to C++.) true if this object is an instance of NullSubstitution



makeSubstitution
public static NFSubstitution makeSubstitution(int pos, NFRule rule, NFRule rulePredecessor, NFRuleSet ruleSet, RuleBasedNumberFormat formatter, String description)(Code)
Parses the description, creates the right kind of substitution, and initializes it based on the description.
Parameters:
  pos - The substitution's position in the rule text of therule that owns it.
Parameters:
  rule - The rule containing this substitution
Parameters:
  rulePredecessor - The rule preceding the one that containsthis substitution in the rule set's rule list (this is usedonly for >>> substitutions).
Parameters:
  ruleSet - The rule set containing the rule containing thissubstitution
Parameters:
  formatter - The RuleBasedNumberFormat that ultimately ownsthis substitution
Parameters:
  description - The description to parse to build the substitution(this is just the substring of the rule's description containingthe substitution token itself) A new substitution constructed according to the description



setDivisor
public void setDivisor(int radix, int exponent)(Code)
Set's the substitution's divisor. Used by NFRule.setBaseValue(). A no-op for all substitutions except multiplier and modulus substitutions.
Parameters:
  radix - The radix of the divisor
Parameters:
  exponent - The exponent of the divisor



toString
public String toString()(Code)
Returns a textual description of the substitution A textual description of the substitution. This mightnot be identical to the description it was created from, butit'll produce the same result.



tokenChar
abstract char tokenChar()(Code)
Returns the character used in the textual representation of substitutions of this type. Used by toString(). This substitution's token character.



transformNumber
abstract public long transformNumber(long number)(Code)
Subclasses override this function to perform some kind of mathematical operation on the number. The result of this operation is formatted using the rule set or DecimalFormat that this substitution refers to, and the result is inserted into the result string.
Parameters:
  The - number being formatted The result of performing the opreration on the number



transformNumber
abstract public double transformNumber(double number)(Code)
Subclasses override this function to perform some kind of mathematical operation on the number. The result of this operation is formatted using the rule set or DecimalFormat that this substitution refers to, and the result is inserted into the result string.
Parameters:
  The - number being formatted The result of performing the opreration on the number



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.