示例#1
0
 /// <summary>Initializes the base class with the given word, then computes
 ///     ushort representations of the metaphone keys computed by the
 ///     base class</summary>
 ///
 /// <param name="word">Word for which to compute metaphone keys</param>
 public ShortDoubleMetaphone(String word) : base(word)
 {
     m_primaryShortKey = ShortDoubleMetaphone.metaphoneKeyToShort(this.PrimaryKey);
     if (this.AlternateKey != null)
     {
         m_alternateShortKey = ShortDoubleMetaphone.metaphoneKeyToShort(this.AlternateKey);
     }
     else
     {
         m_alternateShortKey = METAPHONE_INVALID_KEY;
     }
 }
示例#2
0
        /// <summary>Sets a new current word, computing the string and ushort representations
        ///     of the metaphone keys of the given word.
        ///
        ///     Note that this uses the new modifier, which hides the base class
        ///     computeKeys.  The base class's computeKeys is then explicitly
        ///     called as part of the function body.  It is important to note that
        ///     this is NOT equivalent to overriding a virtual function, in that
        ///     polymorphism is not provided.  In this case, polymorphism is of no
        ///     value, while the potential efficiency gained by not using virtual
        ///     methods is quite valuable.</summary>
        ///
        /// <param name="word">New current word for which to compute metaphone keys</param>
        new public void computeKeys(String word)
        {
            base.computeKeys(word);

            m_primaryShortKey = ShortDoubleMetaphone.metaphoneKeyToShort(this.PrimaryKey);
            if (this.AlternateKey != null)
            {
                m_alternateShortKey = ShortDoubleMetaphone.metaphoneKeyToShort(this.AlternateKey);
            }
            else
            {
                m_alternateShortKey = METAPHONE_INVALID_KEY;
            }
        }