FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
Loading...
Searching...
No Matches
frodo2.controller.userIO.UserIO Class Referenceabstract

This class implements all the functions that a user interface should deliver. More...

Inheritance diagram for frodo2.controller.userIO.UserIO:

Public Member Functions

 UserIO (Controller control)
 A basic constructor.
void start ()
Collection< MessageTypegetMsgTypes ()
void setQueue (Queue queue)
void notifyIn (Message msg)
 The user interface responds to message of the type USER_NOTIFICATION_MSG, that contain message to be displayed to the user.
void load (String filename)
 Used to load a new configuration file.
void startExperiment ()
 Used to start the experiments.
void setDebug (boolean b)
 Used to stop the experiments.
void setLogging (boolean b)
 Tell the controller whether we want to log everything or not.
void getDaemonList ()
 Ask the white pages for a list of all daemons that are registered.
void getAgentList ()
 Ask the white pages for a list of all agents that are registered.
void exit ()
 Stop the experiment, clean everything up and exit the program.
abstract void tellUser (String message)
 Tell the user something.
abstract boolean askUserYesNo (String message)
 Ask the user a yes or no question.
abstract void stopRunning ()
 stop the console
abstract void showUserDaemonList (HashMap< String, AgentAddress > daemons)
 Display the list of daemons.
abstract void showUserAgentList (HashMap< String, AgentAddress > agents)
 Display the list of agents.
Public Member Functions inherited from frodo2.communication.IncomingMsgPolicyInterface< T >
default void notifyIn (Message msg, Object toAgent)
 Notifies the listener of an incoming message.

Static Public Attributes

static final MessageType CONFIGURATION_MSG = MessageType.SYSTEM.newChild("UserIO", "Configure")
 The message type used to convey the configuration file.
static final MessageType USER_NOTIFICATION_MSG = MessageType.SYSTEM.newChild("UserIO", "User-Notification")
 The message type used to send messages to the user.
static final MessageType START_MSG = MessageType.SYSTEM.newChild("UserIO", "StartE")
 The message the user sends to start the experiment.
static final MessageType DEAMON_LIST_REQUEST = MessageType.SYSTEM.newChild("UserIO", "Daemon list requested")
 Message send to request a list of daemons from the white pages.
static final MessageType AGENTS_LIST_REQUEST = MessageType.SYSTEM.newChild("UserIO", "Agent list requested")
 Message send to request a list of agents from the white pages.

Protected Member Functions

 UserIO ()
 Default constructor.

Protected Attributes

Queue controlQueue
 The queue of the controller.
Controller control
 The controller.

Private Attributes

Object queue_lock = new Object()
 Lock for queue used for synchronization.
ArrayList< MessageTypemsgTypes = new ArrayList <MessageType> ()
 The list of messages types this listener wants to be notified of.

Detailed Description

This class implements all the functions that a user interface should deliver.

Author
brammertottens

Constructor & Destructor Documentation

◆ UserIO() [1/2]

frodo2.controller.userIO.UserIO.UserIO ( Controller control)

A basic constructor.

Parameters
controla reference to the controller

References frodo2.controller.WhitePages.AGENTS_LIST, control, frodo2.controller.WhitePages.DEAMONS_LIST, msgTypes, and USER_NOTIFICATION_MSG.

◆ UserIO() [2/2]

frodo2.controller.userIO.UserIO.UserIO ( )
protected

Default constructor.

Member Function Documentation

◆ askUserYesNo()

abstract boolean frodo2.controller.userIO.UserIO.askUserYesNo ( String message)
abstract

Ask the user a yes or no question.

Parameters
messagethe text of the question
Returns
return the answer of the user: yes is true, no is false

Reimplemented in frodo2.controller.userIO.Console, and frodo2.controller.userIO.DistributedSolver< V extends Addable< V >, U extends Addable< U >, S extends Solution< V, U >.

◆ exit()

void frodo2.controller.userIO.UserIO.exit ( )

Stop the experiment, clean everything up and exit the program.

References control.

Referenced by frodo2.controller.userIO.Console.parseInput().

◆ getAgentList()

void frodo2.controller.userIO.UserIO.getAgentList ( )

Ask the white pages for a list of all agents that are registered.

References AGENTS_LIST_REQUEST, and controlQueue.

Referenced by frodo2.controller.userIO.Console.parseInput().

◆ getDaemonList()

void frodo2.controller.userIO.UserIO.getDaemonList ( )

Ask the white pages for a list of all daemons that are registered.

References controlQueue, and DEAMON_LIST_REQUEST.

Referenced by frodo2.controller.userIO.Console.parseInput().

◆ getMsgTypes()

Collection< MessageType > frodo2.controller.userIO.UserIO.getMsgTypes ( )

◆ load()

void frodo2.controller.userIO.UserIO.load ( String filename)

Used to load a new configuration file.

Parameters
filenamethe file to be loaded

References CONFIGURATION_MSG, and controlQueue.

Referenced by frodo2.controller.userIO.Console.parseInput().

◆ notifyIn()

void frodo2.controller.userIO.UserIO.notifyIn ( Message msg)

The user interface responds to message of the type USER_NOTIFICATION_MSG, that contain message to be displayed to the user.

Parameters
msgthe message that was just received

Implements frodo2.communication.IncomingMsgPolicyInterface< T >.

References frodo2.controller.WhitePages.AGENTS_LIST, frodo2.controller.WhitePages.DEAMONS_LIST, notifyIn(), and USER_NOTIFICATION_MSG.

Referenced by notifyIn().

Here is the call graph for this function:

◆ setDebug()

void frodo2.controller.userIO.UserIO.setDebug ( boolean b)

Used to stop the experiments.

Used to suspend the current experiment Used to continue a suspended experiment A message is send to all daemons to clean everything up. If project is still running or is suspended, ask the user if he really wants to clean everything up! Tell the controller whether we want to do step by step debugging

Parameters
bwhether debug mode should be enabled

References tellUser().

Here is the call graph for this function:

◆ setLogging()

void frodo2.controller.userIO.UserIO.setLogging ( boolean b)

Tell the controller whether we want to log everything or not.

Parameters
bwhether logging should be enabled

References tellUser().

Here is the call graph for this function:

◆ setQueue()

void frodo2.controller.userIO.UserIO.setQueue ( Queue queue)

◆ showUserAgentList()

abstract void frodo2.controller.userIO.UserIO.showUserAgentList ( HashMap< String, AgentAddress > agents)
abstract

Display the list of agents.

Parameters
agentsa list of agents together with their addresses

Reimplemented in frodo2.controller.userIO.Console, and frodo2.controller.userIO.DistributedSolver< V extends Addable< V >, U extends Addable< U >, S extends Solution< V, U >.

◆ showUserDaemonList()

abstract void frodo2.controller.userIO.UserIO.showUserDaemonList ( HashMap< String, AgentAddress > daemons)
abstract

Display the list of daemons.

Parameters
daemonsa list of daemons together with their addresses

Reimplemented in frodo2.controller.userIO.Console, and frodo2.controller.userIO.DistributedSolver< V extends Addable< V >, U extends Addable< U >, S extends Solution< V, U >.

◆ start()

void frodo2.controller.userIO.UserIO.start ( )
See also
java.lang.Thread#start()

◆ startExperiment()

void frodo2.controller.userIO.UserIO.startExperiment ( )

Used to start the experiments.

References controlQueue, and START_MSG.

Referenced by frodo2.controller.userIO.Console.parseInput().

◆ stopRunning()

abstract void frodo2.controller.userIO.UserIO.stopRunning ( )
abstract

◆ tellUser()

abstract void frodo2.controller.userIO.UserIO.tellUser ( String message)
abstract

Tell the user something.

Parameters
messagethe message to be given

Reimplemented in frodo2.controller.userIO.Console, and frodo2.controller.userIO.DistributedSolver< V extends Addable< V >, U extends Addable< U >, S extends Solution< V, U >.

Referenced by setDebug(), and setLogging().

Member Data Documentation

◆ AGENTS_LIST_REQUEST

final MessageType frodo2.controller.userIO.UserIO.AGENTS_LIST_REQUEST = MessageType.SYSTEM.newChild("UserIO", "Agent list requested")
static

Message send to request a list of agents from the white pages.

Referenced by getAgentList(), frodo2.controller.WhitePages.notifyIn(), and frodo2.controller.WhitePages.WhitePages().

◆ CONFIGURATION_MSG

◆ control

Controller frodo2.controller.userIO.UserIO.control
protected

The controller.

Referenced by frodo2.controller.userIO.Console.Console(), exit(), and UserIO().

◆ controlQueue

Queue frodo2.controller.userIO.UserIO.controlQueue
protected

The queue of the controller.

Referenced by getAgentList(), getDaemonList(), load(), and startExperiment().

◆ DEAMON_LIST_REQUEST

final MessageType frodo2.controller.userIO.UserIO.DEAMON_LIST_REQUEST = MessageType.SYSTEM.newChild("UserIO", "Daemon list requested")
static

Message send to request a list of daemons from the white pages.

Referenced by getDaemonList(), frodo2.controller.WhitePages.notifyIn(), and frodo2.controller.WhitePages.WhitePages().

◆ msgTypes

ArrayList<MessageType> frodo2.controller.userIO.UserIO.msgTypes = new ArrayList <MessageType> ()
private

The list of messages types this listener wants to be notified of.

Referenced by getMsgTypes(), and UserIO().

◆ queue_lock

Object frodo2.controller.userIO.UserIO.queue_lock = new Object()
private

Lock for queue used for synchronization.

We cannot synchronize directly on queue because it can be null.

Referenced by setQueue().

◆ START_MSG

final MessageType frodo2.controller.userIO.UserIO.START_MSG = MessageType.SYSTEM.newChild("UserIO", "StartE")
static

◆ USER_NOTIFICATION_MSG

final MessageType frodo2.controller.userIO.UserIO.USER_NOTIFICATION_MSG = MessageType.SYSTEM.newChild("UserIO", "User-Notification")
static

The documentation for this class was generated from the following file: