org.cougaar.pizza.plugin
Class PizzaPreferences

java.lang.Object
  extended byorg.cougaar.pizza.plugin.PizzaPreferences
All Implemented Interfaces:
HistoryServletFriendly, java.io.Serializable, org.cougaar.core.util.UniqueObject

public class PizzaPreferences
extends java.lang.Object
implements org.cougaar.core.util.UniqueObject, HistoryServletFriendly

Local accumulation of replies to invite, marking who has replied and the kinds of pizza they want. Automatically updated by the RSVPRelaySource. Published by the InvitePlugin so that the PlaceOrderPlugin knows to start.

This class works as an example of publishing a custom object on the Blackboard. Note that it implements UniqueObject (which extends Serializable) for easy identification and retrieval on the Blackboard, and so it can be sent in messages.

See Also:
InvitePlugin, PlaceOrderPlugin, Serialized Form

Constructor Summary
PizzaPreferences(org.cougaar.core.util.UID uid)
           
 
Method Summary
 void addFriendToPizza(java.lang.String friend, java.lang.String preference)
          The given friend has replied, requesting the given pizza, so store their response.
 java.lang.String getFriendNames()
           
 java.util.Set getFriends()
           
 java.lang.String getFriendToPreference()
           
 int getNumMeat()
           
 int getNumVeg()
           
 java.lang.String getPreferenceForFriend(java.lang.String friend)
          What kind of pizza does the given friend want?
 java.lang.String getPreferenceValues()
           
 org.cougaar.core.util.UID getUID()
           
 void setUID(org.cougaar.core.util.UID uid)
           
 java.lang.String toHTML(int type)
          Print an HTML-friendly description of the object, for use in the HistoryServlet.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PizzaPreferences

public PizzaPreferences(org.cougaar.core.util.UID uid)
Method Detail

getUID

public org.cougaar.core.util.UID getUID()
Specified by:
getUID in interface org.cougaar.core.util.UniqueObject

setUID

public void setUID(org.cougaar.core.util.UID uid)
Specified by:
setUID in interface org.cougaar.core.util.UniqueObject

addFriendToPizza

public void addFriendToPizza(java.lang.String friend,
                             java.lang.String preference)
The given friend has replied, requesting the given pizza, so store their response.

Parameters:
friend - The agent name responding
preference - The kind of meat they like (using a pizza Constant)

getPreferenceForFriend

public java.lang.String getPreferenceForFriend(java.lang.String friend)
What kind of pizza does the given friend want?

Parameters:
friend - to look up
Returns:
kind of pizza they want

getFriends

public java.util.Set getFriends()

getFriendNames

public java.lang.String getFriendNames()
Returns:
printable list of the friends we have preferences for

getPreferenceValues

public java.lang.String getPreferenceValues()
Returns:
printable list of just the preferences collected

getFriendToPreference

public java.lang.String getFriendToPreference()
Returns:
printable list of the friend-to-preference mapping

getNumMeat

public int getNumMeat()
Returns:
Number of people wanting meat pizza

getNumVeg

public int getNumVeg()
Returns:
Number of orders for veggie pizza

toHTML

public java.lang.String toHTML(int type)
Print an HTML-friendly description of the object, for use in the HistoryServlet.

Specified by:
toHTML in interface HistoryServletFriendly
Parameters:
type - Not-used here, is the transaction type
Returns:
HTML text to display this object

toString

public java.lang.String toString()