package ecse414.fall2015.group21.game.server.universe;

import com.flowpowered.math.imaginary.Complexf;
import com.flowpowered.math.vector.Vector2f;

/**
 *
 */
public class Bullet extends Positioned implements Snapshotable<Bullet> {
    private final int number;

    public Bullet(int number) {
        this(number, Vector2f.ZERO, Complexf.IDENTITY);
    }

    public Bullet(int number, Vector2f position, Complexf rotation) {
        super(position, rotation);
        this.number = number;
    }

    public int getNumber() {
        return number;
    }

    @Override
    public Bullet snapshot() {
        return new Bullet(number, position, rotation);
    }
}

@@ -49,16 +49,67 @@
 verse;%0A%0A
+import java.util.concurrent.atomic.AtomicInteger;%0A%0A
 import c
@@ -278,16 +278,124 @@
 llet%3E %7B%0A
+    private static final AtomicInteger ID_COUNTER = new AtomicInteger(0);%0A    private final int internalID;%0A
     priv
@@ -594,33 +594,237 @@
     
-super(position, rotation)
+this(ID_COUNTER.getAndIncrement(), number, position, rotation);%0A    %7D%0A%0A    private Bullet(int internalID, int number, Vector2f position, Complexf rotation) %7B%0A        super(position, rotation);%0A        this.internalID = internalID
 ;%0A  
@@ -988,16 +988,28 @@
  Bullet(
+internalID, 
 number, 
@@ -1034,11 +1034,248 @@
 );%0A    %7D
+%0A%0A    @Override%0A    public boolean equals(Object that) %7B%0A        return this == that %7C%7C that instanceof Bullet && internalID == ((Bullet) that).internalID;%0A    %7D%0A%0A    @Override%0A    public int hashCode() %7B%0A        return internalID;%0A    %7D
 %0A%7D%0A

Fix an efficiency issue related to Bullet hashcode