GNU
|
Liberty Eiffel
|
Automated Tests
|
Wiki
|
Savannah project
|
Debian packages
|
Documentation
>
libraries
>
SEARCHABLE
+
Point of view
All features
ANY
All features
deferred class SEARCHABLE [E_]
Summary
top
A
SEARCHABLE
sequence is
INDEXABLE
, and the index of each element may be retrieved.
Direct parents
Inherit list:
INDEXABLE
Known children
Inherit list:
ABSTRACT_STRING
,
COLLECTION
,
UNICODE_STRING
Overview
top
Features
Looking and Searching:
{
ANY
}
has
(x:
ANY
):
BOOLEAN
Look for
x
using
is_equal
for comparison.
fast_has
(x:
ANY
):
BOOLEAN
Look for
x
using basic
=
for comparison.
first_index_of
(element:
ANY
):
INTEGER_32
Give the index of the first occurrence of
element
using
is_equal
for comparison.
index_of
(element:
ANY
, start_index:
INTEGER_32
):
INTEGER_32
Using
is_equal
for comparison, gives the index of the first occurrence of
element
at or after
start_index
.
reverse_index_of
(element:
ANY
, start_index:
INTEGER_32
):
INTEGER_32
Using
is_equal
for comparison, gives the index of the first occurrence of
element
at or before
start_index
.
last_index_of
(element:
ANY
):
INTEGER_32
Using
is_equal
for comparison, gives the index of the last occurrence of
element
at or before
upper
.
fast_first_index_of
(element:
ANY
):
INTEGER_32
Give the index of the first occurrence of
element
using basic
=
for comparison.
fast_index_of
(element:
ANY
, start_index:
INTEGER_32
):
INTEGER_32
Using basic
=
for comparison, gives the index of the first occurrence of
element
at or after
start_index
.
fast_reverse_index_of
(element:
ANY
, start_index:
INTEGER_32
):
INTEGER_32
Using basic
=
comparison, gives the index of the first occurrence of
element
at or before
start_index
.
fast_last_index_of
(element:
ANY
):
INTEGER_32
Using basic
=
for comparison, gives the index of the last occurrence of
element
at or before
upper
.
Indexing:
{
ANY
}
lower
:
INTEGER_32
Minimum index.
upper
:
INTEGER_32
Maximum index.
valid_index
(i:
INTEGER_32
):
BOOLEAN
True when
i
is valid (i.e., inside actual bounds).
Accessing:
{
ANY
}
item
(i:
INTEGER_32
): E_
Item at the corresponding index
i
.
first
: E_
The very
first
item.
last
: E_
The
last
item.
Agent-based features:
{
ANY
}
for_each
(action:
PROCEDURE
[
TUPLE
[TUPLE 1[E_]]])
Apply
action
to every item of
Current
.
for_all
(test:
FUNCTION
[
TUPLE
[TUPLE 1[E_]]]):
BOOLEAN
Do all items satisfy
test
?
exists
(test:
FUNCTION
[
TUPLE
[TUPLE 1[E_]]]):
BOOLEAN
Does at least one item satisfy
test
?
aggregate
(action:
FUNCTION
[
TUPLE
[TUPLE 2[E_, E_], E_]], initial: E_): E_
Aggregate all the elements starting from the initial value.
Printing:
{
ANY
}
out_in_tagged_out_memory
Append terse printable representation of current object in
tagged_out_memory
.
Counting:
{
ANY
}
count
:
INTEGER_32
Number of available items in the hoard.
is_empty
:
BOOLEAN
Is the hoard empty ?
See also
count
.
Agent-based features:
{
ANY
}
do_all
(action:
ROUTINE
[
TUPLE
[TUPLE 1[E_]]])
Apply
action
to every item of
Current
.
{}
_inline_agent1
(a:
ROUTINE
[
TUPLE
[TUPLE 1[E_]]], e: E_)
has
(x:
ANY
):
BOOLEAN
deferred function
{
ANY
}
top
Look for
x
using
is_equal
for comparison.
See also
fast_has
,
index_of
,
fast_index_of
.
ensure
definition:
Result =
valid_index
(
first_index_of
(x))
fast_has
(x:
ANY
):
BOOLEAN
deferred function
{
ANY
}
top
Look for
x
using basic
=
for comparison.
See also
has
,
fast_index_of
,
index_of
.
ensure
definition:
Result =
valid_index
(
fast_first_index_of
(x))
first_index_of
(element:
ANY
):
INTEGER_32
deferred function
{
ANY
}
top
Give the index of the first occurrence of
element
using
is_equal
for comparison.
Answer
upper + 1
when
element
is not inside.
See also
fast_first_index_of
,
index_of
,
last_index_of
,
reverse_index_of
.
ensure
definition:
Result =
index_of
(element,
lower
)
index_of
(element:
ANY
, start_index:
INTEGER_32
):
INTEGER_32
deferred function
{
ANY
}
top
Using
is_equal
for comparison, gives the index of the first occurrence of
element
at or after
start_index
.
Return
upper + 1
if the search for
element
failed.
See also
fast_index_of
,
reverse_index_of
,
first_index_of
.
ensure
Result.in_range(start_index,
upper
+ 1)
valid_index
(Result) implies (create {
SAFE_EQUAL
}).test(element,
item
(Result))
reverse_index_of
(element:
ANY
, start_index:
INTEGER_32
):
INTEGER_32
deferred function
{
ANY
}
top
Using
is_equal
for comparison, gives the index of the first occurrence of
element
at or before
start_index
.
Search is done in reverse direction, which means from the
start_index
down to the
lower
index . Answer
lower -1
when the search fail.
See also
fast_reverse_index_of
,
last_index_of
,
index_of
.
require
valid_index
(start_index)
ensure
Result.in_range(
lower
- 1, start_index)
valid_index
(Result) implies
item
(Result).is_equal(element)
last_index_of
(element:
ANY
):
INTEGER_32
deferred function
{
ANY
}
top
Using
is_equal
for comparison, gives the index of the last occurrence of
element
at or before
upper
.
Search is done in reverse direction, which means from the
upper
down to the
lower
index . Answer
lower -1
when the search fail.
See also
fast_last_index_of
,
reverse_index_of
,
index_of
.
ensure
definition:
Result =
reverse_index_of
(element,
upper
)
fast_first_index_of
(element:
ANY
):
INTEGER_32
deferred function
{
ANY
}
top
Give the index of the first occurrence of
element
using basic
=
for comparison.
Answer
upper + 1
when
element
is not inside.
See also
first_index_of
,
last_index_of
,
fast_last_index_of
.
ensure
definition:
Result =
fast_index_of
(element,
lower
)
fast_index_of
(element:
ANY
, start_index:
INTEGER_32
):
INTEGER_32
deferred function
{
ANY
}
top
Using basic
=
for comparison, gives the index of the first occurrence of
element
at or after
start_index
.
Answer
upper + 1
when
element
when the search fail.
See also
index_of
,
fast_reverse_index_of
,
fast_first_index_of
.
ensure
Result.in_range(start_index,
upper
+ 1)
valid_index
(Result) implies element =
item
(Result)
fast_reverse_index_of
(element:
ANY
, start_index:
INTEGER_32
):
INTEGER_32
deferred function
{
ANY
}
top
Using basic
=
comparison, gives the index of the first occurrence of
element
at or before
start_index
.
Search is done in reverse direction, which means from the
start_index
down to the
lower
index . Answer
lower -1
when the search fail.
See also
reverse_index_of
,
fast_index_of
,
fast_last_index_of
.
require
valid_index
(start_index)
ensure
Result.in_range(
lower
- 1, start_index)
valid_index
(Result) implies
item
(Result) = element
fast_last_index_of
(element:
ANY
):
INTEGER_32
deferred function
{
ANY
}
top
Using basic
=
for comparison, gives the index of the last occurrence of
element
at or before
upper
.
Search is done in reverse direction, which means from the
upper
down to the
lower
index . Answer
lower -1
when the search fail.
See also
fast_reverse_index_of
,
last_index_of
.
ensure
definition:
Result =
fast_reverse_index_of
(element,
upper
)
lower
:
INTEGER_32
deferred function
{
ANY
}
top
Minimum index.
See also
upper
,
valid_index
,
item
.
upper
:
INTEGER_32
deferred function
{
ANY
}
top
Maximum index.
See also
lower
,
valid_index
,
item
.
valid_index
(i:
INTEGER_32
):
BOOLEAN
effective function
{
ANY
}
top
True when
i
is valid (i.e., inside actual bounds).
See also
lower
,
upper
,
item
.
ensure
definition:
Result =
lower
<= i and i <=
upper
item
(i:
INTEGER_32
): E_
deferred function
{
ANY
}
top
Item at the corresponding index
i
.
See also
lower
,
upper
,
valid_index
.
require
valid_index
(i)
first
: E_
deferred function
{
ANY
}
top
The very
first
item.
See also
last
,
item
.
require
not
is_empty
ensure
definition:
Result =
item
(
lower
)
last
: E_
deferred function
{
ANY
}
top
The
last
item.
See also
first
,
item
.
require
not
is_empty
ensure
definition:
Result =
item
(
upper
)
for_each
(action:
PROCEDURE
[
TUPLE
[TUPLE 1[E_]]])
effective procedure
{
ANY
}
top
Apply
action
to every item of
Current
.
See also
for_all
,
exists
,
aggregate
.
require
action /= Void
for_all
(test:
FUNCTION
[
TUPLE
[TUPLE 1[E_]]]):
BOOLEAN
effective function
{
ANY
}
top
Do all items satisfy
test
?
See also
for_each
,
exists
,
aggregate
.
require
test /= Void
exists
(test:
FUNCTION
[
TUPLE
[TUPLE 1[E_]]]):
BOOLEAN
effective function
{
ANY
}
top
Does at least one item satisfy
test
?
See also
for_each
,
for_all
,
aggregate
.
require
test /= Void
aggregate
(action:
FUNCTION
[
TUPLE
[TUPLE 2[E_, E_], E_]], initial: E_): E_
effective function
{
ANY
}
top
Aggregate all the elements starting from the initial value.
See also
for_each
,
for_all
,
exists
.
require
action /= Void
out_in_tagged_out_memory
effective procedure
{
ANY
}
top
Append terse printable representation of current object in
tagged_out_memory
.
require
locked:
tagged_out_locked
ensure
still_locked:
tagged_out_locked
not_cleared:
tagged_out_memory.count >= old tagged_out_memory.count
append_only:
old tagged_out_memory.twin.is_equal(tagged_out_memory.substring(1, old tagged_out_memory.count))
count
:
INTEGER_32
deferred function
{
ANY
}
top
Number of available items in the hoard.
See also
is_empty
ensure
Result >= 0
is_empty
:
BOOLEAN
deferred function
{
ANY
}
top
Is the hoard empty ?
See also
count
.
ensure
definition:
Result =
count
= 0
do_all
(action:
ROUTINE
[
TUPLE
[TUPLE 1[E_]]])
frozen
effective procedure
{
ANY
}
top
Apply
action
to every item of
Current
.
This feature is obsolete:
Use `for_each` instead. This feature is not secure because it accepts a FUNCTION, the result of which is lost.
_inline_agent1
(a:
ROUTINE
[
TUPLE
[TUPLE 1[E_]]], e: E_)
frozen
effective procedure
{}
top