javax.constraints.impl.search.selectors
Class VarSelectorRandom

java.lang.Object
  extended by javax.constraints.impl.search.selectors.AbstractVarSelector
      extended by javax.constraints.impl.search.selectors.VarSelectorRandom
All Implemented Interfaces:
VarSelector

public class VarSelectorRandom
extends AbstractVarSelector


Constructor Summary
VarSelectorRandom(SearchStrategy strategy)
          Constructor from the Var[]
 
Method Summary
 VarSelectorType getType()
          Returns a type of this selector
 int select()
          Returns the index of a randomly selected variable.
 
Methods inherited from class javax.constraints.impl.search.selectors.AbstractVarSelector
getSearchStrategy, getVars
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VarSelectorRandom

public VarSelectorRandom(SearchStrategy strategy)
Constructor from the Var[]

Method Detail

getType

public VarSelectorType getType()
Description copied from interface: VarSelector
Returns a type of this selector

Returns:
a type of this selector

select

public int select()
Returns the index of a randomly selected variable. If no variables to select, it returns -1;

Specified by:
select in interface VarSelector
Specified by:
select in class AbstractVarSelector
Returns:
the index of the selected variable in the array of constrained variables upon which this selector was defined. Returns -1 if there are no variables to select.