Esempio n. 1
0
        internal void SetMorphoForms(List <MorphoFormNative> morphoForms)
        {
            if (morphoForms.Count != 0)
            {
                LinkedList <MorphoAttributeEnum> morphoAttributes = null;
                for (int i = 0, len = morphoForms.Count; i < len; i++)
                {
                    var morphoForm = morphoForms[i];

                    tempBufferHS.Add((IntPtr)morphoForm.Ending);

                    var endingUpperPtr = (IntPtr)morphoForm.EndingUpper;
                    if (!tempBufferDict.TryGetValue(endingUpperPtr, ref morphoAttributes))
                    {
                        morphoAttributes = PopLinkedList();
                        tempBufferDict.Add(endingUpperPtr, morphoAttributes);
                    }
                    var morphoAttribute = MorphoAttributePair.GetMorphoAttribute(this, morphoForm);
                    morphoAttributes.AddLast(morphoAttribute);
                }

                _morphoFormEndings = new char *[tempBufferHS.Count];
                fixed(char **morphoFormEndingsBase = _morphoFormEndings)
                {
                    var it = tempBufferHS.GetEnumerator();

                    for (var i = 0; it.MoveNext(); i++)
                    {
                        *(morphoFormEndingsBase + i) = (char *)it.Current;
                    }
                }

                tempBufferHS.Clear();

                _morphoFormEndingUpperAndMorphoAttributes = new MorphoFormEndingUpperAndMorphoAttribute[tempBufferDict.Count];

                var it2 = tempBufferDict.GetEnumerator();
                for (var i = 0; it2.MoveNext(); i++)
                {
                    _morphoFormEndingUpperAndMorphoAttributes[i] =
                        new MorphoFormEndingUpperAndMorphoAttribute(it2.Current_IntPtr, it2.Current_Value);
                    PushLinkedList(it2.Current_Value);
                }

                tempBufferDict.Clear();
            }
            else
            {
                _morphoFormEndings = EMPTY_ENDINGS;
                _morphoFormEndingUpperAndMorphoAttributes = EMPTY_MFUEMA;
            }
        }
        internal void SetMorphoForms(List <MorphoFormNative> morphoForms)
        {
            if (morphoForms.Count != 0)
            {
                //---_MorphoForms = morphoForms.ToArray();

                LinkedList <MorphoAttributeEnum> morphoAttributes = null;
                for (int i = 0, len = morphoForms.Count; i < len; i++)
                {
                    var morphoForm = morphoForms[i];

                    #region [.окончания морфо-форм.]
                    _TempBufferSet.Add((IntPtr)morphoForm.Ending);
                    #endregion

                    #region [.MorphoFormEndingUpper-&-MorphoAttribute.]
                    var endingUpperPtr = (IntPtr)morphoForm.EndingUpper;
                    if (!_TempBufferSetLiists.TryGetValue(endingUpperPtr, ref morphoAttributes))
                    {
                        morphoAttributes = PopLinkedList();
                        _TempBufferSetLiists.Add(endingUpperPtr, morphoAttributes);
                    }
                    var morphoAttribute = MorphoAttributePair.GetMorphoAttribute(this, morphoForm);
                    morphoAttributes.AddLast(morphoAttribute);
                    #endregion
                }

                #region [.окончания морфо-форм.]
                _MorphoFormEndings = new char *[_TempBufferSet.Count];
                fixed(char **morphoFormEndingsBase = _MorphoFormEndings)
                {
                    var it = _TempBufferSet.GetEnumerator();

                    for (var i = 0; it.MoveNext(); i++)
                    {
                        *(morphoFormEndingsBase + i) = (char *)it.Current;
                    }

                    #region commented. foreach.

                    /*var i = 0;
                     * foreach ( var intptr in tempBufferHS )
                     * {
                     *(morphoFormEndingsBase + i++) = (char*) intptr;
                     * }*/
                    #endregion
                }

                _TempBufferSet.Clear();
                #endregion

                #region [.MorphoFormEndingUpper-&-MorphoAttribute.]
                _MorphoFormEndingUpperAndMorphoAttributes = new MorphoFormEndingUpperAndMorphoAttribute[_TempBufferSetLiists.Count];

                var it2 = _TempBufferSetLiists.GetEnumerator();
                for (var i = 0; it2.MoveNext(); i++)
                {
                    _MorphoFormEndingUpperAndMorphoAttributes[i] = new MorphoFormEndingUpperAndMorphoAttribute(
                        it2.Current_IntPtr, it2.Current_Value);
                    PushLinkedList(it2.Current_Value);
                }
                #region commented

                /*
                 * var k = 0;
                 * foreach ( var p in tempBufferDict )
                 * {
                 *  _MorphoFormEndingUpperAndMorphoAttributes[ k++ ] = new MorphoFormEndingUpperAndMorphoAttribute( p.Key, p.Value.ToArray() );
                 *  PushLinkedList( p.Value );
                 * }
                 */
                #endregion

                _TempBufferSetLiists.Clear();
                #endregion
            }
            else
            {
                //_MorphoForms = EMPTY_MORPHOFORM;
                _MorphoFormEndings = EMPTY_ENDINGS;
                _MorphoFormEndingUpperAndMorphoAttributes = EMPTY_MFUEMA;
            }
        }