Let's look at an example;
void stopEngine();
Property<Float> speed();
void accelerate( int acceleratorPosition );
void break( int breakForce );
}
public abstract class SpeedMixin
implements Car
{
private long lastTime;
private float currentSpeed;
public SpeedMixin()
{
currentSpeed = new ComputedPropertyInstance<Float>()
{
public Float get()
{
return currentSpeed;
}
};
}
public Property<Float> speed()
{
// Update the speed from time past and
// accel/break applied.
return currentSpeed;
}
public void accelerate( int acceleratorPosition )
{
// Update the speed from time past and
// accel/break applied.
}
public void break( int breakForce )
{
// Update the speed from time past and
// accel/break applied.
}
}