Beispiel #1
0
        // private methods --------------------------------------------------

        /// <summary>
        /// Group name iteration, iterate all the names in the current 32-group and
        /// returns the first codepoint that has a valid name.
        /// </summary>
        /// <param name="result">Stores the result codepoint and name.</param>
        /// <param name="limit">Last codepoint + 1 in range to search.</param>
        /// <returns>false if a codepoint with a name is found in group and we can
        /// bail from further iteration, true to continue on with the
        /// iteration.</returns>
        private bool IterateSingleGroup(ValueEnumeratorElement result, int limit)
        {
            lock (GROUP_OFFSETS_)
            {
                lock (GROUP_LENGTHS_)
                {
                    int index = m_name_.GetGroupLengths(m_groupIndex_, GROUP_OFFSETS_,
                                                        GROUP_LENGTHS_);
                    while (m_current_ < limit)
                    {
                        int    offset = UCharacterName.GetGroupOffset(m_current_);
                        string name   = m_name_.GetGroupName(
                            index + GROUP_OFFSETS_[offset],
                            GROUP_LENGTHS_[offset], (UCharacterNameChoice)m_choice_);
                        if ((name == null || name.Length == 0) &&
                            m_choice_ == (int)UCharacterNameChoice.ExtendedCharName)
                        {
                            name = m_name_.GetExtendedName(m_current_);
                        }
                        if (name != null && name.Length > 0)
                        {
                            result.Integer = m_current_;
                            result.Value   = name;
                            return(false);
                        }
                        ++m_current_;
                    }
                }
            }
            return(true);
        }
        // private methods --------------------------------------------------

        /// <summary>
        /// Group name iteration, iterate all the names in the current 32-group and
        /// returns the first codepoint that has a valid name.
        /// </summary>
        ///
        /// <param name="result">stores the result codepoint and name</param>
        /// <param name="limit">last codepoint + 1 in range to search</param>
        /// <returns>false if a codepoint with a name is found in group and we can
        /// bail from further iteration, true to continue on with the
        /// iteration</returns>
        private bool IterateSingleGroup(ValueIterator_Constants.Element result, int limit)
        {
            lock (GROUP_OFFSETS_) {
                lock (GROUP_LENGTHS_) {
                    int index = m_name_.GetGroupLengths(m_groupIndex_,
                                                        GROUP_OFFSETS_, GROUP_LENGTHS_);
                    while (m_current_ < limit)
                    {
                        int    offset = IBM.ICU.Impl.UCharacterName.GetGroupOffset(m_current_);
                        String name   = m_name_.GetGroupName(index
                                                             + GROUP_OFFSETS_[offset], GROUP_LENGTHS_[offset],
                                                             m_choice_);
                        if ((name == null || name.Length == 0) &&
                            m_choice_ == IBM.ICU.Impl.UCharacterNameChoice_Constants.EXTENDED_CHAR_NAME)
                        {
                            name = m_name_.GetExtendedName(m_current_);
                        }
                        if (name != null && name.Length > 0)
                        {
                            result.integer   = m_current_;
                            result.value_ren = name;
                            return(false);
                        }
                        ++m_current_;
                    }
                }
            }
            return(true);
        }
Beispiel #3
0
        // private methods --------------------------------------------------

        /// <summary>
        /// Group name iteration, iterate all the names in the current 32-group and
        /// returns the first codepoint that has a valid name.
        /// </summary>
        /// <param name="result">Stores the result codepoint and name.</param>
        /// <param name="limit">Last codepoint + 1 in range to search.</param>
        /// <returns>false if a codepoint with a name is found in group and we can
        /// bail from further iteration, true to continue on with the
        /// iteration.</returns>
        private bool IterateSingleGroup(ValueEnumeratorElement result, int limit)
        {
            lock (GROUP_OFFSETS_) // ICU4N: Removed unnecessary redundant lock
            {
                int index = m_name_.GetGroupLengths(m_groupIndex_, GROUP_OFFSETS_,
                                                    GROUP_LENGTHS_);
                while (m_current_ < limit)
                {
                    int    offset = UCharacterName.GetGroupOffset(m_current_);
                    string name   = m_name_.GetGroupName(
                        index + GROUP_OFFSETS_[offset],
                        GROUP_LENGTHS_[offset], (UCharacterNameChoice)m_choice_);
                    if (string.IsNullOrEmpty(name) &&
                        m_choice_ == (int)UCharacterNameChoice.ExtendedCharName)
                    {
                        name = m_name_.GetExtendedName(m_current_);
                    }
                    if (!string.IsNullOrEmpty(name))
                    {
                        result.Integer = m_current_;
                        result.Value   = name;
                        return(false);
                    }
                    ++m_current_;
                }
            }
            return(true);
        }