Doesn't use a Java 1.8 Method to sort KeyframeList's contents

This commit is contained in:
CrushedPixel
2015-07-10 14:14:29 +02:00
parent dea3f7fc9f
commit 1c417877e6

View File

@@ -1,10 +1,11 @@
package eu.crushedpixel.replaymod.interpolation; package eu.crushedpixel.replaymod.interpolation;
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
import eu.crushedpixel.replaymod.holders.Keyframe; import eu.crushedpixel.replaymod.holders.Keyframe;
import eu.crushedpixel.replaymod.holders.KeyframeComparator; import eu.crushedpixel.replaymod.holders.KeyframeComparator;
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
public class KeyframeList<K extends KeyframeValue> extends ArrayList<Keyframe<K>> { public class KeyframeList<K extends KeyframeValue> extends ArrayList<Keyframe<K>> {
@@ -44,7 +45,7 @@ public class KeyframeList<K extends KeyframeValue> extends ArrayList<Keyframe<K>
public void sort() { public void sort() {
previousCallLinear = null; previousCallLinear = null;
sort(KEYFRAME_COMPARATOR); Collections.sort(this, KEYFRAME_COMPARATOR);
} }
/** /**
@@ -138,6 +139,8 @@ public class KeyframeList<K extends KeyframeValue> extends ArrayList<Keyframe<K>
} }
public K getInterpolatedValueForPathPosition(float pathPosition, boolean linear) { public K getInterpolatedValueForPathPosition(float pathPosition, boolean linear) {
//as every implementation of KeyframeValue returns a new instance of itself, this warning can be ignored
@SuppressWarnings("unchecked")
K toApply = (K)first().getValue().newInstance(); K toApply = (K)first().getValue().newInstance();
if(previousCallLinear != (Boolean)linear) { if(previousCallLinear != (Boolean)linear) {