indexing
description: "[
Special objects: homogeneous sequences of values,
used to represent arrays and strings
]"
library: "Free implementation of ELKS library"
copyright: "Copyright (c) 1986-2005, Eiffel Software and others"
license: "Eiffel Forum License v2 (see forum.txt)"
date: "$Date: 2008-05-23 17:24:07 -0700 (Fri, 23 May 2008) $"
revision: "$Revision: 170 $"
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
base_address: POINTER
`0'
require
not_dotnet: not {PLATFORM}.is_dotnet
ensure
base_address_not_null: Result /= default_pointer
generating_type: STRING_8
ANY
ensure ANY
generating_type_not_void: Result /= Void
generating_type_not_empty: not Result.is_empty
generator: STRING_8
ANY
ensure ANY
generator_not_void: Result /= Void
generator_not_empty: not Result.is_empty
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)
item alias "[]" (i: INTEGER_32): T assign put
`i'
require
index_big_enough: i >= 0
index_small_enough: i < count
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
native_array: ?NATIVE_ARRAY [T]
require
is_dotnet: {PLATFORM}.is_dotnet
infix "@" (i: INTEGER_32): T
`i'
require
index_big_enough: i >= 0
index_small_enough: i < count
feature
capacity: INTEGER_32
ensure
capacity_non_negative: Result >= 0
count: INTEGER_32
ensure ABSTRACT_SPECIAL
count_non_negative: Result >= 0
lower: INTEGER_32 is 0
upper: INTEGER_32
ensure
definition: lower <= Result + 1
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 (other /= Void and then 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))
frozen is_deep_equal (other: SPECIAL [T]): BOOLEAN
`Current'`other'
ANY
require ANY
other_not_void: other /= Void
ensure 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: SPECIAL [T]): 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: SPECIAL [T]): 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
all_default (start_index, end_index: INTEGER_32): BOOLEAN
`start_index'`end_index'
require
start_index_non_negative: start_index >= 0
start_index_not_too_big: start_index <= end_index + 1
end_index_valid: end_index < count
ensure
valid_on_empty_area: (end_index < start_index) implies Result
conforms_to (other: ANY): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
same_items (other: like Current; start_index, end_index: INTEGER_32): BOOLEAN
`start_index'`end_index'
require
start_index_non_negative: start_index >= 0
start_index_not_too_big: start_index <= end_index + 1
end_index_valid: end_index < count
other_not_void: other /= Void
other_has_enough_items: end_index < other.count
ensure
valid_on_empty_area: (end_index < start_index) 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))
valid_index (i: INTEGER_32): BOOLEAN
`i'
ensure
definition: Result = ((0 <= i) and (i < count))
feature
copy_data (other: SPECIAL [T]; 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
same_type: other.conforms_to (Current)
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 + 1
end_index_valid: end_index < count
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
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
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
put (v: T; i: INTEGER_32)
`i'`v'
require
index_big_enough: i >= 0
index_small_enough: i < count
ensure
inserted: item (i) = v
feature
clear_all
ensure
cleared: all_default (0, upper)
feature
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
resized_area (n: INTEGER_32): like Current
`n'
require
n_non_negative: n >= 0
ensure
result_not_void: Result /= Void
result_different_from_current: Result /= Current
new_count: Result.count = n
feature
copy (other: SPECIAL [T])
`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: SPECIAL [T])
copy`other'deep_twin
ANY
require ANY
other_not_void: other /= Void
ensure ANY
deep_equal: deep_equal (Current, other)
frozen deep_twin: SPECIAL [T]
ANY
ensure ANY
deep_twin_not_void: Result /= Void
deep_equal: deep_equal (Current, Result)
frozen standard_copy (other: SPECIAL [T])
`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: SPECIAL [T]
`other'
ANY
ensure ANY
standard_twin_not_void: Result /= Void
equal: standard_equal (Result, Current)
frozen twin: SPECIAL [T]
`Current'
twincopycopy
ANY
ensure ANY
twin_not_void: Result /= Void
is_equal: Result.is_equal (Current)
feature
frozen default: ?SPECIAL [T]
ANY
frozen default_pointer: POINTER
`POINTER'
`p'default
`p'`POINTER'
ANY
default_rescue
ANY
frozen do_nothing
ANY
feature
io: STD_FILES
ANY
ensure ANY
io_not_void: Result /= Void
out: STRING_8
ANY
ensure ANY
out_not_void: Result /= Void
print (some: ?ANY)
`some'
ANY
frozen tagged_out: STRING_8
ANY
ensure ANY
tagged_out_not_void: Result /= Void
feature
operating_environment: OPERATING_ENVIRONMENT
ANY
ensure ANY
operating_environment_not_void: Result /= Void
invariant
ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)
end SPECIAL