src/main/java/net/christophermerrill/FancyFxTree/example/ExampleDataNodeBuilder.java
private static void addDecendents(ExampleDataNode parent, int[] num_descendents)
        {
        if (num_descendents.length < 1)
            return;

        int[] num_grandchildren = null;
        if (num_descendents.length > 1)
            num_grandchildren = Arrays.copyOfRange(num_descendents, 1, num_descendents.length);

        for (int i = 0; i < num_descendents[0]; i++)
            {
            ExampleDataNode child = new ExampleDataNode(parent.getName() + "." + (i+1));
            if (num_grandchildren !=  null)
                addDecendents(child, num_grandchildren);
            parent.addChild(child);
            }
        }
/**
     * Adds a hierarchy of children, grandchildren. The length of the array indicates
     * the depth of the hierarchy. The values of the array indicates the number of
     * descendants at each depth.
     */
Adds a hierarchy of children, grandchildren. The length of the array indicates
the depth of the hierarchy. The values of the array indicates the number of
descendants at each depth.
Adds a hierarchy of children grandchildren . The length of the array indicates the depth of the hierarchy . The values of the array indicates the number of descendants at each depth .
private static void addDecendents(ExampleDataNode parent, int[] num_descendents)
        {
        if (num_descendents.length < 1)
            return;
        int[] num_grandchildren = null;
        if (num_descendents.length > 1)
            num_grandchildren = Arrays.copyOfRange(num_descendents, 1, num_descendents.length);
        for (int i = 0; i < num_descendents[0]; i++)
            {
            ExampleDataNode child = new ExampleDataNode(parent.getName() + "." + (i+1));
            if (num_grandchildren !=  null)
                addDecendents(child, num_grandchildren);
            parent.addChild(child);
            }
        }
private static void addDecendents ( ExampleDataNode parent , int [ ] num_descendents ) { if ( num_descendents . length < 1 ) return ; int [ ] num_grandchildren = null ; if ( num_descendents . length > 1 ) num_grandchildren = Arrays . copyOfRange ( num_descendents , 1 , num_descendents . length ) ; for ( int i = 0 ; i < num_descendents [ 0 ] ; i ++ ) { ExampleDataNode child = new ExampleDataNode ( parent . getName ( ) + "." + ( i + 1 ) ) ; if ( num_grandchildren != null ) addDecendents ( child , num_grandchildren ) ; parent . addChild ( child ) ; } }
Adds a hierarchy of children, grandchildren.
Adds a hierarchy of children grandchildren .