private int resolveOrder ( String path ) throws CyclicDependencyException { m_seen = true ; try { int highOrder = - 1 ; for ( Vertex < T > dv : m_dependencies ) { if ( dv . m_seen ) { throw new CyclicDependencyException ( path + " -> " + dv . getName ( ) ) ; } else { highOrder = Math . max ( highOrder , dv . resolveOrder ( path + " -> " + dv . getName ( ) ) ) ; } } // Set this order so it is one higher than the highest dependency. m_order = highOrder + 1 ; return m_order ; } finally { m_seen = false ; } }
Recursively searches for cycles by travelling down the dependency lists of this vertex looking for the start vertex .