org.squashtest.tm.service.internal.library
Class NextLayerFeeder

java.lang.Object
  extended by org.squashtest.tm.service.internal.library.NextLayerFeeder
All Implemented Interfaces:
org.squashtest.tm.domain.library.NodeVisitor

@Component
@Scope(value="prototype")
public class NextLayerFeeder
extends Object
implements org.squashtest.tm.domain.library.NodeVisitor


Constructor Summary
NextLayerFeeder()
           
 
Method Summary
 void feedNextLayer(org.squashtest.tm.domain.library.TreeNode destination, org.squashtest.tm.domain.library.TreeNode source, Map<org.squashtest.tm.domain.library.NodeContainer<org.squashtest.tm.domain.library.TreeNode>,Collection<org.squashtest.tm.domain.library.TreeNode>> nextLayer, Collection<? extends org.squashtest.tm.domain.library.TreeNode> outputList)
          This method is used with the PasteStrategy that goes through a three generation by generation (or layer by layer).
 void visit(org.squashtest.tm.domain.campaign.Campaign campaign)
           
 void visit(org.squashtest.tm.domain.campaign.CampaignFolder campaignFolder)
           
 void visit(org.squashtest.tm.domain.campaign.Iteration iteration)
           
 void visit(org.squashtest.tm.domain.requirement.Requirement requirement)
           
 void visit(org.squashtest.tm.domain.requirement.RequirementFolder requirementFolder)
           
 void visit(org.squashtest.tm.domain.testcase.TestCase testCase)
           
 void visit(org.squashtest.tm.domain.testcase.TestCaseFolder testCaseFolder)
           
 void visit(org.squashtest.tm.domain.campaign.TestSuite testSuite)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NextLayerFeeder

public NextLayerFeeder()
Method Detail

feedNextLayer

public void feedNextLayer(org.squashtest.tm.domain.library.TreeNode destination,
                          org.squashtest.tm.domain.library.TreeNode source,
                          Map<org.squashtest.tm.domain.library.NodeContainer<org.squashtest.tm.domain.library.TreeNode>,Collection<org.squashtest.tm.domain.library.TreeNode>> nextLayer,
                          Collection<? extends org.squashtest.tm.domain.library.TreeNode> outputList)
This method is used with the PasteStrategy that goes through a three generation by generation (or layer by layer).
It will feed the next layer to process (nextLayer) with the children of the processed node (source).

The next layer maps these next layer nodes with their future destination.
The future destination is the result of a PasteOperation on the source node. Hence destination and source are of the same type.

This method doesn't add output nodes to next layer so that we avoid infinite loops when a node is copied and pasted in himself.
example : 1 node A (containing C)
copy A into A should lead to A (containing A' + C) with A' containing C'.
When we process the first layer, A is copied as A' into A.
Then we fill the next layer to copy that is the content of A = A' + C .
We don't want to copy A' that is already the result of the copy. It would lead to infinite loop : copy A' into A', A'' into A'' ...
Thus we need to fill the next generation without A'.

Why can't we fill the next layer before copying ? We need to fill the next layer node by node because we have to remember the node destination and to know it it is allowed to go deeper on the node (both depend on the operation).

Parameters:
destination - : the result of a PasteOperation on the source node
source - : The TreeNode in which a paste operation has been processed.
nextLayer - : a map to fill with an entry of new source-nodes mapped by their destination
outputList - : the output list of the paste strategy.

visit

public void visit(org.squashtest.tm.domain.campaign.CampaignFolder campaignFolder)
Specified by:
visit in interface org.squashtest.tm.domain.library.NodeVisitor

visit

public void visit(org.squashtest.tm.domain.requirement.RequirementFolder requirementFolder)
Specified by:
visit in interface org.squashtest.tm.domain.library.NodeVisitor

visit

public void visit(org.squashtest.tm.domain.testcase.TestCaseFolder testCaseFolder)
Specified by:
visit in interface org.squashtest.tm.domain.library.NodeVisitor

visit

public void visit(org.squashtest.tm.domain.campaign.Campaign campaign)
Specified by:
visit in interface org.squashtest.tm.domain.library.NodeVisitor

visit

public void visit(org.squashtest.tm.domain.campaign.Iteration iteration)
Specified by:
visit in interface org.squashtest.tm.domain.library.NodeVisitor

visit

public void visit(org.squashtest.tm.domain.campaign.TestSuite testSuite)
Specified by:
visit in interface org.squashtest.tm.domain.library.NodeVisitor

visit

public void visit(org.squashtest.tm.domain.requirement.Requirement requirement)
Specified by:
visit in interface org.squashtest.tm.domain.library.NodeVisitor

visit

public void visit(org.squashtest.tm.domain.testcase.TestCase testCase)
Specified by:
visit in interface org.squashtest.tm.domain.library.NodeVisitor


Copyright © 2010-2013 Henix, henix.fr. All Rights Reserved.