All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jadex.bdi.examples.blackjack.manager.ManagerDealerRegisterPlan Maven / Gradle / Ivy

Go to download

The Jadex BDI applications package contain several example applications, benchmarks and testcases using BDI agents.

There is a newer version: 2.4
Show newest version
package jadex.bdi.examples.blackjack.manager;

import jadex.bdi.runtime.Plan;
import jadex.bridge.IComponentIdentifier;

/**
 *  Register at dealer, when dealer belief has changed.
 */
public class ManagerDealerRegisterPlan extends Plan
{
	/**
	 *  Execute a plan.
	 */
	public void body()
	{		
		final IComponentIdentifier dealerAID = (IComponentIdentifier)getBeliefbase().getBelief("localDealerAID").getFact();
//		final ManagerFrame	gui	= (ManagerFrame)getBeliefbase().getBelief("gui").getFact();
		getLogger().info("Dealer-AID has changed " + dealerAID);
		
		// new dealer found
		/*if (dealerAID != null)
		{
//			// Send register message to the dealer.
//			IMessageEvent	register	= createMessageEvent("dealer_register");
//			register.getParameterSet(SFipa.RECEIVERS).addValue(dealerAID);
//			getLogger().info("send registerAsTracker-Query to Dealer");
//			sendMessage(register);
			
			// AWTThread.
			EventQueue.invokeLater(new Runnable()
			{
				public void run()
				{
					gui.setDealerLabels(dealerAID.getName(), null);
				}
			});
		}
		else // no dealer found
		{
			getLogger().info("No dealer in beliefbase, reset GUILabel");

			// AWTThread.
			EventQueue.invokeLater(new Runnable()
			{
				public void run()
				{
					gui.resetDealerLabels();
					gui.setLocalDealerButtonMode(true);
				}
			});
		}*/
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy