[gclist] Finalization and object orientation.
Mon, 31 Mar 1997 07:21:15 -0600
At 02:16 PM 3/28/97 -0800, you wrote:
> I am considering the following scheme. Objects have an int
> getFinalizerOrder() and a void setFinalizerOrder(int n) method.
> If you need a pre-finalized version of object X you use
> setFinalizerOrder(X->getFinalizerOrder() + 1);
>I'd recommend against setting an absolute order by using integers. As your example shows,
>you don't really care about the absolute order, but rather the relative order. In the
>past, I've used objects to represent dependencies. Dependencies are just arcs in a
> class Dependency : GraphArc...
>So, to denote that "this" depends on "X" and therefore must be finalized after it:
> Graph finalizerDependencies;
> finalizerDependenies.add( new Dependency( this, X ) );
>Coming up with a dependency order is now just a topological sort:
> Iterator i;
> i = finalizerDependencies.topoSort();
Great tell me about this method topoSort() does it detect cycles. Where
do I get source.
Charles Fiterman Geodesic Systems
414 North Orleans Suite 410 Phone 312 832 1221 x223
Chicago IL 60610-4418 FAX 312 832 1230
A computer language without garbage collection
is like a city without garbage collection.