note
	description: "Packed boolean strings"
	library: "Free implementation of ELKS library"
	status: "See notice at end of class."
	legal: "See notice at end of class."
	names: packed_booleans
	access: index
	representation: array
	size: fixed
	date: "$Date: 2020-02-18 09:43:52 +0000 (Tue, 18 Feb 2020) $"
	revision: "$Revision: 103939 $"

class interface
	BOOL_STRING

create 
	make

feature -- Initialization

	make (n: INTEGER_32)
			-- Allocate area of n booleans.
		require
			non_negative_size: n >= 0
		ensure
			correct_allocation: count = n
			all_false:  i: 1 |..| n ¦
					not item (i)
	
feature -- Access

	item alias "[]" (i: INTEGER_32): BOOLEAN assign put
			-- Boolean at i-th position,
			-- beginning at left, 1 origin
			-- Was declared in BOOL_STRING as synonym of at.

	at alias "@" (i: INTEGER_32): BOOLEAN assign put
			-- Boolean at i-th position,
			-- beginning at left, 1 origin
			-- Was declared in BOOL_STRING as synonym of item.
	
feature -- Comparison

	is_equal (other: like Current): BOOLEAN
			-- Is other attached to an object considered
			-- equal to current object?
	
feature -- Duplication

	copy (other: like Current)
			-- Update current object using fields of object attached
			-- to other, so as to yield equal objects.
		ensure then
			not_shared_if_different: other /= Current implies area /= other.area
			equal_areas: area ~ other.area
	
feature -- Status report

	valid_index (i: INTEGER_32): BOOLEAN
			-- Is i within the bounds of Current?
	
feature -- Measurement

	count: INTEGER_32
			-- Number of boolean in the area.
	
feature -- Element change

	put (v: like item; i: INTEGER_32)
			-- Put boolean v at i-th position
			-- beginning at left, 1 origin.

	all_true
			-- Set all booleans to true.
		ensure
			all_true:  i: 1 |..| count ¦
					item (i)

	all_false
			-- Set all booleans to false.
		ensure
			all_false:  i: 1 |..| count ¦
					not item (i)
	
feature -- Basic operations

	conjuncted alias "and" (other: like Current): like Current
			-- Logical and of 'Current' and other
		require
			other_not_void: other /= Void
			same_size: other.count = count

	disjuncted alias "or" (other: like Current): like Current
			-- Logical or of 'Current' and other
		require
			other_not_void: other /= Void
			same_size: other.count = count

	disjuncted_exclusive alias "xor" (other: like Current): like Current
			-- Logical exclusive or of 'Current' and other
		require
			other_not_void: other /= Void
			same_size: other.count = count

	negated alias "not": like Current
			-- Negation of 'Current'

	right_shifted (n: INTEGER_32): like Current
			-- Right shifted 'Current' set, by n positions
		require
			non_negative_shift: n >= 0

	left_shifted (n: INTEGER_32): like Current
			-- Left shifted 'Current' set, by n positions
		require
			non_negative_shift: n >= 0
	
note
	copyright: "Copyright (c) 1984-2020, Eiffel Software and others"
	license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
	source: "[
		Eiffel Software
		5949 Hollister Ave., Goleta, CA 93117 USA
		Telephone 805-685-1006, Fax 805-685-6869
		Website http://www.eiffel.com
		Customer support http://support.eiffel.com
	]"

end -- class BOOL_STRING

Generated by ISE EiffelStudio