org.opensha.commons.param.constraint.impl
Class ListBasedConstraint<E>

java.lang.Object
  extended by org.opensha.commons.param.constraint.AbstractParameterConstraint<E>
      extended by org.opensha.commons.param.constraint.impl.ListBasedConstraint<E>
All Implemented Interfaces:
Serializable, Named, ParameterConstraint<E>

public class ListBasedConstraint<E>
extends AbstractParameterConstraint<E>

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.opensha.commons.param.constraint.AbstractParameterConstraint
C, D, editable, name, nullAllowed
 
Constructor Summary
ListBasedConstraint(List<E> allowed)
           
 
Method Summary
 Object clone()
          Returns a copy so you can't edit or damage the origial.
 List<E> getAllowed()
           
 boolean isAllowed(E obj)
          Determine if the new value being set is allowed.
 void setAllowed(List<E> allowed)
           
 
Methods inherited from class org.opensha.commons.param.constraint.AbstractParameterConstraint
checkEditable, getName, isEditable, isNullAllowed, setName, setNonEditable, setNullAllowed
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListBasedConstraint

public ListBasedConstraint(List<E> allowed)
Method Detail

setAllowed

public void setAllowed(List<E> allowed)

getAllowed

public List<E> getAllowed()

isAllowed

public boolean isAllowed(E obj)
Description copied from interface: ParameterConstraint
Determine if the new value being set is allowed.

Parameters:
obj - Object to check if allowed via constraints.
Returns:
True if the value is allowed.

clone

public Object clone()
Description copied from class: AbstractParameterConstraint
Returns a copy so you can't edit or damage the origial. All concrete subclasses must implement this.

Specified by:
clone in interface ParameterConstraint<E>
Specified by:
clone in class AbstractParameterConstraint<E>
Returns:
Exact copy of this object's state.