CommandList.java :  » Game » magicwars » mw » mtgforge » Java Open Source

Java Open Source » Game » magicwars 
magicwars » mw » mtgforge » CommandList.java
package mw.mtgforge;

import java.io.Serializable;
import java.util.ArrayList;

import mw.server.pattern.Command;

public class CommandList extends Command implements Serializable {
  private ArrayList<Command> a = new ArrayList<Command>();

  public void add(Command c) {
    a.add(0, c);
  }

  public Command get(int i) {
    return (Command) a.get(i);
  }

  public Command remove(int i) {
    return (Command) a.remove(i);
  }

  public boolean remove(Object o) {
    return a.remove(o);
  }

  public int size() {
    return a.size();
  }

  public void clear() {
    a.clear();
  }

  public void execute() {
    for (int i = 0; i < size(); i++)
      get(i).execute();
  }

  /**
   * Default UID.
   */
  private static final long serialVersionUID = 1L;
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.