org.callbackparams.combine
Class AbstractCombineStrategy

java.lang.Object
  extended by org.callbackparams.combine.AbstractCombineStrategy
All Implemented Interfaces:
CombineStrategy
Direct Known Subclasses:
CombineAllPossible2Combinations, CombineCompletely

public abstract class AbstractCombineStrategy
extends Object
implements CombineStrategy

Abstract stub implementation of CombineStrategy that is intended to be a convenient super-class for most implementations.

Author:
Henrik Kaipe

Field Summary
protected  int maxCount
           
 
Constructor Summary
AbstractCombineStrategy()
           
 
Method Summary
 Collection combine(ValuesCollection vc)
          Implementations of this method will create a collection of callback- records based on the configuration of this CombineStrategy instance.
protected abstract  Collection combineInternal(ValuesCollection vc)
          This is the method to implement when implementing CombineStrategy by subclassing AbstractCombineStrategy.
protected  long getRandomSeed()
          Returns the random-seed that has been set by setRandomSeed(long).
 void setMaxCount(int maxCount)
          Specifies the maximum number of combinations that the method CombineStrategy.combine(ValuesCollection) is allowed to return.
 void setRandomSeed(long randomSeed)
          Some CombineStrategy implementations does to some extent pick callback-record parameters randomly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxCount

protected int maxCount
Constructor Detail

AbstractCombineStrategy

public AbstractCombineStrategy()
Method Detail

setMaxCount

public void setMaxCount(int maxCount)
Description copied from interface: CombineStrategy
Specifies the maximum number of combinations that the method CombineStrategy.combine(ValuesCollection) is allowed to return. The default value is implementation dependent.

Specified by:
setMaxCount in interface CombineStrategy

setRandomSeed

public void setRandomSeed(long randomSeed)
Description copied from interface: CombineStrategy
Some CombineStrategy implementations does to some extent pick callback-record parameters randomly. With this setter it is possible to specify which random seed to use and therewith make sure the exact same set of callback-records is used on each test-run.

Specified by:
setRandomSeed in interface CombineStrategy

combine

public Collection combine(ValuesCollection vc)
Description copied from interface: CombineStrategy
Implementations of this method will create a collection of callback- records based on the configuration of this CombineStrategy instance. The callback-parameters used at a certain index in the created callback-records are picked from the array at the corresponding index in the argument ValuesCollection instance.

Specified by:
combine in interface CombineStrategy

getRandomSeed

protected long getRandomSeed()
Returns the random-seed that has been set by setRandomSeed(long). If random-seed has not yet been set it will be set to the current timestamp.


combineInternal

protected abstract Collection combineInternal(ValuesCollection vc)
This is the method to implement when implementing CombineStrategy by subclassing AbstractCombineStrategy. The advantage compared to overriding combine(ValuesCollection) is that maxCount-check and validation of configuration for setMaxCount(int) and setRandomSeed(long) will be taken care of by the super-class - relieving this method to administer combining exclusivly.



Copyright © 2010-2013 Henrik Kaipe. All Rights Reserved.