javax.constraints.impl.search.selectors
Class AbstractVarSelector

java.lang.Object
  extended by javax.constraints.impl.search.selectors.AbstractVarSelector
All Implemented Interfaces:
VarSelector
Direct Known Subclasses:
VarSelectorInputOrder, VarSelectorMinDomain, VarSelectorMinDomainMinValue, VarSelectorRandom

public abstract class AbstractVarSelector
extends java.lang.Object
implements VarSelector

This abstract defines an interface for the selection of the constrained variable from a given array of variables.


Constructor Summary
AbstractVarSelector(SearchStrategy strategy)
          Constructor from SearchStrategy
 
Method Summary
 SearchStrategy getSearchStrategy()
          Return a search strategy with which this selector is associated
 Var[] getVars()
          Returns the array of constrained variables upon which this selector was defined.
abstract  int select()
          Returns the index of the selected variable in the array of constrained variables passed to the selector as a constructor parameter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.constraints.VarSelector
getType
 

Constructor Detail

AbstractVarSelector

public AbstractVarSelector(SearchStrategy strategy)
Constructor from SearchStrategy

Method Detail

getSearchStrategy

public final SearchStrategy getSearchStrategy()
Return a search strategy with which this selector is associated

Specified by:
getSearchStrategy in interface VarSelector
Returns:
SearchStrategy

getVars

public final Var[] getVars()
Description copied from interface: VarSelector
Returns the array of constrained variables upon which this selector was defined.

Specified by:
getVars in interface VarSelector
Returns:
the array of constrained variables upon which this selector was defined.

select

public abstract int select()
Returns the index of the selected variable in the array of constrained variables passed to the selector as a constructor parameter. If no variables to select, it returns -1;

Specified by:
select in interface VarSelector
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.