This is not the document you are looking for? Use the search form below to find more!

Report home > Art & Culture

ABT upr4

0.00 (0 votes)
Document Description
abt upr4
File Details
  • Added: September, 23rd 2012
  • Reads: 36
  • Downloads: 0
  • File size: 45.95kb
  • Pages: 4
  • Tags: abt
  • content preview
Submitter
  • Name: Doncho
Embed Code:

Add New Comment




Related Documents

2009 ABT AS3 Audi A3

by: ronnie, 2 pages

ABT AS3 Audi A3 2009 - Front Side View,Audi A3 ABT AS3 2009 - Side View,Audi A3 ABT AS3 2009 - Rear Side View

2009 ABT AS5 Cabrio Based on Audi A5

by: cesar, 2 pages

ABT AS5 Cabrio Based on Audi A5 2009 - Front Side View,Audi A5 ABT AS5 Cabrio - Side View,ABT AS5 Cabrio based on Audi A5 2009 - Rear Side View

2009 ABT Audi AS5-R

by: gloria, 2 pages

2009 Audi ABT AS5-R - Front Angle Picture,Audi ABT AS5-R 2009 - Front Side Picture

2009 ABT Audi Q5

by: robert1, 2 pages

2009 Audi Q5 by ABT Sportsline - Front Angle View,Audi Q5 by ABT Sportsline 2009 - Side View,2009 Audi Q5 by ABT Sportsline - Rear Angle View,Audi Q5 by ABT Sportsline 2009 - Rear View

2009 ABT Audi R8 5.2 FSI V10

by: solomon, 3 pages

2009 ABT Audi R8 5.2 FSI V10 - Front Side View,ABT Audi R8 5.2 FSI V10 2009 - Side View,2009 ABT Audi R8 5.2 FSI V10 - Rear Side View,ABT Audi R8 5.2 FSI V10 2009 - Rear Wing View,2009 ABT Audi R8 5 ...

2009 ABT Audi S4

by: john2, 4 pages

2009 ABT Audi S4 - Front Angle View,ABT Sportsline Audi S4 2009 - Front Side View,2009 ABT Audi S4 - Rear Angle View,ABT Audi S4 2009 - Rear Side View,2009 ABT Audi S4 - Side View

2009 ABT Golf VI GTD

by: cesar, 7 pages

ABT Golf VI GTD 2009 - Front Side View,2009 ABT Golf VI GTD - Rear Side View,2009 ABT Golf VI GTI - Front Angle View,2009 ABT Golf VI GTI - Interior View,2009 ABT Golf VI GTI - Rear Angle View,ABT ...

2009 ABT Radeberger Audi A5 Cabrio

by: lawrence1, 2 pages

ABT Radeberger Audi A5 Cabrio 2009 - Front Side View,ABT Radeberger Audi A5 Cabrio 2009 - Front Angle View,Audi A5 Cabrio ABT Radeberger Pilsner 2009 - Front View,2009 ABT Radeberger Audi A5 Cabrio - ...

2009 ABT Sportsline AS5-R Audi S5

by: bernadette, 2 pages

Audi S5 2009 ABT Sportsline AS5-R - Front Side Picture,ABT Sportsline AS5-R Audi S5 2009 - Front Angle Picture

2009 Abt Sportsline Audi TT-RS

by: ronnie, 2 pages

Abt Sportsline Audi TT-RS 2009 - Front Side View,Abt Sportsline Audi TT-RS 2009 - Side View,Abt Sportsline Audi TT-RS 2009 - Rear Side View

Content Preview
JADE Agent Behaviours - II part

CyclicBehaviour: This behaviour stays active as long as its agent is alive and will be called
repeatedly after every event. Quite useful to handle message reception.


Exercise 1: CyclicBehaviourAgent.java

package cse5610.tutorial.behaviours;

import jade.core.Agent;
import jade.core.behaviours.CyclicBehaviour;

public class CyclicBehaviourAgent extends Agent {



protected void setup() {


addBehaviour(new MyCyclicBehaviour(this));

}



class MyCyclicBehaviour extends CyclicBehaviour {


private int count = 0;


public MyCyclicBehaviour(Agent a)


{



super(a);


}



@Override


public void action() {



System.out.println("Round " + count++);


}

}
}

Exercise 2: Extended CyclicBehaviourAgent.java

package cse5610.tutorial.behaviours;

import jade.core.Agent;
import jade.core.behaviours.CyclicBehaviour;

public class CyclicBehaviourAgent extends Agent {

private int count = 0;



protected void setup() {


addBehaviour(new MyCyclicBehaviour(this));


addBehaviour(new CounterBehaviour(this));




}



protected void takeDown() {


System.out.println("Disposing of agent");

}



class CounterBehaviour extends CyclicBehaviour {



public CounterBehaviour(Agent a)


{



super(a);


}






@Override


public void action() {



if(count == 10)




myAgent.doDelete();


}




}



class MyCyclicBehaviour extends CyclicBehaviour {



public MyCyclicBehaviour(Agent a)


{



super(a);


}



@Override


public void action() {



System.out.println("Round " + count++);


}

}
}

Exercise 3: Generic Behaviour

package cse5610.tutorial.behaviours;

import jade.core.Agent;
import jade.core.behaviours.Behaviour;

public class GenericBehaviourAgent extends Agent {


protected void setup()

{


addBehaviour(new ThreeStepBehaviour());

}



class ThreeStepBehaviour extends Behaviour {


private int step = 0;





public void action() {



switch(step) {



case 0:




// do something




step++;




System.out.println("Step " + step);







break;



case 1:




// do something




step++;




System.out.println("Step " + step);







break;



case 2:




// do something




step++;




System.out.println("Step " + step);







break;



}







}



@Override


public boolean done() {



return step == 3;


}





}
}


Exercise 4: Expand the previous exercise so that at the end of the
ThreeStepBehaviour, the agent starts a new OneShotBehaviour

Composite Behaviours
*
ParallelBehaviour: controls a set of children behaviours that execute in parallel. The
important thing is the termination condition: we can specify that the group terminates
when ALL children are done, N children are done or ANY child is done.
*
SequentialBehaviour: this behaviour executes its children behaviours one after the other
and terminates when the last child has ended.

SequentialBehaviour & ParallelBehaviour


import jade.core.Agent;
import jade.core.behaviours.OneShotBehaviour;
import jade.core.behaviours.ParallelBehaviour;
import jade.core.behaviours.SequentialBehaviour;

public class CompositeBehaviourAgent extends Agent {


protected void setup()

{


SequentialBehaviour seq1 = new SequentialBehaviour(this);


seq1.setBehaviourName("SB1");





seq1.addSubBehaviour(




new OneShotBehaviour(this) {





public void action() {






System.out.println(this.getParent().getBehaviourName() + " : First");





}




});





seq1.addSubBehaviour(




new OneShotBehaviour(this) {





public void action() {






System.out.println(this.getParent().getBehaviourName() + " : Second");





}




});






seq1.addSubBehaviour(




new OneShotBehaviour(this) {





public void action() {






System.out.println(this.getParent().getBehaviourName() + " : Third");





}





});






SequentialBehaviour seq2 = new SequentialBehaviour(this);


seq2.setBehaviourName("SB2");





seq2.addSubBehaviour(




new OneShotBehaviour(this) {





public void action() {






System.out.println(this.getParent().getBehaviourName() + " : First");





}




});





seq2.addSubBehaviour(




new OneShotBehaviour(this) {





public void action() {






System.out.println(this.getParent().getBehaviourName() + " : Second");





}




});






seq2.addSubBehaviour(




new OneShotBehaviour(this) {





public void action() {






System.out.println(this.getParent().getBehaviourName() + " : Third");





}




});






ParallelBehaviour p = new ParallelBehaviour(this,
ParallelBehaviour.WHEN_ALL);





p.addSubBehaviour(seq1);


p.addSubBehaviour(seq2);





addBehaviour(p);

}
}


Download
ABT upr4

 

 

Your download will begin in a moment.
If it doesn't, click here to try again.

Share ABT upr4 to:

Insert your wordpress URL:

example:

http://myblog.wordpress.com/
or
http://myblog.com/

Share ABT upr4 as:

From:

To:

Share ABT upr4.

Enter two words as shown below. If you cannot read the words, click the refresh icon.

loading

Share ABT upr4 as:

Copy html code above and paste to your web page.

loading