Thursday, March 09, 2006

Rolon subclasses, factory, creates

Rolons are interesting in that they only have (or should have) a final reference to the Ark instance and a final TKS record id. Further, Rolons are not cahced, but only created as needed. (Topics for example, caches only the record Ids.) So as a Rolon's type changes, we can simply reinstantiate it as the correct class.

Lets then have a Descriptor Entry (DEnt) which names the Rolon's type. We can then have a table (like cmds.txt and displays.txt) which maps the type to the appropriate subtype. Then we can implement a createRolon which instantiates the Rolon based on the Type DEnt.

Now for narrowing, we can have a static create method on each subtype which first calls the comon createRolon factory and then checks that the instance can be cast to that subtype. Then we can place the various accessor methods on the appropriate subclass, and similarly distribute the logic for handling descriptor data.

That just might work.

Bill

0 Comments:

Post a Comment

<< Home