#**##set( $return = $imports.addToImports("java.util.*") )
#**##set( $postfix = "$utility.upFirstChar($sourceName)To$utility.upFirstChar($targetName)" )
#**##set( $iter = "fujaba__Iter$postfix" )
#**##set( $children = $utility.indent("      ",$!children) )
#**##set( $localVars = $engine.getFromInformation("localVars") )
#**##set( $return = $localVars.addLocalVariable($iter, "Iterator", $link) )
#**##set( $searchOpComment = "iterate to-many link $link.InstanceOf.Name from $sourceName to $targetName" )
#**#// $searchOpComment
#**##if ( $targetSet )
#*   *##set( $return = $imports.addToImports("de.upb.tools.fca.*") )
#*   *##set( $return = $localVars.addLocalVariable($collectionName, "FHashSet", $link) )
#*   *#$collectionName = new FHashSet ();
#**##else
#*   *#fujaba__Success = false;
#**##end
#**##if( $path )
#*   *#$iter = new de.uni_kassel.sdm.Path ($sourceName, "$path");
#*   *###$iter = new Path ($sourceName, "$path");
#**##else
#*   *#$iter = #parse("$!{style}storyPattern/link/iterator.vm" )
#*   *#
#**##end
#**##if ( $upperbound )
#*   *#fujaba__UpperBound_$postfix = false;
#*   *##set( $return = $localVars.addLocalVariable("fujaba__UpperBound_$postfix","boolean","false", $link) )
#*   *##set( $upperadd = " && !(fujaba__UpperBound_$postfix)" )
#**##end
#**##set( $debug = $debug || $elem.firstFromDiagrams.parentElement.hasKeyInStereotypes("assert") )
#**##if( $debug )
#*   *#List<JavaSDMException> causes$postfix = new ArrayList<JavaSDMException>();
#**##end
#**#while ( #if(!$forEach && !$targetSet || $targetNegative || $check)!(fujaba__Success) && #end${iter}.hasNext ()$!upperadd )
#**#{
#**##set($depth = $utility.getPatternDepth($token))
#**#   pattern#if($depth>0)$depth#end: 
#**#   {
#**##if($check)
#**#      if ( ! ${targetName}.equals (${iter}.next ())#parse("$lang/default:storyPattern/sdmComment.vm")) break pattern#if($depth>0)$depth#end; // <== not a match
#**##else
#*   *##set( $typeCast = (!$role.getTarget().equals($target.getInstanceOf())) )
#**##set( $source = "#if(!$typeCast)($targetType)#end ${iter}.next ()" )
#*   *##set( $toMany = true )
#*   *##set( $targetToken = $dlrTool.createDLRToken([$target]) )
#*   *#$!targetToken.createStartTag()##
#*   *##set( $template = "$!{style}storyPattern/object/assign.vm" )
#*   *#$utility.indent("      ", "#parse($template)" )##
#*   *#$!targetToken.createEndTag()##
#**##if($targetToken)#set( $targetToken.comment = $opComment )#end
#*   *##if ( $upperbound )
#*      *#      if ( ${targetName}.equals ($upperbound) )
#*      *#      {
#*      *#         fujaba__UpperBound_$postfix = true;
#*      *##set($depth = $utility.getPatternDepth($token))
#*   *#         break pattern#if($depth>0)$depth#end; // <==== not a match
#*      *#      }
#*   *##end
#**##end
#**##set( $opComment = $searchOpComment )
#**#$!children
#**##if ( $targetSet )
#*   *#      ${collectionName}.add ($targetName);
#**##else
#*   *#      fujaba__Success = true;
#**##end
#**#   }
#**##if( $debug )
#*   *#   if ( ! fujaba__Success )
#*   *#   {
#*   *#      causes${postfix}.add (fujaba__InternalException);
#*   *#   }
#**##end
#**#}
#**##if ( $targetOptional )
#*   *#if (!fujaba__Success)
#*   *#{
#*   *#   fujaba__Success = true;
#*   *#   $targetName = null;
#*   *#}
#**##elseif ( !$targetSet )
#*   *#if (##
#**##if( !($path && $linkNegative) )!#end
#*   *##set($depth = $depth - 1)
#**#fujaba__Success#if( $debug ), "$opComment", causes$postfix#end) break pattern#if($depth>0)$depth#end; // <==== not a match
#*   *#fujaba__Success = false;
#*   *#
#**##end
