@Test public void testSearchForLoop() { Component c1 = new Component( "c1" ); Assert.assertNull( ComponentHelpers.searchForLoop( c1 )); Component c11 = new Component( "c11" ); c1.addChild( c11 ); Assert.assertNull( ComponentHelpers.searchForLoop( c1 )); Component c12 = new Component( "c1" ); c1.addChild( c12 ); Assert.assertEquals( "c1 -> c1", ComponentHelpers.searchForLoop( c1 )); Assert.assertNull( ComponentHelpers.searchForLoop( c11 )); Assert.assertNull( ComponentHelpers.searchForLoop( c12 )); c12.setName( "c12" ); Component c121 = new Component( "c1" ); c12.addChild( c121 ); Assert.assertEquals( "c1 -> c12 -> c1", ComponentHelpers.searchForLoop( c1 )); Assert.assertNull( ComponentHelpers.searchForLoop( c11 )); Assert.assertNull( ComponentHelpers.searchForLoop( c12 )); Assert.assertNull( ComponentHelpers.searchForLoop( c121 )); c121.setName( "c121" ); c121.addChild( c1 ); Assert.assertEquals( "c1 -> c12 -> c121 -> c1", ComponentHelpers.searchForLoop( c1 )); Assert.assertEquals( "c12 -> c121 -> c1 -> c12", ComponentHelpers.searchForLoop( c12 )); Assert.assertEquals( "c121 -> c1 -> c12 -> c121", ComponentHelpers.searchForLoop( c121 )); Assert.assertNull( ComponentHelpers.searchForLoop( c11 )); }
public static String searchForLoop( Component component ) { return searchForLoop( component, new ArrayList<Component> ()); }
ComponentHelpers { public static String searchForLoop( Component component ) { return searchForLoop( component, new ArrayList<Component> ()); } }
ComponentHelpers { public static String searchForLoop( Component component ) { return searchForLoop( component, new ArrayList<Component> ()); } private  ComponentHelpers(); }
ComponentHelpers { public static String searchForLoop( Component component ) { return searchForLoop( component, new ArrayList<Component> ()); } private  ComponentHelpers(); static Component findComponent( Graphs graphs, String name ); static Component findComponent( AbstractApplication app, String name ); static Component findComponentFrom( Component component, String componentName ); static List<String> extractNames( Collection<? extends AbstractType> types ); static boolean isTarget( Component component ); static Collection<Component> findAllChildren( Component component ); static Collection<Component> findAllAncestors( Component component ); static String findComponentInstaller( Component component ); static Map<String,String> findAllExportedVariables( Component component ); static Map<String,String> findAllExportedVariables( AbstractType type ); static Map<String,String> findAllExportedVariables( Graphs graphs ); static Map<String,String> findAllExportedVariables( Facet facet ); static Map<String,ImportedVariable> findAllImportedVariables( Component component ); static Collection<Facet> findAllFacets( Component component ); static List<Component> findAllExtendedComponents( Component component ); static Collection<Facet> findAllExtendedFacets( Facet facet ); static Collection<Facet> findAllExtendingFacets( Facet facet ); static Collection<Component> findAllExtendingComponents( Component component ); static List<Component> findAllComponents( Graphs graphs ); static List<Component> findAllComponents( AbstractApplication app ); static String searchForLoop( Component component ); static String searchForInheritanceCycle( Facet facet ); static String searchForInheritanceCycle( Component component ); static Map<String,Boolean> findComponentDependenciesFor( Component component ); static Map<Component,Boolean> findComponentDependenciesFor( Component component, ApplicationTemplate app ); static Map<Component,Boolean> findComponentsThatDependOn( Component component, ApplicationTemplate app ); }
ComponentHelpers { public static String searchForLoop( Component component ) { return searchForLoop( component, new ArrayList<Component> ()); } private  ComponentHelpers(); static Component findComponent( Graphs graphs, String name ); static Component findComponent( AbstractApplication app, String name ); static Component findComponentFrom( Component component, String componentName ); static List<String> extractNames( Collection<? extends AbstractType> types ); static boolean isTarget( Component component ); static Collection<Component> findAllChildren( Component component ); static Collection<Component> findAllAncestors( Component component ); static String findComponentInstaller( Component component ); static Map<String,String> findAllExportedVariables( Component component ); static Map<String,String> findAllExportedVariables( AbstractType type ); static Map<String,String> findAllExportedVariables( Graphs graphs ); static Map<String,String> findAllExportedVariables( Facet facet ); static Map<String,ImportedVariable> findAllImportedVariables( Component component ); static Collection<Facet> findAllFacets( Component component ); static List<Component> findAllExtendedComponents( Component component ); static Collection<Facet> findAllExtendedFacets( Facet facet ); static Collection<Facet> findAllExtendingFacets( Facet facet ); static Collection<Component> findAllExtendingComponents( Component component ); static List<Component> findAllComponents( Graphs graphs ); static List<Component> findAllComponents( AbstractApplication app ); static String searchForLoop( Component component ); static String searchForInheritanceCycle( Facet facet ); static String searchForInheritanceCycle( Component component ); static Map<String,Boolean> findComponentDependenciesFor( Component component ); static Map<Component,Boolean> findComponentDependenciesFor( Component component, ApplicationTemplate app ); static Map<Component,Boolean> findComponentsThatDependOn( Component component, ApplicationTemplate app );  }