|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectubiware.core.visualizer.BeliefTreeModel
public class BeliefTreeModel
Maps a belief to a tree like structure.
This is a tree structure whose nodes are complete subtrees. For more information, read SubtreesTreeModel.
A belief always has three children, with the following indexes:
0 : subject 1 : predicate 2 : object
Subject and Object can be either a string literal or a BeliefContainerTreeModel. A Predicate is always a string literal. A string
literal has 0 children.
String literals are now officially always instances of StringLiteralTreeModel or subclasses.
| Constructor Summary | |
|---|---|
BeliefTreeModel(javax.swing.tree.TreeModel root,
ReusableAtomicBehavior rabi,
SemanticStatement ss)
Initialises a new instance of BeliefTreeModel which will represent the semantic statement specified by the given semantic
statement. |
|
| Method Summary | |
|---|---|
void |
addTreeModelListener(javax.swing.event.TreeModelListener l)
This method has no effect in this implementation. |
java.lang.Object |
getChild(java.lang.Object parent,
int index)
If parent == this then it returns the semantic statement parts as follows: |
int |
getChildCount(java.lang.Object parent)
|
int |
getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
|
javax.swing.tree.TreeModel |
getObject()
Equivalent to getChild(this, 2). |
javax.swing.tree.TreeModel |
getPredicate()
Equivalent to getChild(this, 1). |
javax.swing.tree.TreeModel |
getRoot()
|
javax.swing.tree.TreeModel |
getSubject()
Equivalent to getChild(this, 0). |
boolean |
isLeaf(java.lang.Object node)
|
void |
removeTreeModelListener(javax.swing.event.TreeModelListener l)
This method has no effect in this implementation. |
java.lang.String |
toString()
Returns a simple textual representation of this semantic statement tree model representation which consists of the subject's, predicate's and object's textual representations ( toString()), separated by a space character. |
void |
valueForPathChanged(javax.swing.tree.TreePath path,
java.lang.Object newValue)
This method has no effect in this implementation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public BeliefTreeModel(javax.swing.tree.TreeModel root,
ReusableAtomicBehavior rabi,
SemanticStatement ss)
Initialises a new instance of BeliefTreeModel which will represent the semantic statement specified by the given semantic
statement.
The given ReusableAtomicBehavior, rabi, is used in order to acquire all beliefs in the belief contexts found as
subject, predicate or object of this semantic statement. rabi is never used again, throughout the whole life cycle of this
object. It is not even stored in a field.
This model will create a whole tree-like substructure of the Agent's beliefs (as acquired by rabi). The children of this
model will be either BeliefContainerTreeModels or string literals, created according to the actual beliefs found in
ss's SemanticStatement.subject and SemanticStatement.object. SemanticStatement.predicate is expected
always to be a string literal. The locally re-created structure of beliefs is used whenever queries are made to this model. The
Agent's actual belief storage is never re-read.
root is the actual root element of this model. This could be any TreeModel which might
cooperate with this one. If root is null then the root of the tree is believed to be this! and this
belief is being passed accordingly to the children TreeModels created as the result of this model's
initialisation.
root - the actual root of the whole tree (if null then root = this)rabi - a RAB to be used for accessing the Agent's beliefsss - the semantic statement to be represented by this model| Method Detail |
|---|
public javax.swing.tree.TreeModel getRoot()
getRoot in interface javax.swing.tree.TreeModel
public java.lang.Object getChild(java.lang.Object parent,
int index)
If parent == this then it returns the semantic statement parts as follows:
Otherwise it calls TreeModel.getChild(java.lang.Object, int) for parent, after casting it to a
TreeModel.
getChild in interface javax.swing.tree.TreeModelparent - the parent of the childindex - the index of the child (0, 1, 2)
public int getChildCount(java.lang.Object parent)
getChildCount in interface javax.swing.tree.TreeModelpublic boolean isLeaf(java.lang.Object node)
isLeaf in interface javax.swing.tree.TreeModel
public void valueForPathChanged(javax.swing.tree.TreePath path,
java.lang.Object newValue)
This method has no effect in this implementation.
valueForPathChanged in interface javax.swing.tree.TreeModelpath - ignorednewValue - ignored
public int getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
getIndexOfChild in interface javax.swing.tree.TreeModelpublic void addTreeModelListener(javax.swing.event.TreeModelListener l)
This method has no effect in this implementation.
addTreeModelListener in interface javax.swing.tree.TreeModell - ignoredpublic void removeTreeModelListener(javax.swing.event.TreeModelListener l)
This method has no effect in this implementation.
removeTreeModelListener in interface javax.swing.tree.TreeModell - ignoredpublic javax.swing.tree.TreeModel getSubject()
Equivalent to getChild(this, 0).
public javax.swing.tree.TreeModel getPredicate()
Equivalent to getChild(this, 1).
public javax.swing.tree.TreeModel getObject()
Equivalent to getChild(this, 2).
public java.lang.String toString()
Returns a simple textual representation of this semantic statement tree model representation which consists of the subject's,
predicate's and object's textual representations (toString()), separated by a space character.
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||