Turtle programming game that was never finished to a playable state (but had cute graphics and sounds)
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package com.porcupine.mutable;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Mutable object
|
|
|
|
*
|
|
|
|
* @author Ondřej Hruška (MightyPork)
|
|
|
|
* @param <T> type
|
|
|
|
*/
|
|
|
|
public abstract class AbstractMutable<T> {
|
|
|
|
|
|
|
|
/** The wrapped value */
|
|
|
|
public T o = getDefault();
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implicint constructor
|
|
|
|
*/
|
|
|
|
public AbstractMutable() {}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* new mutable object
|
|
|
|
*
|
|
|
|
* @param o value
|
|
|
|
*/
|
|
|
|
public AbstractMutable(T o) {
|
|
|
|
this.o = o;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the wrapped value
|
|
|
|
*
|
|
|
|
* @return value
|
|
|
|
*/
|
|
|
|
public T get()
|
|
|
|
{
|
|
|
|
return o;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set value
|
|
|
|
*
|
|
|
|
* @param o new value to set
|
|
|
|
*/
|
|
|
|
public void set(T o)
|
|
|
|
{
|
|
|
|
this.o = o;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get default value
|
|
|
|
*
|
|
|
|
* @return default value
|
|
|
|
*/
|
|
|
|
protected abstract T getDefault();
|
|
|
|
}
|