/Dependz

A dependency analysis utility in Java which uses topological sorting to order values based on their dependencies.

Primary LanguageJavaOpen Software License 3.0OSL-3.0

Dependz

Stable

A dependency analysis utility in Java which uses topological sorting to order values based on their dependencies.

There are two methods to build a DependencyGraph, one with DependencyNodes (which requires all DependencyNode references to be created ahead of time) or by using DependencyMap which can use an arbitrary key to map dependencies between values.

Example

DependencyMap<String, Integer> map = new DependencyMap<String, Integer>();
map.put( "value0", 0 );
map.put( "value1", 1 );
map.put( "value2", 2 );
map.put( "value3", 3 );
map.put( "value4", 4 );
map.addDependency( "value0", "value1" ); // value0 depends on value1
map.addDependency( "value2", "value0" ); 
map.addDependency( "value1", "value3" );
map.addDependency( "value1", "value4" );
        
DependencyAnalyzer<Integer> analyzer = map.toAnalyzer();

assertTrue( analyzer.isValid() );
assertEquals( Arrays.asList( 3, 4, 1, 0, 2 ), graph.getOrdered() );

Builds

Projects using Dependz