Re: Finding nearest location, calculating distance - best way to store and sort info?
"Matt Kime" <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <[email protected]> |
I know I'm really showing my java ignorance here but...
can this be done within an object or an an object function? a quick
trial seems to indicate that it can't be. as i think about it though,
i guess its fine that it isn't.
many thanks,
matt
> Well, that's what caching/memoization is for. Rather than sort the
> items directly, for example,
> you could put them into a simple Object
> private class SortableAddress {
> Address address;
> float distanceFromCentroid = -1;
> }
> then calculate and save the distance into that extra field.