PageRenderTime 37ms CodeModel.GetById 27ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/src/elements/CompositeEvent.java

http://inequity.googlecode.com/
Java | 41 lines | 22 code | 4 blank | 15 comment | 1 complexity | 863afc778efae9afb8e8e06b77e2a62d MD5 | raw file
 1package elements;
 2
 3import java.util.ArrayList;
 4
 5/**
 6 * An single event that can contain multiple sub events
 7 * @author Joel Garboden
 8 */
 9public class CompositeEvent extends BaseEvent
10{
11  private ArrayList<BaseEvent> eventList;
12
13  /**
14   * Creates empty event list
15   */
16  public CompositeEvent()
17  {
18    eventList = new ArrayList<BaseEvent>();
19  }
20  /**
21   * Function to execute events of an event
22   * @param portfolio player's portfolio
23   */
24  @Override
25  public final void execEvent(PlayerPortfolio portfolio)
26  {
27    for(BaseEvent event : eventList)
28    {
29      event.execEvent(portfolio);
30    }
31  }
32
33  /**
34   * Adds event to the event list
35   * @param event event to add
36   */
37  public void addEvent(BaseEvent event)
38  {
39    eventList.add(event);
40  }
41}