JACK 5.4 Application Interface

aos.jack.jak.beliefset
Class OpenWorld

java.lang.Object
  extended byaos.jack.jak.util.Watchable
      extended byaos.jack.jak.beliefset.BeliefSet
          extended byaos.jack.jak.beliefset.OpenWorld
All Implemented Interfaces:
ObservableInt

public abstract class OpenWorld
extends BeliefSet

Base class for open-world relations. This kind of relation stores both true facts and false facts. Facts not stored are qualified as "unknown".


Constructor Summary
OpenWorld()
           
OpenWorld(aos.jack.jak.event.EventRecipient h)
           
 
Method Summary
protected  void __init()
           
 void addfact(Tuple t, BeliefState d)
          Callback invoked when a fact is asserted.
 void assertTuple(Tuple t, BeliefState d)
          Asserts a fact.
 void delfact(Tuple t, BeliefState d)
          Callback invoked when a fact is retracted.
 void endfact(Tuple t, BeliefState d, BeliefState newst)
          Callback invoked when a fact retraction changes the belief-set.
protected  void fixSizes()
           
 void moddb()
          Callback invoked when a fact assertion or retraction changes the belief-set.
 void modfact(Tuple newf, BeliefState d, Tuple oldtrue, Tuple oldfalse)
          Callback invoked when a fact assertion changes the belief-set.
 void newfact(Tuple t, BeliefState d, BeliefState prevst)
          Callback invoked when a fact assertion changes the belief-set.
 int nFacts()
          Returns the number of facts stored in the relation.
 int read(aos.apib.InStream is)
          Method to read facts from an InStream.
 void reset()
          Reinitialize the beliefset to an empty state.
 void retractTuple(Tuple t, BeliefState d)
          Retracts a fact.
 int write(aos.apib.OutStream s)
          Method to write facts to an OutStream.
 
Methods inherited from class aos.jack.jak.beliefset.BeliefSet
dump, getArrSize, getHandler, getTuple, invokeAssertListener, invokeRetractListener, newArr, nIndexes, postEvent, read, read, registerOpListener, requireNextOpNotification, resetNextOpNotification, toString, write, write
 
Methods inherited from class aos.jack.jak.util.Watchable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OpenWorld

public OpenWorld()

OpenWorld

public OpenWorld(aos.jack.jak.event.EventRecipient h)
Method Detail

nFacts

public int nFacts()
Returns the number of facts stored in the relation. This is the sum of true facts and false facts.

Specified by:
nFacts in class BeliefSet
Returns:
The number of facts.

addfact

public void addfact(Tuple t,
                    BeliefState d)
Callback invoked when a fact is asserted. Default implementation sets flags to false so it will not be called again


newfact

public void newfact(Tuple t,
                    BeliefState d,
                    BeliefState prevst)
Callback invoked when a fact assertion changes the belief-set. Default implementation sets flags to false so it will not be called again


endfact

public void endfact(Tuple t,
                    BeliefState d,
                    BeliefState newst)
Callback invoked when a fact retraction changes the belief-set. Default implementation sets flags to false so it will not be called again


delfact

public void delfact(Tuple t,
                    BeliefState d)
Callback invoked when a fact is retracted. Default implementation sets flags to false so it will not be called again


modfact

public void modfact(Tuple newf,
                    BeliefState d,
                    Tuple oldtrue,
                    Tuple oldfalse)
Callback invoked when a fact assertion changes the belief-set. Default implementation sets flags to false so it will not be called again


moddb

public void moddb()
Callback invoked when a fact assertion or retraction changes the belief-set. Default implementation sets flags to false so it will not be called again


__init

protected void __init()

reset

public void reset()
Reinitialize the beliefset to an empty state.


assertTuple

public void assertTuple(Tuple t,
                        BeliefState d)
Asserts a fact. Note that the JACK compiler automatically generates two add() methods to allow users to add facts to the beliefset. These are described in the user manual.

Specified by:
assertTuple in class BeliefSet

retractTuple

public void retractTuple(Tuple t,
                         BeliefState d)
Retracts a fact. Note that the JACK compiler automatically generates two remove() methods to allow users to remove facts from the belief-set. These are described in the JACK user manual.

Specified by:
retractTuple in class BeliefSet

fixSizes

protected void fixSizes()

read

public int read(aos.apib.InStream is)
Method to read facts from an InStream. The facts are read from a pair of JACOB object structures of the form:
    <TupleTable
        :tuples (
           ... // Individual tuples
        )
    >
  
The first TupleTable defines the true facts, and the second TupleTable defined the false facts. Individual tuple formats are derived from the actual tuples, and are generated by the JACK compiler.

Specified by:
read in class BeliefSet
Parameters:
is - The Jacob Stream to read from.
Returns:
an int indicating the success or failure of the reading.

write

public int write(aos.apib.OutStream s)
Method to write facts to an OutStream. The facts are written as a pair of JACOB object structures, so they can be read back with the read() method.

Specified by:
write in class BeliefSet
Parameters:
s - the OutStream to write to.
Returns:
An int indicating the success or failure of the writing.

JACK 5.4 Application Interface

Copyright (C) 1999-2008, Agent Oriented Software Pty. Ltd.

US Government Restricted Rights
The JACK Modules and relevant Software Material have been developed entirely at private expense and are accordingly provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of DFARS 252.227-7013 or subparagraph (c)(1) and (2) of the Commercial Computer Software Restricted Rights and 48 CFR 52.2270-19, as applicable.


Agent Oriented Software Pty. Ltd.     http://www.aosgrp.com
PO Box 639, Carlton South, Victoria 3053, Australia
Phone: +61 3 9349 5055, Fax: +61 3 9349 5088