immutable class RANGE
****

________This_class_embodies_the_notion_of_an_inclusive_range_of_values_as,
___for_example,_in_code_repertoires,_for_which_it_was_originally_designed.




Public


Readable Attributes
attr low, high : XTP ; .. Included as high
**** low = high implies 'empty'
attr low, high : XTP ; .. Included as low
**** low = high implies 'empty'

Features
aget(index : CARD) : CARD
binstr : BINSTR .. Included as binstr
build(index : BIN_CURSOR) : SAME .. Included as build
build( .. Included as build
contains(val : XTP) : BOOL .. Included as contains
****
________This_predicate_returns_true_iff_val_lies_in_the_range.__Note_the
___assymetric_test_since_high_is_always_one_greater_than_the_high_defined
___when_created,_etc.
create(str : BINSTR) : SAME .. Included as create
create(from,to : XTP) : SAME .. Included as create
create( .. Included as create
empty : SAME .. Included as empty
****
________This_routine_returns_an_empty_range_which_is_represented_by_having
___low_and_high_the_same_value_--_irrespective_of_what_that_value_may_be!
first : XTP .. Included as first
fmt( .. Included as fmt
fmt( .. Included as fmt
intersection(other : SAME) : SAME .. Included as intersection
invariant : BOOL .. Included as invariant
is_adjacent(other : SAME) : BOOL .. Included as is_adjacent
****
________This_predicate_returns_true_if_and_only_if_self_and_other_are
___adjacent_or_intersecting.
is_disjoint(other : SAME) : BOOL .. Included as is_disjoint
****
________This_predicate_returns_true_if_and_only_if_self_and_other_do_not
___overlap.
is_empty : BOOL .. Included as is_empty
****
________This_predicate_returns_true_if_and_only_if_self_is_an_empty_range.
is_eq(other : SAME) : BOOL .. Included as is_eq
****
________This_predicate_returns_true_if_and_only_if_the_high_and_low_values_of
___self_and_other_are_the_same.
is_eq(other : $OB) : BOOL .. Included as is_eq
**** This is the generic equality predicate. c.f. the class $IS_EQ
is_intersecting(other : SAME) : BOOL .. Included as is_intersecting
****
________This_predicate_returns_true_if_and_only_if_the_ranges_of_other_and
___self_have_one_or_more_common_values.
is_lt(other : SAME) : BOOL .. Included as is_lt
****
________This_predicate_returns_true_if_and_only_if_the_high_value_of_self_is
___strictly_less_than_the_low_value_of_other_--_taking_into_account_the_fact
___that_the_stored_'high'_is_one_greater_than_the_actual_end_of_the_range.
is_range( .. Included as is_range
last : XTP .. Included as last
merge(other : SAME) : SAME .. Included as merge
offset(range_val : XTP) : XTP .. Included as offset
read(index : BIN_CURSOR) : SAME .. Included as read
shift_down(by : CARD) : SAME
shift_up(by : CARD) : SAME
size : CARD .. Included as size
str( .. Included as str
str : STR .. Included as str
union(other : SAME) : SAME .. Included as union
write(fyle : BIN_FILE) .. Included as write

Iters
elt! : XTP .. Included as elt!
equally!(once cnt : CARD) : SAME
partition!(once cnt : CARD) : SAME
rev! : XTP .. Included as rev!


Private

ellipsis( .. Included as ellipsis
attr low, high : XTP ; .. Included as high
**** low = high implies 'empty'
attr low, high : XTP ; .. Included as low
**** low = high implies 'empty'
lump_at_end!(once range : XTP,once cnt : CARD) : XTP .. Included as lump_at_end!
****
________This_iter_yields_the_size_of_cnt_successive_sub-ranges_of_range,
___placing_any_remainder_of_an_uneven_division_in_the_last_sub-range.
scan( .. Included as scan
spread_extra!(once range : XTP,once cnt : CARD) : XTP .. Included as spread_extra!

The Sather Home Page