Class Event

java.lang.Object
FAtiMA.Core.sensorEffector.Event
All Implemented Interfaces:
Serializable, Cloneable

public class Event extends Object implements Cloneable, Serializable
Represents an external event that happened in the virtual world
Author:
Joao Dias
See Also:
  • Field Details

    • _action

      protected String _action
    • _parameters

      protected ArrayList<Parameter> _parameters
    • _subject

      protected String _subject
    • _target

      protected String _target
    • _time

      protected long _time
    • _status

      protected short _status
    • _type

      protected short _type
  • Constructor Details

    • Event

      public Event(String subject)
      Creates a new Event
      Parameters:
      subject - - the subject of the event (who performed the action)
    • Event

      public Event(String subject, String action, String target)
      Creates a new Event
      Parameters:
      subject - - the subject of the event (who performed the action)
      action - - the action specified by the event
      target - - the target of the action
    • Event

      public Event(String subject, String action, 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 event
      target - - the target of the action
      type - - the type of event
      status - - the status of the goal/action
    • Event

      public Event(String subject, String action, String target, short type, short status, Long time)
  • Method Details

    • 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 matched
      eventPerception - - right Event to be matched
      Returns:
      true if the events match, false otherwise
    • ApplyPerspective

      public Event ApplyPerspective(String agentName)
    • RemovePerspective

      public Event RemovePerspective(String agentName)
    • ParseEvent

      public static Event ParseEvent(String subject, String action, String target, 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:
    • GetAction

      public String GetAction()
      Gets the event's action
      Returns:
      the event's action
    • GetParameters

      public ArrayList<Parameter> GetParameters()
      Gets the event's parameters (usually arguments or parameters of the action)
      Returns:
      an ArrayList with all the parameters
      See Also:
    • GetSubject

      public String GetSubject()
      Gets the event's subject (Who performed the action)
      Returns:
      the event's subject
    • GetTarget

      public 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(String action)
      Sets the event's action (what happened)
      Parameters:
      action - - the action to store in the event
    • SetSubject

      public void SetSubject(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(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(Object obj)
      Compares the event against a given object
      Overrides:
      equals in class Object
      Returns:
      true if the received object equals the event, false otherwise
    • clone

      public Object clone()
      Creates a new copy of the Event
      Overrides:
      clone in class Object
      Returns:
      a new Event equal to the cloned Event
    • MakeGround

      public void MakeGround(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:
    • GenerateBindings

      public 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
    • toName

      public Name toName()
      Converts the event to a Name
      Returns:
      the converted Name
      See Also:
    • 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 String toString()
      Converts the event to a String
      Overrides:
      toString in class Object
      Returns:
      the converted String