Package jade.util.leap

Examples of jade.util.leap.Iterator


  SearchConstraints sc = new SearchConstraints();
  try{
   
    FIPAAppletRequestProto arp = new FIPAAppletRequestProto(this,df,FIPAManagementVocabulary.SEARCH,dfd,sc);
    arp.doProto();
    Iterator result = arp.getSearchResult().iterator();
    ArrayList listOfAID = new ArrayList();
    ArrayList listOfChildren = new ArrayList();
    while(result.hasNext())
      {
        DFAgentDescription next = (DFAgentDescription)result.next();
        listOfAID.add(next.getName());
        if(isADF(next))
          listOfChildren.add(next.getName());
      }
 
    //second request the df the parent
    JADEAppletRequestProto getParent = new JADEAppletRequestProto(this,getDescriptionOfThisDF().getName(), DFAppletVocabulary.GETPARENTS,null,null);
    getParent.doProto();
    Iterator parents = getParent.getResult().iterator();
 
    gui.refresh(listOfAID.iterator(), parents, listOfChildren.iterator());
  }catch(FIPAAppletRequestProto.NotYetReady nyr){
    nyr.printStackTrace();
  }catch(JADEAppletRequestProto.NotYetReady ex){
View Full Code Here


  SearchConstraints sc = new SearchConstraints();
 
  try{
    FIPAAppletRequestProto arp = new FIPAAppletRequestProto(this,df,FIPAManagementVocabulary.SEARCH,dfd,sc);
    arp.doProto();
    Iterator result = arp.getSearchResult().iterator();
    if(result.hasNext())
     outDesc = (DFAgentDescription)result.next();
  }catch(FIPAAppletRequestProto.NotYetReady nyr){
    nyr.printStackTrace();
  }catch(FIPAException e){
  e.printStackTrace();
  }
View Full Code Here

        }
      }
    }
   
    public boolean match(ACLMessage msg) {
      Iterator it = msg.getAllReceiver();
      while (it.hasNext()) {
        AID receiver = (AID) it.next();
        if (TopicUtility.isTopic(receiver)) {
          if (matchAll) {
            return true;
          }
          else {
View Full Code Here

    if (notYetReady)
      throw new NotYetReady();
    if(lastMsg.getPerformative() != ACLMessage.INFORM)
      throw new FIPAException(lastMsg);
    Result r = AppletRequestProto.extractContent(lastMsg.getContent(),(SLCodec)c,o);
        Iterator i = r.getItems().iterator(); //this is the set of DFAgentDescription
        List l = new ArrayList();
        while (i.hasNext())
          l.add(i.next());
        return l;
  }
View Full Code Here

      StringBuffer str = new StringBuffer("(");
      str.append(msg.getPerformative(msg.getPerformative()) + "\n");
      AID sender = msg.getSender();
      if (sender != null)
  str.append(SENDER + " "+ sender.toString()+"\n");
      Iterator it = msg.getAllReceiver();
      if (it.hasNext()) {
  str.append(RECEIVER + " (set ");
  while(it.hasNext())
    str.append(it.next().toString()+" ");
  str.append(")\n");
      }
      it = msg.getAllReplyTo();
      if (it.hasNext()) {
  str.append(REPLY_TO + " (set \n");
  while(it.hasNext())
    str.append(it.next().toString()+" ");
  str.append(")\n");
      }
      if (msg.hasByteSequenceContent()) {
    str.append(":X-"+ BASE64ENCODING_KEY + " " + BASE64ENCODING_VALUE + "\n");
    try {
View Full Code Here

        String key = (String) e.nextElement();
        Object o = profileProp.get(key);
        if (o.getClass().isAssignableFrom(aList.getClass())) {
          System.out.print(key + "=");
          ArrayList al = (ArrayList)o;
          Iterator itor = al.iterator();
          if (!itor.hasNext()) {
            System.out.println("<empty>");
          } else {
            StringBuffer sb = new StringBuffer();
            while (itor.hasNext()) {
              sb.append(itor.next());
              if (itor.hasNext()) {
                sb.append(" ");
              }
            }
            System.out.println(sb.toString());
          }
View Full Code Here

   
    // If we have a composite behaviour, add the
    // children to this behaviour id.
    if (b instanceof CompositeBehaviour) {
      CompositeBehaviour c = (CompositeBehaviour)b;
      Iterator iter = c.getChildren().iterator();
      while (iter.hasNext()) {
        addChildren(new BehaviourID((Behaviour)iter.next()));
      }
    }
  }
View Full Code Here

 
  private void notifyPendingEvents(AID id) {
    synchronized (pendingEvents) {
      List l = (List) pendingEvents.remove(id);
      if (l != null) {
        Iterator it = l.iterator();
        while (it.hasNext()) {
          JADEEvent ev = (JADEEvent) it.next();
          ev.notifyProcessed(null);
        }
      }
    }
  }
View Full Code Here

    }
  }
 
  private void notifyAllPendingEvents() {
    synchronized (pendingEvents) {
      Iterator it1 = pendingEvents.values().iterator();
      while (it1.hasNext()) {
        List l = (List) it1.next();
        Iterator it2 = l.iterator();
        while (it2.hasNext()) {
          JADEEvent ev = (JADEEvent) it2.next();
          ev.notifyProcessed(null);
        }
      }
    }
  }
View Full Code Here

   */
  public String dump(String key) {
    if (key == null || key.equals(ALL_DUMP_KEY)) {
      StringBuffer sb = new StringBuffer("LOCAL: ").append(isLocal()).append('\n');
      sb.append("CACHED SLICES:\n");
      Iterator it = slices.keySet().iterator();
      while (it.hasNext()) {
        String name = (String) it.next();
        sb.append("- ").append(name).append(" --> "+stringifySlice((Slice) slices.get(name))).append("\n");
      }
     
      return sb.toString();
    }
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.