cz.cuni.amis.pogamut.episodic.schemas
Class SchemaCounter
java.lang.Object
cz.cuni.amis.pogamut.episodic.schemas.SchemaCounter
- All Implemented Interfaces:
- Serializable
public class SchemaCounter
- extends Object
- implements Serializable
SchemaCounter is a structure that counts how many times
were certain nodes and set of nodes executed. It is defined by the nodes
that contribude to the set. These can be either SchemaEpisodeNodes
or SlotContents. Each counter keeps the list of nodes it is
consisting of, its key that is used to index it in map of all schema counters
and its actual count number.
It is used to compute average episodes and the derivability of nodes from
other nodes of given episode.
- Author:
- Michal Cermak
- See Also:
SchemaBag,
Serialized Form
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SchemaCounter
public SchemaCounter(int _key,
Collection<SchemaEpisodeNode> _schemaNodes,
Collection<SlotContent> _contentNodes)
- Instantiate the counter by providing its key and sets of
SchemaEpisodeNodes and SlotContents
defining this counter.
- Parameters:
_key - Key that will index this counter in the map of all schema
counters. It is a sum of IDs of all schema nodes and slot
contents defining this counter _schemaNodes - Collection of SchemaEpisodeNodes
contributing to the set of nodes defining this counter. Can be empty
if this is single counter for a SlotContent._contentNodes - Collection of SlotContents
contributing to the set of nodes defining this counter. Can be empty
if this is single counter for a SchemaEpisodeNode.
increaseCount
public void increaseCount()
- Increases the actual count in this counter by one.
increaseTotalCount
public void increaseTotalCount()
- Increases the total count in this counter by one.
getCount
public int getCount()
- Getter method for the
count variable.
Difference between count and totalCount is
that if execution of some node has longer duration, its count is always
increased only once, but its total count is increased in each logic
iteration until the execution is finished.
- Returns:
- Returns actual count number of this counter. It says how
many times given nodes where executed together with the use of given objects.
getTotalCount
public int getTotalCount()
- Getter method for the
totalCount variable.
Difference between count and totalCount is
that if execution of some node has longer duration, its count is always
increased only once, but its total count is increased in each logic
iteration until the execution is finished.
- Returns:
- Returns actual total count number of this counter. It says how
many times given nodes where executed together with the use of given objects.
checkNodes
public boolean checkNodes(Collection<Integer> col)
- Because occasionally two counters can have identical key. It may be needed
to check if the retreived counter is actually the wanted one. This
method can be used to check if the IDs of nodes it is defined by, all
fall into the specified set of integers.
Actually nodes defining this counter has to be subset of col.
- Parameters:
col - Set of integers with IDs of nodes/contents defining this counter.
- Returns:
- Returns true if IDs of all the nodes and slot contents are
contained in the specified set. Returns false otherwise (if there is
at least one ID not in the specified set).
checkNode
public boolean checkNode(Integer i)
- Checks if the counter is co-defined by a specified node. Node can
be either schema episode node or slot content node.
- Parameters:
i - ID of a node that should be defining this counter.
- Returns:
- Returns true if specified node is co-defining this counter,
returns false otherwise.
checkNodes
public boolean checkNodes(Collection<SchemaEpisodeNode> sn,
Collection<SlotContent> cn)
- Because occasionally two counters can have identical key. It may be needed
to check if the retreived counter is actually the wanted one. This
method can be used to check if the counter is actually defined by
the specified sets of
SchemaEpisodeNodes and
SlotContents.
- Parameters:
sn - Set of SchemaEpisodeNodes defining this counter.cn - Set of SlotContents defining this counter.
- Returns:
- Returns true if the counter is actually defined by exactly
the specified sets of nodes and counters. Returns false otherwise.
getENodes
public Collection<SchemaEpisodeNode> getENodes()
getContentsNodes
public Collection<SlotContent> getContentsNodes()
Copyright © 2013 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.