📄 observerimmunitysystem.java
字号:
import swarm.Globals;
import swarm.Selector;
import swarm.defobj.Zone;
import swarm.activity.Activity;
import swarm.activity.ActionGroup;
import swarm.activity.ActionGroupImpl;
import swarm.activity.Schedule;
import swarm.activity.ScheduleImpl;
import swarm.objectbase.Swarm;
import swarm.objectbase.VarProbe;
import swarm.objectbase.MessageProbe;
import swarm.objectbase.EmptyProbeMapImpl;
import swarm.gui.Colormap;
import swarm.gui.ColormapImpl;
import swarm.gui.ZoomRaster;
import swarm.gui.ZoomRasterImpl;
import swarm.analysis.EZGraph;
import swarm.analysis.EZGraphImpl;
import swarm.simtoolsgui.GUISwarm;
import swarm.simtoolsgui.GUISwarmImpl;
import swarm.space.Value2dDisplay;
import swarm.space.Value2dDisplayImpl;
import swarm.space.Object2dDisplay;
import swarm.space.Object2dDisplayImpl;
import java.util.List;
public class ObserverImmunitySystem extends GUISwarmImpl {
public int now = 0;
public int endTime;
public int displayFrequency;
public ActionGroup displayActions;
public Schedule displaySchedule;
public ImmunitySystem immunitySystem;
public EZGraph appetencyGraph;
public ObserverImmunitySystem (Zone aZone) {
super(aZone);
displayFrequency = 1;
}
public Object _appetencyGraphDeath_() {
appetencyGraph.drop();
appetencyGraph = null;
return this;
}
public Object buildObjects() {
super.buildObjects();
immunitySystem = new ImmunitySystem(getZone());
getControlPanel().setStateStopped();
immunitySystem.buildObjects();
endTime = immunitySystem.getEndTime();
appetencyGraph = new EZGraphImpl
(getZone(),
"Appetency between Antigen and Antibody vs time",
"time","Appetency between Antigen and Antibody vs time",
"appetencyGraph");
try {
appetencyGraph.enableDestroyNotification$notificationMethod
(this, new Selector (getClass (),
"_appetencyGraphDeath_",
false));
} catch (Exception e) {
System.err.println ("Exception _unhappyGraphDeath_: "
+ e.getMessage ());
}
try {
appetencyGraph.createAverageSequence$withFeedFrom$andSelector
("Appetency", immunitySystem.getCellList (),
new Selector (Class.forName ("Cell"), "getMatchValue",
false));
} catch (Exception e) {
System.err.println ("Exception getUnhappiness: "
+ e.getMessage ());
}
return this;
}
public Object _update_() {
if (appetencyGraph != null) {
appetencyGraph.step();
}
return this;
}
public Object buildActions() {
super.buildActions();
immunitySystem.buildActions();
displayActions = new ActionGroupImpl(getZone());
System.out.println("10");
try {
displayActions.createActionTo$message
(this,new Selector(getClass(),"_update_",false));
System.out.println("11");
displayActions.createActionTo$message
(getActionCache(),new Selector
(getActionCache().getClass(),"doTkEvents",true));
System.out.println("12");
} catch (Exception e) {
System.err.println("Exception in setting up displayActions : "
+ e.getMessage());
}
System.out.println("13");
displaySchedule = new ScheduleImpl (getZone (), displayFrequency);
displaySchedule.at$createAction(0,displayActions);
return this;
}
public Activity activateIn(Swarm swarmContext) {
super.activateIn(swarmContext);
immunitySystem.activateIn(this);
displaySchedule.activateIn(this);
return getActivity();
}
public void drop() {
if (appetencyGraph != null) {
appetencyGraph.disableDestroyNotification();
}
super.drop();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -