Package org.objectstyle.ashwood.graph

Examples of org.objectstyle.ashwood.graph.IndegreeTopologicalSort


                indexedDbEntities.put(entity, new Integer(index++));
            }
        }
        boolean acyclic = GraphUtils.isAcyclic(pkDependencyGraph);
        if (acyclic) {
            IndegreeTopologicalSort sorter = new IndegreeTopologicalSort(
                    pkDependencyGraph);
            while (sorter.hasNext())
                indexedDbEntities.put(sorter.next(), new Integer(index++));
        }
        else {
            StrongConnection contractor = new StrongConnection(
                    pkDependencyGraph,
                    CollectionFactory.ARRAYLIST_FACTORY);
            Digraph contractedDigraph = new MapDigraph(MapDigraph.HASHMAP_FACTORY);
            contractor.contract(contractedDigraph, CollectionFactory.ARRAYLIST_FACTORY);
            IndegreeTopologicalSort sorter = new IndegreeTopologicalSort(
                    contractedDigraph);
            while (sorter.hasNext()) {
                Collection component = (Collection) sorter.next();
                for (Iterator i = component.iterator(); i.hasNext();)
                    indexedDbEntities.put(i.next(), new Integer(index++));
            }
        }
    }
View Full Code Here


                CollectionFactory.ARRAYLIST_FACTORY);
        contractedReferentialDigraph = new MapDigraph(MapDigraph.HASHMAP_FACTORY);
        contractor.contract(
                contractedReferentialDigraph,
                CollectionFactory.ARRAYLIST_FACTORY);
        IndegreeTopologicalSort sorter = new IndegreeTopologicalSort(
                contractedReferentialDigraph);
        components = new HashMap(contractedReferentialDigraph.order());
        int componentIndex = 0;
        while (sorter.hasNext()) {
            Collection component = (Collection) sorter.next();
            ComponentRecord rec = new ComponentRecord(componentIndex++, component);
            for (Iterator i = component.iterator(); i.hasNext();) {
                components.put(i.next(), rec);
            }
        }
View Full Code Here

                    }
                }
            }
        }

        IndegreeTopologicalSort sorter = new IndegreeTopologicalSort(
                objectDependencyGraph);

        while (sorter.hasNext()) {
            Object o = sorter.next();
            if (o == null)
                throw new CayenneRuntimeException("Sorting objects for "
                        + objEntity.getClassName()
                        + " failed. Cycles found.");
            sorted.add(o);
View Full Code Here

TOP

Related Classes of org.objectstyle.ashwood.graph.IndegreeTopologicalSort

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.