Package FAtiMA.Core.sensorEffector
Class Event
- java.lang.Object
-
- FAtiMA.Core.sensorEffector.Event
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class Event extends java.lang.Object implements java.lang.Cloneable, java.io.SerializableRepresents an external event that happened in the virtual world- Author:
- Joao Dias
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Event(java.lang.String subject)Creates a new EventEvent(java.lang.String subject, java.lang.String action, java.lang.String target)Creates a new EventEvent(java.lang.String subject, java.lang.String action, java.lang.String target, short type, short status)Creates a new eventEvent(java.lang.String subject, java.lang.String action, java.lang.String target, short type, short status, java.lang.Long time)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidAddParameter(Parameter param)Adds a Parameter to the event (usually arguments or parameters of the action)EventApplyPerspective(java.lang.String agentName)java.lang.Objectclone()Creates a new copy of the Eventbooleanequals(java.lang.Object obj)Compares the event against a given objectjava.util.ArrayList<Substitution>GenerateBindings()Generates a List of bindings that associate the Variables [Subject], [Action],[Target],[P1],[P2],...java.lang.StringGetAction()Gets the event's actionjava.util.ArrayList<Parameter>GetParameters()Gets the event's parameters (usually arguments or parameters of the action)shortGetStatus()Gets the event's status (activation, success, failure for goal and success, failure for action)java.lang.StringGetSubject()Gets the event's subject (Who performed the action)java.lang.StringGetTarget()Meiyii 07/01/10 Gets the event's target (what is the target of the event's action)longGetTime()Gets the event's timeshortGetType()Meiyii 07/01/10 Gets the event's type (whether goal or action)voidMakeGround(java.util.ArrayList<Substitution> substitutions)Applies a set of substitutions to the object, grounding it.static booleanMatchEvent(Event matchRule, Event eventPerception)Receives two events and sees if they match.static EventParseEvent(java.lang.String subject, java.lang.String action, java.lang.String target, java.lang.String parameters)Parses an eventEventRemovePerspective(java.lang.String agentName)voidSetAction(java.lang.String action)Sets the event's action (what happened)voidSetStatus(short status)Meiyii 07/01/10 Sets the event's status (activation, success, failure for goal and success, failure for action)voidSetSubject(java.lang.String subject)Sets the event's subject (who performed the action)voidSetTarget(java.lang.String target)Sets the event's target (what is the target of the event's action)voidSetType(short type)Meiyii 07/01/10 Sets the event's type (goal or action)NametoName()Converts the event to a NameNametoStepName()Converts the event into the equivalent of a step's namejava.lang.StringtoString()Converts the event to a String
-
-
-
Field Detail
-
_action
protected java.lang.String _action
-
_parameters
protected java.util.ArrayList<Parameter> _parameters
-
_subject
protected java.lang.String _subject
-
_target
protected java.lang.String _target
-
_time
protected long _time
-
_status
protected short _status
-
_type
protected short _type
-
-
Constructor Detail
-
Event
public Event(java.lang.String subject)
Creates a new Event- Parameters:
subject- - the subject of the event (who performed the action)
-
Event
public Event(java.lang.String subject, java.lang.String action, java.lang.String target)Creates a new Event- Parameters:
subject- - the subject of the event (who performed the action)action- - the action specified by the eventtarget- - the target of the action
-
Event
public Event(java.lang.String subject, java.lang.String action, java.lang.String target, short type, short status)Creates a new event- Parameters:
subject- - the subject of the event (who performed the action)action- - the action specified by the eventtarget- - the target of the actiontype- - the type of eventstatus- - the status of the goal/action
-
Event
public Event(java.lang.String subject, java.lang.String action, java.lang.String target, short type, short status, java.lang.Long time)
-
-
Method Detail
-
MatchEvent
public static boolean MatchEvent(Event matchRule, Event eventPerception)
Receives two events and sees if they match. Two events match if they refer to the same subject, action, target and parameters- Parameters:
matchRule- - left Event to be matchedeventPerception- - right Event to be matched- Returns:
- true if the events match, false otherwise
-
ApplyPerspective
public Event ApplyPerspective(java.lang.String agentName)
-
RemovePerspective
public Event RemovePerspective(java.lang.String agentName)
-
ParseEvent
public static Event ParseEvent(java.lang.String subject, java.lang.String action, java.lang.String target, java.lang.String parameters)
Parses an event- Parameters:
subject-action-target-parameters-- Returns:
- the parsed Event
-
AddParameter
public void AddParameter(Parameter param)
Adds a Parameter to the event (usually arguments or parameters of the action)- Parameters:
param- - the Parameter to add- See Also:
Parameter
-
GetAction
public java.lang.String GetAction()
Gets the event's action- Returns:
- the event's action
-
GetParameters
public java.util.ArrayList<Parameter> GetParameters()
Gets the event's parameters (usually arguments or parameters of the action)- Returns:
- an ArrayList with all the parameters
- See Also:
Parameter
-
GetSubject
public java.lang.String GetSubject()
Gets the event's subject (Who performed the action)- Returns:
- the event's subject
-
GetTarget
public java.lang.String GetTarget()
Meiyii 07/01/10 Gets the event's target (what is the target of the event's action)- Returns:
- the event's target
-
GetType
public short GetType()
Meiyii 07/01/10 Gets the event's type (whether goal or action)- Returns:
- the event's type
-
GetStatus
public short GetStatus()
Gets the event's status (activation, success, failure for goal and success, failure for action)- Returns:
- the event's status
-
GetTime
public long GetTime()
Gets the event's time- Returns:
- the event's time
-
SetAction
public void SetAction(java.lang.String action)
Sets the event's action (what happened)- Parameters:
action- - the action to store in the event
-
SetSubject
public void SetSubject(java.lang.String subject)
Sets the event's subject (who performed the action)- Parameters:
subject- - the subject to store in the event
-
SetStatus
public void SetStatus(short status)
Meiyii 07/01/10 Sets the event's status (activation, success, failure for goal and success, failure for action)- Parameters:
status- - the status of the event
-
SetType
public void SetType(short type)
Meiyii 07/01/10 Sets the event's type (goal or action)- Parameters:
type- - the type of the event
-
SetTarget
public void SetTarget(java.lang.String target)
Sets the event's target (what is the target of the event's action)- Parameters:
target- - the target to store in the event
-
equals
public boolean equals(java.lang.Object obj)
Compares the event against a given object- Overrides:
equalsin classjava.lang.Object- Returns:
- true if the received object equals the event, false otherwise
-
clone
public java.lang.Object clone()
Creates a new copy of the Event- Overrides:
clonein classjava.lang.Object- Returns:
- a new Event equal to the cloned Event
-
MakeGround
public void MakeGround(java.util.ArrayList<Substitution> substitutions)
Applies a set of substitutions to the object, grounding it. Only considers substitutions that start with [Subject],[Target], [Action],[P1],[P2], etc... Example: Applying the substitution "[Subject]/John" in the event, will replace the events subject with John Attention, this method modifies the original object.- Parameters:
substitutions- - A list of substitutions of the type "[Variable]/value"- See Also:
Substitution
-
GenerateBindings
public java.util.ArrayList<Substitution> GenerateBindings()
Generates a List of bindings that associate the Variables [Subject], [Action],[Target],[P1],[P2],... respectively to the event's subject, action, target and parameters- Returns:
- the mentioned list of substitutions
-
toStepName
public Name toStepName()
Converts the event into the equivalent of a step's name- Returns:
- a Name that corresponds to a Step's description
-
toString
public java.lang.String toString()
Converts the event to a String- Overrides:
toStringin classjava.lang.Object- Returns:
- the converted String
-
-