aboutsummaryrefslogtreecommitdiff
path: root/java/api/src/aurelienribon/tweenengine/primitives/MutableFloat.java
blob: a2683b99a38d2c2c1231a531cf157b123e1d7130 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package aurelienribon.tweenengine.primitives;

import aurelienribon.tweenengine.TweenAccessor;

/**
 * @author Aurelien Ribon | http://www.aurelienribon.com/
 */
public class MutableFloat extends Number implements TweenAccessor<MutableFloat> {
	private float value;

	public MutableFloat(float value) {
		this.value = value;
	}

	public void setValue(float value) {
		this.value = value;
	}

	@Override public int intValue() {return (int) value;}
	@Override public long longValue() {return (long) value;}
	@Override public float floatValue() {return (float) value;}
	@Override public double doubleValue() {return (double) value;}

	@Override
	public int getValues(MutableFloat target, int tweenType, float[] returnValues) {
		returnValues[0] = target.value;
		return 1;
	}

	@Override
	public void setValues(MutableFloat target, int tweenType, float[] newValues) {
		target.value = newValues[0];
	}
}