package mahjong.engine;

import java.util.Vector;

/**
 * Created by joe on 12/3/14.
 */
public class Logger {
    Vector<Action> actions = new Vector<Action>();

    public Logger(String str)
    {
        for (String entry:str.split("\n"))
            add(new Action(entry));
    }

    public void add(Action action)
    {
        actions.add(action);
    }

    public int getLastGuidIndex()
    {
        if (actions.size()==0)
            return -1;
        return actions.lastElement().getGuid();
    }

    @Override
    public String toString() {
        String str="";
        for (Action action:actions)
            str.concat(action.toString());
        return super.toString();
    }
}