From: Mark S. <ma...@Sc...> - 2007-03-01 02:42:51
|
Rodrigo Cunha wrote: > Mark, my implementation has some bug... it doesn't really work, but just > let me know if the API is ok to you. > > We can iron-out bugs latter, with Jimmy help perhaps :-) > > You can create a SimpleContext, witch holds a position, with: > > SimpleContext ctx = new SimpleContext(null); > //starts as an empty context > > or > > SimpleContext ctx = new SimpleContext(int size); > // starts with given nodes capacity, so reallocation can be minimized > during reuse > > and you can use the object to hold and retrieve positions with: > > navigator.setCtxFromNav(ctx); > //holds current position in this context object > > and > > navigator.setNavFromCtx(ctx); > //sets navigator pointers from this context object > > > The object itself has little storage requirements, only a small integer > array, so you can create thousands and still live happy. > > They are also reusable, to minimize garbage collection just in case your > algoritm wants to reuse them. > > Does this sound ok for you, Mark? I'm not sure. Jimmy and Tatu have the interesting idea about Map<String, int> and running an XPath from the int (node index). I like that! In my case, it would be Map<int, int> with both ints non-objects using fastutils. Do you think some thing as simple as this would be too simple for your use cases? Cheers. -- http://www.ScheduleWorld.com/ Free Google Calendar synchronization with Outlook, Evolution, cell phones, BlackBerry, PalmOS, Exchange, Mozilla, Thunderbird, Pocket PC/Windows Mobile. Also sync tasks, notes and contacts! WebDAV, vfreebusy, RSS, LDAP, iCalendar, iTIP, iMIP support. -- http://www.ScheduleWorld.com/ Free Google Calendar synchronization with Outlook, Evolution, cell phones, BlackBerry, PalmOS, Exchange, Mozilla, Thunderbird, Pocket PC/Windows Mobile. Also sync tasks, notes and contacts! WebDAV, vfreebusy, RSS, LDAP, iCalendar, iTIP, iMIP support. |