public class PersistedAtomManager extends AtomManager
AtomManager
with a twist: this AtomManager will only return
RandomVariableAtoms
that were persisted in the Database
at instantiation.
All other types of Atoms are returned normally.
getAtom() is thread-safe.Modifier and Type | Class and Description |
---|---|
static class |
PersistedAtomManager.PersistedAccessException |
db, enableAccessExceptions
Constructor and Description |
---|
PersistedAtomManager(Database db) |
PersistedAtomManager(Database db,
boolean prebuiltCache) |
PersistedAtomManager(Database db,
boolean prebuiltCache,
InitialValue initialValueOnIllegalAccess)
Constructs a PersistedAtomManager with a built-in set of all the database's persisted RandomVariableAtoms.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addToPersistedCache(Set<RandomVariableAtom> atoms) |
void |
commitPersistedAtoms()
Commit all the atoms in this manager's persisted cache.
|
GroundAtom |
getAtom(Predicate predicate,
Constant... arguments)
Returns the GroundAtom for the given Predicate and GroundTerms.
|
int |
getPersistedCount() |
Iterable<RandomVariableAtom> |
getPersistedRVAtoms() |
void |
reportAccessException(RuntimeException ex,
GroundAtom offendingAtom)
Decide whether or not to throw an access exception.
|
enableAccessExceptions, executeGroundingQuery, executeQuery, getCachedRVACount, getDatabase, isClosed
public PersistedAtomManager(Database db)
public PersistedAtomManager(Database db, boolean prebuiltCache)
public PersistedAtomManager(Database db, boolean prebuiltCache, InitialValue initialValueOnIllegalAccess)
prebuiltCache
- the database already has a populated atom cache, no need to build it again.initialValueOnIllegalAccess
- the initial value to give an atom accessed illegally.public GroundAtom getAtom(Predicate predicate, Constant... arguments)
AtomManager
ReadableDatabase.getAtom(Predicate, Constant...)
to actually retrieve the GroundAtom.getAtom
in class AtomManager
predicate
- the Predicate of the Atomarguments
- the GroundTerms of the Atompublic void commitPersistedAtoms()
public int getPersistedCount()
public Iterable<RandomVariableAtom> getPersistedRVAtoms()
protected void addToPersistedCache(Set<RandomVariableAtom> atoms)
public void reportAccessException(RuntimeException ex, GroundAtom offendingAtom)
AtomManager
reportAccessException
in class AtomManager
Copyright © 2020 University of California, Santa Cruz. All rights reserved.