Package cmion.level3

Class MindAction


  • public class MindAction
    extends java.lang.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 java.lang.String name
      the name/identifier of the action
      protected java.util.List<java.lang.String> parameters
      the parameters of this action
      protected java.lang.String subject
      the name/identifier of the agent/ user who has performed this action
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected MindAction()
      protected constructor for subclasses to use
        MindAction​(java.lang.String subject, java.lang.String name, java.util.List<java.lang.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​(org.w3c.dom.Node domNode)
      create a mindAction from a DOM Node (used when parsing rules file)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      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​(java.lang.Object other)
      override equals to allow comparisons between 2 mind actions
      java.util.HashMap<java.lang.String,​java.lang.String> getMappings()
      returns the name, subject and parameters of this action in a map, indexed by "$subject" "$action" "$parameter1", "$parameter2", etc
      java.lang.String getName()
      returns the name/identifier of this action
      java.util.List<java.lang.String> getParameters()
      returns the parameters of this action
      java.lang.String getSubject()
      returns the name/identifier of the agent/ user who has performed this action
      int hashCode()
      define hash code for mind actions
      java.lang.String toString()
      returns a textual representation of this mind action
      • Methods inherited from class java.lang.Object

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

      • name

        protected java.lang.String name
        the name/identifier of the action
      • subject

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

        protected java.util.List<java.lang.String> parameters
        the parameters of this action
    • Constructor Detail

      • MindAction

        public MindAction​(java.lang.String subject,
                          java.lang.String name,
                          java.util.List<java.lang.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​(org.w3c.dom.Node domNode)
                   throws java.lang.Exception
        create a mindAction from a DOM Node (used when parsing rules file)
        Throws:
        java.lang.Exception
    • Method Detail

      • 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​(java.lang.Object other)
        override equals to allow comparisons between 2 mind actions
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

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

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

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

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

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