class ARRAY{TYP} < $ARR{TYP}
****

________This_class_implements_one-dimensional_arrays_of_elements_of_type_TYP.
___The_operations_provided_include_sorting,_searching,_etc._Array_indices
___start_at_0_and_go_up_to_`asize-1'.

________Most_features_here_work_when_self_is_void._The_intent_is_that
___a_void_array_behaves_just_like_a_zero-sized_array._Thus_self_may_be_void
___on_operations_which_don't_try_to_directly_access_specific_elements_since
___any_such_access_would_be_out_of_range.


Ancestors
$ARR{_} $RO_ARR{_} $CONTAINER{_} $STR
$COPY $FILTERS{_} $ELT{_} $ELT
AREF{_}



Public


Features
aget(index : CARD) : ELT .. Included as aget
aget(index : INT) : ELT .. Included as aget
append(arr : SAME) : SAME
append(arr1,arr2 : SAME) : SAME
append(arr1,arr2,arr3 : SAME) : SAME
append(elem:TYP):SAME
array : ARRAY{ETP} .. Included as array
array_ptr : REFERENCE .. Included as array_ptr
aset(index : CARD, val : ELT) .. Included as aset
aset(index : INT, val:ELT) .. Included as aset
asize : CARD .. Included as asize
binary_search(elem : TYP) : CARD
binary_search_by(elem : TYP,order : ROUT{TYP,TYP} : BOOL) : CARD
build( cursor : STR_CURSOR) : SAME .. Included as build
****
build(cursor : STR_CURSOR, start, finish : CHAR ) : SAME .. Included as build
clear
**** This routine sets each array element to void. Built-in to this
___implementation._Self_may_be_void.
contains(elem : TYP) : BOOL
**** This predicate returns true if and only if self contains an element
___for_which_elt_eq_returns_true,_otherwise_false.
copy(src : SAME)
copy(beg : CARD, src : SAME )
copy(beg,num : CARD, src : SAME )
copy(beg, num, srcbeg : CARD, src : SAME)
copy : SAME
count(val : TYP) : CARD
count_if( .. Included as count_if
create(arr : ARRAY{TYP}) : SAME
**** This routine creates a new array which has exactly the same contents as arr.
create(sz : CARD) : SAME
**** This routine creates a new array of the given size, all of whose
___elements_are_void.
create( str : STR ) : SAME .. Included as create
****
create(str : STR, sep : CHAR ) : SAME .. Included as create
****
create : SAME
**** This routine creates an empty array.
create_from(elems : $ELT{TYP}) : SAME
**** This routine creates an array out of the elements of "elems". It is
___expensive_-_first_converts_the_argument_into_an_FLIST_to_determine_the
___number_of_elements_and_then_converts_the_FLIST_into_an_array.
elt_eq(first,second : ETP) : BOOL .. Included as elt_eq
**** This is the standard 'less than' predicate used in sorting routines.
___The_using_class_must_specify_an_equality_predicate_routine.
elt_hash(elem : $OB) : CARD .. Included as elt_hash
****
________This_routine_returns_a_hash_value_associated_with_an_element._This
___must_have_the_property_that_if_"elt_eq(first,second)"_then
___"elt_hash(first)=elt_hash(second)"._It_could_be_defined_always_to_return_0,
___but_many_routines_will_then_become_quadratic._This_uses_the_object_"id"_by
___default.___It_may_be_redefined_in_descendants.
elt_lt(first,second : ETP) : BOOL .. Included as elt_lt
****
________This_routine_is_the_standard_predicate_'less_than'_for_use_in
___sorting.___By_default_the_object_identity_components_are_compared.
___It_may_be_redefined_in_descendants.
elt_nil : ETP .. Included as elt_nil
****
________This_routine_returns_the_NIL_value.___If_the_element_class_is_a
___subclass_of_$NIL_then_it_returns_nil,_otherwise_void.
equals(arr : $CONTAINER{TYP}) : BOOL
**** This predicate returns true if and only if all elements of self are
___the_same_as_the_corresponding_elements_of_arr.
every( .. Included as every
exists( .. Included as exists
exists( .. Included as exists
find_if(test : ROUT{TYP} : BOOL) : TYP
has(elem : TYP ) : BOOL
**** This predicate is a renaming of contains.
has_ind(val : CARD) : BOOL
**** This predicate returns true if and only if val is a valid index for the array.
index_if(test : ROUT{TYP} : BOOL) : CARD
index_of(elem : TYP) : CARD
inds : ARRAY{CARD}
insertion_sort_by(order : ROUT{TYP,TYP} : BOOL)
insertion_sort_range(lower,upper : CARD)
inspect:STR .. Included as inspect
**** This routine returns a string representation of the contents of self. K.Kodama
is_elt_nil( elem : ETP) : BOOL .. Included as is_elt_nil
**** This predicate returns true if and only if elem is NIL.
is_empty : BOOL .. Included as is_empty
is_sorted : BOOL
**** This predicate returns true if and only if the elements of self are
___sorted_according_to_the_relation_elt_lt.___Self_may_be_void.
is_sorted_by(order : ROUT{TYP,TYP} : BOOL) : BOOL
map(operation : ROUT{TYP} : TYP)
median : TYP
merge_with_by(arr : SAME,order : ROUT{TYP,TYP} : BOOL) : SAME
mismatch(arr : SAME) : CARD
not_every( .. Included as not_every
not_exists( .. Included as not_exists
quicksort_range(lower,upper : CARD)
reduce(operation : ROUT{TYP,TYP} : TYP) : TYP
remove(elem : TYP) : SAME
remove_duplicates : SAME
remove_if(test : ROUT{TYP} : BOOL) : SAME
resize(new_size : CARD) : SAME
reverse : SAME
**** This routine returns a copy of self with all elements in reverse order. Self may be void.
scan(operation : ROUT{TYP,TYP} : TYP)
search(arr : SAME) : CARD
search(beg : CARD, arr : SAME) : CARD
select( index : CARD)
select_by(order : ROUT{TYP,TYP} : BOOL,index : CARD)
size : CARD
**** This routine returns the number of elements in the array. Self may
___be_void.__Built-in_to_this_implementation.
slice(beg,num : CARD) : SAME
sort
stable_sort
str( lib : LIBCHARS ) : STR .. Included as str
str(lib : LIBCHARS, sep : CHAR ) : STR .. Included as str
str : STR .. Included as str
****
__This_routine_returns_a_string_representation_of_the_contents_of_self
__in_the_default_repertoire_and_encoding.
to(src : SAME)
to_replace(old, new_val : TYP)
to_replace_if(test : ROUT{TYP} : BOOL, new_val : TYP)
to_reverse
**** This routine reverses the order of the elements in self. Self may be void.
to_val(val : TYP)

Iters
elt!(once beg : CARD) : TYP
elt!(once beg,once num : CARD) : TYP
elt!(once beg,once num : CARD,once step : INT) : TYP
elt! : TYP
****
elt_rev! :TYP
****
__This_iter_yields_each_element_of_self_in_reversed_order._Self_may_be_void.
filter!( .. Included as filter!
ind! : CARD
ind1! : CARD
ind_rev! :CARD
**** This iter yields the indices of self in reversed order. Self may be void.
not_filter!( .. Included as not_filter!
set!(val : TYP)
set!( once beg : CARD, val : TYP)
set!( once beg,once num : CARD,val : TYP)
set!( once beg,once num : CARD,once step : INT,val : TYP)
unique! : ETP .. Included as unique!


Private

const Default_Array_Size : CARD := 5 ; .. Included as Default_Array_Size
aclear .. Included as aclear
acopy(src : SAME) .. Included as acopy
acopy(beg : CARD, src : SAME) .. Included as acopy
acopy(beg, num : CARD, src : SAME) .. Included as acopy
acopy(beg, num, srcbeg : CARD, src : SAME) .. Included as acopy
aelt!(once beg : CARD) : ELT .. Included as aelt!
aelt!(once beg, once num : CARD) : ELT .. Included as aelt!
aelt!(once beg,once num : CARD,once step : INT) : ELT .. Included as aelt!
aelt! : ELT .. Included as aelt!
aind! : CARD .. Included as aind!
aset!(val : ELT) .. Included as aset!
aset!(once beg : CARD,val : ELT) .. Included as aset!
aset!(once beg, once num : CARD, val : ELT) .. Included as aset!
aset!(once beg, once num : CARD, once step : INT,val : ELT) .. Included as aset!
build(cursor : STR_CURSOR, sep : CHAR_CODE, start : CHAR, finish : CHAR ) : SAME .. Included as build
for_all(first, second : SAME) : BOOL .. Included as for_all
****
__This_private_predicate_returns_true_if_and_only_if_all_elements_of
___first_and_second_are_the_same!
is_legal_aelts_arg(beg, num : CARD, step : INT) : BOOL .. Included as is_legal_aelts_arg
**** This predicate returns true if and only if the arguments are legal
___values_for_aelt_and_aset_iters_below.
is_sorted(lower : CARD, upper : CARD ) : BOOL
**** This predicate returns true if and only if the elements of self are
___sorted_according_to_the_relation_elt_lt.___Self_may_be_void.
const quicksort_limit : CARD := 10 ;

The Sather Home Page