Robo Home | SmartFactorTargeting | Changes | Preferences | AllPages

I've moved all this old chat into here for the moment. --Wolfman

Great! I love it when people try to come up with unorthodox ideas :-) Keep us posted! -- Vic

I believe I came up with an interesting (I can't say anything better) idea for a gun. But I would need a ready to use (and preferably as fast as possible) implementation of Red-Black Tree, as in C++ STL set class. Is there any such thing in Java? --lRem

If you just need something like std::set (regardless of implementation), you can use a Java TreeSet? or HashSet? (which behave like std::set and std::hash_set respectively). If you use a TreeSet?, the objects you put in there either need to implement the Comparable interface (or in Java 5, Comparable<Type> interface), or you can pass in a Comparator implementation. The first case is analogous to implementing std::less for the type, the second is like passing in a strict weak ordering to use instead of std::less. An Iterator created by a TreeSet? will iterate in the natural order (or the ordering you give it) of the objects in the set. If this order doesn't matter, you can alternately use a HashSet? (which means you don't need a comparator, but you probably need to override hashCode to do something useful, and maybe equals as well). Many built in objects already override hashCode() and implement Comparable if there is an appropriate comparison that can be made. Java also has a TreeMap? and HashMap? class (which are analogous to std::map and std::hash_map). -- Kawigi (P.S.- man, am I just a show off today with library knowledge!) (P.P.S.- TreeMap/HashMap? are common ways to store enemy information in melee so they can be indexed by name)

Cool :) Now I only need a lot of motivation to implement it ;) --lRem

Robo Home | SmartFactorTargeting | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited March 1, 2006 10:18 EST by unallocated.star.net.uk (diff)