Package jade.core.behaviours

Examples of jade.core.behaviours.Behaviour$RunnableChangedEvent


       for(Iterator it = new EnumIterator(readyBehaviours.elements()); it.hasNext();)
       #MIDP_INCLUDE_END*/
      behaviours[counter++] = (Behaviour)it.next();
   
    for(int i = 0; i < behaviours.length; i++) {
      Behaviour b = behaviours[i];
      b.restart();
    }
   
    behaviours = new Behaviour[blockedBehaviours.size()];
    counter = 0;
    //#MIDP_EXCLUDE_BEGIN
    for(Iterator it = blockedBehaviours.iterator(); it.hasNext();) {
      //#MIDP_EXCLUDE_END
      /*#MIDP_INCLUDE_BEGIN
       for(Iterator it = new EnumIterator(blockedBehaviours.elements()); it.hasNext();) {
       #MIDP_INCLUDE_END*/
     
      //#DOTNET_EXCLUDE_BEGIN
      behaviours[counter++] = (Behaviour)it.next();
      //#DOTNET_EXCLUDE_END
      /*#DOTNET_INCLUDE_BEGIN
       Object tmpB = null;
       try // Hack: sometimes .NET inserts into this array a non-Behaviour object
       {
       tmpB = it.next();
       behaviours[counter++] = (Behaviour)tmpB;
       }
       catch(ClassCastException cce)
       {
       System.out.println("Found an object of type "+tmpB.getClass().getName()+" instead of Behaviour");
       cce.printStackTrace();
       }
       #DOTNET_INCLUDE_END*/
    }
   
    for(int i = 0; i < behaviours.length; i++) {
      Behaviour b = behaviours[i];
      /*#DOTNET_INCLUDE_BEGIN
       if (b != null)
       #DOTNET_INCLUDE_END*/
      b.restart();
     
    }
  }
 
View Full Code Here


    while(readyBehaviours.isEmpty()) {
      owner.idle();
    }
   
    //#MIDP_EXCLUDE_BEGIN
    Behaviour b = (Behaviour)readyBehaviours.get(currentIndex);
    //#MIDP_EXCLUDE_END
    /*#MIDP_INCLUDE_BEGIN
     Behaviour b = (Behaviour)readyBehaviours.elementAt(currentIndex);
     #MIDP_INCLUDE_END*/
    currentIndex = (currentIndex + 1) % readyBehaviours.size();
View Full Code Here

   
    Behaviour[] result = new Behaviour[blockedBehaviours.size() + readyBehaviours.size()];
    Iterator itReady = readyBehaviours.iterator();
    Iterator itBlocked = blockedBehaviours.iterator();
    for(int i = 0; i < result.length; i++) {
      Behaviour b = null;
      if(itReady.hasNext()) {
        b = (Behaviour)itReady.next();
      }
      else {
        b = (Behaviour)itBlocked.next();
View Full Code Here

   
    readyBehaviours.clear();
    blockedBehaviours.clear();
   
    for(int i = 0; i < behaviours.length; i++) {
      Behaviour b = behaviours[i];
      if(b.isRunnable()) {
        readyBehaviours.add(b);
      }
      else {
        blockedBehaviours.add(b);
      }
View Full Code Here

    }
   
    private void handleNotifyAddedBehaviour(VerticalCommand cmd) {
      Object[] params = cmd.getParams();
      AID id = (AID)params[0];
      Behaviour b = (Behaviour)params[1];
     
      fireAddedBehaviour(id, b);
    }
View Full Code Here

    }
   
    private void handleNotifyRemovedBehaviour(VerticalCommand cmd) {
      Object[] params = cmd.getParams();
      AID id = (AID)params[0];
      Behaviour b = (Behaviour)params[1];
     
      fireRemovedBehaviour(id, b);
    }
View Full Code Here

    }
   
    private void handleNotifyChangedBehaviourState(VerticalCommand cmd) {
      Object[] params = cmd.getParams();
      AID id = (AID)params[0];
      Behaviour b = (Behaviour)params[1];
      String from = (String)params[2];
      String to = (String)params[3];
     
      fireChangedBehaviourState(id, b, from, to);
    }
View Full Code Here

    e.addSlice(sliceKey, slice, node);

    if (isLocalNode(node)) {
      // The service is just started on this main container
      // Register the service-specific behaviour (if any) within the AMS
      Behaviour b = service.getAMSBehaviour();
      if (b != null) {
        myMain.installAMSBehaviour(b);
      }
    }
View Full Code Here

      NodeDescriptor dsc = getDescriptor(sliceKey);
      if (dsc != null && isLocalNode(dsc.getNode())) {
        // The service slice was removed on this node
        // Deregister the service-specific behaviour (if any) within the AMS
        Behaviour b = e.getService().getAMSBehaviour();
        if (b != null) {
          myMain.uninstallAMSBehaviour(b);
        }
      }
View Full Code Here

   This method runs within the time-critical Timer Dispatcher thread and
   is not intended to be called by users. It is defined public only because
   is part of the <code>TimerListener</code> interface.
   */
  public void doTimeOut(Timer t) {
    Behaviour b = null;
    // This synchronized block avoids that if a behaviour is blocked
    // again just after pendingTimers.getPeer(t) is called, a new mapping
    // is added before the old one is removed --> The new mapping is
    // removed instead of the old one.
    // In any case b.restart() must be called outside the synchronized
    // block to avoid a deadlock between the TimerDispatcher and the Scheduler.
    synchronized (theDispatcher) {
      b = pendingTimers.getPeer(t);
      if(b != null) {
        pendingTimers.removeMapping(b);
      }
    }
    if(b != null) {
      b.restart();
    }
    else {
      System.out.println("Warning: No mapping found for expired timer "+t.expirationTime());
    }
  }
View Full Code Here

TOP

Related Classes of jade.core.behaviours.Behaviour$RunnableChangedEvent

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.