Hook: Define DataBasket Entry Grouping
Requirement
The entries of a DataBasket need to be grouped before displaying
them.
For example, if a user removes 7 apples and later 5 more apples
from a CountingStock, using the same DataBasket for both
operations, the DataBasket might afterwards contain two entries,
one describing the removal of 7 apples, the other one the removal
of the 5 additional apples. When presenting the contents of the
DataBasket, you might want to hide these details from the user
and rather present one entry telling about 12 apples having been
removed from the CountingStock. In this case you may have to group
the DataBasket's entries before displaying them. This is an
implementation of the hook.
Method of AdaptationEnable Feature
Level of SupportParameter Pattern
HotSpotStandard User Interaction for Data Management
ParticipantsDataBasketEntryGrouper,
NewEntryGrouper
Changes
-
implementation NewEntryGrouper of DataBasketEntryGrouper.
-
NewEntryGrouper.canGroup implements
DataBasketEntryGrouper.canGroup
.
-
NewEntryGrouper.group implements
DataBasketEntryGrouper.group
.
Constraints
-
The relation imposed by
canGroup
must be an equality
relation, i.e. it must be
-
reflexive
for all entries a
canGroup
(a, a) must
return
true
.
-
symmetric
for all entries a and b
canGroup
(a, b) ==
canGroup
(b, a).
-
transitive
for all entries a, b and c if
canGroup
(a, b) returns
true
and
canGroup
(b, c) returns
true
then
canGroup
(a, c) must also return
true
.
-
canGroup
must never throw a
ClassCastException
.
-
group
will be given tuples of entries for which
canGroup
returned
true
. It must create a
new entry that represents the grouping of the two entries.
If a and b are the two entries to be grouped and c is the grouped
entry,
canGroup
(a, c) as well as
canGroup
(b, c) must return
true
.
Comments