Package cmion.level3

Class MindAction

java.lang.Object
cmion.level3.MindAction

public class MindAction extends Object
the base class for mind actions, different minds (e.g. fatima) can implement different subclasses of this
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected String
    the name/identifier of the action
    protected List<String>
    the parameters of this action
    protected String
    the name/identifier of the agent/ user who has performed this action
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    protected constructor for subclasses to use
     
    MindAction(String subject, String name, List<String> parameters)
    create a new mind action with the specified name and parameters, if the action has no parameters, the second parameter of this constructor may be null
     
    MindAction(Node domNode)
    create a mindAction from a DOM Node (used when parsing rules file)
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    compareMatch(MindAction matchAction)
    compares whether this mindAction (part of a rule with "*" allowed as name or parameter) produces a match with the mind action that is passed to this function.
    boolean
    equals(Object other)
    override equals to allow comparisons between 2 mind actions
    returns the name, subject and parameters of this action in a map, indexed by "$subject" "$action" "$parameter1", "$parameter2", etc
    returns the name/identifier of this action
    returns the parameters of this action
    returns the name/identifier of the agent/ user who has performed this action
    int
    define hash code for mind actions
    returns a textual representation of this mind action

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • name

      protected String name
      the name/identifier of the action
    • subject

      protected String subject
      the name/identifier of the agent/ user who has performed this action
    • parameters

      protected List<String> parameters
      the parameters of this action
  • Constructor Details

    • MindAction

      public MindAction(String subject, String name, List<String> parameters)
      create a new mind action with the specified name and parameters, if the action has no parameters, the second parameter of this constructor may be null
    • MindAction

      protected MindAction()
      protected constructor for subclasses to use
    • MindAction

      public MindAction(Node domNode) throws Exception
      create a mindAction from a DOM Node (used when parsing rules file)
      Throws:
      Exception
  • Method Details

    • compareMatch

      public boolean compareMatch(MindAction matchAction)
      compares whether this mindAction (part of a rule with "*" allowed as name or parameter) produces a match with the mind action that is passed to this function. A match occurs, when all of the following 3 conditions are fulfilled: 1) the names are equal, or this.name == "*", 2.) both actions have the same number of parameters. 3) all parameters have either the same value or the value of the parameter in this is "*"
    • equals

      public boolean equals(Object other)
      override equals to allow comparisons between 2 mind actions
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      define hash code for mind actions
      Overrides:
      hashCode in class Object
    • getName

      public String getName()
      returns the name/identifier of this action
    • getSubject

      public String getSubject()
      returns the name/identifier of the agent/ user who has performed this action
    • getParameters

      public List<String> getParameters()
      returns the parameters of this action
    • getMappings

      public HashMap<String,String> getMappings()
      returns the name, subject and parameters of this action in a map, indexed by "$subject" "$action" "$parameter1", "$parameter2", etc
    • toString

      public String toString()
      returns a textual representation of this mind action
      Overrides:
      toString in class Object