Пример #1
0
        /// <summary>
        /// Inserts a value into this square.
        /// </summary>
        /// <param name="pValue">The value to insert.</param>
        public void InsertValue(char pValue)
        {
            if (Filled)
            {
                return;
            }

            Filled = true;

            // Prepare entities for insertion
            mEntities.ForEach(e => e.PreInsertion(pValue));

            // Remove all possible values from this square since it is now occupied
            ITechnique tech = Technique.CreateOccupiedTechnique(pValue, Index);

            foreach (char value in Constants.ALL_VALUES)
            {
                EliminatePossibility(value, tech);
            }

            // Insert the value into the entities
            mEntities.ForEach(e => e.StartInsertion(Index));
            mEntities.ForEach(e => e.EndInsertion());
        }