Added comments and class diagram.

This commit is contained in:
Ilkka Seppala
2015-04-23 22:51:21 +03:00
parent cd581154ac
commit fcd500d3ae
17 changed files with 292 additions and 1 deletions
@@ -16,7 +16,21 @@ import com.iluwatar.property.Movement;
import com.iluwatar.selector.ColorSelector;
import com.iluwatar.selector.MovementSelector;
/**
*
* The central idea of Specification pattern is to separate the statement of how to match a candidate, from the
* candidate object that it is matched against. As well as its usefulness in selection, it is also valuable for
* validation and for building to order.
*
* In this example we have a pool of creatures with different properties. We then have defined separate selection
* rules (Specifications) that we apply to the collection and as output receive only the creatures that match
* the selection criteria.
*
* http://martinfowler.com/apsupp/spec.pdf
*
*/
public class App {
public static void main( String[] args ) {
// initialize creatures list
List<Creature> creatures = Arrays.asList(new Goblin(), new Octopus(), new Dragon(), new Shark(), new Troll(), new KillerBee());