Markers are now subclasses of Keyframe

Markers can now be moved and jumped to on the Replay Timeline
This commit is contained in:
CrushedPixel
2015-06-09 22:55:20 +02:00
parent d30ef19c89
commit b2ad52d5b6
13 changed files with 133 additions and 99 deletions

View File

@@ -2,25 +2,26 @@ package eu.crushedpixel.replaymod.holders;
import org.apache.commons.lang3.builder.HashCodeBuilder;
public class Marker {
public Marker(Position position, int timestamp, String name) {
this.position = position;
this.timestamp = timestamp;
this.name = name;
}
public class MarkerKeyframe extends Keyframe {
private Position position;
private int timestamp;
private String name;
@Override
public Object clone() {
return new MarkerKeyframe(this.getPosition(), this.getRealTimestamp(), this.getName());
}
public MarkerKeyframe(Position position, int timestamp, String name) {
super(timestamp);
this.position = position;
this.name = name;
}
public Position getPosition() {
return position;
}
public int getTimestamp() {
return timestamp;
}
public String getName() {
return name;
@@ -29,8 +30,8 @@ public class Marker {
@Override
public boolean equals(Object o2) {
if(o2 == null) return false;
if(!(o2 instanceof Marker)) return false;
Marker m2 = (Marker)o2;
if(!(o2 instanceof MarkerKeyframe)) return false;
MarkerKeyframe m2 = (MarkerKeyframe)o2;
return hashCode() == m2.hashCode();
}
@@ -38,7 +39,7 @@ public class Marker {
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(position)
.append(timestamp)
.append(getRealTimestamp())
.append(name)
.toHashCode();
}