/** * \brief Create an agent using information in a previous state or initialisation file * * <p>Create an agent using information in a previous state or initialisation file * * @param aSim The simulation object used to simulate the conditions specified in the protocol * file * @param singleAgentData Data from the result or initialisation file that is used to recreate * this agent */ public void initFromResultFile(Simulator aSim, String[] singleAgentData) { // this routine will read data from the end of the singleAgentData array // and then pass the remaining values onto the super class // Chemostat "if" added by Sonia 27.10.09 // Rearranged by Rob 10.01.11 // find the position to start at by using length and number of values read int nValsRead = 5; int iDataStart = singleAgentData.length - nValsRead; if (Simulator.isChemostat) { // Rob: this is necessary for the case when biofilm agents in one simulation // are transferred into a chemostat for the next. _location.set(0, 0, 0); } else { double newAgentX, newAgentY, newAgentZ; newAgentX = Double.parseDouble(singleAgentData[iDataStart]); newAgentY = Double.parseDouble(singleAgentData[iDataStart + 1]); newAgentZ = Double.parseDouble(singleAgentData[iDataStart + 2]); _location.set(newAgentX, newAgentY, newAgentZ); } // agent size _radius = Double.parseDouble(singleAgentData[iDataStart + 3]); _totalRadius = Double.parseDouble(singleAgentData[iDataStart + 4]); _myDivRadius = getDivRadius(); _myDeathRadius = getDeathRadius(); // now go up the hierarchy with the rest of the data String[] remainingSingleAgentData = new String[iDataStart]; for (int i = 0; i < iDataStart; i++) remainingSingleAgentData[i] = singleAgentData[i]; super.initFromResultFile(aSim, remainingSingleAgentData); }
/** * \brief Mutate inherited agent parameters after agent division. * * <p>Mutation Function. If you don't want apply a mutation in a specified class, do not redefine * this method. If you want, you are free to choose which fields to mutate for each different * class by a simple redefinition */ public void mutateAgent() { // Mutate parameters inherited super.mutateAgent(); // Now mutate your parameters }
/** * \brief Kills an agent. Called by detachment and starving test * * <p>Kills an agent. Called by detachment and starving test */ public void die(boolean isStarving) { super.die(isStarving); }
/** * \brief Creates an agent of the specified species and notes the grid in which this is assigned * * <p>Creates an agent of the specified species and notes the grid in which this is assigned * * @param aSim The simulation object used to simulate the conditions specified in the protocol * file * @param xmlMarkUp A species mark-up within the specified protocol file */ public void initFromProtocolFile(Simulator aSim, XMLParser xmlMarkUp) { super.initFromProtocolFile(aSim, xmlMarkUp); _myDivRadius = getDivRadius(); _myDeathRadius = getDeathRadius(); }
/** * \brief Registers a created agent into a respective container. Each agent must be referenced by * one such container. * * <p>Registers a created agent into a respective container. Each agent must be referenced by one * such container. In this case, the species is registered into the agent grid */ public void registerBirth() { // Register on species and reaction guilds super.registerBirth(); }