public bool IteratorHasValues(ISegmentIterator iterator, int[] values) { foreach (int value in values) { if (value != iterator.GetCurrent().Value) { return(false); } iterator.Next(); } return(true); }
private void BuildValueList(ISegmentIterator iterator) { _values = new List <int>(); iterator.First(); while (!iterator.IsDone()) { var value = iterator.GetCurrent().Value; if (value != CellValue.Unknown.Value) { _values.Add(value); } iterator.Next(); } }
private bool Reduce(ISegmentIterator iterator) { var finished = true; iterator.First(); while (!iterator.IsDone()) { var cell = iterator.GetCurrent(); foreach (int v in _values) { if (cell.RemoveCandidate(v)) { finished = false; } } iterator.SetCurrent(cell); iterator.Next(); } return(finished); }
public bool Execute(ISegmentIterator iterator) { _values = new List <int>(); iterator.First(); while (!iterator.IsDone()) { var cell = iterator.GetCurrent(); if (cell.Value != CellValue.Unknown.Value) { if (_values.Exists(x => x == cell.Value)) { _validated = false; return(false); } _values.Add(cell.Value); } iterator.Next(); } _validated = true; return(true); }