Example #1
0
  /**
   * \brief Create a new agent in a specified position
   *
   * <p>Create a new agent in a specified position
   *
   * @param position Vector stating where this agent should be located
   */
  public void createNewAgent(ContinuousVector position) {
    try {
      // Get a clone of the progenitor
      LocatedAgent baby = (LocatedAgent) sendNewAgent();
      baby.giveName();

      // randomize its mass
      baby.mutatePop();

      baby.updateSize();

      this._myDivRadius = getDivRadius();
      baby._myDivRadius = getDivRadius();
      baby._myDeathRadius = getDeathRadius();

      // Just to avoid to be in the carrier
      position.x += this._totalRadius;

      baby.setLocation(position);

      baby.registerBirth();

    } catch (CloneNotSupportedException e) {
      utils.LogFile.writeLog("Error met in LocAgent:createNewAgent()");
    }
  }