A Cascade Comparator would be initialized with an sequence of Comparators to be
activated when the previous one finds a match. Every next comparator will
usually perform a stricter comparison than the previous one, trying to find
differences at a finer level.
A comparator which uses increasingly stricter comparation methods could solve
several issues, such as:
- when the name of an activity is not reliable to compare it with older ones
(namely, when there are tabs) it can still be used to check if the activity is
new, that is: if there are no other activities with the same name, then the
activity is new; if there's an activity with the same name, use a stricter
comparator that ignores the name.
- sometimes is useful to compare on EditText or even TextView widgets, but
comparing of the name of this items is senseless, since it is often supposed to
change. At the moment, we perform id check and name check on the same set of
widgets. With a Cascade Comparator, we could perform id checking on a set of
widgets (with a first comparator) then perform name checking on another set of
widgets (with a second comparator).
Original issue reported on code.google.com by nofatclips on 2 Nov 2011 at 1:27
Original issue reported on code.google.com by
nofatclips
on 2 Nov 2011 at 1:27