Package jade.util.leap

Examples of jade.util.leap.Iterator


        DFAgentDescription matchEverything = new DFAgentDescription();
        // FIXME: Getting a list with all DFAgentDescriptions may cause out of memory
        // The DFGui should probably be paged and we should use an iterated search.
        List agents = agentDescriptions.search(matchEverything, -1);
        List AIDList = new ArrayList();
        Iterator it = agents.iterator();
        while(it.hasNext())
          AIDList.add(((DFAgentDescription)it.next()).getName());
       
        gui.refresh(AIDList.iterator(), parents.iterator(), children.iterator());
        gui.setVisible(true);
        return true;
       
View Full Code Here


   * Retrieve a string representation for this platform description.
   * @return an SL0-like String representation of this object
   **/
  public String toString() {
    String s = "(Envelope ";
    Iterator i = getAllTo();
    if (i.hasNext()) {
      s = s + " :to (sequence ";
      for (Iterator ii=i; ii.hasNext(); )
        s = s+" "+ii.next().toString();
      s = s + ") ";
    }
    if (getFrom() != null)
      s = s + " :from " + getFrom().toString();
    if (getComments() != null)
      s = s + " :comments " + getComments();
    if (getAclRepresentation() != null)
      s = s + " :acl-representation " + getAclRepresentation();
    if (getPayloadLength() != null)
      s = s + " :payload-length " + getPayloadLength().toString();
    if (getPayloadEncoding() != null)
      s = s + " :payload-encoding " + getPayloadEncoding();
    if (getDate() != null)
      s = s + " :date " + getDate().toString();
    i = getAllIntendedReceiver();
    if (i.hasNext()) {
      s = s + " :intended-receiver (sequence ";
      for (Iterator ii=i; ii.hasNext(); )
        s = s+" "+ ii.next().toString();
      s = s + ") ";
    }
View Full Code Here

    final String className = ca.getClassName();
    final ContainerID container = ca.getContainer();
    if (logger.isLoggable(Logger.FINE))
      logger.log(Logger.FINE, "Agent " + requester + " requesting Create-agent " + agentID + " on container " + container);
    // Prepare arguments as a Object[]
    Iterator it = ca.getAllArguments();
    ArrayList listArg = new ArrayList();
    while (it.hasNext()) {
      listArg.add(it.next());
    }
    final Object[] args = listArg.toArray();
    final JADEPrincipal owner = ca.getOwner();
    final Credentials initialCredentials = ca.getInitialCredentials();
View Full Code Here

          for(int i = 0; i < cids.length; i++) {
            ContainerID cid = cids[i];
           
            try {
              List mtps = impl.containerMTPs(cid);
              Iterator it = mtps.iterator();
              while(it.hasNext()) {
                MTPDescriptor mtp = (MTPDescriptor)it.next();
                newSlice.addRoute(mtp, cid.getName());
              }
            }
            catch(NotFoundException nfe) {
              // Should never happen
View Full Code Here

          er = new EventRecord(ac, here());
          eventQueue.put(er);

          // Send the list of the MTPs installed on this container
          Iterator mtps = myPlatform.containerMTPs(cid).iterator();
          while (mtps.hasNext()) {
            AddedMTP amtp = new AddedMTP();
            amtp.setAddress(((MTPDescriptor) mtps.next()).getAddresses()[0]);
            amtp.setWhere(cid);

            er = new EventRecord(amtp, here());
            eventQueue.put(er);
          }
View Full Code Here

            ReceivedObject ro = new ReceivedObject();
            ro.setBy(accID);
            ro.setDate(new Date());
            env.setReceived(ro);
           
            Iterator it = env.getAllIntendedReceiver();
            // FIXME: There is a problem if no 'intended-receiver' is present,
            // but this should not happen
            while (it.hasNext()) {
              AID rcv = (AID)it.next();
              GenericMessage msg = new GenericMessage(env,payload);
              String traceId = getTraceId(env);
              if (traceId != null) {
                myLogger.log(Logger.INFO, "MTP In-Channel handling message from the outside for receiver "+rcv.getName()+". TraceID = "+traceId);
                msg.setTraceID(traceId);
View Full Code Here

    List mtps = new ArrayList();
    ContainerID[] cc = myPlatform.containerIDs();
    for (int i = 0; i < cc.length; ++i) {
      try {
        List l = myPlatform.containerMTPs(cc[i]);
        Iterator it = l.iterator();
        while (it.hasNext()) {
          mtps.add(it.next());
        }
      } catch (NotFoundException nfe) {
        // The container has died while we were looping --> ignore it
      }
    }
View Full Code Here

      }
    }
  }

  void bootAllServices(List services) throws ServiceException {
    Iterator it = services.iterator();
    while (it.hasNext()) {
      ServiceDescriptor dsc = (ServiceDescriptor) it.next();
      try {
        dsc.getService().boot(myProfile);
      }
      catch(Throwable t) {
        if ( dsc.isMandatory() ) {
View Full Code Here

  }

  private void startBootstrapAgents() {
    try {
      List l = myProfile.getSpecifiers(Profile.AGENTS);
      Iterator agentSpecifiers = l.iterator();
      while(agentSpecifiers.hasNext()) {
        Specifier s = (Specifier) agentSpecifiers.next();
        if (s.getName() != null) {
          AID agentID = new AID(s.getName(), AID.ISLOCALNAME);

          try {
            //#MIDP_EXCLUDE_BEGING
View Full Code Here

  /**
   Issue a SEND_MESSAGE VerticalCommand for each receiver
   */
  public void handleSend(ACLMessage msg, AID sender, boolean needClone) {
    Iterator it = msg.getAllIntendedReceiver();
    // If there are multiple receivers the message must always be cloned
    // since the MessageManager will modify it. If there is a single
    // receiver we clone it or not depending on the needClone parameter
    boolean isFirst = true;
    while (it.hasNext()) {
      AID receiver = (AID)it.next();
      if (isFirst) {
        needClone = needClone || it.hasNext();
        isFirst = false;
      }
      GenericCommand cmd = new GenericCommand(jade.core.messaging.MessagingSlice.SEND_MESSAGE, jade.core.messaging.MessagingSlice.NAME, null);
      cmd.addParam(sender);
      ACLMessage toBeSent = null;
View Full Code Here

TOP

Related Classes of jade.util.leap.Iterator

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.