indexing
description: "Formatter for non-integral numbers"
status: "See notice at end of class"
names: format_double
date: "$Date$"
revision: "$Revision$"
class interface
FORMAT_DOUBLE
create
make (w, d: INTEGER)
require
reasonable_field: w >= 1
reasonable_decimals: d <= w
ensure
blank_fill: fill_character = ' '
show_sign_negative: show_sign_negative
no_separator: no_separator
width_set: width = w
right_justified: right_justified
leading_sign: leading_sign
decimals_set: decimals = d
decimal_point: decimal = '.'
feature
make (w, d: INTEGER)
require
reasonable_field: w >= 1
reasonable_decimals: d <= w
ensure
blank_fill: fill_character = ' '
show_sign_negative: show_sign_negative
no_separator: no_separator
width_set: width = w
right_justified: right_justified
leading_sign: leading_sign
decimals_set: decimals = d
decimal_point: decimal = '.'
set_defaults (w: INTEGER)
FORMAT_INTEGER
require FORMAT_INTEGER
reasonable_field: w >= 1
ensure FORMAT_INTEGER
blank_fill: fill_character = ' '
show_sign_negative: show_sign_negative
no_separator: no_separator
width_set: width = w
right_justified: right_justified
leading_sign: leading_sign
feature
after_decimal_separate: BOOLEAN
bracketted_negative: BOOLEAN
FORMAT_INTEGER
decimal: CHARACTER
decimals: INTEGER
fill_character: CHARACTER
FORMAT_INTEGER
justification: INTEGER
FORMAT_INTEGER
separator: CHARACTER
FORMAT_INTEGER
sign_format: INTEGER
FORMAT_INTEGER
sign_string: STRING
FORMAT_INTEGER
trailing_sign: BOOLEAN
FORMAT_INTEGER
width: INTEGER
FORMAT_INTEGER
zero_not_shown: BOOLEAN
feature
centered: BOOLEAN
FORMAT_INTEGER
ensure FORMAT_INTEGER
Result = (justification = center_justification)
ignore_sign: BOOLEAN
FORMAT_INTEGER
ensure FORMAT_INTEGER
Result = (sign_format = ignore_sign_value)
leading_sign: BOOLEAN
FORMAT_INTEGER
ensure FORMAT_INTEGER
Result = not trailing_sign
left_justified: BOOLEAN
FORMAT_INTEGER
ensure FORMAT_INTEGER
Result = (justification = left_justification)
no_separator: BOOLEAN
FORMAT_INTEGER
ensure FORMAT_INTEGER
Result = (separator = '%U')
not_justified: BOOLEAN
FORMAT_INTEGER
ensure FORMAT_INTEGER
Result = (justification = no_justification)
right_justified: BOOLEAN
FORMAT_INTEGER
ensure FORMAT_INTEGER
Result = (justification = right_justification)
show_sign: BOOLEAN
FORMAT_INTEGER
ensure FORMAT_INTEGER
Result = (sign_format = show_sign_value)
show_sign_negative: BOOLEAN
FORMAT_INTEGER
ensure FORMAT_INTEGER
Result = (sign_format = sign_negative_value)
show_sign_positive: BOOLEAN
FORMAT_INTEGER
ensure FORMAT_INTEGER
Result = (sign_format = sign_positive_value)
feature
asterisk_fill
FORMAT_INTEGER
ensure FORMAT_INTEGER
fill_character = '*'
blank_fill
FORMAT_INTEGER
ensure FORMAT_INTEGER
fill_character = ' '
bracket_negative
FORMAT_INTEGER
ensure FORMAT_INTEGER
bracketted_negative
center_justify
FORMAT_INTEGER
ensure FORMAT_INTEGER
centered
comma_decimal
ensure
decimal = ','
comma_separate
ensure FORMAT_INTEGER
separator = ','
ensure then
after_decimal_separate
dollar_fill
FORMAT_INTEGER
ensure FORMAT_INTEGER
fill_character = '$'
dot_separate
FORMAT_INTEGER
ensure FORMAT_INTEGER
separator = '.'
hide_zero
ensure
zero_not_shown
left_justify
FORMAT_INTEGER
ensure FORMAT_INTEGER
left_justified
no_justify
FORMAT_INTEGER
ensure FORMAT_INTEGER
not_justified
no_separate_after_decimal
ensure
not after_decimal_separate
point_decimal
ensure
decimal = '.'
remove_separator
ensure FORMAT_INTEGER
separator = '%U'
ensure then
not after_decimal_separate
right_justify
FORMAT_INTEGER
ensure FORMAT_INTEGER
right_justified
separate_after_decimal
ensure
after_decimal_separate
set_decimals (d: INTEGER)
d
require
d <= width
ensure
decimals = d
set_fill (c: CHARACTER)
c
FORMAT_INTEGER
ensure FORMAT_INTEGER
fill_character = c
set_separator (c: CHARACTER)
c
FORMAT_INTEGER
ensure FORMAT_INTEGER
separator = c
set_sign (s: STRING)
FORMAT_INTEGER
require FORMAT_INTEGER
s /= void
s.count >= 3
s.count \\ 3 = 0
ensure FORMAT_INTEGER
sign_string.is_equal (s)
set_width (w: INTEGER)
w
FORMAT_INTEGER
require FORMAT_INTEGER
wide_enough: w >= 1
ensure FORMAT_INTEGER
width = w
show_zero
ensure
not zero_not_shown
sign_cr_dr
FORMAT_INTEGER
ensure FORMAT_INTEGER
sign_string.is_equal ("CR DR")
sign_dr_cr
FORMAT_INTEGER
ensure FORMAT_INTEGER
sign_string.is_equal ("DR CR")
sign_floating_dollar
FORMAT_INTEGER
ensure FORMAT_INTEGER
sign_string.is_equal ("$$$")
sign_floating_dollar_signed
FORMAT_INTEGER
ensure FORMAT_INTEGER
sign_string.is_equal ("-$ $+$")
sign_ignore
FORMAT_INTEGER
ensure FORMAT_INTEGER
ignore_sign
sign_leading
FORMAT_INTEGER
ensure FORMAT_INTEGER
leading_sign
sign_negative_only
FORMAT_INTEGER
ensure FORMAT_INTEGER
show_sign_negative
sign_normal
FORMAT_INTEGER
ensure FORMAT_INTEGER
sign_string.is_equal ("- +")
sign_positive_only
FORMAT_INTEGER
ensure FORMAT_INTEGER
show_sign_positive
sign_show
FORMAT_INTEGER
ensure FORMAT_INTEGER
show_sign
sign_trailing
FORMAT_INTEGER
ensure FORMAT_INTEGER
trailing_sign
unbracket_negative
FORMAT_INTEGER
ensure FORMAT_INTEGER
not bracketted_negative
underscore_separate
ensure FORMAT_INTEGER
separator = '_'
ensure then
after_decimal_separate
zero_fill
FORMAT_INTEGER
ensure FORMAT_INTEGER
fill_character = '0'
feature
formatted (d: DOUBLE): STRING
d
ensure
exists: Result /= void
correct_length: not_justified or Result.count >= width
invariant
separate_all: no_separator implies not after_decimal_separate
ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)
FORMAT_INTEGER
sign_string_constraint: sign_string /= void
wide_enough: width >= 1
no_justification <= justification and justification <= right_justification
indexing
library: "[
EiffelBase: Library of reusable components for Eiffel.
]"
status: "[
Copyright 1986-2001 Interactive Software Engineering (ISE).
For ISE customers the original versions are an ISE product
covered by the ISE Eiffel license and support agreements.
]"
license: "[
EiffelBase may now be used by anyone as FREE SOFTWARE to
develop any product, public-domain or commercial, without
payment to ISE, under the terms of the ISE Free Eiffel Library
License (IFELL) at http://eiffel.com/products/base/license.html.
]"
source: "[
Interactive Software Engineering Inc.
ISE Building
360 Storke Road, Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Electronic mail <info@eiffel.com>
Customer support http://support.eiffel.com
]"
info: "[
For latest info see award-winning pages: http://eiffel.com
]"
end -- FORMAT_DOUBLE