private List<IArc> generateArcsInstancesCase11( Collection<INode> sourcesNodes, Collection<INode> targetsNodes, AssociationDefinition associationDefinition, Collection<AssociationDefinition> associations, Collection<IArc> generatedArcs) { List<IArc> arcsInstances = new ArrayList<IArc>(); if (numberOfOutputArcs > 0) { while (!sourcesNodes.isEmpty() && !targetsNodes.isEmpty()) { INode source = RandomMethods.selectRandomlyNode(sourcesNodes); INode target = RandomMethods.selectRandomlyNode(targetsNodes); IArc arc = createRandomlyArc(source, target, associationDefinition); AssociationDefinition invAssoc = generatorServices.searchInverseAssoc( source, target, associationDefinition, associations); if (invAssoc != null) { IArc invArc = generatorServices.getInverseGeneratedArc(source, target, invAssoc, generatedArcs); if (invArc != null) { arc = null; } } if (arc != null) { arcsInstances.add(arc); } sourcesNodes.remove(source); targetsNodes.remove(target); } } return arcsInstances; }
private List<IArc> generateArcsInstancesCaseNN( Collection<INode> sourcesNodes, Collection<INode> targetsNodes, AssociationDefinition associationDefinition) { List<IArc> arcsInstances = new ArrayList<IArc>(); while (!sourcesNodes.isEmpty()) { INode source = RandomMethods.selectRandomlyNode(sourcesNodes); Collection<INode> tempTargetsNodes = targetsNodes; int numberOfArcs = 0; if (!targetsNodes.isEmpty()) { while (numberOfArcs < numberOfOutputArcs && /* * targetsNodes.size( * ) >= * numberOfOutputArcs */ !tempTargetsNodes.isEmpty()) { INode target = RandomMethods.selectRandomlyNode(targetsNodes); IArc arc = createRandomlyArc(source, target, associationDefinition); if (arc != null) { arcsInstances.add(arc); numberOfArcs++; } tempTargetsNodes.remove(target); } } sourcesNodes.remove(source); } return arcsInstances; }