Пример #1
0
        public void GetContent(CompilerContext context, ParseTreeNode parseNode)
        {
            if (parseNode.HasChildNodes())
            {

                if (parseNode.ChildNodes.Count >= 3)
                {
                    IBaseEdge ListOfDefaults;
                    var firstListObject = GraphDBTypeMapper.GetBaseObjectFromCSharpType(parseNode.ChildNodes[2].ChildNodes[0].Token.Value);

                    if (parseNode.ChildNodes[1].Token.Text.ToUpper() == DBConstants.SETOF)
                    {
                        ListOfDefaults = new EdgeTypeSetOfBaseObjects();
                    }

                    else if (parseNode.ChildNodes[1].Token.Text.ToUpper() == DBConstants.LISTOF)
                    {
                        ListOfDefaults = new EdgeTypeListOfBaseObjects();
                    }

                    else
                    {
                        throw new GraphDBException(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                    }

                    ListOfDefaults.AddRange(parseNode.ChildNodes[2].ChildNodes.Select(item => CheckTypeOfItems(item.Token.Value, firstListObject)));

                    Value = ListOfDefaults;
                }
                else
                {

                    var baseObject = GraphDBTypeMapper.GetBaseObjectFromCSharpType(parseNode.ChildNodes[1].Token.Value);
                    Value = (IObject)baseObject;
                }

            }

            else
            {
                Value = null;
            }
        }
Пример #2
0
        private object Deserialize(ref SerializationReader mySerializationReader, EdgeTypeSetOfBaseObjects myValue)
        {
            var count = mySerializationReader.ReadUInt32();
            myValue._Objects = new HashSet<ADBBaseObject>();
            for (UInt32 i = 0; i < count; i++)
            {
                myValue._Objects.Add((ADBBaseObject)mySerializationReader.ReadObject());
            }

            CalcEstimatedSize(myValue);

            return myValue;
        }
Пример #3
0
 private void Serialize(ref SerializationWriter mySerializationWriter, EdgeTypeSetOfBaseObjects myValue)
 {
     mySerializationWriter.WriteUInt32((UInt32)myValue._Objects.Count);
     foreach (var obj in myValue._Objects)
     {
         mySerializationWriter.WriteObject(obj);
     }
 }
Пример #4
0
        private void CalcEstimatedSize(EdgeTypeSetOfBaseObjects myTypeAttribute)
        {
            //_Objects + base size
            _estimatedSize = base.GetBaseSize();

            if (_Objects != null)
            {
                _estimatedSize += EstimatedSizeConstants.HashSet;

                foreach (var aADBBaseObject in _Objects)
                {
                    //key
                    _estimatedSize += aADBBaseObject.GetEstimatedSize();
                }
            }
        }