Commit Graph

47 Commits

Author SHA1 Message Date
Ray Greenwell fc91faf25f Standardized what we do in cases where a CloneNotSupportedException occurs
where we don't think it ever will.
Instead of returning null, or the exception, always throw a runtime
with just the CloneNotSupportedException as the argument, as this will
contain the most information and will preserve the stack trace.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4264 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-07-13 18:07:27 +00:00
Michael Bayne 8afd0316ec I decided to go hog wild and clean up all the type use in Presents which
required some serious bending and folding of the generic type system, but for
the most part we managed to avoid any mutilating. The gendobj task now
generates properly typed "addToXXX" and "updateXXX" DSet methods based on the
parameterized type of the DSet. This might cause unrecompiled code to break,
but I don't think there are many cases in the base toolkit where people call
DSet adders or updaters. We'll see and I'll add backwards compatibility
versions for cases where we need them to support GG games (everything else we
can just recompile).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4245 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-07-05 00:55:05 +00:00
Michael Bayne c0a244cb8d Hold onto your hats kids, it's the biggest little refactor this side of the
Pecos. I'll sort out the per-project niggling bits in just a moment.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4209 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-06-23 18:12:45 +00:00
Michael Bayne 2f3ecdf86d Some backwards compatibility bits.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4207 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-06-21 08:40:20 +00:00
Ray Greenwell 79c6427c21 StringBuffer -> StringBuilder.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4191 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-06-13 22:42:20 +00:00
Michael Bayne 331c3b285f A whole monkey load of type-safety and the addition of typedClone() which
returns a properly typed clone of the DSet in question.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4164 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-05-31 04:14:42 +00:00
Ray Greenwell 481722188d Removed some unneeded casts now that the _entries array
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4064 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-04-26 21:32:09 +00:00
Michael Bayne 0e27af2af4 Because we defined DSet as parameterized on <E extends DSet.Entry> it rewrites
all generic references to E as DSet.Entry rather than Object which is what I
was assuming. So when I write:

(E[])new Object[...]

that gets rewritten to:

(Entry[])new Object[...]

which causes le freakout. We need to use Entry[] everywhere, which we happened
to be doing for everything except toArray().

I rewrote things to use E[] everywhere now that I know it will get rewritten to
Entry[]. I thought it was going to get rewritten to Object[] before so I didn't
genericize that stuff.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4059 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-04-26 02:13:10 +00:00
Michael Bayne 918d38a3b1 Implement Iterable. Whee!
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4054 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-04-25 02:07:32 +00:00
Michael Bayne a4c7ecb5e3 Made DSet (sort of) type safe. To be really really typesafe DSet.Entry would
have to be parameterized on the type of the Comparable that is returned by
getKey(), but that turns out to be a twisty maze of generics that is not
obvious to me how to express using Java's generics syntax and it opens up
various cans of worms that I don't have time to solve right now. So we'll
settle for the DSet itself being parameterized on the Entry class and the Entry
class being non-type safe.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4051 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-04-24 22:02:48 +00:00
Michael Bayne ad49401543 Proguard fucks up if we use clone(). There's no apparent way to find out why it
magically booches and causes an IncompatibleClassChangeError, so we're just
going to work around it.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4008 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-04-10 20:16:44 +00:00
Ray Greenwell 333d476a4a Use array cloning rather than creating a new one and copying into it.
(It may be the same thing under the hood, but our pal Occam would approve.)


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3958 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-03-17 22:29:00 +00:00
Ray Greenwell 7336f11d6f Shrink capacity in DSets upon element removal if the capacity is 8x larger
than it needs to be.
Broke streaming compatibility in order to be much more efficient over the wire.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3938 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-03-11 02:43:32 +00:00
Ray Greenwell 16322b1422 Added some warnings for illegal DSet operations and added a small
optimization in the process.
Previously, we dumped stack on the server if a entry add was illegal but
did nothing for update/remove.
On the client, we complained for updates and (indirectly) adds, but not
removes.
Now we complain everywhere.
And- as an added bonus, on the server we now do only one binary search for
updates and removals. Whee!


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3528 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-04-29 02:30:23 +00:00
Ray Greenwell 12b267dbae One day we hope to implement Iterable, let's implement the standard
'iterator()' name and deprecate the old 'entries()' method.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3405 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-03-15 01:40:22 +00:00
Michael Bayne a9720fd905 LGPLed the library. Hello world.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3099 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-08-27 02:21:06 +00:00
Michael Bayne 10ceff36d2 Log up a warning in these trying circumstances so that future bugs don't
remain obscure.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2708 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-07-13 02:59:27 +00:00
Michael Bayne d37c56b077 Added more substantial funny business checks.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2701 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-07-11 01:49:52 +00:00
Ray Greenwell 71cd8b421a - Use the newer binary search method of locating entries in get().
- Require a Comparable key in get() and containsKey().


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2698 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-07-11 01:21:23 +00:00
Michael Bayne 1b29c23f6e Check and fail if a DSet is modified while we are iterating over it.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2380 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-04-05 20:30:44 +00:00
Ray Greenwell a8ca78bde2 toArray now returns Object[] instead of Object
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2327 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-03-26 00:16:03 +00:00
Michael Bayne 7b97f872c8 Allow initialization from an array of entries.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2285 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-02-18 19:50:34 +00:00
Michael Bayne 48823b10f9 More revamped serialization cleanup.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2079 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-12-20 23:41:27 +00:00
Michael Bayne ee9049fe3e Factored out code for events that all shared a name; removed
hand-serialization code for fields which are now handled automatically.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2078 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-12-20 23:29:04 +00:00
Michael Bayne 90b76f1417 Added a toArray() method.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2065 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-12-13 02:07:27 +00:00
Michael Bayne 14a313486b Documentation repairs.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1842 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-10-27 18:49:51 +00:00
Ray Greenwell be2bc4205b Anally removed Comparator.equals() implementations that overrode
Object.equals() with equivalent functionality.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1799 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-10-15 21:01:39 +00:00
Michael Bayne 893e3d3aa0 Whoops, clone should obtain the uninitialized cloned object via
super.clone() so that it is of the appropriate derived class. I must have
picked a bad week to stop sniffing glue.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1781 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-10-06 20:24:53 +00:00
Michael Bayne 165843ac96 Fixed calculation error.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1643 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-08-14 23:52:15 +00:00
Michael Bayne e54a4d41f4 The great invocation services rethink of 2002! Rearchitected the remote
method invocation services and converted everything to the new style.
Could this be my biggest checkin ever?


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1642 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-08-14 19:08:01 +00:00
Michael Bayne c3191b9170 Brought code into line with the new streaming world order.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1606 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-07-23 05:52:49 +00:00
Michael Bayne 7ccb9594b9 Changed DSet.Element to DSet.Entry in preparation for the addition of
array element update support. (Arrays have elements, sets have entries.)


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1133 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-03-18 23:21:26 +00:00
Michael Bayne 1e36cb65d8 Need to prefix heterogenous set elements with their classname.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@964 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-02-08 05:14:22 +00:00
Michael Bayne b4d5f7da24 Have to cope with heterogenous sets in toString().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@963 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-02-08 04:44:32 +00:00
Michael Bayne 5bb4e3435b Provided a mechanism by which a DSet can be populated at construct time.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@927 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-02-04 01:34:59 +00:00
Michael Bayne 25717d3cce Modified distributed sets such that they can be heterogenous or
homogenous, and in the latter case, they simply conserve network bandwidth
by not transmitting the classname of serialized elements when transmitting
themselves or element added/updated events.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@925 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-02-04 00:50:12 +00:00
Michael Bayne dec8be5d57 Added size(), fixed two bugs in internal array expansion: one was that it
was doubling the size of the internal array every time add() was called,
whether it needed to or not, the other was that unserializing an empty set
caused expand() to be called with -1 as the index from which mayhem would
ensue.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@463 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-10-16 16:43:20 +00:00
Michael Bayne 0b44521984 Implement clone().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@456 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-10-12 20:11:00 +00:00
Michael Bayne 8521994204 DSet needs to implement Streamable so that we can pass it around as a
distributed value.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@442 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-10-12 00:29:34 +00:00
Michael Bayne 8a4c46badc The first great Three Rings renaming. Cocktail changed to Narya, Cher
changed to Presents and Party changed to Crowd. Whee!


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@431 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-10-11 04:07:54 +00:00
Michael Bayne 6620936a04 We've always been at war with Eurasia. Changed InvocationManager to
InvocationDirector (please god let the renaming be done). Removed IntMap
and modified code to use samskivert's HashIntMap.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@375 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-10-02 02:08:16 +00:00
Michael Bayne 70eb9480d8 Made element iteration work properly.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@291 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-08-21 19:35:56 +00:00
Michael Bayne dac504c7bb Provide support for iterating over a DSet.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@283 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-08-21 00:58:26 +00:00
Michael Bayne b7b78e9f79 Wired up marshalling for DSet objects.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@277 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-08-20 21:44:10 +00:00
Michael Bayne eac3e9aa94 Edits.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@268 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-08-16 04:22:50 +00:00
Michael Bayne 890bad996e Added ability to update elements in a set.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@266 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-08-16 03:45:43 +00:00
Michael Bayne 55c4847a17 Added support for distributed sets: unordered collections of elements
where the elements are user defined objects that know how to read and
write themselves on a stream. Sets are required to contain elements all of
the same type to make network traffic more efficient (avoid sending the
classname every time an element is added or removed).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@264 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-08-16 03:31:09 +00:00