Пример #1
0
 /**
  * \brief Registers the created species to the simulation speciesManager
  *
  * <p>Registers the created species to the simulation speciesManager
  *
  * @param aSimulator The simulator object being used to create the conditions specified in the
  *     protocol file
  * @param aSpRoot XML markup for the species being created. Taken from the protocol file
  */
 public void register(Simulator aSimulator, XMLParser aSpRoot) {
   currentSimulator = aSimulator;
   speciesName = aSpRoot.getName();
   speciesIndex = aSimulator.speciesList.size();
   aSimulator.speciesList.add(this);
   domain = aSimulator.world.getDomain(aSpRoot.getAttribute("computationDomain"));
 }
Пример #2
0
  /**
   * \brief Creates a species object from that specified in the XML protocol file
   *
   * <p>This method takes an object specified in the SPECIES mark-up and creates a simulation object
   * for that species
   *
   * @param aSimulator The simulation object used to simulate the conditions specified in the
   *     protocol file
   * @param aSpRoot A Species mark-up within the specified protocol file
   */
  public Species(Simulator aSimulator, XMLParser aSpRoot, XMLParser speciesDefaults) {
    // Name of the species as specified in the protocol file
    speciesName = aSpRoot.getName();

    // colour is used to distinguish agents in POV-Ray output images - read this from the protocol
    // file
    String colorName = aSpRoot.getParam("color");

    // Set the colour to white if not specified
    if (colorName == null) colorName = "white";
    // Translate this text string into a colour
    color = utils.UnitConverter.getColor(colorName);

    // Register this species
    // KA 8/3/13 - is this correct - this is storing the number of species in the simulation
    speciesIndex = aSimulator.speciesList.size();

    // Take a local copy of the current simulation
    currentSimulator = aSimulator;

    // KA May 2013
    // If this is self-attach, useful to store the injection period parameters here, so can
    // reference these later
    cellInjectionStartHour = aSpRoot.getParamDbl("cellInjectionStartHour");
    injectionOnAttachmentFrequency = aSpRoot.getParamDbl("injectionOnAttachmentFrequency");
    cellInjectionEndHour = aSpRoot.getParamDbl("cellInjectionEndHour");
    injectionOffAttachmentFrequency = aSpRoot.getParamDbl("injectionOffAttachmentFrequency");

    // Create the progenitor and tune its speciesParam object
    _progenitor = (SpecialisedAgent) aSpRoot.instanceCreator("simulator.agent.zoo");
    // Get parameters for this progenitor object from the protocol file if present

    _progenitor.getSpeciesParam().init(aSimulator, aSpRoot, speciesDefaults);

    _progenitor.setSpecies(this);

    // Set the computational domain this species is associated with
    // KA Aug 13 - changed as this may be a default
    domain =
        aSimulator.world.getDomain(
            _progenitor
                .getSpeciesParam()
                .getSpeciesParameterString("computationDomain", aSpRoot, speciesDefaults));
  }