indexing
description: "Formatter for non-integral numbers"
legal: "See notice at end of class."
status: "See notice at end of class."
names: format_double
date: "$Date: 2006-01-22 18:25:44 -0800 (Sun, 22 Jan 2006) $"
revision: "$Revision: 56675 $"
class interface
FORMAT_DOUBLE
create
make (w, d: INTEGER_32)
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_32)
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_32)
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_8
decimals: INTEGER_32
fill_character: CHARACTER_8
FORMAT_INTEGER
generating_type: STRING_8
ANY
generator: STRING_8
ANY
justification: INTEGER_32
FORMAT_INTEGER
separator: CHARACTER_8
FORMAT_INTEGER
sign_format: INTEGER_32
FORMAT_INTEGER
sign_string: STRING_8
FORMAT_INTEGER
trailing_sign: BOOLEAN
FORMAT_INTEGER
width: INTEGER_32
FORMAT_INTEGER
zero_not_shown: BOOLEAN
feature
frozen deep_equal (some: ANY; other: like arg #1): BOOLEAN
`some'`other'
ANY
ensure ANY
shallow_implies_deep: standard_equal (some, other) implies Result
both_or_none_void: (some = Void) implies (Result = (other = Void))
same_type: (Result and (some /= Void)) implies some.same_type (other)
symmetric: Result implies deep_equal (other, some)
frozen equal (some: ANY; other: like arg #1): BOOLEAN
`some'`other'
ANY
ensure ANY
definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.is_equal (other))
is_equal (other: like Current): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
ensure ANY
symmetric: Result implies other.is_equal (Current)
consistent: standard_is_equal (other) implies Result
frozen standard_equal (some: ANY; other: like arg #1): BOOLEAN
`some'`other'
ANY
ensure ANY
definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.standard_is_equal (other))
frozen standard_is_equal (other: like Current): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
ensure ANY
same_type: Result implies same_type (other)
symmetric: Result implies other.standard_is_equal (Current)
feature
centered: BOOLEAN
FORMAT_INTEGER
ensure FORMAT_INTEGER
Result = (justification = center_justification)
conforms_to (other: ANY): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
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)
same_type (other: ANY): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
ensure ANY
definition: Result = (conforms_to (other) and other.conforms_to (Current))
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
require FORMAT_INTEGER
True
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
require FORMAT_INTEGER
True
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_32)
`d'
require
d <= width
ensure
decimals = d
set_fill (c: CHARACTER_8)
`c'
FORMAT_INTEGER
ensure FORMAT_INTEGER
fill_character = c
set_separator (c: CHARACTER_8)
`c'
FORMAT_INTEGER
ensure FORMAT_INTEGER
separator = c
set_sign (s: STRING_8)
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_32)
`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
require FORMAT_INTEGER
True
ensure FORMAT_INTEGER
separator = '_'
ensure then
after_decimal_separate
zero_fill
FORMAT_INTEGER
ensure FORMAT_INTEGER
fill_character = '0'
feature
formatted (d: REAL_64): STRING_8
`d'
ensure
exists: Result /= Void
correct_length: not_justified or Result.count >= width
feature
copy (other: like Current)
`other'
ANY
require ANY
other_not_void: other /= Void
type_identity: same_type (other)
ensure ANY
is_equal: is_equal (other)
frozen deep_copy (other: like Current)
copy`other'deep_twin
ANY
require ANY
other_not_void: other /= Void
ensure ANY
deep_equal: deep_equal (Current, other)
frozen deep_twin: like Current
ANY
ensure ANY
deep_equal: deep_equal (Current, Result)
frozen standard_copy (other: like Current)
`other'
ANY
require ANY
other_not_void: other /= Void
type_identity: same_type (other)
ensure ANY
is_standard_equal: standard_is_equal (other)
frozen standard_twin: like Current
`other'
ANY
ensure ANY
standard_twin_not_void: Result /= Void
equal: standard_equal (Result, Current)
frozen twin: like Current
`Current'
twincopycopy
ANY
ensure ANY
twin_not_void: Result /= Void
is_equal: Result.is_equal (Current)
feature
frozen default: like Current
ANY
frozen default_pointer: POINTER
`POINTER'
`p'default
`p'`POINTER'
ANY
default_rescue
ANY
frozen do_nothing
ANY
feature
io: STD_FILES
ANY
out: STRING_8
ANYtagged_out
ANY
print (some: ANY)
`some'
ANY
frozen tagged_out: STRING_8
ANYout
ANY
feature
operating_environment: OPERATING_ENVIRONMENT
ANY
invariant
separate_all: no_separator implies not after_decimal_separate
FORMAT_INTEGER
sign_string_constraint: sign_string /= Void
wide_enough: width >= 1
no_justification <= justification and justification <= right_justification
ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)
indexing
library: "EiffelBase: Library of reusable components for Eiffel."
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
356 Storke Road, Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end FORMAT_DOUBLE