/*********************************************************************/
/* */
/* AgentService Framework */
/* www.agentservice.it */
/* */
/* Copyright (C) 2007 l.i.d.o. - DIST, University of Genoa, Italy */
/* GNU Lesser General Public License */
/* */
/* This library is free software; you can redistribute it and/or */
/* modify it under the terms of the GNU Lesser General Public */
/* License as published by the Free Software Foundation, */
/* version 2.1 of the License. */
/* */
/* This library is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
/* Lesser General Public License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public */
/* License along with this library; if not, write to the */
/* Free Software Foundation, Inc., 59 Temple Place - Suite 330, */
/* Boston, MA 02111-1307, USA. */
/* */
/*********************************************************************/
using System;
using AgentService.Agent;
// this namespace contains the elements for the instantiation
// of new knowledges.
using AgentService.Agent.Knowledge;
// this namespac contains the elements for the instantiation
// of new behaviours.
using AgentService.Agent.Behaviour;
namespace AuctionDemo
{
///
/// Maintains information regarding the budget of each agent.
///
[Serializable]
public class Budget:Knowledge
{
///
/// Default constructor
///
public Budget():base(){}
///
/// Constructs an instance of the knwoledge
///
/// knowledge name
/// persistence mode
/// maximum price to spend
/// raising price
public Budget(string name, PersistenceMode pMode, float amount, float increment):base(name, pMode)
{
this.AddItem("Amount",typeof(float),amount);
this.AddItem("Increment",typeof(float),increment);
}
#region Getter e Setter
///
/// Getter for the amount property
///
/// Instance of the behaviour that requests the access.
/// the value of the property
[KnowledgeItem("Amount", typeof(float), true)]
public float GetAmount(Behaviour lockingBehaviour)
{
return (float) this["Amount",lockingBehaviour];
}
///
/// Setter for the Amount property.
///
/// Instance of the behaviour that requests the access.
/// the new value of the property
/// the new value
[KnowledgeItem("Amount", typeof(float), false)]
public float SetAmount(Behaviour lockingBehaviour, float value)
{
this["Amount",lockingBehaviour] = value;
return (float) this["Amount", lockingBehaviour];
}
///
/// Getter for the Increment property.
///
/// Instance of the behaviour that requests the access.
/// the value of the Increment property
[KnowledgeItem("Increment",typeof(float),true)]
public float GetIncrement(Behaviour lockingBehaviour)
{
return (float) this["Increment", lockingBehaviour];
}
///
/// Setter for the Increment property.
///
/// Instance of the behaviour that requests the access.
/// the new value of the property
/// the new value
[KnowledgeItem("Increment", typeof(float), false)]
public float SetIncrement(Behaviour lockingBehaviour, float value)
{
this["Increment", lockingBehaviour] = value;
return (float) this["Increment", lockingBehaviour];
}
#endregion
}
}