示例#1
0
        internal void Deserialize(Pullenti.Morph.Internal.ByteArrayWrapper str, ref int pos)
        {
            byte b = str.DeserializeByte(ref pos);

            Transitive = b != 0;
            int sh = str.DeserializeShort(ref pos);

            Questions = (Pullenti.Semantic.Utils.QuestionType)sh;
            sh        = str.DeserializeShort(ref pos);
            if (sh != 0)
            {
                string pr = str.DeserializeString(ref pos);
                Pullenti.Morph.MorphCase cas = new Pullenti.Morph.MorphCase();
                cas.Value = (short)sh;
                Agent     = new NextModelItem(pr, cas);
            }
            sh = str.DeserializeShort(ref pos);
            if (sh != 0)
            {
                string pr = str.DeserializeString(ref pos);
                Pullenti.Morph.MorphCase cas = new Pullenti.Morph.MorphCase();
                cas.Value = (short)sh;
                Pacient   = new NextModelItem(pr, cas);
            }
            sh = str.DeserializeShort(ref pos);
            if (sh != 0)
            {
                string pr = str.DeserializeString(ref pos);
                Pullenti.Morph.MorphCase cas = new Pullenti.Morph.MorphCase();
                cas.Value  = (short)sh;
                Instrument = new NextModelItem(pr, cas);
            }
            int cou = str.DeserializeShort(ref pos);

            for (; cou > 0; cou--)
            {
                string pref = str.DeserializeString(ref pos);
                if (pref == null)
                {
                    pref = "";
                }
                Pullenti.Morph.MorphCase cas = new Pullenti.Morph.MorphCase();
                sh        = str.DeserializeShort(ref pos);
                cas.Value = (short)sh;
                if (Nexts == null)
                {
                    Nexts = new Dictionary <string, Pullenti.Morph.MorphCase>();
                }
                Nexts.Add(pref, cas);
            }
        }
示例#2
0
 public NextModelItem(string prep, Pullenti.Morph.MorphCase cas, string spel = null, Pullenti.Semantic.Utils.QuestionType typ = Pullenti.Semantic.Utils.QuestionType.Undefined)
 {
     Preposition = prep;
     Case        = cas;
     Spelling    = spel;
     Question    = typ;
     if (spel != null)
     {
         return;
     }
     if (!string.IsNullOrEmpty(prep))
     {
         if (cas.IsGenitive)
         {
             Spelling = string.Format("{0} чего", prep.ToLower());
         }
         else if (cas.IsDative)
         {
             Spelling = string.Format("{0} чему", prep.ToLower());
         }
         else if (cas.IsAccusative)
         {
             Spelling = string.Format("{0} что", prep.ToLower());
         }
         else if (cas.IsInstrumental)
         {
             Spelling = string.Format("{0} чем", prep.ToLower());
         }
         else if (cas.IsPrepositional)
         {
             Spelling = string.Format("{0} чём", prep.ToLower());
         }
     }
     else
     {
         Preposition = "";
         if (cas.IsNominative)
         {
             Spelling = "кто";
         }
         else if (cas.IsGenitive)
         {
             Spelling = "чего";
         }
         else if (cas.IsDative)
         {
             Spelling = "чему";
         }
         else if (cas.IsAccusative)
         {
             Spelling = "что";
         }
         else if (cas.IsInstrumental)
         {
             Spelling = "чем";
         }
         else if (cas.IsPrepositional)
         {
             Spelling = "чём";
         }
     }
 }