// Path: app/src/main/java/org/bobstuff/bobball/Player.java
// public class Player implements Parcelable {
// 
//     private int score;
//     public Bar bar;
//     private int lives;
//     public int level;
//     private int playerId;
// 
//     public Player(int playerId) {
//         this.score = 0;
//         this.bar = null;
//         this.lives = 0;
//         this.level = 0;
//         this.playerId = playerId;
//     }
// 
//     public Player(Player other) {
//         this.score = other.score;
//         if (other.bar != null)
//             this.bar = new Bar(other.bar);
//         this.lives = other.lives;
//         this.level = other.level;
//         this.playerId = other.playerId;
// 
//     }
// 
//     public int getPlayerId() {
//         return playerId;
//     }
// 
//     public int getLives() {
//         return lives;
//     }
// 
//     public void setLives(int lives) {
//         this.lives = lives;
//     }
// 
//     public int getScore() {
//         return score;
//     }
// 
//     public void setScore(int score) {
//         this.score = score;
//     }
// 
//     //implement parcelable
// 
//     public int describeContents() {
//         return 0;
//     }
// 
//     public int getColor() {
//         float hue = playerId * 36;
//         return Color.HSVToColor(new float[]{hue, 1, 1});
//     }
// 
// 
//     protected Player(Parcel in) {
//         ClassLoader classLoader = getClass().getClassLoader();
//         playerId = in.readInt();
//         level = in.readInt();
//         score = in.readInt();
//         bar = in.readParcelable(classLoader);
//         lives = in.readInt();
//     }
// 
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeInt(playerId);
//         dest.writeInt(level);
//         dest.writeInt(score);
//         dest.writeParcelable(bar, flags);
//         dest.writeInt(lives);
//     }
// 
// 
//     public static final Parcelable.Creator<Player> CREATOR
//             = new Parcelable.Creator<Player>() {
//         public Player createFromParcel(Parcel in) {
//             return new Player(in);
//         }
// 
//         public Player[] newArray(int size) {
//             return new Player[size];
//         }
// 
//     };
// 
// }
// 
// Path: app/src/main/java/org/bobstuff/bobball/Direction.java
// public enum Direction implements Parcelable{
// 	LEFT,
// 	RIGHT,
//     UP,
//     DOWN;
// 
// 
//     public static Direction getRandom(Random randomGenerator) {
//         return Direction.values()[randomGenerator.nextInt(Direction.values().length)];
//     }
// 
//     //implement parcelable
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeInt(ordinal());
//     }
// 
// 
//     public static final Parcelable.Creator<Direction> CREATOR = new Parcelable.Creator<Direction>() {
// 
//         public Direction createFromParcel(Parcel in) {
//             return Direction.values()[in.readInt()];
//         }
// 
//         public Direction[] newArray(int size) {
//             return new Direction[size];
//         }
// 
//     };
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
// }


import android.graphics.PointF;
import android.os.Parcel;
import org.bobstuff.bobball.Player;
import org.bobstuff.bobball.Direction;
        @Override
        public GameEventStartBar[] newArray(int size) {
            return new GameEventStartBar[size];
        }
    };
    private final PointF origin;
    private final Direction dir;
    private final int playerId;

    public GameEventStartBar(final int time, final PointF origin,
                             final Direction dir, int playerId) {
        super(time);

        this.origin = origin;
        this.dir = dir;
        this.playerId = playerId;
    }


    //implement parcelable
    protected GameEventStartBar(Parcel in) {
        super(in);
        ClassLoader classLoader = getClass().getClassLoader();
        origin = in.readParcelable(classLoader);
        dir = in.readParcelable(classLoader);
        playerId = in.readInt();
    }

    @Override
    public void apply(GameState gs) {
// Path: app/src/main/java/org/bobstuff/bobball/Player.java
// public class Player implements Parcelable {
// 
//     private int score;
//     public Bar bar;
//     private int lives;
//     public int level;
//     private int playerId;
// 
//     public Player(int playerId) {
//         this.score = 0;
//         this.bar = null;
//         this.lives = 0;
//         this.level = 0;
//         this.playerId = playerId;
//     }
// 
//     public Player(Player other) {
//         this.score = other.score;
//         if (other.bar != null)
//             this.bar = new Bar(other.bar);
//         this.lives = other.lives;
//         this.level = other.level;
//         this.playerId = other.playerId;
// 
//     }
// 
//     public int getPlayerId() {
//         return playerId;
//     }
// 
//     public int getLives() {
//         return lives;
//     }
// 
//     public void setLives(int lives) {
//         this.lives = lives;
//     }
// 
//     public int getScore() {
//         return score;
//     }
// 
//     public void setScore(int score) {
//         this.score = score;
//     }
// 
//     //implement parcelable
// 
//     public int describeContents() {
//         return 0;
//     }
// 
//     public int getColor() {
//         float hue = playerId * 36;
//         return Color.HSVToColor(new float[]{hue, 1, 1});
//     }
// 
// 
//     protected Player(Parcel in) {
//         ClassLoader classLoader = getClass().getClassLoader();
//         playerId = in.readInt();
//         level = in.readInt();
//         score = in.readInt();
//         bar = in.readParcelable(classLoader);
//         lives = in.readInt();
//     }
// 
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeInt(playerId);
//         dest.writeInt(level);
//         dest.writeInt(score);
//         dest.writeParcelable(bar, flags);
//         dest.writeInt(lives);
//     }
// 
// 
//     public static final Parcelable.Creator<Player> CREATOR
//             = new Parcelable.Creator<Player>() {
//         public Player createFromParcel(Parcel in) {
//             return new Player(in);
//         }
// 
//         public Player[] newArray(int size) {
//             return new Player[size];
//         }
// 
//     };
// 
// }
// 
// Path: app/src/main/java/org/bobstuff/bobball/Direction.java
// public enum Direction implements Parcelable{
// 	LEFT,
// 	RIGHT,
//     UP,
//     DOWN;
// 
// 
//     public static Direction getRandom(Random randomGenerator) {
//         return Direction.values()[randomGenerator.nextInt(Direction.values().length)];
//     }
// 
//     //implement parcelable
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeInt(ordinal());
//     }
// 
// 
//     public static final Parcelable.Creator<Direction> CREATOR = new Parcelable.Creator<Direction>() {
// 
//         public Direction createFromParcel(Parcel in) {
//             return Direction.values()[in.readInt()];
//         }
// 
//         public Direction[] newArray(int size) {
//             return new Direction[size];
//         }
// 
//     };
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
// }


// Path: app/src/main/java/org/bobstuff/bobball/GameLogic/GameEventStartBar.java
import android.graphics.PointF;
import android.os.Parcel;
import org.bobstuff.bobball.Player;
import org.bobstuff.bobball.Direction;

        @Override
        public GameEventStartBar[] newArray(int size) {
            return new GameEventStartBar[size];
        }
    };
    private final PointF origin;
    private final Direction dir;
    private final int playerId;

    public GameEventStartBar(final int time, final PointF origin,
                             final Direction dir, int playerId) {
        super(time);

        this.origin = origin;
        this.dir = dir;
        this.playerId = playerId;
    }


    //implement parcelable
    protected GameEventStartBar(Parcel in) {
        super(in);
        ClassLoader classLoader = getClass().getClassLoader();
        origin = in.readParcelable(classLoader);
        dir = in.readParcelable(classLoader);
        playerId = in.readInt();
    }

    @Override
    public void apply(GameState gs) {
        Player player = gs.getPlayer(playerId);