| package sdl.SIR.sd; |
| |
| import java.util.ArrayList; |
| import java.util.List; |
| import java.util.Collections; |
| |
| import org.eclipse.core.runtime.IAdapterFactory; |
| import org.eclipse.amp.agf.IGraphicsAdapted; |
| import org.eclipse.amp.agf.IGraphicsAdapter; |
| |
| import org.eclipse.swt.graphics.Color; |
| import org.eclipse.jface.viewers.IColorProvider; |
| |
| import org.ascape.model.Agent; |
| import org.ascape.model.Cell; |
| import org.ascape.model.CellOccupant; |
| import org.ascape.model.HostCell; |
| import org.ascape.model.LocatedAgent; |
| import org.ascape.model.Scape; |
| import org.ascape.model.event.ScapeEvent; |
| import org.ascape.model.rule.Rule; |
| import org.ascape.model.rule.ExecuteThenUpdate; |
| import org.ascape.model.space.CollectionSpace; |
| import org.ascape.model.space.Coordinate; |
| import org.ascape.model.space.Coordinate2DDiscrete; |
| import org.ascape.model.space.Graph; |
| import org.ascape.model.space.Location; |
| import org.ascape.model.space.Singleton; |
| import org.ascape.runtime.NonGraphicRunner; |
| import org.ascape.util.Conditional; |
| import org.ascape.util.data.DataPoint; |
| import org.ascape.util.data.DataPointConcrete; |
| import org.ascape.util.vis.ColorFeature; |
| import org.ascape.util.vis.ColorFeatureConcrete; |
| import org.ascape.view.vis.ChartView; |
| import org.ascape.view.vis.GEFView; |
| import org.ascape.view.vis.GraphView; |
| |
| import org.eclipse.amp.escape.runtime.extension.IAgentChild; |
| import org.eclipse.amp.escape.runtime.extension.IAgentChildProvider; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * SIR Agent Java Implementation. |
| * |
| * Generated by AMF for model: SIR.metaabm in project: org.eclipse.amp.amf.examples.sd |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class SIRAgent extends CellOccupant implements IAgentChildProvider { |
| |
| /** |
| * <!-- begin-user-doc --> |
| * |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| private List<IAgentChild> children; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public List<IAgentChild> getChildren() { |
| return children; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * Constructs a new SIR Agent. |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public SIRAgent() { |
| |
| children = new ArrayList<IAgentChild>(); |
| |
| } |
| //todo, make this a useful value for evaluating compatibility of different versions of generated classes |
| |
| /** |
| * <!-- begin-user-doc --> |
| * |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| private static final long serialVersionUID = 89989998L; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| private static long nextUniqueID; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| private long uniqueID; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public long getUID() { |
| if (uniqueID == 0) { |
| uniqueID = nextUniqueID++; |
| } |
| return uniqueID; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * Clones the agent, ensuring that a unique id is assigned. |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Object clone() { |
| try { |
| SIRAgent clone = (SIRAgent) super.clone(); |
| clone.uniqueID = 0; |
| return clone; |
| } catch (Exception e) { |
| throw new RuntimeException("Unexpected cloning exception: " + e); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public SIR getSIR() { |
| return (SIR) getScape().getScape(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| |
| public void startSimulationAgentChild(int timeStep) { |
| if (timeStep == getRoot().getRunner().getEarliestPeriod()) { |
| for (IAgentChild tmp : children) { |
| tmp.startSimulation(timeStep); |
| } |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| |
| public void calculateTimeStep(int timeStep) { |
| for (IAgentChild tmp : children) { |
| tmp.calculate(timeStep); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getName() { |
| if (name == null) { |
| return "SIR Agent " + getUID(); |
| } else { |
| return name; |
| } |
| } |
| } |