[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Query/Inquisitor/Estimator toy code




Jeff;

Henrik and I just had a short talk about the subject line interfaces.

As part of the discussion, I  wrote the following toy code to illustrate a
point. I'm passing it along so that we are all using the same vocabulary
(I'm adding comments for the sake of this EMail.).

NB. This won't compile and has some inconsistencies in it... Please ignore
this.

- Craig

// accessor method for readonly attribute numEvents of query object
smqQuery :: numEvents() {
	return _my_inquisitor->numEvents();
}

// accessor method for read-writable attribute numEvents of inquisitor object
smqInquisitor :: numEvents() {
	if (_my_numEvents){
		return _my_numEvents;
	}
	else {
		return _my_numEvents = _my_estimator->getNumEvents(this);
	}
}

// estimator method for returning and/or calculating numEvents
smEstimator :: getNumEvents(smqInquisitor i) {
	if( virginQuery(i) ){
		n = calculateNumEvents(i->predicateClause());
	}
	else {
		n = calculatedNumEvents(i->token());
	}
	i->numEvents(n);
}

// mutator method for read-writable attribute numEvents of inquisitor object
smqInquisitor :: numEvents(long n) {
	_my_numEvents=n;
}









-----------------------------------------------------
 Craig E. Tull, Ph.D.
 National Energy Research Scientific Computing Center
 E.O. Lawrence Berkeley National Laboratory
 EMail: cetull@lbl.gov       WWW: iago.lbl.gov/~tull
 Phone: (510)486-7253        FAX: (510)486-4004