indexing
description: "[
Special objects: homogeneous sequences of values,
used to represent arrays and strings
]"
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date: 2006-01-22 18:25:44 -0800 (Sun, 22 Jan 2006) $"
revision: "$Revision: 56675 $"
frozen class interface
SPECIAL [T]
create
make (n: INTEGER_32)
`n'
require
non_negative_argument: n >= 0
ensure
area_allocated: count = n
make_from_native_array (an_array: like native_array)
`an_array'
require
is_dotnet: {PLATFORM}.is_dotnet
an_array_not_void: an_array /= Void
feature
frozen base_address: POINTER
`0'
require
not_dotnet: not {PLATFORM}.is_dotnet
ensure
base_address_not_null: Result /= default_pointer
generating_type: STRING_8
ANY
generator: STRING_8
ANY
frozen index_of (v: T; start_position: INTEGER_32): INTEGER_32
`v'
require
valid_start_position: start_position >= 0
ensure
found_or_not_found: Result = -1 or else (Result >= 0 and then Result < count)
frozen item alias "[]" (i: INTEGER_32): T assign put
`i'
SPECIALinfix "@"
require
index_big_enough: i >= 0
index_small_enough: i < count
frozen item_address (i: INTEGER_32): POINTER
`i'
require
not_dotnet: not {PLATFORM}.is_dotnet
index_big_enough: i >= 0
index_small_enough: i < count
ensure
element_address_not_null: Result /= default_pointer
frozen native_array: NATIVE_ARRAY [T]
require
is_dotnet: {PLATFORM}.is_dotnet
frozen infix "@" (i: INTEGER_32): T assign put
`i'
SPECIALitem
require
index_big_enough: i >= 0
index_small_enough: i < count
feature
frozen capacity: INTEGER_32
SPECIALcount
frozen count: INTEGER_32
SPECIALcapacity
ensure ABSTRACT_SPECIAL
count_non_negative: Result >= 0
lower: INTEGER_32 is 0
frozen upper: INTEGER_32
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
frozen all_default (upper_bound: INTEGER_32): BOOLEAN
`0'`upper_bound'
require
min_upper_bound: upper_bound >= -1
max_upper_bound: upper_bound < count
ensure
valid_on_empty_area: upper_bound = -1 implies Result
conforms_to (other: ANY): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
frozen same_items (other: like Current; upper_bound: INTEGER_32): BOOLEAN
`0'`upper_bound'
require
min_upper_bound: upper_bound >= -1
max_upper_bound: upper_bound < count
other_not_void: other /= Void
other_has_enough_items: upper_bound < other.count
ensure
valid_on_empty_area: upper_bound = -1 implies Result
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))
frozen valid_index (i: INTEGER_32): BOOLEAN
`i'
feature
frozen copy_data (other: like Current; source_index, destination_index, n: INTEGER_32)
`n'`other'`source_index'
`destination_index'
require
other_not_void: other /= Void
source_index_non_negative: source_index >= 0
destination_index_non_negative: destination_index >= 0
n_non_negative: n >= 0
n_is_small_enough_for_source: source_index + n <= other.count
n_is_small_enough_for_destination: destination_index + n <= count
frozen fill_with (v: T; start_index, end_index: INTEGER_32)
`start_index'`end_index'`v'
require
start_index_non_negative: start_index >= 0
start_index_not_too_big: start_index <= end_index
end_index_valid: end_index < count
frozen move_data (source_index, destination_index, n: INTEGER_32)
`n'`source_start'`destination_index'
require
source_index_non_negative: source_index >= 0
destination_index_non_negative: destination_index >= 0
n_non_negative: n >= 0
n_is_small_enough_for_source: source_index + n <= count
n_is_small_enough_for_destination: destination_index + n <= count
frozen non_overlapping_move (source_index, destination_index, n: INTEGER_32)
`n'`source_start'`destination_index'
require
source_index_non_negative: source_index >= 0
destination_index_non_negative: destination_index >= 0
n_non_negative: n >= 0
different_source_and_target: source_index /= destination_index
non_overlapping: (source_index < destination_index implies source_index + n < destination_index) or (source_index > destination_index implies destination_index + n < source_index)
n_is_small_enough_for_source: source_index + n <= count
n_is_small_enough_for_destination: destination_index + n <= count
frozen overlapping_move (source_index, destination_index, n: INTEGER_32)
`n'`source_start'`destination_index'
require
source_index_non_negative: source_index >= 0
destination_index_non_negative: destination_index >= 0
n_non_negative: n >= 0
different_source_and_target: source_index /= destination_index
n_is_small_enough_for_source: source_index + n <= count
n_is_small_enough_for_destination: destination_index + n <= count
frozen put (v: T; i: INTEGER_32)
`i'`v'
require
index_big_enough: i >= 0
index_small_enough: i < count
feature
frozen clear_all
feature
frozen aliased_resized_area (n: INTEGER_32): like Current
`Current'`n'
require
valid_new_count: n > count
ensure
result_not_void: Result /= Void
new_count: Result.count = n
frozen aliased_resized_area_and_keep (n, j, k: INTEGER_32): like Current
`Current'`n'
`j'`k'
require
n_non_negative: n >= 0
j_non_negative: j >= 0
k_non_negative: k >= 0
k_valid: k <= count
ensure
result_not_void: Result /= Void
new_count: Result.count = n
frozen resized_area (n: INTEGER_32): like Current
`n'
require
valid_new_count: n > count
ensure
result_not_void: Result /= Void
result_different_from_current: Result /= Current
new_count: Result.count = n
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
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 SPECIAL