Logtalk 2.30.1 files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1903 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
@@ -1,38 +1,47 @@
|
||||
|
||||
:- object(database).
|
||||
|
||||
:- public(db_test_this/0, db_test_self/0, db_test_obj/0).
|
||||
:- info([
|
||||
version is 2.0,
|
||||
author is 'Paulo Moura',
|
||||
date is 2007/04/17,
|
||||
comment is 'Dynamic database benchmark utility predicates.']).
|
||||
|
||||
:- private(pred_this/0, pred_self/0, pred_obj/0).
|
||||
:- dynamic(pred_this/0, pred_self/0, pred_obj/0).
|
||||
:- public(this_dyndb/1).
|
||||
:- mode(this_dyndb(+nonvar), one).
|
||||
:- info(this_dyndb/1, [
|
||||
comment is 'Asserts and retracts a predicate in "this".',
|
||||
argnames is ['Term']]).
|
||||
|
||||
db_test_this :-
|
||||
{repeat(100)},
|
||||
assertz(pred_this),
|
||||
fail.
|
||||
db_test_this :-
|
||||
retract(pred_this),
|
||||
fail.
|
||||
db_test_this.
|
||||
:- public(self_dyndb/1).
|
||||
:- mode(self_dyndb(+nonvar), one).
|
||||
:- info(self_dyndb/1, [
|
||||
comment is 'Asserts and retracts a predicate using ::/1.',
|
||||
argnames is ['Term']]).
|
||||
|
||||
db_test_self :-
|
||||
{repeat(100)},
|
||||
::assertz(pred_self),
|
||||
fail.
|
||||
db_test_self :-
|
||||
::retract(pred_self),
|
||||
fail.
|
||||
db_test_self.
|
||||
:- public(obj_dyndb/1).
|
||||
:- mode(obj_dyndb(+nonvar), one).
|
||||
:- info(obj_dyndb/1, [
|
||||
comment is 'Asserts and retracts a predicate using ::/2.',
|
||||
argnames is ['Term']]).
|
||||
|
||||
:- private([pred_this/1, pred_self/1, pred_obj/1]).
|
||||
:- dynamic([pred_this/1, pred_self/1, pred_obj/1]).
|
||||
|
||||
db_test_obj :-
|
||||
% direct calls to assertz/1 and retract/1:
|
||||
this_dyndb(N) :-
|
||||
assertz(pred_this(N)),
|
||||
retract(pred_this(N)).
|
||||
|
||||
% calls to assertz/1 and retract/1 using ::/1:
|
||||
self_dyndb(N) :-
|
||||
::assertz(pred_self(N)),
|
||||
::retract(pred_self(N)).
|
||||
|
||||
% calls to assertz/1 and retract/1 using ::/2:
|
||||
obj_dyndb(N) :-
|
||||
this(This),
|
||||
{repeat(100)},
|
||||
This::assertz(pred_obj),
|
||||
fail.
|
||||
db_test_obj :-
|
||||
this(This),
|
||||
This::retract(pred_obj),
|
||||
fail.
|
||||
db_test_obj.
|
||||
This::assertz(pred_obj(N)),
|
||||
This::retract(pred_obj(N)).
|
||||
|
||||
:- end_object.
|
||||
|
Reference in New Issue
Block a user