Automatic generation produced by ISE Eiffel

Classes Clusters Cluster hierarchy Chart Relations Flat contracts Go to:
note description: "Contiguous integer intervals" library: "Free implementation of ELKS library" status: "See notice at end of class." legal: "See notice at end of class." date: "$Date: 2019-07-05 07:26:16 -0800 (Fri, 05 Jul 2019) $" revision: "$Revision: 103325 $" class interface INTEGER_INTERVAL create make (min_index, max_index: INTEGER_32) -- Set up interval to have bounds min_index and -- max_index (empty if min_index > max_index) ensure lower_defined: Lower_defined upper_defined: Upper_defined set_if_non_empty: (min_index <= max_index) implies ((lower = min_index) and (upper = max_index)) empty_if_not_in_order: (min_index > max_index) implies is_empty feature -- Initialization adapt (other: INTEGER_INTERVAL) -- Reset to be the same interval as other. require other_not_void: other /= Void ensure same_lower: lower = other.lower same_upper: upper = other.upper same_lower_defined: Lower_defined = other.Lower_defined same_upper_defined: Upper_defined = other.Upper_defined feature -- Access at alias "@" (i: INTEGER_32): INTEGER_32 -- Entry at index i, if in index interval -- Was declared in INTEGER_INTERVAL as synonym of item. require -- from TABLE valid_key: valid_index (i) generating_type: TYPE [detachable INTEGER_INTERVAL] -- 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 has alias "" (v: INTEGER_32): BOOLEAN -- Does v appear in interval? -- Was declared in INTEGER_INTERVAL as synonym of valid_index. require -- from CONTAINER True ensure -- from CONTAINER not_found_in_empty: Result implies not is_empty ensure then iff_within_bounds: Result = ((Upper_defined implies v <= upper) and (Lower_defined implies v >= lower)) item alias "[]" (i: INTEGER_32): INTEGER_32 -- Entry at index i, if in index interval -- Was declared in INTEGER_INTERVAL as synonym of at. require -- from TABLE valid_key: valid_index (i) require -- from READABLE_INDEXABLE valid_index: valid_index (i) lower: INTEGER_32 -- Smallest value in interval. Lower_defined: BOOLEAN = True -- Is there a lower bound? new_cursor: INDEXABLE_ITERATION_CURSOR [INTEGER_32] -- Fresh cursor associated with current structure -- (from READABLE_INDEXABLE) require -- from ITERABLE True ensure -- from ITERABLE result_attached: Result /= Void upper: INTEGER_32 -- Largest value in interval. Upper_defined: BOOLEAN = True -- Is there an upper bound? valid_index (v: INTEGER_32): BOOLEAN -- Does v appear in interval? -- Was declared in INTEGER_INTERVAL as synonym of has. require -- from READABLE_INDEXABLE True require -- from TABLE True ensure -- from READABLE_INDEXABLE only_if_in_index_set: Result implies (lower <= v and v <= upper) ensure then iff_within_bounds: Result = ((Upper_defined implies v <= upper) and (Lower_defined implies v >= lower)) feature -- Measurement additional_space: INTEGER_32 -- Proposed number of additional items -- (from RESIZABLE) ensure -- from RESIZABLE at_least_one: Result >= 1 capacity: INTEGER_32 -- Maximum number of items in interval -- (here the same thing as count) ensure -- from BOUNDED capacity_non_negative: Result >= 0 count: INTEGER_32 -- Number of items in interval require -- from FINITE True require -- from SET True ensure -- from FINITE count_non_negative: Result >= 0 ensure then definition: Result = upper - lower + 1 Growth_percentage: INTEGER_32 = 50 -- Percentage by which structure will grow automatically -- (from RESIZABLE) index_set: INTEGER_INTERVAL -- Range of acceptable indexes. -- (here: the interval itself) require -- from READABLE_INDEXABLE True ensure -- from READABLE_INDEXABLE not_void: Result /= Void empty_if_not_in_order: (lower > upper) implies Result.is_empty same_lower_if_not_empty: (lower <= upper) implies Result.lower = lower same_upper_if_not_empty: (lower <= upper) implies Result.upper = upper ensure then index_set_is_range: Result ~ Current Minimal_increase: INTEGER_32 = 5 -- Minimal number of additional items -- (from RESIZABLE) occurrences (v: INTEGER_32): INTEGER_32 -- Number of times v appears in structure require -- from BAG True ensure -- from BAG non_negative_occurrences: Result >= 0 ensure then one_iff_in_bounds: Result = 1 implies has (v) zero_otherwise: Result /= 1 implies Result = 0 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 (other: INTEGER_INTERVAL): 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 array made of the same items as other? require -- from ANY other_not_void: other /= Void ensure -- from ANY symmetric: Result implies other ~ Current consistent: standard_is_equal (other) implies Result ensure then iff_same_bounds: Result = ((Lower_defined implies (other.Lower_defined and lower = other.lower)) and (Upper_defined implies (other.Upper_defined and upper = other.upper))) 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 (other: INTEGER_INTERVAL): 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 all_cleared: BOOLEAN -- Are all items set to default values? ensure then iff_at_zero: Result = ((lower = 0) and (upper = 0)) 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 extendible: BOOLEAN -- May new items be added? -- Answer: yes full: BOOLEAN -- Is structure full? -- (from BOUNDED) is_empty: BOOLEAN -- Is structure empty? -- (from FINITE) require -- from CONTAINER True is_inserted (v: INTEGER_32): BOOLEAN -- Has v been inserted by the most recent insertion? -- (By default, the value returned is equivalent to calling -- has (v). However, descendants might be able to provide more -- efficient implementations.) -- (from COLLECTION) object_comparison: BOOLEAN -- Must search operations use equal rather than = -- for comparing references? (Default: no, use =.) -- (from CONTAINER) prunable: BOOLEAN -- May individual items be removed? -- Answer: no resizable: BOOLEAN -- May capacity be changed? (Answer: yes.) -- (from RESIZABLE) 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)) feature -- Status setting compare_objects -- Ensure that future search operations will use equal -- rather than = for comparing references. -- (from CONTAINER) require -- from CONTAINER changeable_comparison_criterion: changeable_comparison_criterion ensure -- from CONTAINER object_comparison compare_references -- Ensure that future search operations will use = -- rather than equal for comparing references. -- (from CONTAINER) require -- from CONTAINER changeable_comparison_criterion: changeable_comparison_criterion ensure -- from CONTAINER reference_comparison: not object_comparison feature -- Element change extend (v: INTEGER_32) -- Make sure that interval goes all the way -- to v (up or down). -- Was declared in INTEGER_INTERVAL as synonym of put. require -- from COLLECTION extendible: extendible ensure -- from COLLECTION item_inserted: is_inserted (v) ensure then -- from SET in_set_already: old has (v) implies (count = old count) added_to_set: not old has (v) implies (count = old count + 1) ensure then extended_down: lower = (old lower).min (v) extended_up: upper = (old upper).max (v) fill (other: CONTAINER [INTEGER_32]) -- Fill with as many items of other as possible. -- The representations of other and current structure -- need not be the same. -- (from COLLECTION) require -- from COLLECTION other_not_void: other /= Void extendible: extendible put (v: INTEGER_32) -- Make sure that interval goes all the way -- to v (up or down). -- Was declared in INTEGER_INTERVAL as synonym of extend. ensure then extended_down: lower = (old lower).min (v) extended_up: upper = (old upper).max (v) feature -- Removal changeable_comparison_criterion: BOOLEAN -- May object_comparison be changed? -- (Answer: only if set empty; otherwise insertions might -- introduce duplicates, destroying the set property.) -- (from SET) require -- from CONTAINER True ensure then -- from SET only_on_empty: Result = is_empty prune_all (v: INTEGER_32) -- Remove all occurrences of v. -- (Reference or object equality, -- based on object_comparison.) -- (from COLLECTION) require -- from COLLECTION prunable: prunable ensure -- from COLLECTION no_more_occurrences: not has (v) wipe_out -- Remove all items. require -- from COLLECTION prunable: prunable ensure -- from COLLECTION wiped_out: is_empty feature -- Resizing automatic_grow -- Change the capacity to accommodate at least -- Growth_percentage more items. -- (from RESIZABLE) require -- from RESIZABLE resizable: resizable ensure -- from RESIZABLE increased_capacity: capacity >= old capacity + old additional_space grow (i: INTEGER_32) -- Ensure that capacity is at least i. require -- from RESIZABLE resizable: resizable ensure -- from RESIZABLE new_capacity: capacity >= i ensure then no_loss_from_bottom: lower <= old lower no_loss_from_top: upper >= old upper resize (min_index, max_index: INTEGER_32) -- Rearrange interval to go from at most -- min_index to at least max_index, -- encompassing previous bounds. resize_exactly (min_index, max_index: INTEGER_32) -- Rearrange interval to go from -- min_index to max_index. trim -- Decrease capacity to the minimum value. -- Apply to reduce allocated storage. ensure -- from RESIZABLE same_count: count = old count minimal_capacity: capacity = count feature -- Conversion as_array: ARRAY [INTEGER_32] -- Plain array containing interval's items require finite: Upper_defined and Lower_defined ensure same_lower: Result.lower = lower same_upper: Result.upper = upper linear_representation: LINEAR [INTEGER_32] -- Representation as a linear structure feature -- Duplication copy (other: like Current) -- Reset to be the same interval as other. require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_equal: Current ~ other frozen deep_copy (other: INTEGER_INTERVAL) -- 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: INTEGER_INTERVAL -- 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: INTEGER_INTERVAL) -- 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: INTEGER_INTERVAL -- 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) subinterval (start_pos, end_pos: INTEGER_32): like Current -- Interval made of items of current array within -- bounds start_pos and end_pos. frozen twin: INTEGER_INTERVAL -- 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 INTEGER_INTERVAL -- 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 -- Inapplicable bag_put (v: INTEGER_32) -- Ensure that structure includes v. -- (from TABLE) require -- from COLLECTION extendible: extendible ensure -- from COLLECTION item_inserted: is_inserted (v) indexable_put (v: INTEGER_32; k: INTEGER_32) -- Associate value v with key k. -- Not applicable here. require -- from TABLE valid_key: valid_index (k) require -- from TABLE valid_key: valid_index (k) ensure -- from TABLE inserted: item (k) = v prune (v: INTEGER_32) -- Remove one occurrence of v if any. -- Not applicable here. require -- from COLLECTION prunable: prunable ensure then -- from SET removed_count_change: old has (v) implies (count = old count - 1) not_removed_no_count_change: not old has (v) implies (count = old count) item_deleted: not has (v) feature -- Iteration do_all (action: PROCEDURE [INTEGER_32]) -- Apply action to every item of current interval. require action_exists: action /= Void finite: Upper_defined and Lower_defined exists (condition: FUNCTION [INTEGER_32, BOOLEAN]): BOOLEAN -- Does at least one of  interval's values -- satisfy condition? require finite: Upper_defined and Lower_defined condition_not_void: condition /= Void ensure consistent_with_count: Result = (hold_count (condition) > 0) exists1 (condition: FUNCTION [INTEGER_32, BOOLEAN]): BOOLEAN -- Does exactly one of  interval's values -- satisfy condition? require finite: Upper_defined and Lower_defined condition_not_void: condition /= Void ensure consistent_with_count: Result = (hold_count (condition) = 1) for_all (condition: FUNCTION [INTEGER_32, BOOLEAN]): BOOLEAN -- Do all interval's values satisfy condition? require finite: Upper_defined and Lower_defined condition_not_void: condition /= Void ensure consistent_with_count: Result = (hold_count (condition) = count) hold_count (condition: FUNCTION [INTEGER_32, BOOLEAN]): INTEGER_32 -- Number of  interval's values that -- satisfy condition require finite: Upper_defined and Lower_defined condition_not_void: condition /= Void ensure non_negative: Result >= 0 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 count_definition: Upper_defined and Lower_defined implies count = upper - lower + 1 not_infinite: Upper_defined and Lower_defined -- from RESIZABLE increase_by_at_least_one: Minimal_increase >= 1 -- from BOUNDED valid_count: count <= capacity full_definition: full = (count = capacity) -- from FINITE empty_definition: is_empty = (count = 0) -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) -- from READABLE_INDEXABLE consistent_boundaries: lower <= upper or else lower = upper + 1 note copyright: "Copyright (c) 1984-2019, 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 INTEGER_INTERVAL
Classes Clusters Cluster hierarchy Chart Relations Flat contracts Go to:

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