-
Notifications
You must be signed in to change notification settings - Fork 0
/
Simpleagent.java
48 lines (34 loc) · 1.18 KB
/
Simpleagent.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.example.kompal_paliwal.firecast_app;
/**
* Created by Mitali on 21-03-2017.
*/
import android.content.Context;
import android.util.Log;
import android.view.View;
import jade.core.Agent;
import android.content.*;
import android.widget.TextView;
import jade.core.behaviours.OneShotBehaviour;
public class Simpleagent extends Agent {
private Context context;
private String agentName = "Simpleagent";
public String operation;
private TextView overlayText;
private static final String TAG = "Agent";
public String news;
protected void setup() {
Object[] args = getArguments(); //passing arguments to initialize the agent
if (args != null && args.length > 0) {
news = (String) args[0];
}
addBehaviour(new overlay());
}
public class overlay extends OneShotBehaviour { //adding functionality to the agent
public void action() {
overlayText.setVisibility(news.length() > 0 ? View.VISIBLE : View.INVISIBLE);
overlayText.setText(news.toString());
}
}
protected void takeDown() { //destroy the agent
}
}