[Bprocessor-commit] /model/src/net/sourceforge/bprocessor/model Selector.java, 1.2, 1.3
Status: Pre-Alpha
Brought to you by:
henryml
|
From: rimestad <rim...@us...> - 2007-05-24 10:56:18
|
Update of /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17580/src/net/sourceforge/bprocessor/model Modified Files: Selector.java Log Message: made selector generic Index: Selector.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/Selector.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Selector.java 30 Jan 2007 16:18:04 -0000 1.2 --- Selector.java 24 May 2007 10:56:16 -0000 1.3 *************** *** 7,10 **** --- 7,11 ---- package net.sourceforge.bprocessor.model; + import java.util.ArrayList; import java.util.List; *************** *** 13,18 **** /** * A list of possible values for an attribute. */ ! public class Selector { /** The logger */ --- 14,20 ---- /** * A list of possible values for an attribute. + * @param <Type> The type contained in the selector */ ! public class Selector<Type> { /** The logger */ *************** *** 20,27 **** /** The options to choose from */ ! private List options; /** The choice of the options */ ! private Object currentValue; /** --- 22,29 ---- /** The options to choose from */ ! private List<Type> options; /** The choice of the options */ ! private Type currentValue; /** *************** *** 29,35 **** * @param options initial options */ ! public Selector(List options) { this.options = options; } /** --- 31,49 ---- * @param options initial options */ ! public Selector(List<Type> options) { this.options = options; } + + /** + * Constructor taking a abitrary number of options for the selector, the object + * have to be of the same type as specified in the constructor + * @param options the options wanted + */ + public Selector(Type ...options) { + this.options = new ArrayList<Type>(options.length); + for (Type t : options) { + this.options.add(t); + } + } /** *************** *** 37,41 **** * @return the current value */ ! public Object getCurrentValue() { return currentValue; } --- 51,55 ---- * @return the current value */ ! public Type getCurrentValue() { return currentValue; } *************** *** 46,50 **** * @param value a new value */ ! public void setCurrentValue(Object value) { if (options.contains(value)) { this.currentValue = value; --- 60,64 ---- * @param value a new value */ ! public void setCurrentValue(Type value) { if (options.contains(value)) { this.currentValue = value; |