Hello there,
I really do need your JAVA help & advise again: 1.) Where do I have to lookup in the Java-Docs to find the meaning of the curious <Integer> notation in the SortedMap example below. Whil'st switching between so many languages, I did obviously have missed something! Are there any current plan's to implement this in NetRexx ? 2.) Has anybody of you already any *practical experiences* with NetBeans? Is it reliable, recommandatable? 3.) I'm seeking for (maybe already existant) Method's to build my SEMANTIC GRAPH within PP. The SEMANTIC GRAPH is a double sided, weighted graph. I do have some *very ancient* (1972!) algorithms on my desk, originally written for my diploma thesis, for COLOURING such a graph with the MINIMUM Number of colours (called the Chromatic Number of such a graph). There is an upper bound (called the TURAN Number), and a LOWER Bound (cannot recall the name), and a *VERY SPEEDY* (i.e. efficient) algorithm (at least, when I studied Mathematics), to make any and all the COLOURING decisions, which in turn does give a DECISION SEQUENCE, and again a NEW LOWER BOUND. I did now translate this (very old) FORTRAN Algorithm to NetRexx (what else) but am still curious wether their aren't already existing classes for double sided GRAPH's manipulations existing. I am (just for info) attaching a related message below. Alan, WHEN *NOT INTERESTED* <blink blink>, please simply skip it... ;-) The purpose of this, my current, research is to use the so called *Minimal-Grad-Folge* (called MGF in german graph theory book's), don't know the english name sorry, for a brand new algorithm I'm writing to decide - which PATTERN of a PROCEDURAL Program (like Rexx, PL/I, COBOL, etc) *should belong* ** to which OO class** ???????????? :-) Anybody NOt interested in this topic: PLS. Simply ignore this message :-) Kind greetings from dark Vienna, Thomas Schneider- ============================================================================================= -------- Original-Nachricht --------
My first suggestion would be to use ChildFactory instead of Children.SortedMap, or Children.Keys sorting the keys in advance If you must use Children.SortedMap I made two examples (first time I used it), I tested them and they both works If neither of these would work I suspect you have to create your nodes in another thread, not only the children but the parent as well. // EXAMPLE 1 package org.scantamburlo.sortedMap; import java.util.Random; import org.openide.nodes.AbstractNode; import org.openide.nodes.Children; /** * * @author Enrico Scantamburlo <scantamburlo at streamsim.com> */ public class RootNode extends AbstractNode { public RootNode() { super(new NumberChildren()); setName(getClass().getName()); } private static class NumberChildren extends Children.SortedMap<Integer> { public NumberChildren() { Random random = new Random(999); for (int i = 0; i < 100; i++) { int num = random.nextInt(); put(num, new NumberNode(num)); } } } private static class NumberNode extends AbstractNode { public NumberNode(int num) { super(Children.LEAF); setName(Integer.toString(num)); } } } // EXAMPLE2 package org.scantamburlo.sortedMap; import java.util.Map; import java.util.Random; import java.util.TreeMap; import org.openide.nodes.AbstractNode; import org.openide.nodes.Children; import org.openide.nodes.Node; /** * * @author Enrico Scantamburlo <scantamburlo at streamsim.com> */ public class RootNode2 extends AbstractNode{ public RootNode2() { super(createSortedMapChildren()); setName(getClass().getName()); } private static Children createSortedMapChildren(){ Random random = new Random(999); Map<Integer, Node> map = new TreeMap<Integer, Node>(); for (int i = 0; i < 100; i++) { int num = random.nextInt(); map.put(num, new NumberNode(num)); } Children.SortedMap<Integer> ch = new Children.SortedMap<Integer>(map){}; return ch; } private static class NumberNode extends AbstractNode { public NumberNode(int num) { super(Children.LEAF); setName(Integer.toString(num)); } } } On Fri, Jul 29, 2011 at 9:28 PM, ilhami
visne <[hidden email]>
wrote:
-- Enrico Scantamburlo "For people that try to compensate the lack of capacity with more effort, there is no limit to the things they cannot do" --
Thomas Schneider (www.thsitc.com) _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
Thomas Schneider, Vienna, Austria (Europe) :-)
www.thsitc.com www.db-123.com |
Thomas,
(1) This is part of Java's generics notation. You can disregard it mostly when converting to NetRexx. It is a compile time technique to ensure the types of elements in collection classes. When you are not using it, as you are forced to do in present day NetRexx, you have to take care to cast the objects you take out of collections to their right types. (2) NetBeans is a good IDE, and I used it a lot until they went, a number of years ago, to a rather strict enforcing of standard directories, ant, etc - up to the point that it would erase source code if it did not comply with its expectations. It has been relaxed later but its usefulness for me stayed limited when it got rid of the freedom and flexibility of the first versions. It has a good Swing visual editor that can keep the generated source code in step with your changes in the interface. If you can accommodate to its rules it is a good platform. The choice of IDE boils down to taste and experience and I think you need to check out some of the more known ones before making your own choice. But this is no place to discuss them if there is no immediate relevancy to a specific NetRexx issue. (3) have a read of the collection classes documentation, it can help you a lot in designing your algorithms. I also found "Algorithms in Java" by Sedgewick a useful resource for these things. best regards, René. On 30 jul. 2011, at 02:56, Thomas Schneider wrote:
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Free forum by Nabble | Edit this page |