org.nlogo.agent
Class ChooserConstraint
java.lang.Object
org.nlogo.agent.ChooserConstraint
- All Implemented Interfaces:
- ValueConstraint
public class ChooserConstraint
- extends Object
- implements ValueConstraint
ChooserConstraint
public ChooserConstraint(LogoList acceptedValues,
int defaultIndex)
ChooserConstraint
public ChooserConstraint(LogoList acceptedValues)
ChooserConstraint
public ChooserConstraint()
updateConstraint
public void updateConstraint()
throws CompilerException,
LogoException
- Specified by:
updateConstraint
in interface ValueConstraint
- Throws:
CompilerException
LogoException
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,
LogoException
- Description copied from interface:
ValueConstraint
- Throws a Violation condition if the input is not acceptable.
- Specified by:
assertConstraint
in interface ValueConstraint
- Throws:
ValueConstraint.Violation
LogoException
coerceValue
public Object coerceValue(Object val)
throws LogoException
- 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
- Throws:
LogoException