Commit Graph

2922 Commits

Author SHA1 Message Date
samskivert e70d0f89e4 Reference the platform docs at their new location. All hail Larry.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2951 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-11-15 18:02:37 +00:00
ray.j.greenwell 515d5b306e Added a shuffle() that uses our internal random.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2950 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-11-14 23:43:49 +00:00
samskivert 31ba6df09f Let's make the directory we're going to write to.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2949 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-11-12 23:00:40 +00:00
samskivert 73506e6969 Hrm, Maven uses surefire-reports. Which is retarded. But we can use
test-reports which perhaps more recognizable to Maven users.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2948 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-11-12 22:57:18 +00:00
samskivert d10d454814 I think I like dist/test-output better, it fits more nicely with
dist/test-classes.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2947 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-11-12 22:55:22 +00:00
samskivert 8c4b9a0da2 Generate test output to dist/tests. Run tests before deploying to Maven.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2946 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-11-12 22:54:50 +00:00
samskivert fc17d99805 No unique version. Just the snapshot and file system timestamp are peachy.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2945 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-11-12 22:50:29 +00:00
samskivert 7ed1d113a6 Specify a default for the repository that can be overridden.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2944 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-11-12 22:47:08 +00:00
samskivert 63adf2d915 A target for deploying our artifacts to a local Maven repository.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2943 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-11-12 22:43:27 +00:00
samskivert a4e126e060 Don't need that echo any more.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2942 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-11-12 16:45:06 +00:00
samskivert 4e92f6c519 An ant target for generating Coreen metadata. This is a placeholder until I
make Coreen understand Maven projects, but this sort of setup will be always
necessary for projects that use a totally custom build.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2941 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-11-12 16:43:49 +00:00
ray.j.greenwell 7301369760 as(), casts the argument or returns null if it's not an instance of
the specified class.
Yeah.
I've had this laying around for a long time, almost embarrassed by it.
But I keep running into places where it'd be handy, and now I'm
going for it.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2940 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-11-09 00:53:26 +00:00
karma@deadmoose.com 019e5f9311 From Monsieur Thomas. The matcher gets cranky when presented with null.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2939 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-28 21:18:27 +00:00
charlie.groves 5b49bb17e0 Export our dependencies again.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2938 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-28 20:07:39 +00:00
samskivert e6230497a9 Nixed unused import.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2937 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-25 19:35:08 +00:00
samskivert f39b34bba1 Regeneratd with mvn eclipse:eclipse and then cleaned up.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2936 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-25 19:27:35 +00:00
samskivert c4b1ec055f [maven-release-plugin] prepare for next development iteration
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2930 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-22 19:31:28 +00:00
samskivert 7b5bfd488a [maven-release-plugin] prepare release samskivert-1.1
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2928 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-22 19:31:22 +00:00
samskivert a005c1769b Some .classpath updates. I need to figure out how to tell Eclipse to get this
information from the POM.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2927 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-22 05:59:54 +00:00
samskivert ef694f3060 Only GPG sign when we're actually deploying a release, not when we're doing a
local install.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2926 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-18 21:42:11 +00:00
samskivert 8e686f4bfe Maven 3 will no longer support RELEASE as a version, so we have to hardcode our
version numbers and then puzzle over why things don't work when we try to use
new plugin features and forget to check what version number said feature was
introduced into the plugin and be sure that we're using that version. Yay!


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2925 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-18 21:41:13 +00:00
samskivert 2726db602f Crazy experiment number two: obtain our dependencies using the Maven Ant task
so that we're 100% external dependency free no matter how you build us. This is
the path to righteousness that all of our libraries must eventually go down to
save us from the dependency frying pan and put us into the dependency fire.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2924 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-15 15:53:24 +00:00
samskivert bdf46ef4c7 No longer need to exclude these guys.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2923 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-15 15:51:16 +00:00
samskivert f8f8057d4f These are now named jjtGetChild instead of getChild, because the former is
clearly more awesome. This is about to precipitate an upgrade from a 10 year
old hacked version of Velocity to a zero year old hacked version of Velocity
which is not going to be pleasant, but is roundabout ten years overdue.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2922 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-15 15:50:53 +00:00
ray.j.greenwell 34f0042956 If we could build upon guava I could make a version of pick() that
took a Function for computing weight. That would be more useful to me, usually.
The Map version could be reimplemented fairly easily with that...


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2921 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-15 02:25:33 +00:00
ray.j.greenwell b77b1c72a6 Formatting.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2920 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-15 02:24:08 +00:00
ray.j.greenwell 57e629dfdb It should be obvious that this will NPE, but I've documented it for the others...
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2919 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-14 20:42:46 +00:00
ray.j.greenwell 003d8819ce Nix getWeighted() and rearrange the Map overload of pick().
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2918 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-13 19:48:05 +00:00
ray.j.greenwell 1f0d6a4a3c Avoid generating a random value for the first weighted entry.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2917 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-13 19:45:51 +00:00
ray.j.greenwell 3dadbe13b9 What was I thinking?: we can't just pick a random number once.
Unsmoke that crack.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2916 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-13 00:12:50 +00:00
ray.j.greenwell 5a8ee16ec5 Dealt with all the TODO's in getWeighted() but in a new override
of pick().
- Iterates once.
- Checks each weight for validity.
- Only generates one random number.

On that last point: huh! I don't think there's anything wrong
with what I've done, and passing a Map with all the values as 1 is
identical to calling the other form of pick on the keySet iterator.
So: maybe I can change the Iterator-based picking and plucking
to only use one random double, like this. In fact, it would make
those methods more optimal in another way: we could stop iteration
as soon as we see the Nth element, where N is (1 / random).

Deprecated getWeighted().
RFC.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2915 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-12 22:59:01 +00:00
ray.j.greenwell 880e785a8a Changed getWeighted() to accept a Map<T, ? extends Number>.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2914 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-12 20:26:02 +00:00
ray.j.greenwell 485e5e160d getNormal() from Mark Johnson.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2913 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-12 01:20:26 +00:00
ray.j.greenwell 4ac0865946 Some javadoc cleanup.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2912 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-06 16:32:02 +00:00
ray.j.greenwell 068aac8e27 A more localized application of @SuppressWarnings is desireable.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2911 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-04 17:13:31 +00:00
ray.j.greenwell 0f7fd4a914 Revert the meat of r2908.
Maybe mdb is using a newer compiler that is behaving correctly,
but my 1.6 freaks out without these.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2910 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-01 23:15:03 +00:00
ray.j.greenwell f49e205f68 Make this inner class protected, as we're fans of that access level.
Use at your own risk!


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2909 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-01 23:08:03 +00:00
karma@deadmoose.com 12906728e5 That's already a T, so we don't need to cast it.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2908 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-01 22:44:46 +00:00
karma@deadmoose.com bf9fd231e0 Flag @Overrides & suppress warnings about those pad members.
I know it's changing code copy & pasted from elsewhere, but 
warnings aren't fun.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2907 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-01 22:43:46 +00:00
samskivert 808f05322f Actually, let's just pass the level index down to the logger implementation (as
Ray suggested). It's less code and skips the casts entirely.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2906 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-01 22:13:48 +00:00
samskivert b33c3fcbba We don't want to expose the type parameter just used to pass log level
constants up from the logger impl and back down, so we'll just use Object and
do the casting manually.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2905 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-01 22:10:14 +00:00
ray.j.greenwell 45b4cb516f Added @ReplaceBy annotation. (The wimpy man's @Deprecated)
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2904 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-01 00:23:51 +00:00
ray.j.greenwell c917825410 Provide access to Randoms that use a faster thread-local Random.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2903 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-10-01 00:14:39 +00:00
ray.j.greenwell e398039478 Javadoc and header.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2902 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-30 23:15:59 +00:00
ray.j.greenwell cfa7c9c79b A new replacement for RandomUtil.
- Instead of duplicating every method twice, once allowing you to specify
  your own Random object, there is a static thread-safe sharable instance
  that anyone can use, and a factory method to create your own instance
  with a supplied Random.

- The goofy methods for picking an element from a collection but skipping
  a particular value, or picking from an iterator but providing a count,
  are gone.

- Instead there are two methods: pick and pluck, for picking an element
  or picking and removing an element. For Iterator, only pick is available.
  Optimized code paths are provided for Lists and Collections, but the API
  is kept simple.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2901 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-30 22:12:56 +00:00
samskivert e88c687229 Import pruning.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2900 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-30 21:39:56 +00:00
samskivert 1f2a1396ee Ray points out that addAll() and putAll() were already added to CollectionUtil.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2899 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-30 21:39:31 +00:00
samskivert e8b633abaf Some tests, just for kicks.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2898 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-30 21:35:55 +00:00
samskivert 8f781ea4cf Oops, missed a spot.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2897 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-30 21:26:52 +00:00
samskivert 510d31b138 Let's go ahead and add general fold and reduce even though I've held off on
adding a function type to samskivert because everyone and their mother has a
function type. This is hopefully innocuous enough and allows you to obtain
generality at the expense of verbosity:

  Folds.foldLeft(new Folds.R<Integer>() {
    public Integer apply (Integer zero, Integer elem) {
      return Math.max(zero, elem);
    }
  }, 0, values);

  Folds.foldLeft(new Folds.R<String>() {
    public String apply (String zero, String elem) {
      return zero + elem;
    }
  }, "", strings);

Maybe by Java 8 or 9 we'll have closures and this can become:

  Folds.foldLeft((Integer b, Integer a) => Math.max(b, a))
  Folds.foldLeft((String b, String a) => b + a)

or maybe:

  Folds.foldLeft(#(Integer b, Integer a) { return Math.max(b, a); })
  Folds.foldLeft(#(String b, String a) { return b + a; })

who knows where the syntax bike shed arguments will end up. Of course, that'll
probably hit the shelves around 2015 or so at the rate Oracle seems to be
proceeding.

If you really want to get jiggy with the functional programming, you can check
out Functional Java, which goes the whole nine yards, but sort of ignores Java's
standard collections in the process which kind of sucks:

  http://functionaljava.org/


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2896 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-30 21:26:26 +00:00