Commit Graph

1951 Commits

Author SHA1 Message Date
mdb 05abb4dea4 Allow IntTuple to be serialized.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1903 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-09-13 00:41:04 +00:00
mdb 420b86f2db Type safety is a goodness.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1902 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-09-12 23:24:03 +00:00
ray bb500f938e Use varargs instead of having a few different overloaded versions of the
same methods. But then I went ahead and added String varargs versions,
otherwise any old code that passes a String[] would have to cast to
Object[] to avoid compiler warnings. (Because the args don't quite match,
the compiler is unsure whether you want your String[] to be the first Object
arg or whether the whole String[] should be cast to the Object[].)


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1901 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-09-11 22:15:46 +00:00
mdb 1b16a084bb Cache resolved resource bundles based on our path to avoid stepping on other
message managers.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1900 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-09-10 16:47:30 +00:00
ray b04e96dc27 Now (actually, a while back...) that the Object[] version of splice is
genericized, we don't need a separate version for String[].


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1899 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-09-06 00:02:37 +00:00
mdb 41b316229a Added insert() to complement append(), made append() use insert().
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1898 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-09-05 23:30:02 +00:00
mdb b1bbd5cef3 Was calling wrong method.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1897 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-09-05 21:57:04 +00:00
mdb 55910b495d Displaying an arbitrary value as currency in the caller's locale is almost
certainly *never* what you want. However, I don't know who's calling these
methods (and they are doing so through Velocity so I can't just recompile
everything to find out; yay for dynamic languages), so I won't remove them
outright. I did remove the dangerous methods from CurrencyUtil.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1896 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-09-05 21:24:11 +00:00
ray 56e58fa431 Genericized methods that benefit from it.
I originally had append have the signature:

    public static <T extends Object, E extends T> T[] append (
        T[] values, E value)

At first I thought I had done a good thing by ensuring that a subclass
element could be added, but then realized that E was pointless because
an E can be passed in for the T parameter anyway.

That got me thinking about generics and I found this:
http://weblogs.java.net/blog/arnold/archive/2005/06/generics_consid_1.html

Some of it made me laugh, and while I didn't read all the comments, I
spotted this gem:

[excerpt]
    The trouble with generics--and this has been known for many years--
    is what I'd like to call the Elvis/Einstein boundary. (Google for
    Mort/Elvis/Einstein if you wonder why the King enters the picture...)

    List<E>. solves a problem that Elvis had: What the !@#$ is in that
    collection?

    But before he knows it, he is at

    <T> int binarySearch(List<? extends Comparable<? super T>> list, T key). 

    That`s for Einstein, not Elvis.



git-svn-id: https://samskivert.googlecode.com/svn/trunk@1895 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-09-02 01:08:38 +00:00
ray 7cdbbd5fd7 Modified the behavior of truncate() that takes a third parameter:
the string is tested against maxLength, but is trimmed at a point
such that the result string will be maxLength after the addition of
the 'append' parameter.

I'm pretty sure nothing (around these parts) depended on the old behavior.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1894 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-09-01 01:00:12 +00:00
ray b053107fd8 A standard generic Predicate.
Sometimes we used the apache predicate, sometimes we rolled our own.
I'm rolling our own now because I want generic support.

Implementation details are subject to change, but two that we may want
to discuss sooner than later:

- I called the arbitration method "isMatch()", but almost went with
  "evaluate()" and considered "is()".
- I made Predicate an abstract class rather than an interface because I felt
  it was cool to be able to create filtered Iterators or views of collections
  using the Predicate.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1893 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-08-28 18:36:18 +00:00
ray 308f771857 Remove by reference as well.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1892 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-08-25 01:28:13 +00:00
ray 3351e80335 Implement indexOf and lastIndexOf using reference equality.
For observer lists, we do not care if two observers happen to
implement equals() such that they agree to be the same, we care 
only if they're the exact same observer.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1891 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-08-25 01:22:03 +00:00
mdb e00883856e Favor dynamic controller method dispatch with an unadulterated method name. We
used to prepend "handle" to an action and then look up the method (which we
still support) but now we also check for a method just named directly after the
action.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1890 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-08-24 18:20:27 +00:00
ray 6bb4640f0a This notation appears to be legal in jdk1.5.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1889 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-08-21 21:35:54 +00:00
ray d0cfcca2fa Don't do anything if there are no observers to notify.
Shrink our working array if it's much larger than it needs to be.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1888 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-08-21 21:31:44 +00:00
ray f2d299dc77 Allow unit names to be specified.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1887 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-08-14 18:05:54 +00:00
mdb 14de52cffb As Ray points out, there is danger in allowing any sort of iterating if we
automatically clear entries on get(). Since the point of this is to be a cache
and not to be iterable, we will simply remove all but the safe and necessary
functionality to keep people out of trouble.

Keep it simple! Put things it, get them out. Or not.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1886 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-08-11 01:24:10 +00:00
mdb cc1f0b34ab Implemented a map that maintains soft references to its values so that they may
be garbage collected. If you iterate over the keys, values or entries, you have
to cope with interleaved null values, doing the "right" thing there is a bit
PITA and iterating over the cache is wacky anyway because size() will most
likely never be right (unless we validated every entry in the cache at the time
you called size() which is also wacky).


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1885 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-08-10 23:05:45 +00:00
ray 4fcc4a60eb git-svn-id: https://samskivert.googlecode.com/svn/trunk@1884 6335cc39-0255-0410-8fd6-9bcaacd3b74c 2006-08-08 20:07:47 +00:00
mdb 652ad810f4 Catch any runtime exceptions also thrown by invokePersist().
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1883 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-28 01:31:28 +00:00
mdb 31546d18bd Two extensions of Invoker.Unit that encapsulate a pattern we frequently find
ourselves repeating.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1882 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-27 17:35:12 +00:00
andrzej cddcfa858e Added marshaller for longs.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1881 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-25 18:32:02 +00:00
ray 05054b0d09 Removed bogus line that was a result of a copy/paste error. Ancient!
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1880 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-25 17:49:55 +00:00
mdb 9b5972c1ec Work around Java's goddamned decision to make allocation and initialization
happen at the same time.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1879 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-22 02:07:46 +00:00
mdb 1a8da5bf2d Added append(float[],float).
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1878 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-21 18:52:05 +00:00
mdb 1805b5b9e3 Reuse a session table entry if a user already has one.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1877 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-14 03:33:27 +00:00
mdb b2d95a9541 Propagate the typely goodness.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1876 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-13 00:45:12 +00:00
ray 78a832b7f9 Added a convenience method to get the message of a Throwable, or the
class name if the message is null.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1875 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-12 23:56:00 +00:00
mdb fd7c4d98eb Type safety, formatting.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1874 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-12 23:22:52 +00:00
mdb 73365f4721 It's too hot today. I realize now that what was going on wasn't entirely stupid
as it caught the 0/0 case and freaked out in the >0/0 case. I'll just
sheepishly change this all back and go fix the fucking webapp that's passing
1/0.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1873 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-07 17:15:59 +00:00
mdb 0e38c639ae Third time's the charm.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1872 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-07 17:12:00 +00:00
mdb c3a736890e Ah, actually the documentation begged to differ. Well checking for a zero
numerator is stupid because the math just works, so we'll keep the new behavior
and change the documentation because I'm tired of seeing giant div0 exceptions
in the logs and the fix will no doubt to be to find those places and change
them to display zero if the denominator is zero which is exactly what we're
doing here anyway. It's the new math.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1871 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-07 17:11:45 +00:00
mdb 3e7523cf0c We surely mean to prevent div0 here.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1870 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-07 17:10:08 +00:00
ray ebfaf480f4 No, retroweaver won't catch this. Reverted to the 1.4-compatible constructor.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1869 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-05 19:50:05 +00:00
ray c2bce61bbe Use additional argument to identify the Timer thread. This is 1.5 only,
I'm not sure if retroweaver handles this.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1868 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-05 19:32:08 +00:00
mdb 52af596bf6 git-svn-id: https://samskivert.googlecode.com/svn/trunk@1867 6335cc39-0255-0410-8fd6-9bcaacd3b74c 2006-07-04 22:39:22 +00:00
mdb 436e588a53 Made Queue type safe.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1866 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-04 22:27:41 +00:00
mdb 348b3cd5ae Allow XHTML compliant <br/> and <hr/> as well.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1865 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-25 16:35:59 +00:00
mdb 6ca7f04ea5 Moved HTML restriction code into HTMLUtil and out of the overweight StringUtil.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1864 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-25 16:26:04 +00:00
mdb d50d4b8c69 Restored the URL processing.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1863 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-25 16:15:03 +00:00
mdb a9a3cdf220 Switch to a line oriented parsing.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1862 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-25 16:11:29 +00:00
mdb 3b8e79e300 We need the column name.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1861 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-17 21:36:57 +00:00
mdb b181ae231a Make sure we have the column or index before we drop it. Unwrapped a non-long
line.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1860 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-17 21:34:50 +00:00
ray 164c1ac40c Let's remove the deprecated methods so that we don't run into trouble
if retroweaver replaces StringBuilder with StringBuffer (resulting in
duplicate methods).


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1859 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-14 01:20:48 +00:00
mdb 20e50e1635 Added support for referencing other translation messages directly from a
translation message. So you can define something like:

m.coins = Doubloons
m.buy_coins = Purchase {m.coins}

and then later override m.coins and all instances of it will be properly
changed. Very useful for our rebranding efforts.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1858 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-13 22:40:23 +00:00
mdb 98de949beb Pass our site identifier to the message manager regardless of whether we're
using site bundles. The message manager will now allow a simpler form of
site-specific messaging wherein it prefixes the site string to the message
bundle and looks for that (assuming we're not using site bundles).


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1857 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-13 22:11:15 +00:00
ray ed2064ae81 Collection -> Iterable, in a few places.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1856 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-13 22:09:50 +00:00
ray ce7a0f1c9f s/StringBuffer/StringBuilder, where possible.
Deprecated versions of the methods in StringUtil will continue to take
a StringBuffer argument for now.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1855 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-13 21:58:37 +00:00
mdb 9d6c997d8a This is so useful we'll bump it up to samskivert.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1854 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-13 16:53:08 +00:00