public static void removeOffScopeInstances( Instance scopedInstance ) {

		List<Instance> todo = new ArrayList<> ();
		todo.addAll( scopedInstance.getChildren());

		while( ! todo.isEmpty()) {
			Instance current = todo.remove( 0 );
			if( isTarget( current ))
				current.getParent().getChildren().remove( current );
			else
				todo.addAll( current.getChildren());
		}
	}
public static void removeOffScopeInstances ( Instance scopedInstance ) { List < Instance > todo = new ArrayList < > ( ) ; todo . addAll ( scopedInstance . getChildren ( ) ) ; while ( ! todo . isEmpty ( ) ) { Instance current = todo . remove ( 0 ) ; if ( isTarget ( current ) ) current . getParent ( ) . getChildren ( ) . remove ( current ) ; else todo . addAll ( current . getChildren ( ) ) ; } }
Removes children instances which are off-scope.
<p>
Agents manage all the instances under their scoped instance, except those
that are associated with the "target" installer. Such instances are indeed managed by another agent.
</p>

@param scopedInstance a scoped instance