package com.quirkygaming.propertylib;

import java.io.Serializable;

import com.quirkygaming.propertylib.PropertyObserver.EventType;

/**
 * An extension of Property<T> with the addition of a set method.
 *
 * @author  Chandler Griscom
 * @version 1.0
 */
public class MutableProperty<T> extends BoundProperty<T> implements Serializable {
	
	private static final long serialVersionUID = -6764130456697090580L;

	/**
	 * Constructs a new MutableProperty with type T as specified by initialValue.
	 * 
	 * @param initialValue Provides the initial value of the MutableProperty as well as its type.
	 * @return The newly constructed MutableProperty
	 */
	public static <T> MutableProperty<T> newProperty(T initialValue) {
		return new MutableProperty<T>(new PropertyImpl<T>(initialValue));
	}
	
	/**
	 * Constructs a new clone-on-get MutableProperty with type T as specified by initialValue.
	 * 
	 * @param initialValue Provides the initial value of the MutableProperty as well as its type.
	 * @return The newly constructed MutableProperty
	 */
	public static <T extends Cloneable> MutableProperty<T> newClonableProperty(T initialValue) {
		return new MutableProperty<T>(new CloningProperty<T>(initialValue));
	}
	
	MutableProperty(Property<T> property) {
		super(property);
	}
	
	/**
	 * Sets the value of this MutableProperty
	 */
	public void set(T v) {
		signal(EventType.SET);
		super.setInternal(v);
	}
	
	/**
	 * Returns an immutable (Property) version of this MutableProperty.
	 * 
	 * @return The immutable version
	 */
	public Property<T> getImmutable() {
		return super.getInternalProperty();
	}
}

@@ -1598,10 +1598,223 @@
 y();%0A%09%7D%0A
+%09%0A%09/**%0A%09 * Construct (if necessary) and return a mutator for this Property%0A%09 * @return The Mutator%0A%09 */%0A%09public Mutator getMutator() %7B%0A%09%09if (mutator == null) %7B%0A%09%09%09mutator = new Mutator();%0A%09%09%7D%0A%09%09return mutator;%0A%09%7D%0A
 %7D%0A

Add getMutator() to MutableProperty