package Replay;

import Constants.BitmaskEnum;
import Constants.KeyStroke;
import com.google.common.collect.ImmutableList;

import java.util.EnumSet;
import java.util.List;
import java.util.Scanner;


public final class Action {
    private final long sincePrevActionMillis;
    private final float xPos;
    private final float yPos;
    private final EnumSet<KeyStroke> keys;

    public Action(long sincePrevActionMillis, float xPos, float yPos, EnumSet<KeyStroke> keys) {
        this.sincePrevActionMillis = sincePrevActionMillis;
        this.xPos = xPos;
        this.yPos = yPos;
        this.keys = keys;
    }

    public long getMillisSincePrevAction() {
        return sincePrevActionMillis;
    }

    public float getX() {
        return xPos;
    }

    public float getY() {
        return yPos;
    }

    public EnumSet<KeyStroke> getKeyPresses() {
        return keys;
    }

    public static List<Action> parseActions(String input) {
        ImmutableList.Builder<Action> builder = ImmutableList.builder();
        try (Scanner scanner = new Scanner(input).useDelimiter(",")) {
            while (scanner.hasNext()) {
                builder.add(parseSingleAction(scanner.next()));
            }
            return builder.build();
        }
    }

    public static Action parseSingleAction(String input) {
        try (Scanner scanner = new Scanner(input).useDelimiter("[|]")) {
            long millis = scanner.nextLong();
            float x = scanner.nextFloat();
            float y = scanner.nextFloat();
            EnumSet<KeyStroke> keys = BitmaskEnum.fromMask(KeyStroke.class, scanner.nextInt());

            return new Action(millis, x, y, keys);
        }
    }
}

@@ -31,171 +31,44 @@
 nts.
-BitmaskEnum;%0Aimport Constants.KeyStroke;%0Aimport com.google.common.collect.ImmutableList;%0A%0Aimport java.util.EnumSet;%0Aimport java.util.List;%0Aimport java.util.Scanner
+KeyStroke;%0A%0Aimport java.util.EnumSet
 ;%0A%0A%0A
@@ -763,811 +763,7 @@
    %7D
-%0A%0A    public static List%3CAction%3E parseActions(String input) %7B%0A        ImmutableList.Builder%3CAction%3E builder = ImmutableList.builder();%0A        try (Scanner scanner = new Scanner(input).useDelimiter(%22,%22)) %7B%0A            while (scanner.hasNext()) %7B%0A                builder.add(parseSingleAction(scanner.next()));%0A            %7D%0A            return builder.build();%0A        %7D%0A    %7D%0A%0A    public static Action parseSingleAction(String input) %7B%0A        try (Scanner scanner = new Scanner(input).useDelimiter(%22%5B%7C%5D%22)) %7B%0A            long millis = scanner.nextLong();%0A            float x = scanner.nextFloat();%0A            float y = scanner.nextFloat();%0A            EnumSet%3CKeyStroke%3E keys = BitmaskEnum.fromMask(KeyStroke.class, scanner.nextInt());%0A%0A            return new Action(millis, x, y, keys);%0A        %7D%0A    %7D
 %0A%7D%0A

remove now defunct parsing methods