Пример #1
0
        public VowelCode GetCode()
        {
            var code = new VowelCode();

            if (this.Code.Length == 3)
            {
                code.Height    = int.Parse(this.Code[0].ToString());
                code.Frontness = int.Parse(this.Code[1].ToString());
                code.Roundness = int.Parse(this.Code[2].ToString());
            }
            else if (this.Code.Length == 4)
            {
                code.Height    = int.Parse(this.Code[0].ToString());
                code.Frontness = int.Parse(this.Code[1].ToString());
                code.Roundness = int.Parse(this.Code[2].ToString() + this.Code[3].ToString());
            }
            else
            {
                var n = this.Code.Length.ToString();

                throw new NotImplementedException("NIE PRZEWIDZIANO KODÓW SAMOGŁOSKOWYCH O DŁUGOŚCI "
                                                  + n
                                                  + ". UZUPEŁNIĆ METODĘ GetCode W KLASIE MODEL.");
            }

            return(code);
        }
Пример #2
0
        public static VowelCode CodeFromString(string code)
        {
            var res = new VowelCode();

            if (code.Length == 3)
            {
                res.Height    = int.Parse(code[0].ToString());
                res.Frontness = int.Parse(code[1].ToString());
                res.Roundness = int.Parse(code[2].ToString());
            }
            else if (code.Length == 4)
            {
                res.Height    = int.Parse(code[0].ToString());
                res.Frontness = int.Parse(code[1].ToString());
                res.Roundness = int.Parse(code[2].ToString() + code[3].ToString());
            }
            else
            {
                throw new NotImplementedException("NIE ZAIMPLEMENTOWANO KONWERSJI KODÓW SAMOGŁOSKOWYCH O DŁUGOŚCI INNEJ NIZ 3 I 4 W KLASIE VowelCode");
            }

            return(res);
        }