[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model/plugin HangingChainPackage.java, 1.
Status: Pre-Alpha
Brought to you by:
henryml
From: Sebastian G. <sg...@us...> - 2011-04-13 11:59:02
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/plugin In directory vz-cvs-2.sog:/tmp/cvs-serv11780/src/net/sourceforge/bprocessor/model/plugin Modified Files: HangingChainPackage.java Log Message: Hanging Chain Copy of B-net Index: HangingChainPackage.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/plugin/HangingChainPackage.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HangingChainPackage.java 10 Apr 2011 15:00:12 -0000 1.2 --- HangingChainPackage.java 13 Apr 2011 11:59:00 -0000 1.3 *************** *** 2,7 **** --- 2,10 ---- import net.sourceforge.bprocessor.model.Command; + import net.sourceforge.bprocessor.model.Item; import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.plugin.CirclePackage.Circle; + import java.util.HashMap; + import java.util.Map; public class HangingChainPackage { *************** *** 11,31 **** public void initialize(Space net) { super.initialize(net); ! increase = true; ! radius = 2; } public void evaluate() { clear(); ! circle(radius); ! if (increase) { ! radius = radius + 0.1; ! if (radius > 10) { ! increase = false; ! } } else { ! radius = radius - 0.1; ! if (radius < 2) { ! increase = true; ! } } } } --- 14,38 ---- public void initialize(Space net) { super.initialize(net); ! } + public void evaluate() { + //remove all elements of last iteration clear(); ! //add a union space containing all new elements ! Space union = (Space) net.getOwner().find("Springsystem"); ! //check if space was already created ! if (union == null) { ! union = Item.createUnion("Springsystem"); ! net.getOwner().add(union); } else { ! union.clear(); } + //copy the net and move it + Map cMap = new HashMap(); + Space cNet = (Space) net.copy(cMap); + cNet.move(0, 0, 2); + union.add(cNet); + } } |