cz.cuni.amis.pogamut.episodic.schemas
Class SchemaEpisodeNode

Package class diagram package SchemaEpisodeNode
java.lang.Object
  extended by cz.cuni.amis.pogamut.episodic.schemas.SchemaEpisodeNode
All Implemented Interfaces:
Serializable

public class SchemaEpisodeNode
extends Object
implements Serializable

The class SchemaEpisodeNode is a mirror of Nodes from decision tree and EpisodeNodes from episode tree in the schemas. Each schema episode node is associated with exactly one node in decision trees, so for each node in episode trees it is possible to find its associated schema node. Same of their equivalents, schema episode nodes can have schema affordance slots attached to them.

Together with SlotContents (linkage between given object and a affordanceslot in schemas) they form a set that is indexing different schema counters. They keep list of references to counters they contribute to. This list can be quite long, but it always contains at least a single counter for current schema episode node.

Author:
Michal Cermak
See Also:
Serialized Form

Constructor Summary
SchemaEpisodeNode(Node _associatedNode, int _id, String _name)
          Instantiate the class by providing its name, reference to associated decision Node, and its unique ID.
 
Method Summary
 void addCount(int key, SchemaCounter count)
          Each SchemaEpisodeNode keeps the list of references to counters it is contributing to (it is contained in set of nodes defining the counter).
 boolean addSlot(String s, int id)
          This method attaches a new slot to this SchemaEpisodeNode.
 Node getAssociatedNode()
          Getter method for the name variable.
 Collection<SchemaEpisodeNode> getChildrenSchemaNodes()
           
 org.apache.commons.collections15.multimap.MultiHashMap<Integer,SchemaCounter> getCounts()
           
 int getId()
          Getter method for the name variable.
 String getName()
          Getter method for the name variable.
 SchemaEpisodeNode getParentSchemaNode()
           
 Integer getSingleCount()
          Returns actual count of this single schema episode node.
 SchemaSlot getSlot(String s)
          This method can be used to retrieve one specified slot attached to this node.
 Collection<SchemaSlot> getSlots()
          Basically a getter method for the slots variable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaEpisodeNode

public SchemaEpisodeNode(Node _associatedNode,
                         int _id,
                         String _name)
Instantiate the class by providing its name, reference to associated decision Node, and its unique ID.

Mutual association with associated node is created in constructor.

Parameters:
_associatedNode - Reference to associated Node.
_id - Unique ID of the new node.
_name - Name of the node.
Method Detail

getName

public String getName()
Getter method for the name variable.

Returns:
Returns the name of the intention, action or atomic action that is represented by this schema node. Same as the name of an associated node.

getId

public int getId()
Getter method for the name variable.

Returns:
Returns the ID of this node. Used as an ID of vertex representing this chronobag when visualizing Schemas.

getAssociatedNode

public Node getAssociatedNode()
Getter method for the name variable.

Returns:
Returns the reference to the associated decision node. It can be either action, intention (goal) or atomic action. Each schema nodes is associated with exactly one decision node.

addSlot

public boolean addSlot(String s,
                       int id)
This method attaches a new slot to this SchemaEpisodeNode. There should be no two slots of same type attached to one node, but since this should already hold for the associated node, it should never happen for the schema node either.

Parameters:
s - Type of the slot and class of item that satisfies it.
id - Unique ID used for visualizing purposes.
Returns:
Returns true if the new slot was attached to the node. Returns false if slot of specified type already existed under this node.

getSlot

public SchemaSlot getSlot(String s)
This method can be used to retrieve one specified slot attached to this node.

Parameters:
s - Type of the slot that is to be returned.
Returns:
Returns the SchemaSlot of specified type that was attached to this node. If no such slot exists returns null.

getSlots

public Collection<SchemaSlot> getSlots()
Basically a getter method for the slots variable.

Returns:
Returns a collection of all SchemaSlots attached to this node. Each slot is equivalent with exactly one affordance slot in decision tree. Through schema slots it is possible to find out how many times was each item used to satisfy the given slot.

addCount

public void addCount(int key,
                     SchemaCounter count)
Each SchemaEpisodeNode keeps the list of references to counters it is contributing to (it is contained in set of nodes defining the counter). So when a new counter is created, that is co-defined by this node, it need to be added to this list.

This method adds a speficied counter to this list under a specified key.

Parameters:
key - Index of the new SchemaCounter. It is the key of the counter minus the ID of current node.
count - Reference to the SchemaCounter that should be added to the list (actually a map) of counters.

getSingleCount

public Integer getSingleCount()
Returns actual count of this single schema episode node. Can be used to set count at creation for episode nodes.

Returns:
Returns an integer number representing current number of executions of this node.

getCounts

public org.apache.commons.collections15.multimap.MultiHashMap<Integer,SchemaCounter> getCounts()

getParentSchemaNode

public SchemaEpisodeNode getParentSchemaNode()

getChildrenSchemaNodes

public Collection<SchemaEpisodeNode> getChildrenSchemaNodes()


Copyright © 2013 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.