indexing
status: "See notice at end of class"
date: "$Date$"
revision: "$Revision$"
class interface
SEQ_STRING
create
make (n: INTEGER)
n
STRING
require STRING
non_negative_size: n >= 0
ensure STRING
empty_string: count = 0
area_allocated: capacity >= n
feature
adapt (s: STRING): like Current
s
s
STRING
from_c (c_string: POINTER)
c_string
STRING
require STRING
c_string_exists: c_string /= default_pointer
ensure STRING
no_zero_byte: not has ('%U')
from_c_substring (c_string: POINTER; start_pos, end_pos: INTEGER)
c_string
STRING
require STRING
c_string_exists: c_string /= default_pointer
start_position_big_enough: start_pos >= 1
end_position_big_enough: start_pos <= end_pos + 1
ensure STRING
valid_count: count = end_pos - start_pos + 1
make_from_c (c_string: POINTER)
c_string
STRING
require STRING
c_string_exists: c_string /= default_pointer
make_from_string (s: STRING)
s
STRING
STRING
require STRING
string_exists: s /= void
ensure STRING
shared_implementation: shared_with (s)
feature
area: SPECIAL [CHARACTER]
TO_SPECIAL
current_item: CHARACTER
require TRAVERSABLE
not_off: not off
require ACTIVE
readable: readable
False_constant: STRING is "false"
STRING
fuzzy_index (other: STRING; start: INTEGER; fuzz: INTEGER): INTEGER
otherstart
fuzzother
STRING
require STRING
other_exists: other /= void
other_not_empty: not other.is_empty
start_large_enough: start >= 1
start_small_enough: start <= count
acceptable_fuzzy: fuzz <= other.count
has (c: CHARACTER): BOOLEAN
c
ensure CONTAINER
not_found_in_empty: Result implies not is_empty
hash_code: INTEGER
STRING
ensure HASHABLE
good_hash_value: Result >= 0
index: INTEGER
current_item
countcount
index_of (c: CHARACTER; start: INTEGER): INTEGER
cstart
STRING
require STRING
start_large_enough: start >= 1
start_small_enough: start <= count + 1
ensure STRING
correct_place: Result > 0 implies item (Result) = c
index_of_occurrence (c: CHARACTER; i: INTEGER): INTEGER
ic
require LINEAR
positive_occurrences: i > 0
ensure LINEAR
non_negative_result: Result >= 0
ensure then
index_value: (Result = 0) or item (Result) = c
item (i: INTEGER): CHARACTER
i
STRING@
STRING
require TABLE
valid_key: valid_index (k)
item_code (i: INTEGER): INTEGER
i
STRING
require STRING
index_small_enough: i <= count
index_large_enough: i > 0
last_index_of (c: CHARACTER; start_index_from_end: INTEGER): INTEGER
c
STRING
require STRING
start_index_small_enough: start_index_from_end <= count
start_index_large_enough: start_index_from_end >= 1
ensure STRING
correct_place: Result > 0 implies item (Result) = c
off: BOOLEAN
BILINEAR
search_after (c: CHARACTER)
current_itemc
search_before (c: CHARACTER)
current_itemc
search_string_after (s: STRING; fuzzy: INTEGER)
s
search_string_before (s: STRING; fuzzy: INTEGER)
s
shared_with (other: like Current): BOOLEAN
other
STRING
substring_index (other: STRING; start: INTEGER): INTEGER
otherstart
STRING
require STRING
other_nonvoid: other /= void
other_notempty: not other.is_empty
start_large_enough: start >= 1
start_small_enough: start <= count
ensure STRING
correct_place: Result > 0 implies substring (Result, Result + other.count - 1).is_equal (other)
True_constant: STRING is "true"
STRING
infix "@" (i: INTEGER): CHARACTER
i
STRINGitem
STRING
require TABLE
valid_key: valid_index (k)
feature
additional_space: INTEGER
RESIZABLE
ensure RESIZABLE
at_least_one: Result >= 1
capacity: INTEGER
STRING
count: INTEGER
STRING
Growth_percentage: INTEGER is 50
RESIZABLE
index_set: INTEGER_INTERVAL
STRING
ensure INDEXABLE
not_void: Result /= void
ensure then STRING
Result.count = count
Minimal_increase: INTEGER is 5
RESIZABLE
occurrences (c: CHARACTER): INTEGER
c
STRING
ensure BAG
non_negative_occurrences: Result >= 0
feature
is_equal (other: like Current): BOOLEAN
other
STRING
require ANY
other_not_void: other /= void
ensure ANY
symmetric: Result implies other.is_equal (Current)
consistent: standard_is_equal (other) implies Result
ensure then COMPARABLE
trichotomy: Result = (not (Current < other) and not (other < Current))
max (other: like Current): like Current
other
COMPARABLE
require COMPARABLE
other_exists: other /= void
ensure COMPARABLE
current_if_not_smaller: Current >= other implies Result = Current
other_if_smaller: Current < other implies Result = other
min (other: like Current): like Current
other
COMPARABLE
require COMPARABLE
other_exists: other /= void
ensure COMPARABLE
current_if_not_greater: Current <= other implies Result = Current
other_if_greater: Current > other implies Result = other
three_way_comparison (other: like Current): INTEGER
other
COMPARABLE
require COMPARABLE
other_exists: other /= void
ensure COMPARABLE
equal_zero: (Result = 0) = is_equal (other)
smaller_negative: (Result = - 1) = (Current < other)
greater_positive: (Result = 1) = (Current > other)
infix "<" (other: like Current): BOOLEAN
other
STRING
require PART_COMPARABLE
other_exists: other /= void
ensure then COMPARABLE
asymmetric: Result implies not (other < Current)
infix "<=" (other: like Current): BOOLEAN
other
COMPARABLE
require PART_COMPARABLE
other_exists: other /= void
ensure then COMPARABLE
definition: Result = ((Current < other) or is_equal (other))
infix ">" (other: like Current): BOOLEAN
other
COMPARABLE
require PART_COMPARABLE
other_exists: other /= void
ensure then COMPARABLE
definition: Result = (other < Current)
infix ">=" (other: like Current): BOOLEAN
other
COMPARABLE
require PART_COMPARABLE
other_exists: other /= void
ensure then COMPARABLE
definition: Result = (other <= Current)
feature
after: BOOLEAN
before: BOOLEAN
Changeable_comparison_criterion: BOOLEAN is False
STRING
exhausted: BOOLEAN
LINEAR
ensure LINEAR
exhausted_when_off: off implies Result
Extendible: BOOLEAN is True
STRING
full: BOOLEAN
BOUNDED
is_boolean: BOOLEAN
Current
STRING
is_double: BOOLEAN
Current
STRING
is_empty: BOOLEAN
FINITE
is_hashable: BOOLEAN
HASHABLE
ensure HASHABLE
ok_if_not_default: Result implies (Current /= default)
is_inserted (v: CHARACTER): BOOLEAN
v
COLLECTION
is_integer: BOOLEAN
Current
STRING
is_real: BOOLEAN
Current
STRING
object_comparison: BOOLEAN
equal=
=
CONTAINER
prunable: BOOLEAN
STRING
readable: BOOLEAN
SEQUENCE
resizable: BOOLEAN
capacity
RESIZABLE
valid_index (i: INTEGER): BOOLEAN
i
STRING
ensure then INDEXABLE
only_if_in_index_set: Result implies ((i >= index_set.lower) and (i <= index_set.upper))
writable: BOOLEAN
SEQUENCE
feature
compare_objects
equal
=
CONTAINER
require CONTAINER
changeable_comparison_criterion
ensure CONTAINER
object_comparison
compare_references
=
equal
CONTAINER
require CONTAINER
changeable_comparison_criterion
ensure CONTAINER
reference_comparison: not object_comparison
feature
back
require BILINEAR
not_before: not before
finish
forth
require LINEAR
not_after: not after
search (v: like current_item)
itemv
v
exhausted
object_comparison
BILINEAR
ensure LINEAR
object_found: (not exhausted and object_comparison) implies equal (v, current_item)
item_found: (not exhausted and not object_comparison) implies v = current_item
start
feature
append (s: STRING)
s
STRING
require STRING
argument_not_void: s /= void
ensure STRING
new_count: count = old count + old s.count
append_boolean (b: BOOLEAN)
b
STRING
append_character (c: CHARACTER)
c
STRINGextend
STRING
ensure then STRING
item_inserted: item (count) = c
new_count: count = old count + 1
append_double (d: DOUBLE)
d
STRING
append_integer (i: INTEGER)
i
STRING
append_real (r: REAL)
r
STRING
append_string (s: STRING)
s
STRING
copy (other: like Current)
other
clone
STRING
require ANY
other_not_void: other /= void
type_identity: same_type (other)
ensure ANY
is_equal: is_equal (other)
ensure then STRING
new_result_count: count = other.count
extend (c: CHARACTER)
c
STRINGappend_character
STRING
require COLLECTION
extendible: extendible
ensure COLLECTION
item_inserted: is_inserted (v)
ensure then BAG
one_more_occurrence: occurrences (v) = old (occurrences (v)) + 1
ensure then STRING
item_inserted: item (count) = c
new_count: count = old count + 1
fill (other: CONTAINER [CHARACTER])
other
other
COLLECTION
require COLLECTION
other_not_void: other /= void
extendible
fill_blank
capacity
STRING
ensure STRING
filled: full
same_size: (count = capacity) and (capacity = old capacity)
fill_character (c: CHARACTER)
capacityc
STRING
ensure STRING
filled: full
same_size: (count = capacity) and (capacity = old capacity)
force (v: like current_item)
v
SEQUENCE
require SEQUENCE
extendible: extendible
ensure then SEQUENCE
new_count: count = old count + 1
item_inserted: has (v)
head (n: INTEGER)
n
ncount
STRING
require STRING
non_negative_argument: n >= 0
ensure STRING
new_count: count = n.min (old count)
insert (s: STRING; i: INTEGER)
si
STRING
require STRING
string_exists: s /= void
index_small_enough: i <= count
index_large_enough: i > 0
ensure STRING
new_count: count = old count + s.count
left_adjust
STRING
ensure STRING
new_count: (count /= 0) implies ((item (1) /= ' ') and (item (1) /= ' ') and (item (1) /= '%R') and (item (1) /= ''))
string_precede (c: CHARACTER)
c
STRINGprepend_character
STRING
ensure STRING
new_count: count = old count + 1
precede (c: CHARACTER)
c
ensure
new_index: index = old index + 1
prepend (s: STRING)
s
require
argument_not_void: s /= void
ensure
new_index: index = old index + s.count
string_prepend (s: STRING)
s
STRING
require STRING
argument_not_void: s /= void
ensure STRING
new_count: count = old count + s.count
prepend_boolean (b: BOOLEAN)
b
STRING
prepend_character (c: CHARACTER)
c
STRINGprecede
STRING
ensure STRING
new_count: count = old count + 1
prepend_double (d: DOUBLE)
d
STRING
prepend_integer (i: INTEGER)
i
STRING
prepend_real (r: REAL)
r
STRING
prepend_string (s: STRING)
s
STRING
put (c: CHARACTER; i: INTEGER)
ic
STRING
require TABLE
valid_key: valid_index (k)
ensure then INDEXABLE
insertion_done: item (k) = v
replace (c: CHARACTER)
c
require ACTIVE
writable: writable
ensure ACTIVE
item_replaced: current_item = v
replace_blank
STRING
ensure STRING
same_size: (count = old count) and (capacity = old capacity)
replace_character (c: CHARACTER)
c
STRING
ensure STRING
same_size: (count = old count) and (capacity = old capacity)
replace_substring (s: like Current; start_pos, end_pos: INTEGER)
start_posend_poss
STRING
require STRING
string_exists: s /= void
index_small_enough: end_pos <= count
order_respected: start_pos <= end_pos
index_large_enough: start_pos > 0
ensure STRING
new_count: count = old count + s.count - end_pos + start_pos - 1
replace_substring_all (original, new: like Current)
originalnew
STRING
require STRING
original_exists: original /= void
new_exists: new /= void
original_not_empty: not original.is_empty
right_adjust
STRING
ensure STRING
new_count: (count /= 0) implies ((item (count) /= ' ') and (item (count) /= ' ') and (item (count) /= '%R') and (item (count) /= ''))
set (t: like Current; n1, n2: INTEGER)
tn1
n2
STRING
require STRING
argument_not_void: t /= void
ensure STRING
is_substring: is_equal (t.substring (n1, n2))
share (other: like Current)
other
require
argument_not_void: other /= void
ensure
shared_index: other.index = index
string_share (other: like Current)
other
other
STRING
require STRING
argument_not_void: other /= void
ensure STRING
shared_count: other.count = count
subcopy (other: like Current; start_pos, end_pos, index_pos: INTEGER)
otherstart_pos
end_posindex_pos
STRING
require STRING
other_not_void: other /= void
valid_start_pos: other.valid_index (start_pos)
valid_end_pos: other.valid_index (end_pos)
valid_bounds: (start_pos <= end_pos) or (start_pos = end_pos + 1)
valid_index_pos: valid_index (index_pos)
enough_space: (count - index_pos) >= (end_pos - start_pos)
tail (n: INTEGER)
n
ncount
STRING
require STRING
non_negative_argument: n >= 0
ensure STRING
new_count: count = n.min (old count)
infix "+" (s: STRING): STRING
STRING
require STRING
argument_not_void: s /= void
ensure STRING
result_exists: Result /= void
new_count: Result.count = count + s.count
feature
clear_all
STRING
ensure STRING
is_empty: count = 0
same_capacity: capacity = old capacity
prune (c: CHARACTER)
c
require COLLECTION
prunable: prunable
require else STRING
True
prune_all (c: CHARACTER)
c
STRING
require COLLECTION
prunable
require else STRING
True
ensure COLLECTION
no_more_occurrences: not has (v)
ensure then STRING
changed_count: count = (old count) - (old occurrences (c))
prune_all_leading (c: CHARACTER)
c
STRING
prune_all_trailing (c: CHARACTER)
c
STRING
remove (i: INTEGER)
i
STRING
require STRING
index_small_enough: i <= count
index_large_enough: i > 0
ensure STRING
new_count: count = old count - 1
remove_current_item
require ACTIVE
prunable: prunable
writable: writable
wipe_out
require COLLECTION
prunable
ensure COLLECTION
wiped_out: is_empty
string_wipe_out
STRING
require COLLECTION
prunable
ensure COLLECTION
wiped_out: is_empty
ensure then STRING
is_empty: count = 0
empty_capacity: capacity = 0
feature
adapt_size
count
STRING
automatic_grow
Growth_percentage
RESIZABLE
ensure RESIZABLE
increased_capacity: capacity >= old capacity + old capacity * growth_percentage // 100
grow (newsize: INTEGER)
newsize
STRING
require RESIZABLE
True
require else STRING
new_size_non_negative: newsize >= 0
ensure RESIZABLE
new_capacity: capacity >= i
resize (newsize: INTEGER)
newsize
STRING
require STRING
new_size_non_negative: newsize >= 0
feature
center_justify
STRING
character_justify (pivot: CHARACTER; position: INTEGER)
pivot
position
STRING
require STRING
valid_position: position <= capacity
positive_position: position >= 1
pivot_not_space: pivot /= ' '
not_empty: not is_empty
left_justify
STRING
linear_representation: LINEAR [CHARACTER]
LINEAR
string_mirror
STRING
ensure STRING
same_count: count = old count
string_mirrored: like Current
STRING
ensure STRING
same_count: Result.count = count
right_justify
STRING
split (a_separator: CHARACTER): LIST [STRING]
a_separator
STRING
ensure STRING
Result /= void
to_boolean: BOOLEAN
TrueFalse
STRING
require STRING
is_boolean: is_boolean
frozen to_c: ANY
STRING
to_double: DOUBLE
STRING
require STRING
represents_a_double: is_double
to_integer: INTEGER
STRING
require STRING
is_integer: is_integer
to_lower
STRING
to_real: REAL
STRING
require STRING
represents_a_real: is_real
to_upper
STRING
feature
mirror
ensure
same_count: count = old count
mirrored_index: index = count - old index + 1
mirrored: like Current
capacity
ensure
mirrored_index: Result.index = count - index + 1
same_count: Result.count = count
multiply (n: INTEGER)
STRING
require STRING
meaningful_multiplier: n >= 1
substring (n1, n2: INTEGER): like Current
n1n2
STRING
ensure STRING
new_result_count: Result.count = n2 - n1 + 1 or Result.count = 0
feature
do_all (action: PROCEDURE [ANY, TUPLE [CHARACTER]])
action
action
LINEAR
require TRAVERSABLE
action_exists: action /= void
do_if (action: PROCEDURE [ANY, TUPLE [CHARACTER]]; test: FUNCTION [ANY, TUPLE [CHARACTER], BOOLEAN])
actiontest
actiontest
LINEAR
require TRAVERSABLE
action_exists: action /= void
test_exits: test /= void
for_all (test: FUNCTION [ANY, TUPLE [CHARACTER], BOOLEAN]): BOOLEAN
test
LINEAR
require TRAVERSABLE
test_exits: test /= void
there_exists (test: FUNCTION [ANY, TUPLE [CHARACTER], BOOLEAN]): BOOLEAN
test
LINEAR
require TRAVERSABLE
test_exits: test /= void
feature
out: like Current
STRING
invariant
ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)
STRING
extendible: extendible
compare_character: not object_comparison
index_set_has_same_count: index_set.count = count
INDEXABLE
index_set_not_void: index_set /= void
RESIZABLE
increase_by_at_least_one: minimal_increase >= 1
BOUNDED
valid_count: count <= capacity
full_definition: full = (count = capacity)
FINITE
empty_definition: is_empty = (count = 0)
non_negative_count: count >= 0
COMPARABLE
irreflexive_comparison: not (Current < Current)
ACTIVE
writable_constraint: writable implies readable
empty_constraint: is_empty implies (not readable) and (not writable)
BILINEAR
not_both: not (after and before)
before_constraint: before implies off
LINEAR
after_constraint: after implies off
TRAVERSABLE
empty_constraint: is_empty implies off
indexing
library: "[
EiffelBase: Library of reusable components for Eiffel.
]"
status: "[
Copyright 1986-2001 Interactive Software Engineering (ISE).
For ISE customers the original versions are an ISE product
covered by the ISE Eiffel license and support agreements.
]"
license: "[
EiffelBase may now be used by anyone as FREE SOFTWARE to
develop any product, public-domain or commercial, without
payment to ISE, under the terms of the ISE Free Eiffel Library
License (IFELL) at http://eiffel.com/products/base/license.html.
]"
source: "[
Interactive Software Engineering Inc.
ISE Building
360 Storke Road, Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Electronic mail <info@eiffel.com>
Customer support http://support.eiffel.com
]"
info: "[
For latest info see award-winning pages: http://eiffel.com
]"
end -- SEQ_STRING