All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.roguewave.format.NumericPicture

java.lang.Object
   |
   +----com.roguewave.format.NumericPicture

public class NumericPicture
extends Object
The NumericPicture class separates the formatting of a numeric value, how many characters before and after the decimal place, from its text layout, the specification of sign placement and padding. A numeric layout can be specified using 5 or fewer symbols:
 ' ' == pad
 's' == sign: negative ? "-" : ""
 'S' == sign: negative ? "-" : " "
 '+' == sign: negative ? "-" : "+"
 '(' == sign: negative ? "(" : " "
 ')' == sign: negative ? ")" : " "
 'N' == numeric
 
Examples:
   " sN", " (N)", "( N)", "s N", "NS"
 

The NumericPicture method provides a pictorial interface that uses the TextAlignment class to specify how the various components of a floating point number should appear without committing to a fixed width.

A NumericPicture is created from a string of up to 5 characters. The valid characters are:

' ' (space)
Indicates where padding should occur.
's'
Will be replace with '-' if negative or nothing if positive.
'S'
Will be replaced with '-' if negative or ' ' (space) if positive.
'+'
Will be replaced with '-' if negative or '+ ' if positive.
'('
Will be replaced with '(' if negative or ' ' (space) if positive.
')'
Will be replaced with ')' if negative or ' ' (space) if positive.
'N'
Will be replaced with the numeric value.

Space characters in the following table are shown as underscores:
Picture: "_sN" "_(N)" "(_N)" "+_N" "NS"
width=0, +1.5 "1.5" "_1.5_" "_1.5_" "+1.5" "1.5_"
width=0, -1.5 "-1.5" "(1.5)" "(1.5)" "-1.5" "1.5-"
width=7, +1.5 "____1.5" "___1.5_" "___1.5_" "+___1.5" "___1.5_"
width=7, -1.5 "___-1.5" "__(1.5)" "(__1.5)" "-___1.5" "___1.5-"


Constructor Index

 o NumericPicture()
 o NumericPicture(String)

Method Index

 o layout(boolean, String)
Use the layout that was set up in the constructor to produce a TextAlignment object that follows the NumericPicture.
 o layout(Double)
Return a TextAlignment that can be used to produce a string of any length with the format specified by self.
 o layout(double)
Return a TextAlignment that can be used to produce a string of any length with the format specified by self.
 o layout(float)
Return a TextAlignment that can be used to produce a string of any length with the format specified by self.
 o layout(Float)
Return a TextAlignment that can be used to produce a string of any length with the format specified by self.
 o layout(Formattable)
Return a TextAlignment that can be used to produce a string of any length with the format specified by self.
 o layout(int)
Return a TextAlignment that can be used to produce a string of any length with the format specified by self.
 o layout(Integer)
Return a TextAlignment that can be used to produce a string of any length with the format specified by self.
 o layout(long)
Return a TextAlignment that can be used to produce a string of any length with the format specified by self.
 o layout(Long)
Return a TextAlignment that can be used to produce a string of any length with the format specified by self.
 o layout(String)
Take a numeric string value of the form [-]ddd.ddd, separate out the sign from the numeric value and return the result from layout(sign, numeric).

Constructors

 o NumericPicture
 public NumericPicture()
 o NumericPicture
 public NumericPicture(String picture)

Methods

 o layout
 public TextAlignment layout(String numeric)
Take a numeric string value of the form [-]ddd.ddd, separate out the sign from the numeric value and return the result from layout(sign, numeric).

 o layout
 public TextAlignment layout(int i)
Return a TextAlignment that can be used to produce a string of any length with the format specified by self.

 o layout
 public TextAlignment layout(Integer i)
Return a TextAlignment that can be used to produce a string of any length with the format specified by self.

 o layout
 public TextAlignment layout(long l)
Return a TextAlignment that can be used to produce a string of any length with the format specified by self.

 o layout
 public TextAlignment layout(Long l)
Return a TextAlignment that can be used to produce a string of any length with the format specified by self.

 o layout
 public TextAlignment layout(float f)
Return a TextAlignment that can be used to produce a string of any length with the format specified by self.

 o layout
 public TextAlignment layout(Float f)
Return a TextAlignment that can be used to produce a string of any length with the format specified by self.

 o layout
 public TextAlignment layout(double d)
Return a TextAlignment that can be used to produce a string of any length with the format specified by self.

 o layout
 public TextAlignment layout(Double d)
Return a TextAlignment that can be used to produce a string of any length with the format specified by self.

 o layout
 public TextAlignment layout(Formattable f)
Return a TextAlignment that can be used to produce a string of any length with the format specified by self.

 o layout
 public TextAlignment layout(boolean isPositive,
                             String numeric)
Use the layout that was set up in the constructor to produce a TextAlignment object that follows the NumericPicture.


All Packages  Class Hierarchy  This Package  Previous  Next  Index