/** * Set the current value to the previous value in the domain, * or to the last one if we reach the domain lower bound. */ public void UnshiftValue() { if (IndexDomain >= 0) { IndexDomain = IndexDomain > 0 ? IndexDomain - 1 : Domain.GetSize() - 1; } }
/** * Set the current value to the next value in the domain, * or to the first one if we reach the domain upper bound. */ public void ShiftValue() { if (IndexDomain >= 0) { IndexDomain = IndexDomain < Domain.GetSize() - 1 ? IndexDomain + 1 : 0; } }
/** * To know what values are in the current domain. * @return a List<int> of values belonging to the variable domain. */ public List <int> PossibleValues() { var possibleValues = new List <int>(); for (int i = 0; i < Domain.GetSize(); ++i) { possibleValues.Add(Domain.GetValue(i)); } return(possibleValues); }
/** * To know what values are in the current domain. * @return a List<int> of values belonging to the variable domain. */ public List <int> PossibleValues() { return(Enumerable.Range(0, Domain.GetSize()) .Select(i => Domain.GetValue(i)) .ToList()); }