Predicates totally removed
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
1 post
• Page 1 of 1
Predicates totally removed
by Max mtg » 28 Sep 2012, 07:15
A year ago I have introduced Predicate class into forge, that held a rule to evaluate conditions and could filter, count, calculate aggregates on lists. I was not aware that Google had made a similiar library long ago. I thought of switching to better quality code since then, and the day has come.
Today's commit has removed the custom predicates Forge had had. All the functional programming now relies on guava libraries. They also have predicates, functions and plenty of methods to use them.
Please see the link http://code.google.com/p/guava-librarie ... lExplained and the code in SVN (that has changed) for examples on how to use the current codebase.
One of the most significant differences between old predicates and guava is that the latter's filters do not create a new list. Instead they offer a view for the source collection. Thus, once the source was changed there is no need to obtain a new filtered collection - the old iterable won't get the removed items. It was LimitedDeck class where I saw lists of cards being re-filtered after each change to source list, now it's not needed.
Today's commit has removed the custom predicates Forge had had. All the functional programming now relies on guava libraries. They also have predicates, functions and plenty of methods to use them.
Please see the link http://code.google.com/p/guava-librarie ... lExplained and the code in SVN (that has changed) for examples on how to use the current codebase.
One of the most significant differences between old predicates and guava is that the latter's filters do not create a new list. Instead they offer a view for the source collection. Thus, once the source was changed there is no need to obtain a new filtered collection - the old iterable won't get the removed items. It was LimitedDeck class where I saw lists of cards being re-filtered after each change to source list, now it's not needed.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
1 post
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 22 guests