It is currently 11 Sep 2025, 20:48
   
Text Size

Predicates totally removed

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Predicates totally removed

Postby 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.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 30 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 30 users online :: 0 registered, 0 hidden and 30 guests (based on users active over the past 10 minutes)
Most users ever online was 7967 on 09 Sep 2025, 23:08

Users browsing this forum: No registered users and 30 guests

Login Form