Automatic generation produced by ISE Eiffel

Classes Clusters Cluster hierarchy Chart Relations Flat contracts Go to:
note description: "Formatter for non-integral numbers" library: "Free implementation of ELKS library" status: "See notice at end of class." legal: "See notice at end of class." names: format_double date: "$Date: 2021-02-22 05:30:58 -0900 (Mon, 22 Feb 2021) $" revision: "$Revision: 105200 $" 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 = '.' trailing_zeros_shown: trailing_zeros_shown feature -- Initialization 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 = '.' trailing_zeros_shown: trailing_zeros_shown set_defaults (w: INTEGER_32) -- (from FORMAT_INTEGER) require -- from FORMAT_INTEGER reasonable_field: w >= 1 ensure -- from 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 -- Access after_decimal_separate: BOOLEAN -- Use separators after the decimal? bracketted_negative: BOOLEAN -- Enclose negative numbers in brackets? -- (from FORMAT_INTEGER) decimal: CHARACTER_8 -- What is used for the decimal decimals: INTEGER_32 -- Number of digits after the decimal point. fill_character: CHARACTER_8 -- Padding character. -- (from FORMAT_INTEGER) generating_type: TYPE [detachable FORMAT_DOUBLE] -- Type of current object -- (type of which it is a direct instance) -- (from ANY) ensure -- from ANY generating_type_not_void: Result /= Void generator: STRING_8 -- Name of current object's generating class -- (base class of the type of which it is a direct instance) -- (from ANY) ensure -- from ANY generator_not_void: Result /= Void generator_not_empty: not Result.is_empty justification: INTEGER_32 -- Where in the field the format goes. -- (from FORMAT_INTEGER) separator: CHARACTER_8 -- Separator between 1000's of numbers. -- (from FORMAT_INTEGER) sign_format: INTEGER_32 -- How the sign is formatted. -- (from FORMAT_INTEGER) sign_string: STRING_8 -- Formatting details for the sign. -- (from FORMAT_INTEGER) trailing_sign: BOOLEAN -- Is the sign at the end? -- (from FORMAT_INTEGER) trailing_zeros_shown: BOOLEAN -- Show 0.5000 as 0.5 or 0.5000? width: INTEGER_32 -- Width of the field. -- (from FORMAT_INTEGER) zero_not_shown: BOOLEAN -- Show 0.5 as .5 or 0.5? feature -- Comparison frozen deep_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void -- or attached to isomorphic object structures? -- (from ANY) ensure -- from ANY instance_free: class shallow_implies_deep: standard_equal (a, b) implies Result both_or_none_void: (a = Void) implies (Result = (b = Void)) same_type: (Result and (a /= Void)) implies (b /= Void and then a.same_type (b)) symmetric: Result implies deep_equal (b, a) frozen equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached -- to objects considered equal? -- (from ANY) ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.is_equal (b)) frozen is_deep_equal alias "≡≡≡" (other: FORMAT_DOUBLE): BOOLEAN -- Are Current and other attached to isomorphic object structures? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY shallow_implies_deep: standard_is_equal (other) implies Result same_type: Result implies same_type (other) symmetric: Result implies other.is_deep_equal (Current) is_equal (other: FORMAT_DOUBLE): BOOLEAN -- Is other attached to an object considered -- equal to current object? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY symmetric: Result implies other ~ Current consistent: standard_is_equal (other) implies Result frozen standard_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached to -- field-by-field identical objects of the same type? -- Always uses default object comparison criterion. -- (from ANY) ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.standard_is_equal (b)) frozen standard_is_equal alias "" (other: FORMAT_DOUBLE): BOOLEAN -- Is other attached to an object of the same type -- as current object, and field-by-field identical to it? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY same_type: Result implies same_type (other) symmetric: Result implies other.standard_is_equal (Current) feature -- Status report centered: BOOLEAN -- Are numbers to be formatted centered? -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER Result = (justification = Center_justification) conforms_to (other: ANY): BOOLEAN -- Does type of current object conform to type -- of other (as per Eiffel: The Language, chapter 13)? -- (from ANY) require -- from ANY other_not_void: other /= Void ignore_sign: BOOLEAN -- Ignore the sign of a number? -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER Result = (sign_format = Ignore_sign_value) leading_sign: BOOLEAN -- Is the sign leading? -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER Result = not trailing_sign left_justified: BOOLEAN -- Are numbers to be formatted with spaces on the right? -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER Result = (justification = Left_justification) no_separator: BOOLEAN -- Is there a separator? -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER Result = (separator = '%U') not_justified: BOOLEAN -- Are numbers to be formatted in smallest string possible -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER Result = (justification = No_justification) right_justified: BOOLEAN -- Are numbers to be formatted with spaces on the left? -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER Result = (justification = Right_justification) same_type (other: ANY): BOOLEAN -- Is type of current object identical to type of other? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY definition: Result = (conforms_to (other) and other.conforms_to (Current)) show_sign: BOOLEAN -- Are numbers to show sign whether positive or negative? -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER Result = (sign_format = Show_sign_value) show_sign_negative: BOOLEAN -- Are numbers to show sign only when negative? -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER Result = (sign_format = Sign_negative_value) show_sign_positive: BOOLEAN -- Are numbers to show sign only when positive? -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER Result = (sign_format = Sign_positive_value) feature -- Status setting asterisk_fill -- Fill numbers with asterisks. -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER fill_character = '*' blank_fill -- Fill numbers with blanks. -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER fill_character = ' ' bracket_negative -- Bracket negative numbers. -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER bracketted_negative center_justify -- Put padding on right and left -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER centered comma_decimal -- Use , as the decimal point. ensure decimal = ',' comma_separate -- Set the separator to be comma. require -- from FORMAT_INTEGER True ensure -- from FORMAT_INTEGER separator = ',' ensure then after_decimal_separate dollar_fill -- Fill numbers with dollars. -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER fill_character = '$' dot_separate -- Set separator to period. -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER separator = '.' hide_trailing_zeros -- Show 0.5000 as 0.5, and 0.0000 as 0.0. ensure trailing_zeros_shown_set: not trailing_zeros_shown hide_zero -- Show 0.5 as .5 . ensure zero_not_shown left_justify --Put padding on right -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER left_justified no_justify -- Always return the smallest string possible -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER not_justified no_separate_after_decimal -- Do not use separators after the decimal. ensure not after_decimal_separate point_decimal -- Use . as the decimal point. ensure decimal = '.' remove_separator -- Remove the separator. require -- from FORMAT_INTEGER True ensure -- from FORMAT_INTEGER separator = '%U' ensure then not after_decimal_separate right_justify -- Put padding on left -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER right_justified separate_after_decimal -- Use separators after the decimal. ensure after_decimal_separate set_decimals (d: INTEGER_32) -- d decimals to be displayed. require d <= width ensure decimals = d set_fill (c: CHARACTER_8) -- Fill numbers with c -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER fill_character = c set_separator (c: CHARACTER_8) -- Set the separator to c -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER separator = c set_sign (s: STRING_8) -- Set sign values for positive, zero, negative -- All values must be the same length. -- Stored as negative, zero, positive. -- (from FORMAT_INTEGER) require -- from FORMAT_INTEGER s /= Void s.count >= 3 s.count \\ 3 = 0 ensure -- from FORMAT_INTEGER sign_set: sign_string ~ s set_width (w: INTEGER_32) -- Set width to w -- (from FORMAT_INTEGER) require -- from FORMAT_INTEGER wide_enough: w >= 1 ensure -- from FORMAT_INTEGER width = w show_trailing_zeros -- Show 0.5000 as 0.5000. ensure trailing_zeros_shown_set: trailing_zeros_shown show_zero -- Show 0.5 as 0.5 . ensure not zero_not_shown sign_cr_dr -- Set sign for CR/DR -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER sign_string ~ "CR DR" sign_dr_cr -- Set sign for DR/CR -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER sign_string ~ "DR CR" sign_floating_dollar -- Set sign for floating dollar. -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER sign_string ~ "$$$" sign_floating_dollar_signed -- Set sign for floating dollar include sign. -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER sign_string ~ "-$ $+$" sign_ignore -- Do not show sign. -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER ignore_sign sign_leading -- Set the sign to lead -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER leading_sign sign_negative_only -- Show sign for negative numbers only. -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER show_sign_negative sign_normal -- Set sign for - and +. -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER sign_string ~ "- +" sign_positive_only -- Show sign for positive numbers only. -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER show_sign_positive sign_show -- Show sign for all numbers. -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER show_sign sign_trailing -- Set the sign to trail -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER trailing_sign unbracket_negative -- Do not bracket negative numbers. -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER not bracketted_negative underscore_separate -- Set the separator to be underscore. require -- from FORMAT_INTEGER True ensure -- from FORMAT_INTEGER separator = '_' ensure then after_decimal_separate zero_fill -- Fill numbers with zeros. -- (from FORMAT_INTEGER) ensure -- from FORMAT_INTEGER fill_character = '0' feature -- Conversion formatted (d: REAL_64): STRING_8 -- Format d. ensure exists: Result /= Void correct_length: not_justified or Result.count >= width feature -- Duplication copy (other: FORMAT_DOUBLE) -- Update current object using fields of object attached -- to other, so as to yield equal objects. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_equal: Current ~ other frozen deep_copy (other: FORMAT_DOUBLE) -- Effect equivalent to that of: -- copy (other . deep_twin) -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY deep_equal: deep_equal (Current, other) frozen deep_twin: FORMAT_DOUBLE -- New object structure recursively duplicated from Current. -- (from ANY) ensure -- from ANY deep_twin_not_void: Result /= Void deep_equal: deep_equal (Current, Result) frozen standard_copy (other: FORMAT_DOUBLE) -- Copy every field of other onto corresponding field -- of current object. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_standard_equal: standard_is_equal (other) frozen standard_twin: FORMAT_DOUBLE -- New object field-by-field identical to other. -- Always uses default copying semantics. -- (from ANY) ensure -- from ANY standard_twin_not_void: Result /= Void equal: standard_equal (Result, Current) frozen twin: FORMAT_DOUBLE -- New object equal to Current -- twin calls copy; to change copying/twinning semantics, redefine copy. -- (from ANY) ensure -- from ANY twin_not_void: Result /= Void is_equal: Result ~ Current feature -- Basic operations frozen default: detachable FORMAT_DOUBLE -- Default value of object's type -- (from ANY) frozen default_pointer: POINTER -- Default value of type POINTER -- (Avoid the need to write p.default for -- some p of type POINTER.) -- (from ANY) ensure -- from ANY instance_free: class default_rescue -- Process exception for routines with no Rescue clause. -- (Default: do nothing.) -- (from ANY) frozen do_nothing -- Execute a null action. -- (from ANY) ensure -- from ANY instance_free: class feature -- Output Io: STD_FILES -- Handle to standard file setup -- (from ANY) ensure -- from ANY instance_free: class io_not_void: Result /= Void out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY out_not_void: Result /= Void print (o: detachable ANY) -- Write terse external representation of o -- on standard output. -- (from ANY) ensure -- from ANY instance_free: class frozen tagged_out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY tagged_out_not_void: Result /= Void feature -- Platform Operating_environment: OPERATING_ENVIRONMENT -- Objects available from the operating system -- (from ANY) ensure -- from ANY instance_free: class operating_environment_not_void: Result /= Void invariant separate_all: no_separator implies not after_decimal_separate -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) -- from FORMAT_INTEGER sign_string_attached: sign_string /= Void sign_string_count: sign_string.count >= 3 sign_string_equal_parts: sign_string.count \\ 3 = 0 wide_enough: width >= 1 No_justification <= justification and justification <= Right_justification note copyright: "Copyright (c) 1984-2021, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software 5949 Hollister Ave., Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end -- class FORMAT_DOUBLE
Classes Clusters Cluster hierarchy Chart Relations Flat contracts Go to:

-- Generated by Eiffel Studio --
For more details: eiffel.org