[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model/modellor Modellor.java, 1.4, 1.5
Status: Pre-Alpha
Brought to you by:
henryml
|
From: Nordholt <nor...@us...> - 2007-02-07 16:53:17
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2970/src/net/sourceforge/bprocessor/model/modellor Modified Files: Modellor.java Log Message: implemented passiv/active modellors Index: Modellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/Modellor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Modellor.java 2 Jan 2007 17:48:58 -0000 1.4 --- Modellor.java 7 Feb 2007 16:52:56 -0000 1.5 *************** *** 10,16 **** --- 10,19 ---- import java.util.Collection; import java.util.HashMap; + import java.util.Iterator; import java.util.LinkedList; + import java.util.List; import java.util.Map; + import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Observer; *************** *** 30,33 **** --- 33,39 ---- protected Map parameters; + /** Active flag */ + private boolean active = true; + static { modellors = new LinkedList(); *************** *** 114,118 **** * @param m the map containing the values; */ ! public abstract void setContent(Map m); /** --- 120,126 ---- * @param m the map containing the values; */ ! public void setContent(Map m) { ! active = ((Boolean)m.get("active")).booleanValue(); ! } /** *************** *** 120,124 **** * @return A map of key to value pairs of the content */ ! public abstract Map getContent(); } --- 128,175 ---- * @return A map of key to value pairs of the content */ ! public Map getContent() { ! Map content = new HashMap(); ! content.put("active", Boolean.valueOf(active)); ! return content; ! } ! ! /** ! * Get the active status of the modellor ! * @return active status of the modellor ! */ ! public boolean isActive() { ! return active; ! } ! ! /** ! * Activate / deactivate the modellor ! * @param active the desired activity status ! */ ! public void setActive(boolean active) { ! this.active = active; ! } ! ! /** ! * Get the attributes of this modellor ! * @return the attributes ! */ ! public List getAttributes() { ! List<Attribute> l = new LinkedList<Attribute>(); ! l.add(new Attribute("Active", Boolean.valueOf(active), true)); ! return l; ! } + /** + * Set the attributes of the modellor + * @param attributes the new attributes + */ + public void setAttributes(List attributes) { + Iterator it = attributes.iterator(); + while (it.hasNext()) { + Attribute a = (Attribute)it.next(); + if (a.getName().equals("Active")) { + setActive((Boolean)a.getValue()); + } + } + } } |