Package cmion.level3
Class MindAction
- java.lang.Object
-
- cmion.level3.MindAction
-
public class MindAction extends java.lang.Objectthe 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.Stringnamethe name/identifier of the actionprotected java.util.List<java.lang.String>parametersthe parameters of this actionprotected java.lang.Stringsubjectthe name/identifier of the agent/ user who has performed this action
-
Constructor Summary
Constructors Modifier Constructor Description protectedMindAction()protected constructor for subclasses to useMindAction(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 nullMindAction(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 booleancompareMatch(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.booleanequals(java.lang.Object other)override equals to allow comparisons between 2 mind actionsjava.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", etcjava.lang.StringgetName()returns the name/identifier of this actionjava.util.List<java.lang.String>getParameters()returns the parameters of this actionjava.lang.StringgetSubject()returns the name/identifier of the agent/ user who has performed this actioninthashCode()define hash code for mind actionsjava.lang.StringtoString()returns a textual representation of this mind 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.Exceptioncreate 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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
define hash code for mind actions- Overrides:
hashCodein classjava.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:
toStringin classjava.lang.Object
-
-