import java.util.*;

public class Command
{
    public static final String MASK = "mask";
    public static final String MEM = "mem";
    public static final String OPEN_BRACE = "[";
    public static final String CLOSE_BRACE = "]";
    public static final String EQUALS = "=";

    public Command (String mask, Vector<String> cmds, boolean debug)
    {
        _mask = mask;
        _commands = cmds;
        _debug = debug;
    }

    public void execute (HashMap<Long, Long> memory)
    {
        String theMask = _mask.substring(_mask.indexOf(EQUALS) +1).trim();

        if (_debug)
            System.out.println("Bitmask is: "+theMask);

        for (int i = 0; i < _commands.size(); i++)
        {
            int startIndex = _commands.elementAt(i).indexOf(OPEN_BRACE);
            int endIndex = _commands.elementAt(i).indexOf(CLOSE_BRACE);
            String addr = _commands.elementAt(i).substring(startIndex +1, endIndex);

            if (_debug)
                System.out.println("Memory address: "+addr);

            startIndex = _commands.elementAt(i).indexOf(EQUALS);

            String value = _commands.elementAt(i).substring(startIndex +1).trim();

            if (_debug)
                System.out.println("Value: "+value);
        }
    }

    @Override
    public String toString ()
    {
        String str = _mask;

        for (int i = 0; i < _commands.size(); i++)
        {
            str += "\n" + _commands.elementAt(i);
        }

        return str;
    }

    private String _mask;
    private Vector<String> _commands;
    private boolean _debug;
}
@@ -867,16 +867,19 @@
 ing addr
+Str
  = _comm
@@ -931,16 +931,65 @@
 dIndex);
+%0A            Long addr = Long.parseLong(addrStr);
 %0A%0A      
@@ -1158,16 +1158,19 @@
 ng value
+Str
  = _comm
@@ -1211,32 +1211,83 @@
 ndex +1).trim();
+%0A            Long value = Long.parseLong(valueStr);
 %0A%0A            if

Update Command.java