internal void Deserialize(Stream stream) { m_Class = new Pullenti.Morph.MorphClass() { Value = Pullenti.Ner.Core.Internal.SerializerHelper.DeserializeShort(stream) }; m_Case = new Pullenti.Morph.MorphCase() { Value = Pullenti.Ner.Core.Internal.SerializerHelper.DeserializeShort(stream) }; m_Gender = (Pullenti.Morph.MorphGender)Pullenti.Ner.Core.Internal.SerializerHelper.DeserializeShort(stream); m_Number = (Pullenti.Morph.MorphNumber)Pullenti.Ner.Core.Internal.SerializerHelper.DeserializeShort(stream); m_Voice = (Pullenti.Morph.MorphVoice)Pullenti.Ner.Core.Internal.SerializerHelper.DeserializeShort(stream); m_Language = new Pullenti.Morph.MorphLang() { Value = Pullenti.Ner.Core.Internal.SerializerHelper.DeserializeShort(stream) }; int cou = Pullenti.Ner.Core.Internal.SerializerHelper.DeserializeInt(stream); m_Items = new List <Pullenti.Morph.MorphBaseInfo>(); for (int i = 0; i < cou; i++) { Pullenti.Morph.MorphBaseInfo it = this.DeserializeItem(stream); if (it != null) { m_Items.Add(it); } } m_NeedRecalc = false; }
void _recalc() { m_NeedRecalc = false; if (m_Items == null || m_Items.Count == 0) { return; } m_Class = new Pullenti.Morph.MorphClass(); m_Gender = Pullenti.Morph.MorphGender.Undefined; bool g = m_Gender == Pullenti.Morph.MorphGender.Undefined; m_Number = Pullenti.Morph.MorphNumber.Undefined; bool n = m_Number == Pullenti.Morph.MorphNumber.Undefined; m_Case = new Pullenti.Morph.MorphCase(); bool ca = m_Case.IsUndefined; bool la = m_Language == null || m_Language.IsUndefined; m_Voice = Pullenti.Morph.MorphVoice.Undefined; bool verbHasUndef = false; if (m_Items != null) { foreach (Pullenti.Morph.MorphBaseInfo it in m_Items) { m_Class.Value |= it.Class.Value; if (g) { m_Gender |= it.Gender; } if (ca) { m_Case |= it.Case; } if (n) { m_Number |= it.Number; } if (la) { m_Language.Value |= it.Language.Value; } if (it.Class.IsVerb) { if (it is Pullenti.Morph.MorphWordForm) { Pullenti.Morph.MorphVoice v = (it as Pullenti.Morph.MorphWordForm).Misc.Voice; if (v == Pullenti.Morph.MorphVoice.Undefined) { verbHasUndef = true; } else { m_Voice |= v; } } } } } if (verbHasUndef) { m_Voice = Pullenti.Morph.MorphVoice.Undefined; } }