JACK 5.4 Application Interface

aos.jack.jak.beliefset
Class ClosedWorld

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

public abstract class ClosedWorld
extends BeliefSet

Base class for closed world relations. Closed World relations only store true facts. Anything not stored is assumed to be false.


Constructor Summary
ClosedWorld()
           
 
Method Summary
 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 database.
protected  void fixSizes()
           
 void moddb()
          Callback invoked when a fact assertion or retraction changes the database.
 void modfact(Tuple newf, BeliefState d, Tuple oldtrue, Tuple oldfalse)
          Callback invoked when a fact assertion changes the database.
 void newfact(Tuple t, BeliefState d, BeliefState prevst)
          Callback invoked when a fact assertion changes the database.
 int nFacts()
          Returns the number of positive facts stored.
 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

ClosedWorld

public ClosedWorld()
Method Detail

nFacts

public int nFacts()
Returns the number of positive facts stored.

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.


newfact

public void newfact(Tuple t,
                    BeliefState d,
                    BeliefState prevst)
Callback invoked when a fact assertion changes the database.


endfact

public void endfact(Tuple t,
                    BeliefState d,
                    BeliefState newst)
Callback invoked when a fact retraction changes the database.


delfact

public void delfact(Tuple t,
                    BeliefState d)
Callback invoked when a fact is retracted.


modfact

public void modfact(Tuple newf,
                    BeliefState d,
                    Tuple oldtrue,
                    Tuple oldfalse)
Callback invoked when a fact assertion changes the database.


moddb

public void moddb()
Callback invoked when a fact assertion or retraction changes the database.


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. 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. These are described in the 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 JACOB object structure in the form:
    <TupleTable
        :tuples (
             ... // individual tuples
        )
     >
 
Individual tuple formats are derived from the actual tuples, and are generated by the JACK compiler. NOTE: This does not go throughb assertTuple. This has 2 major affects + no user notification occurs (Possibly ok) + no key constraint management occurs (BUG) which can result in an inconsistent state

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 JACOB object structure, so it 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