Esempio n. 1
0
        private static Attribute ExtractAttr(AttrInfo [] infos)
        {
            Value val = null;
            Attribute attr = new Attribute();
            attr.attributeID = int.Parse(infos[0].attrId);
            attr.Value = new ValTypeCollection();

            AttrInfo info;
            int cnt = infos.Length;
            for (int i = 0; i < cnt; i ++)
            {
                info = infos[i];
                if (info.typeId == AttributeTypes.ATTR_ID)
                {
                    val = new Value();
                    val.ValueID = int.Parse(info.val);
                    attr.Value.Add(val);
                }
                else if (info.typeId == AttributeTypes.ATTR_IDS)
                {
                    string [] ss = info.val.Split(SEPS);
                    for (int j = 0; j < ss.Length; j++)
                    {
                        val = new Value();
                        val.ValueID = int.Parse(ss[j]);
                        attr.Value.Add(val);
                    }
                }
                else
                {
                    val = new Value();
                    val.ValueLiteral = info.val;
                    attr.Value.Add(val);
                }
            }

            return attr;
        }
Esempio n. 2
0
        private static Attribute ExtractAttr2(AttrInfo info1, AttrInfo info2)
        {
            Attribute attr = new Attribute();
            attr.Value = new ValTypeCollection();
            attr.attributeID = int.Parse(info1.attrId);
            attr.Type = info1.typeId;

            Value val = new Value();
            val.ValueID = int.Parse(info1.val);
            val.ValueLiteral = info2.val;
            attr.Value.Add(val);

            return attr;
        }
Esempio n. 3
0
        private static Attribute ExtractAttr(AttrInfo info)
        {
            Value val = null;
            Attribute attr = new Attribute();
            attr.attributeID = int.Parse(info.attrId);
            attr.Type = info.typeId;
            attr.Value = new ValTypeCollection();

            ValueTypes valType = AttrToValType(info.typeId);

            if (info.typeId == AttributeTypes.ATTR_ID)
            {
                val = new Value(valType);
                val.ValueID = int.Parse(info.val);
                attr.Value.Add(val);

                /*
                if (info.val.Equals("-10"))
                {
                    attr.SType = -1;
                }
                */
            }
            else if (info.typeId == AttributeTypes.ATTR_IDS)
            {
                string [] ss = info.val.Split(SEPS);
                for (int i = 0; i < ss.Length; i++)
                {
                    val = new Value(valType);
                    val.ValueID = int.Parse(ss[i]);
                    attr.Value.Add(val);
                }
                /*
                if (info.val.IndexOf("-10") > -1)
                {
                    attr.SType = -1;
                }
                */
            }
            else
            {
                val = new Value(valType);
                val.ValueLiteral = info.val;
                attr.Value.Add(val);
            }

            return attr;
        }