コード例 #1
0
        /// <summary>
        /// Attempts to add the given solution to the set.
        /// </summary>
        /// <param name="solution">Solution to add.</param>
        /// <returns>True if the solution was added. False otherwise.</returns>
        public bool SafeAdd(FuriganaSolution solution)
        {
            if (!solution.Check())
            {
                // The specified solution is not valid.
                return(false);
            }

            if (Solutions.Any(s => s.Equals(solution)))
            {
                // We already have an equivalent solution.
                return(false);
            }

            // All is good.
            Solutions.Add(solution);
            return(true);
        }
コード例 #2
0
 /// <summary>
 /// Checks if the solution is correctly solved.
 /// </summary>
 /// <returns>True if the furigana covers all characters without overlapping.
 /// False otherwise.</returns>
 public bool Check()
 {
     return(FuriganaSolution.Check(Vocab, Furigana));
 }