INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

title: "16-bit signed integer values."
project: "Eiffel Kernel Library"
revision: "$Revision: 1.1 $"
copyright: "Copyright (C) 1996-2005 Object Tools Group"
license: "http://visual-eiffel.com/license"
cluster: kernel
expanded class INTEGER_16
inherit

HASHABLE
undefine
is_equal
redefine
out
end

NUMERIC
rename
infix "/" as infix "//"
undefine
is_equal
redefine
out
end

COMPARABLE
redefine
out
end
feature -- Conversion

as_integer: INTEGER
-- Integer value converted to INTEGER

from_integer (other: INTEGER)
-- Set the value to the given one
require
other_in_range: -32768 <= other and other <= 32767
feature -- Access

item: INTEGER_16
-- Integer value

hash_code: INTEGER
-- Hash code value
-- (From HASHABLE)
feature -- Comparison

infix "<" (other: like Current): BOOLEAN
-- Is current integer less than 'other'?
-- (From COMPARABLE)
feature -- Element change

set_item (i: INTEGER_16)
-- Make 'i' the associated integer value
ensure
item_set: item = i

one: like Current
-- Neutral element for "*" and "/"
-- (From NUMERIC)
ensure
value: standard_equal (Result.as_integer, 1)

sign: INTEGER
-- Sign value (0, -1 or 1)
ensure
three_way: Result = three_way_comparison (zero)

zero: like Current
-- Neutral element for "+" and "-"
-- (From NUMERIC)
ensure
value: standard_equal (Result.as_integer, 0)
feature -- Status report

divisible (other: like Current): BOOLEAN
-- May current object be divided by 'other'?
-- (From NUMERIC)
ensure
value: Result implies (other.as_integer /= 0)

exponentiable (other: DOUBLE): BOOLEAN
-- May current object be elevated to the power 'other'?
-- (From NUMERIC)
feature -- Basic operations

abs: like Current
-- Absolute value
ensure
non_negative: Result >= zero
same_absolute_value: standard_equal (Result, Current) or standard_equal (Result, - Current)

infix "*" (other: like Current): like Current
-- Product by 'other'
-- (From NUMERIC)

infix "+" (other: like Current): like Current
-- Sum with 'other'
-- (From NUMERIC)

infix "-" (other: like Current): like Current
-- Result of subtracting 'other'
-- (From NUMERIC)

infix "/" (other: like Current): DOUBLE
-- Division by 'other'

infix "//" (other: like Current): like Current
-- Integer division of Current by 'other'
-- (From "/" in NUMERIC)

infix "\\" (other: like Current): like Current
-- Remainder of the integer division of Current by 'other'

infix "^" (other: DOUBLE): DOUBLE
-- Integer power of Current by 'other'
-- (From NUMERIC)

prefix "+": like Current
-- Unary plus
-- (From NUMERIC)

prefix "-": like Current
-- Unary minus
-- (From NUMERIC)
feature -- Output

out: STRING
-- Printable representation of integer value
-- (From GENERAL)
end -- class INTEGER_16

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES