/*********************************************************************/
/* */
/* 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 System.Runtime.Serialization;
using AgentService.Platform.AMS;
using AgentService.Ontology.Interfaces;
using AgentService.Ontology.Schema.Abstract;
namespace AgentService.Ontology.SL0
{
///
/// This class implements the actioncode>operator of the FIPA SL0 action.
///
[Serializable()]
public class Action : AgentService.Ontology.Interfaces.AgentAction
{
private AgentService.Platform.AMS.AID actor;
private Concept act;
///
/// Constructs an action operator.
///
public Action()
{
actor = null;
act = null;
}
///
/// Constructs an action operator with a given AID and concept.
///
/// The AID.
/// The concept.
public Action(AID id, Concept a)
{
this.act=a;
this.actor=id;
}
///
/// The AID of the actor.
///
public AID Actor
{
set
{
this.actor=value;
}
get
{
return this.actor;
}
}
///
/// The concept action.
///
public Concept Act
{
set
{
this.act=value;
}
get
{
return this.act;
}
}
///
/// Sets attributes of an abstract object (casted as a AbsAgentAction).
///
/// The abstract object
/// The reference ontology.
public void externalise(AbsObject abs, Ontology onto)
{
try
{
AbsAgentAction absAction = (AbsAgentAction) abs;
absAction.SetAttribute(BasicOntology.action_actor, (AbsTerm) onto.FromObject(this.Actor));
absAction.SetAttribute(BasicOntology.action_action, (AbsTerm) onto.FromObject(this.Act));
}
catch
{
throw new OntologyException("Error externalising Action");
}
}
}
}