note description: "Implementation of TUPLE" library: "Free implementation of ELKS library" status: "See notice at end of class." legal: "See notice at end of class." date: "$Date: 2020-05-19 14:32:38 +0000 (Tue, 19 May 2020) $" revision: "$Revision: 104260 $" class interface TUPLE create default_create -- Process instances of classes with no creation clause. -- (Default: do nothing.) -- (from ANY) feature -- Access at alias "@" (index: INTEGER_32): detachable separate ANY assign put -- Entry of key index. -- Was declared in TUPLE as synonym of item. boolean_item (index: INTEGER_32): BOOLEAN -- Boolean item at index. require valid_index: valid_index (index) is_boolean: is_boolean_item (index) character_32_item (index: INTEGER_32): CHARACTER_32 -- Character item at index. require valid_index: valid_index (index) is_character_32: is_character_32_item (index) character_8_item (index: INTEGER_32): CHARACTER_8 -- Character item at index. require valid_index: valid_index (index) is_character_8: is_character_8_item (index) character_item (index: INTEGER_32): CHARACTER_8 -- Character item at index. require valid_index: valid_index (index) is_character_8: is_character_8_item (index) double_item (index: INTEGER_32): REAL_64 -- Double item at index. require valid_index: valid_index (index) is_numeric: is_double_item (index) generating_type: TYPE [detachable TUPLE] -- 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 integer_16_item (index: INTEGER_32): INTEGER_16 -- INTEGER_16 item at index. require valid_index: valid_index (index) is_integer: is_integer_16_item (index) integer_32_item (index: INTEGER_32): INTEGER_32 -- INTEGER_32 item at index. require valid_index: valid_index (index) is_integer: is_integer_32_item (index) integer_64_item (index: INTEGER_32): INTEGER_64 -- INTEGER_64 item at index. require valid_index: valid_index (index) is_integer: is_integer_64_item (index) integer_8_item (index: INTEGER_32): INTEGER_8 -- INTEGER_8 item at index. require valid_index: valid_index (index) is_integer: is_integer_8_item (index) integer_item (index: INTEGER_32): INTEGER_32 -- INTEGER_32 item at index. require valid_index: valid_index (index) is_integer: is_integer_32_item (index) item alias "[]" (index: INTEGER_32): detachable separate ANY assign put -- Entry of key index. -- Was declared in TUPLE as synonym of at. require -- from READABLE_INDEXABLE valid_index: valid_index (index) natural_16_item (index: INTEGER_32): NATURAL_16 -- NATURAL_16 item at index. require valid_index: valid_index (index) is_integer: is_natural_16_item (index) natural_32_item (index: INTEGER_32): NATURAL_32 -- NATURAL_32 item at index. require valid_index: valid_index (index) is_integer: is_natural_32_item (index) natural_64_item (index: INTEGER_32): NATURAL_64 -- NATURAL_64 item at index. require valid_index: valid_index (index) is_integer: is_natural_64_item (index) natural_8_item (index: INTEGER_32): NATURAL_8 -- NATURAL_8 item at index. require valid_index: valid_index (index) is_integer: is_natural_8_item (index) new_cursor: INDEXABLE_ITERATION_CURSOR [detachable separate ANY] -- Fresh cursor associated with current structure -- (from READABLE_INDEXABLE) ensure -- from ITERABLE result_attached: Result /= Void pointer_item (index: INTEGER_32): POINTER -- Pointer item at index. require valid_index: valid_index (index) is_pointer: is_pointer_item (index) real_32_item (index: INTEGER_32): REAL_32 -- real item at index. require valid_index: valid_index (index) is_real_or_integer: is_real_32_item (index) real_64_item (index: INTEGER_32): REAL_64 -- Double item at index. require valid_index: valid_index (index) is_numeric: is_real_64_item (index) real_item (index: INTEGER_32): REAL_32 -- real item at index. require valid_index: valid_index (index) is_real_or_integer: is_real_item (index) reference_item (index: INTEGER_32): detachable separate ANY -- Reference item at index. require valid_index: valid_index (index) is_reference: is_reference_item (index) wide_character_item (index: INTEGER_32): CHARACTER_32 -- Character item at index. require valid_index: valid_index (index) is_character_32: is_character_32_item (index) 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: TUPLE): 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: like Current): BOOLEAN -- Is other attached to an object considered -- equal to current object? require -- from ANY other_not_void: other /= Void ensure -- from ANY symmetric: Result implies other ~ Current consistent: standard_is_equal (other) implies Result object_comparison: BOOLEAN -- Must search operations use equal rather than = -- for comparing references? (Default: no, use =.) 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: TUPLE): 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 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 count: INTEGER_32 -- Number of element in Current. hash_code: INTEGER_32 -- Hash code value ensure -- from HASHABLE good_hash_value: Result >= 0 is_empty: BOOLEAN -- Is Current empty? is_hashable: BOOLEAN -- May current object be hashed? -- (True by default.) -- (from HASHABLE) Lower: INTEGER_32 = 1 -- Lower bound of TUPLE. 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)) upper: INTEGER_32 -- Upper bound of TUPLE. -- Use count instead. ensure definition: Result = count valid_index (k: INTEGER_32): BOOLEAN -- Is k a valid key? ensure -- from READABLE_INDEXABLE only_if_in_index_set: Result implies (Lower <= k and k <= count) valid_type_for_index (v: detachable separate ANY; index: INTEGER_32): BOOLEAN -- Is object v a valid target for element at position index? require valid_index: valid_index (index) feature -- Status setting compare_objects -- Ensure that future search operations will use equal -- rather than = for comparing references. ensure object_comparison: object_comparison compare_references -- Ensure that future search operations will use = -- rather than equal for comparing references. ensure reference_comparison: not object_comparison feature -- Element change put (v: detachable separate ANY; index: INTEGER_32) -- Insert v at position index. require valid_index: valid_index (index) valid_type_for_index: valid_type_for_index (v, index) put_boolean (v: BOOLEAN; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type: is_boolean_item (index) put_character (v: CHARACTER_8; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type: is_character_8_item (index) put_character_32 (v: CHARACTER_32; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type: is_character_32_item (index) put_character_8 (v: CHARACTER_8; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type: is_character_8_item (index) put_double (v: REAL_64; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type: is_double_item (index) put_integer (v: INTEGER_32; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type: is_integer_32_item (index) put_integer_16 (v: INTEGER_16; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type: is_integer_16_item (index) put_integer_32 (v: INTEGER_32; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type: is_integer_32_item (index) put_integer_64 (v: INTEGER_64; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type: is_integer_64_item (index) put_integer_8 (v: INTEGER_8; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type: is_integer_8_item (index) put_natural_16 (v: NATURAL_16; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type: is_natural_16_item (index) put_natural_32 (v: NATURAL_32; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type: is_natural_32_item (index) put_natural_64 (v: NATURAL_64; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type: is_natural_64_item (index) put_natural_8 (v: NATURAL_8; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type: is_natural_8_item (index) put_pointer (v: POINTER; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type: is_pointer_item (index) put_real (v: REAL_32; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type: is_real_item (index) put_real_32 (v: REAL_32; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type: is_real_item (index) put_real_64 (v: REAL_64; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type: is_double_item (index) put_reference (v: detachable separate ANY; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type_for_index: valid_type_for_index (v, index) valid_type: is_reference_item (index) put_wide_character (v: CHARACTER_32; index: INTEGER_32) -- Put v at position index in Current. require valid_index: valid_index (index) valid_type: is_character_32_item (index) feature -- Duplication copy (other: TUPLE) -- 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: TUPLE) -- 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: TUPLE -- 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: TUPLE) -- 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: TUPLE -- 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: TUPLE -- 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 TUPLE -- 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 -- Access: lower level Any_code: NATURAL_8 = 255 -- Code used to identify type in TUPLE. Boolean_code: NATURAL_8 = 1 Character_32_code: NATURAL_8 = 14 -- Was declared in TUPLE as synonym of Wide_character_code. Character_8_code: NATURAL_8 = 2 -- Was declared in TUPLE as synonym of Character_code. Character_code: NATURAL_8 = 2 -- Was declared in TUPLE as synonym of Character_8_code. Integer_16_code: NATURAL_8 = 7 Integer_32_code: NATURAL_8 = 8 Integer_64_code: NATURAL_8 = 9 Integer_8_code: NATURAL_8 = 6 item_code (index: INTEGER_32): NATURAL_8 -- Type code of item at index. Used for -- argument processing in ROUTINE require valid_index: valid_index (index) Natural_16_code: NATURAL_8 = 11 Natural_32_code: NATURAL_8 = 12 Natural_64_code: NATURAL_8 = 13 Natural_8_code: NATURAL_8 = 10 Pointer_code: NATURAL_8 = 5 Real_32_code: NATURAL_8 = 4 Real_64_code: NATURAL_8 = 3 Reference_code: NATURAL_8 = 0 Wide_character_code: NATURAL_8 = 14 -- Was declared in TUPLE as synonym of Character_32_code. feature -- Concatenation plus alias "+" (a_other: TUPLE): detachable like Current -- Concatenation of Current with a_other. ensure has_expected_count: Result /= Void implies Result.count = count + a_other.count has_expected_items: Result /= Void implies ((∀ ic_1: 1 |..| count ¦ Result [ic_1] = item (ic_1)) and (∀ ic_2: 1 |..| a_other.count ¦ Result [count + ic_2] = a_other [ic_2])) feature -- Correction Mismatch_information: MISMATCH_INFORMATION -- Original attribute values of mismatched object -- (from MISMATCH_CORRECTOR) 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 feature -- Retrieval correct_mismatch -- Attempt to correct object mismatch using Mismatch_information. feature -- Type queries is_boolean_item (index: INTEGER_32): BOOLEAN -- Is item at index a BOOLEAN? require valid_index: valid_index (index) is_character_32_item (index: INTEGER_32): BOOLEAN -- Is item at index a CHARACTER_32? -- Was declared in TUPLE as synonym of is_wide_character_item. require valid_index: valid_index (index) is_character_8_item (index: INTEGER_32): BOOLEAN -- Is item at index a CHARACTER_8? -- Was declared in TUPLE as synonym of is_character_item. require valid_index: valid_index (index) is_character_item (index: INTEGER_32): BOOLEAN -- Is item at index a CHARACTER_8? -- Was declared in TUPLE as synonym of is_character_8_item. require valid_index: valid_index (index) is_double_item (index: INTEGER_32): BOOLEAN -- Is item at index a REAL_64? require valid_index: valid_index (index) is_integer_16_item (index: INTEGER_32): BOOLEAN -- Is item at index an INTEGER_16? require valid_index: valid_index (index) is_integer_32_item (index: INTEGER_32): BOOLEAN -- Is item at index an INTEGER_32? -- Was declared in TUPLE as synonym of is_integer_item. require valid_index: valid_index (index) is_integer_64_item (index: INTEGER_32): BOOLEAN -- Is item at index an INTEGER_64? require valid_index: valid_index (index) is_integer_8_item (index: INTEGER_32): BOOLEAN -- Is item at index an INTEGER_8? require valid_index: valid_index (index) is_integer_item (index: INTEGER_32): BOOLEAN -- Is item at index an INTEGER_32? -- Was declared in TUPLE as synonym of is_integer_32_item. require valid_index: valid_index (index) is_natural_16_item (index: INTEGER_32): BOOLEAN -- Is item at index an NATURAL_16? require valid_index: valid_index (index) is_natural_32_item (index: INTEGER_32): BOOLEAN -- Is item at index an NATURAL_32? require valid_index: valid_index (index) is_natural_64_item (index: INTEGER_32): BOOLEAN -- Is item at index an NATURAL_64? require valid_index: valid_index (index) is_natural_8_item (index: INTEGER_32): BOOLEAN -- Is item at index an NATURAL_8? require valid_index: valid_index (index) is_pointer_item (index: INTEGER_32): BOOLEAN -- Is item at index a POINTER? require valid_index: valid_index (index) is_real_32_item (index: INTEGER_32): BOOLEAN -- Is item at index a REAL_32? require valid_index: valid_index (index) is_real_64_item (index: INTEGER_32): BOOLEAN -- Is item at index a REAL_64? require valid_index: valid_index (index) is_real_item (index: INTEGER_32): BOOLEAN -- Is item at index a REAL_32? require valid_index: valid_index (index) is_reference_item (index: INTEGER_32): BOOLEAN -- Is item at index a REFERENCE? require valid_index: valid_index (index) is_uniform: BOOLEAN -- Are all items of the same basic type or all of reference type? ensure yes_if_empty: (count = 0) implies Result is_uniform_boolean: BOOLEAN -- Are all items of type BOOLEAN? ensure yes_if_empty: (count = 0) implies Result is_uniform_character: BOOLEAN -- Are all items of type CHARACTER_8? -- Was declared in TUPLE as synonym of is_uniform_character_8. ensure yes_if_empty: (count = 0) implies Result is_uniform_character_32: BOOLEAN -- Are all items of type CHARACTER_32? -- Was declared in TUPLE as synonym of is_uniform_wide_character. ensure yes_if_empty: (count = 0) implies Result is_uniform_character_8: BOOLEAN -- Are all items of type CHARACTER_8? -- Was declared in TUPLE as synonym of is_uniform_character. ensure yes_if_empty: (count = 0) implies Result is_uniform_double: BOOLEAN -- Are all items of type REAL_64? ensure yes_if_empty: (count = 0) implies Result is_uniform_integer: BOOLEAN -- Are all items of type INTEGER? -- Was declared in TUPLE as synonym of is_uniform_integer_32. ensure yes_if_empty: (count = 0) implies Result is_uniform_integer_16: BOOLEAN -- Are all items of type INTEGER_16? ensure yes_if_empty: (count = 0) implies Result is_uniform_integer_32: BOOLEAN -- Are all items of type INTEGER? -- Was declared in TUPLE as synonym of is_uniform_integer. ensure yes_if_empty: (count = 0) implies Result is_uniform_integer_64: BOOLEAN -- Are all items of type INTEGER_64? ensure yes_if_empty: (count = 0) implies Result is_uniform_integer_8: BOOLEAN -- Are all items of type INTEGER_8? ensure yes_if_empty: (count = 0) implies Result is_uniform_natural_16: BOOLEAN -- Are all items of type NATURAL_16? ensure yes_if_empty: (count = 0) implies Result is_uniform_natural_32: BOOLEAN -- Are all items of type NATURAL_32? ensure yes_if_empty: (count = 0) implies Result is_uniform_natural_64: BOOLEAN -- Are all items of type NATURAL_64? ensure yes_if_empty: (count = 0) implies Result is_uniform_natural_8: BOOLEAN -- Are all items of type NATURAL_8? ensure yes_if_empty: (count = 0) implies Result is_uniform_pointer: BOOLEAN -- Are all items of type POINTER? ensure yes_if_empty: (count = 0) implies Result is_uniform_real: BOOLEAN -- Are all items of type REAL_32? ensure yes_if_empty: (count = 0) implies Result is_uniform_real_32: BOOLEAN -- Are all items of type REAL_32? ensure yes_if_empty: (count = 0) implies Result is_uniform_real_64: BOOLEAN -- Are all items of type REAL_64? ensure yes_if_empty: (count = 0) implies Result is_uniform_reference: BOOLEAN -- Are all items of reference type? ensure yes_if_empty: (count = 0) implies Result is_uniform_wide_character: BOOLEAN -- Are all items of type CHARACTER_32? -- Was declared in TUPLE as synonym of is_uniform_character_32. ensure yes_if_empty: (count = 0) implies Result is_wide_character_item (index: INTEGER_32): BOOLEAN -- Is item at index a CHARACTER_32? -- Was declared in TUPLE as synonym of is_character_32_item. require valid_index: valid_index (index) invariant -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) -- from READABLE_INDEXABLE consistent_boundaries: Lower <= count or else Lower = count + 1 note copyright: "Copyright (c) 1984-2020, 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 TUPLE
Generated by ISE EiffelStudio