mvc
Class Choice<T>
java.lang.Object
mvc.Choice<T>
- All Implemented Interfaces:
- java.lang.Iterable<T>
public class Choice<T>
- extends java.lang.Object
- implements java.lang.Iterable<T>
A Choice is a model type that restricts model values
to a fixed set of choices with Java type T.
A Choice is a factory class for creating models.
It also defines a control protocol for its models.
Nested Class Summary |
static interface |
Choice.Controller<T>
|
static class |
Choice.ControllerImplementation<TC,TD>
Concrete subclasses should retain TC as a parameter but should
replace TD in the class declaration and all of its method
declarations with a non-generic class that can be displayed by
the subclass. |
static class |
Choice.Model<TM>
DOCME. |
Constructor Summary |
Choice(java.lang.Iterable<? extends T> cl)
new Choice(cl) returns a new Choice
with choice values from cl. |
Choice(java.util.Iterator<? extends T> cl)
new Choice(cl) returns a new Choice
with choice values from cl. |
Choice(T[] cl)
new Choice(cl) returns a new Choice
with choice values from cl. |
Method Summary |
Choice.Model<T> |
createModel(java.lang.String nm)
mc.createModel(nm) returns a new editable model with name nm
whose possible values are the choices of mc. |
T |
getValue(int indx)
mc.getValue(indx) returns the choice of mc indexed by indx. |
int |
getValueCount()
mc.getValueCount() returns the number of choices in mc. |
java.util.Iterator<T> |
iterator()
mc.iterator() returns an iterator for the choices of mc. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Choice
public Choice(T[] cl)
- new Choice(cl) returns a new Choice
with choice values from cl.
Note that the entry type of cl must exactly match T.
- Parameters:
cl
-
Choice
public Choice(java.lang.Iterable<? extends T> cl)
- new Choice(cl) returns a new Choice
with choice values from cl.
- Parameters:
cl
-
Choice
public Choice(java.util.Iterator<? extends T> cl)
- new Choice(cl) returns a new Choice
with choice values from cl.
- Parameters:
cl
-
getValueCount
public int getValueCount()
- mc.getValueCount() returns the number of choices in mc.
- Returns:
- the count of choice values in mc
getValue
public T getValue(int indx)
- mc.getValue(indx) returns the choice of mc indexed by indx.
- Parameters:
indx
- the index for the value
- Returns:
- the value indexed by indx in mc
iterator
public java.util.Iterator<T> iterator()
- mc.iterator() returns an iterator for the choices of mc.
- Specified by:
iterator
in interface java.lang.Iterable<T>
- Returns:
- an iterator for the choice values of mc
createModel
public Choice.Model<T> createModel(java.lang.String nm)
- mc.createModel(nm) returns a new editable model with name nm
whose possible values are the choices of mc.
- Parameters:
nm
- the name for the returned model
- Returns:
- a new model with name nm and choices from mc