package structures.data.events;


import structures.data.DataObject;

public class CollisionEvent implements IDataEvent {

    public final DataObject other;
    public final String otherName;

    public CollisionEvent(DataObject other){
        this.other = other;
        this.otherName = null;
    }
    
    public CollisionEvent(String other) {
    	this.other = null;
    	this.otherName = other;
    }
    
    public String otherName() {
    	return this.other == null ? otherName : this.other.getName();
    }

    @Override
    public int hashCode() {
    	return this.getClass().hashCode() ^ otherName().hashCode();
    }

    @Override
    public boolean equals(Object obj) {
    	if (this.getClass().equals(obj.getClass())) {
    		if (otherName().equals(((CollisionEvent)obj).otherName())) {
    			return true;
    		}
    	}
    	return false;
    }

	@Override
	public String getName() {
		return String.format("Collision with ", other.getName());
	}


	@Override
    public String toString(){
    	return this.getName();
    }
}

@@ -289,36 +289,32 @@
 e = null;%0A    %7D%0A
-    
 %0A    public Coll
@@ -399,20 +399,16 @@
 ;%0A    %7D%0A
-    
 %0A    pub
@@ -1013,20 +1013,42 @@
 urn 
-this.getName
+%22Collision with %22 + other.toString
 ();%0A

fix collision event name