Class KnowledgeSlot
- java.lang.Object
-
- FAtiMA.Core.memory.semanticMemory.KnowledgeSlot
-
- All Implemented Interfaces:
java.io.Serializable
public class KnowledgeSlot extends java.lang.Object implements java.io.SerializableClass used to store knowledge in the KnowledgeBase. A KnowledgeSlot can store an object, but also any number of children KnowledgeSlots. This hierarchical composition of KnowledgeSlots builds up the KnowledgeBase and allows fast indexing and search of properties.- Author:
- Joao Dias
- See Also:
KnowledgeBase, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description KnowledgeSlot(java.lang.String name)Creates an empty KnowledgeSpot, identified by the received name
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears all the information stored in the KnowledgeSlot (including all its children)booleancontainsKey(java.lang.String key)Determines if this KnowledgeSlot has a child with a specific keyintCountElements()Counts the number of valid elements (ones that have a value stored in them) stored within this KnowledgeSlot (may include children, grandchildren, grandgrandchildren, etc).KnowledgeSlotget(java.lang.String key)Gets the child KnowledgeSlot identified by the given keyjava.util.Iterator<java.lang.String>getKeyIterator()Gets an Iterator that iterates over the set of existing child Keysjava.util.Set<java.lang.String>getKeys()java.lang.StringgetName()Gets the KnowledgeSlot identifierjava.lang.ObjectgetValue()Gets the object stored in the KnowledgeSlotvoidput(java.lang.String key, KnowledgeSlot kSlot)Adds a KS child to the KnowledgeSlotvoidremove(java.lang.String key)Removes a child from the KnowledgeSlotvoidsetValue(java.lang.Object object)Sets the object stored in the KnowledgeSlotjava.lang.StringtoString()Converts the KnowledgeSlot to a Stringjava.lang.StringtoXML()
-
-
-
Method Detail
-
clear
public void clear()
Clears all the information stored in the KnowledgeSlot (including all its children)
-
containsKey
public boolean containsKey(java.lang.String key)
Determines if this KnowledgeSlot has a child with a specific key- Parameters:
key- - the key of the child to search- Returns:
- true if the KnowledgeSlot contains a child with the received key
-
get
public KnowledgeSlot get(java.lang.String key)
Gets the child KnowledgeSlot identified by the given key- Parameters:
key- - the key of the child to get- Returns:
- the child KnowledgeSlot
-
getKeys
public java.util.Set<java.lang.String> getKeys()
-
getKeyIterator
public java.util.Iterator<java.lang.String> getKeyIterator()
Gets an Iterator that iterates over the set of existing child Keys- Returns:
- the key Iterator
-
getName
public java.lang.String getName()
Gets the KnowledgeSlot identifier- Returns:
- the KnowledgeSlot ID
-
getValue
public java.lang.Object getValue()
Gets the object stored in the KnowledgeSlot- Returns:
- the object stored in the KS
-
CountElements
public int CountElements()
Counts the number of valid elements (ones that have a value stored in them) stored within this KnowledgeSlot (may include children, grandchildren, grandgrandchildren, etc).- Returns:
- the number of elements stored inside the KnowledgeSlot
-
put
public void put(java.lang.String key, KnowledgeSlot kSlot)Adds a KS child to the KnowledgeSlot- Parameters:
key- - the Key of the KnowledgeSlot to ADDkSlot- - the KnowledgeSlot to ADD
-
remove
public void remove(java.lang.String key)
Removes a child from the KnowledgeSlot- Parameters:
key- - the key of the child to remove
-
setValue
public void setValue(java.lang.Object object)
Sets the object stored in the KnowledgeSlot- Parameters:
object- - the new object to store in the KnowledgeSlot
-
toString
public java.lang.String toString()
Converts the KnowledgeSlot to a String- Overrides:
toStringin classjava.lang.Object- Returns:
- the converted String
-
toXML
public java.lang.String toXML()
-
-