Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!gatech!newsxfer.itd.umich.edu!zip.eecs.umich.edu!umn.edu!vulcan.iss.bnr.com!news
From: kandimalla@ftw.bnr.com
Subject: Re: How do you get a list of all instance of a class?
Message-ID: <1994Dec14.222228.21877@vulcan.iss.bnr.com>
Lines: 44
Sender: news@vulcan.iss.bnr.com
Nntp-Posting-Host: e001119.iss.bnr.com
Reply-To: kandimalla@ftw.bnr.com
Organization: Burlington Northern Railroad
X-Newsreader: IBM NewsReader/2 v1.00
References: <Pine.3.89.9412120844.F29175-0100000@mercury.interpath.net>
Date: Wed, 14 Dec 1994 22:22:28 GMT

In <Pine.3.89.9412120844.F29175-0100000@mercury.interpath.net>, rayhorn@mercury.interpath.net (Smalltalker) writes:
>object-name allInstances inspect
>
>-Smalltalker
>
>---------- Forwarded message ----------
>Date: Fri, 9 Dec 1994 17:31:00 GMT
>From: Mr F Reiff <reiff@comp.lancs.ac.uk>
>Subject: How do you get a list of all instance of a class?
>
>Is there any way in smalltalk to get a list of all instances of a class, say
>ScheduledWindow, that are in existence in the system at that moment in time?
>Furthermore, I need to do this within a program, so I can't use inspectors on 
>'Smalltalk' or anything similar.
>
>Thanks in advance
>
>                                                                Frank
>----------------------------------------------------------------------------
>reiff@comp.lancs.ac.uk
>
>
>
>



use the method 'allInstances', which is understood by any class name.

For example, if you want to find out all instances of the class 
'ScheduledWindow' you would code :


        ScheduledWindow allInstances

The result of the above would be a colection of all instances of ScheduledWIndow.

hope that helps.

ram kandimalla





