Package ise.mace.actions

Examples of ise.mace.actions.RespondToApplication


    if (input.getClass().equals(JoinRequest.class))
    {
      final JoinRequest req = (JoinRequest)input;
      boolean response = this.respondToJoinRequest(req.getAgent());
      if (response) this.dm.addMember(req.getAgent());
      ec.act(new RespondToApplication(req.getAgent(), response), this.getId(),
              authCode);
      logger.log(Level.FINE, "{0} got a join request from {1}", new Object[]
              {
                dm.getName(),
                ec.nameof(((JoinRequest)input).getAgent())
              });
      return;
    }

    if (input.getClass().equals(LeaveNotification.class))
    {
      final LeaveNotification in = (LeaveNotification)input;

      dm.removeMember(in.getAgent());
      this.onMemberLeave(in.getAgent(), in.getReason());
      //Bug fix
      ec.act(new RespondToApplication(in.getAgent(), false), this.getId(),
              authCode);
      //Bug fix end
      logger.log(Level.FINE, "{0} lost memeber {1} because of {2}", new Object[]
              {
                dm.getName(),
View Full Code Here


    }

    @Override
    public Input handle(Action action, String actorID)
    {
      RespondToApplication application = (RespondToApplication)action;

      sim.getPlayer(application.getAgent()).enqueueInput(new ApplicationResponse(
              sim.getTime(), actorID, application.wasAccepted()));
      if (application.wasAccepted())
      {
        String old_group = dmodel.getAgentById(application.getAgent()).getGroupId();
        if (old_group != null)
        {
          sim.getPlayer(old_group).enqueueInput(new LeaveNotification(
                  sim.getTime(), LeaveNotification.Reasons.Other,
                  application.getAgent()));
        }
      }
      logger.log(Level.FINE,
              "Agent {0} has attempted to join group {1}, and the result was: {2}",
              new Object[]
              {
                nameOf(application.getAgent()),
                nameOf(actorID), application.wasAccepted()
              });
      return null;
    }
View Full Code Here

TOP

Related Classes of ise.mace.actions.RespondToApplication

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.