GNU
|
Liberty Eiffel
|
Automated Tests
|
Wiki
|
Savannah project
|
Debian packages
|
Documentation
>
libraries
>
STRING_RECYCLING_ITEM
+
Point of view
All features
ANY
STRING_RECYCLING_POOL
STRING_RECYCLING_ITEM
STRING_RECYCLING_ITEM_SORTER
All features
expanded class STRING_RECYCLING_ITEM
Summary
top
Used by
STRING_RECYCLING_POOL
to track
STRING
capacities and to allow the use of a sorted array with
"holes"
(since
STRING
's are
WEAK_REFERENCE
'ed)
Direct parents
Insert list:
ANY
Class invariant
top
capacity
>= 0
Overview
top
Features
{
ANY
}
is_equal
(other: STRING_RECYCLING_ITEM):
BOOLEAN
Is
other
attached to an object considered equal to current object?
copy
(other: STRING_RECYCLING_ITEM)
Update current object using fields of object attached to
other
, so as to yield equal objects.
{
STRING_RECYCLING_POOL
,
STRING_RECYCLING_ITEM
,
STRING_RECYCLING_ITEM_SORTER
}
capacity
:
INTEGER_32
item
:
STRING
The
STRING
item.
set_item
(a_item:
STRING
)
Stores the
STRING
as being reusable.
set_capacity
(a_capacity:
INTEGER_32
)
Sets the capacity.
{}
item_memory
:
WEAK_REFERENCE
[
STRING
]
Holds a recyclable
STRING
is_equal
(other: STRING_RECYCLING_ITEM):
BOOLEAN
effective function
{
ANY
}
top
Is
other
attached to an object considered equal to current object?
require
other /= Void
ensure
commutative:
generating_type = other.generating_type implies Result = other.is_equal(Current)
copy
(other: STRING_RECYCLING_ITEM)
effective procedure
{
ANY
}
top
Update current object using fields of object attached to
other
, so as to yield equal objects.
Note: you can't copy object from a different dynamic type.
require
not immutable
same_dynamic_type(other)
ensure
is_equal(other)
capacity
:
INTEGER_32
writable attribute
{
STRING_RECYCLING_POOL
,
STRING_RECYCLING_ITEM
,
STRING_RECYCLING_ITEM_SORTER
}
top
item
:
STRING
effective function
{
STRING_RECYCLING_POOL
,
STRING_RECYCLING_ITEM
,
STRING_RECYCLING_ITEM_SORTER
}
top
The
STRING
item.
May become Void if the GC decides so.
set_item
(a_item:
STRING
)
effective procedure
{
STRING_RECYCLING_POOL
,
STRING_RECYCLING_ITEM
,
STRING_RECYCLING_ITEM_SORTER
}
top
Stores the
STRING
as being reusable.
The GC may remove it afterwards.
require
a_item = Void or else a_item.is_empty
ensure
item
= a_item
set_capacity
(a_capacity:
INTEGER_32
)
effective procedure
{
STRING_RECYCLING_POOL
,
STRING_RECYCLING_ITEM
,
STRING_RECYCLING_ITEM_SORTER
}
top
Sets the capacity.
Useful for array sorting and element comparison. Should not be used when a
STRING
is stored.
require
a_capacity >= 0
item
= Void
ensure
capacity
= a_capacity
item_memory
:
WEAK_REFERENCE
[
STRING
]
writable attribute
{}
top
Holds a recyclable
STRING