flowElement = iterator.next();
}
catch( IllegalArgumentException exception )
{
if( flowElement == null )
throw new ElementGraphException( "unable to traverse to the first element" );
throw new ElementGraphException( flowElement, "unable to traverse to the next element after " + flowElement );
}
if( requireUniqueCheckpoints && flowElement instanceof Checkpoint )
{
String name = ( (Checkpoint) flowElement ).getName();
if( checkpointNames.contains( name ) )
throw new ElementGraphException( (Pipe) flowElement, "may not have duplicate checkpoint names in assembly, found: " + name );
checkpointNames.add( name );
}
if( incomingEdgesOf( flowElement ).size() != 0 && outgoingEdgesOf( flowElement ).size() != 0 )
continue;
if( flowElement instanceof Extent )
continue;
if( flowElement instanceof Pipe )
{
if( incomingEdgesOf( flowElement ).size() == 0 )
throw new ElementGraphException( (Pipe) flowElement, "no Tap connected to head Pipe: " + flowElement + ", possible ambiguous branching, try explicitly naming tails" );
else
throw new ElementGraphException( (Pipe) flowElement, "no Tap connected to tail Pipe: " + flowElement + ", possible ambiguous branching, try explicitly naming tails" );
}
if( flowElement instanceof Tap )
throw new ElementGraphException( (Tap) flowElement, "no Pipe connected to Tap: " + flowElement );
else
throw new ElementGraphException( flowElement, "unknown element type: " + flowElement );
}
}