indexing
description: "Rectangular areas."
status: "See notice at end of class"
date: "$Date$"
revision: "$Revision$"
class interface
EV_RECTANGLE
create
make (a_x, a_y, a_width, a_height: INTEGER)
a_xa_ya_widtha_height
EV_RECTANGLEset
require
a_width_positive: a_width >= 0
a_height_positive: a_height >= 0
set (a_x, a_y, a_width, a_height: INTEGER)
a_xa_ya_widtha_height
EV_RECTANGLEmake
require
a_width_positive: a_width >= 0
a_height_positive: a_height >= 0
feature
bottom: INTEGER
height: INTEGER
Current
left: INTEGER
right: INTEGER
top: INTEGER
width: INTEGER
Current
x: INTEGER
y: INTEGER
feature
has (c: EV_COORDINATE): BOOLEAN
cCurrent
require
c_not_void: c /= void
has_x_y (a_x, a_y: INTEGER): BOOLEAN
a_xa_yCurrent
intersects (other: like Current): BOOLEAN
otherCurrent
lower_left: EV_COORDINATE
Current
ensure
result_exists: Result /= void
result_assigned: Result.x = x and then Result.y = y + height
lower_right: EV_COORDINATE
Current
ensure
result_exists: Result /= void
result_assigned: Result.x = x + width and then Result.y = y + height
upper_left: EV_COORDINATE
Current
ensure
result_exists: Result /= void
result_assigned: Result.x = x and then Result.y = y
upper_right: EV_COORDINATE
Current
ensure
result_exists: Result /= void
result_assigned: Result.x = x + width and then Result.y = y
feature
grow_bottom (i: INTEGER)
i
grow_left (i: INTEGER)
i
require
width + i > 0
grow_right (i: INTEGER)
i
grow_top (i: INTEGER)
i
require
height + i > 0
include (a_x, a_y: INTEGER)
a_xa_yCurrent
include_point (c: EV_COORDINATE)
cCurrent
require
c_not_void: c /= void
ensure
has_c: has (c)
merge (other: like Current)
Currentother
require
other_not_void: other /= void
move (a_x, a_y: INTEGER)
a_xa_y
ensure
x_assigned: x = a_x
y_assigned: y = a_y
move_and_resize (a_x, a_y, a_width, a_height: INTEGER)
a_xa_ya_widtha_height
require
a_width_positive: a_width >= 0
a_height_positive: a_height >= 0
resize (a_width, a_height: INTEGER)
a_widtha_height
require
a_width_positive: a_width >= 0
a_height_positive: a_height >= 0
ensure
width_assigned: width = a_width
height_assigned: height = a_height
set_bottom (i: INTEGER)
ibottom
require
i - y >= 0
ensure
assigned: bottom = i
set_height (new_height: INTEGER)
new_heightheight
require
new_height_positive: new_height >= 0
ensure
height_assigned: height = new_height
set_left (i: INTEGER)
ileft
require
i <= right
ensure
assigned: left = i
right_same: right = old right
set_right (i: INTEGER)
iright
require
i - x >= 0
ensure
assigned: right = i
set_top (i: INTEGER)
itop
require
i <= bottom
ensure
assigned: top = i
bottom_same: bottom = old bottom
set_width (new_width: INTEGER)
new_width
require
new_width_positive: new_width >= 0
ensure
width_assigned: width = new_width
set_x (new_x: INTEGER)
new_xx
ensure
x_set: x = new_x
set_y (new_y: INTEGER)
new_yy
ensure
y_set: y = new_y
feature
out: STRING
invariant
width_positive: width >= 0
height_positive: height >= 0
ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)
end -- EV_RECTANGLE