Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2364/src/net/sourceforge/bprocessor/model
Modified Files:
EnergyCalc.java Parametric.java
Added Files:
Selector.java
Log Message:
Added an selector, this is for attributes that have a list of options from which the value should be choosen.
Index: EnergyCalc.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/EnergyCalc.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** EnergyCalc.java 24 Jan 2007 10:23:11 -0000 1.4
--- EnergyCalc.java 29 Jan 2007 18:08:45 -0000 1.5
***************
*** 57,63 ****
boolean first = true;
if (isrelevant(classification, current)) {
! Iterator it = classification.getElements().iterator();
!
!
while (it.hasNext()) {
Space elemcheck = (Space) it.next();
--- 57,61 ----
boolean first = true;
if (isrelevant(classification, current)) {
! Iterator it = classification.getElements().iterator();
while (it.hasNext()) {
Space elemcheck = (Space) it.next();
Index: Parametric.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Parametric.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Parametric.java 11 Feb 2006 15:02:21 -0000 1.2
--- Parametric.java 29 Jan 2007 18:08:45 -0000 1.3
***************
*** 25,29 ****
*/
public List getAttributes();
!
/**
* Return the general name of the object
--- 25,29 ----
*/
public List getAttributes();
!
/**
* Return the general name of the object
--- NEW FILE: Selector.java ---
//---------------------------------------------------------------------------------
// $Id: Selector.java,v 1.1 2007/01/29 18:08:45 nordholt Exp $
//
// Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net)
// Released under the Lesser GNU Public License v2.1
//---------------------------------------------------------------------------------
package net.sourceforge.bprocessor.model;
import java.util.List;
import org.apache.log4j.Logger;
/**
* A list of possible values for an attribute.
*/
public class Selector {
/** The logger */
private static Logger log = Logger.getLogger(Selector.class);
/** The options to choose from */
private List options;
/** The choice of the options */
private Object currentValue;
/**
* Constructor for the selector
* @param options initial options
*/
public Selector(List options) {
log.info("new selector");
this.options = options;
}
/**
* Gets the currently choosen option
* @return the current value
*/
public Object getCurrentValue() {
log.info("Getting current: " + currentValue);
return currentValue;
}
/**
* Sets the current value to an other value, given the this
* value is an option.
* @param value a new value
*/
public void setCurrentValue(Object value) {
if (options.contains(value)) {
log.info("managed to chance the value to: " + value);
this.currentValue = value;
}
}
/**
* Gets the list of options
* @return the options
*/
public List getOptions() {
return options;
}
}
|