Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 1.15 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5.  
  6. package com.derpina.roma.backend.action.pyramid;
  7.  
  8. import com.derpina.roma.backend.choices.ChoiceFactory;
  9. import com.derpina.roma.core.Choice;
  10. import com.derpina.roma.core.GameState;
  11. import java.util.ArrayList;
  12. import java.util.Collection;
  13.  
  14. /**
  15.  *
  16.  * @author Lasath Fernando <edu@lasath.org>
  17.  * @author Matthew Moss
  18.  */
  19. abstract public class HipsterAction implements Action {
  20.     protected final GameState gameState;
  21.  
  22.     private Collection<ChoiceFactory> children;
  23.  
  24.     public HipsterAction(GameState gameState) {
  25.         this.gameState = gameState;
  26.         this.children = new ArrayList<ChoiceFactory>();
  27.     }
  28.  
  29.     protected void registerFactory(ChoiceFactory f) {
  30.         children.add(f);
  31.     }
  32.  
  33.     @Override
  34.     public Collection<Choice> getIntents() {
  35.         for (ChoiceFactory choiceFactory : children) {
  36.             if (!choiceFactory.isValueSet()) {
  37.                 return choiceFactory.getChoices();
  38.             }
  39.         }
  40.  
  41.         return new ArrayList<Choice>();
  42.     }
  43.  
  44.     @Override
  45.     public void execute() {
  46.     }
  47. }