org.nlogo.agent
Class ChooserConstraint

java.lang.Object
  extended by org.nlogo.agent.ChooserConstraint
All Implemented Interfaces:
ValueConstraint

public class ChooserConstraint
extends Object
implements ValueConstraint


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.nlogo.api.ValueConstraint
ValueConstraint.Violation
 
Constructor Summary
ChooserConstraint()
           
ChooserConstraint(LogoList acceptedValues)
           
ChooserConstraint(LogoList acceptedValues, int defaultIndex)
           
 
Method Summary
 LogoList acceptedValues()
           
 void acceptedValues(LogoList vals)
           
 void assertConstraint(Object val)
          Throws a Violation condition if the input is not acceptable.
 Object coerceValue(Object val)
          Returns the constrained value, which can differ from the input.
 int defaultIndex()
           
 void defaultIndex(int def)
           
 Object defaultValue()
          Returns the default value for this constraint
 int indexForValue(Object value)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChooserConstraint

public ChooserConstraint(LogoList acceptedValues,
                         int defaultIndex)

ChooserConstraint

public ChooserConstraint(LogoList acceptedValues)

ChooserConstraint

public ChooserConstraint()
Method Detail

acceptedValues

public LogoList acceptedValues()

acceptedValues

public void acceptedValues(LogoList vals)

defaultValue

public Object defaultValue()
Description copied from interface: ValueConstraint
Returns the default value for this constraint

Specified by:
defaultValue in interface ValueConstraint

defaultIndex

public void defaultIndex(int def)

defaultIndex

public int defaultIndex()

indexForValue

public int indexForValue(Object value)

assertConstraint

public void assertConstraint(Object val)
                      throws ValueConstraint.Violation
Description copied from interface: ValueConstraint
Throws a Violation condition if the input is not acceptable.

Specified by:
assertConstraint in interface ValueConstraint
Throws:
ValueConstraint.Violation

coerceValue

public Object coerceValue(Object val)
Description copied from interface: ValueConstraint
Returns the constrained value, which can differ from the input. Throws a Violation condition if the input is not coercable.

Specified by:
coerceValue in interface ValueConstraint