Inheritance: RelNode
示例#1
0
        private Dictionary <uint, Node> ReadNodes(OsiReader reader)
        {
            var nodes = new Dictionary <uint, Node>();
            var count = reader.ReadUInt32();

            while (count-- > 0)
            {
                Node node   = null;
                var  type   = reader.ReadByte();
                var  nodeId = reader.ReadUInt32();
                switch ((Node.Type)type)
                {
                case Node.Type.Database:
                    node = new DatabaseNode();
                    break;

                case Node.Type.Proc:
                    node = new ProcNode();
                    break;

                case Node.Type.DivQuery:
                    node = new DivQueryNode();
                    break;

                case Node.Type.InternalQuery:
                    node = new InternalQueryNode();
                    break;

                case Node.Type.And:
                    node = new AndNode();
                    break;

                case Node.Type.NotAnd:
                    node = new NotAndNode();
                    break;

                case Node.Type.RelOp:
                    node = new RelOpNode();
                    break;

                case Node.Type.Rule:
                    node = new RuleNode();
                    break;

                case Node.Type.UserQuery:
                    node = new UserQueryNode();
                    break;

                default:
                    throw new NotImplementedException("No serializer found for this node type");
                }

                node.Read(reader);
                nodes.Add(nodeId, node);
            }

            return(nodes);
        }
示例#2
0
 public void Visit(RelOpNode node)
 {
     Visit(node as RelNode);
     writer.WritePropertyName("op");
     writer.WriteValue(node.RelOp.ToString());
     writer.WritePropertyName("left");
     VisitVar(node.LeftValue);
     writer.WritePropertyName("leftIndex");
     writer.WriteValue(node.LeftValueIndex);
     writer.WritePropertyName("right");
     VisitVar(node.RightValue);
     writer.WritePropertyName("rightIndex");
     writer.WriteValue(node.RightValueIndex);
 }
示例#3
0
文件: Story.cs 项目: Norbyte/lslib
        private Dictionary<uint, Node> ReadNodes(OsiReader reader)
        {
            var nodes = new Dictionary<uint, Node>();
            var count = reader.ReadUInt32();
            while (count-- > 0)
            {
                Node node = null;
                var type = reader.ReadByte();
                var nodeId = reader.ReadUInt32();
                switch ((Node.Type)type)
                {
                    case Node.Type.Database:
                        node = new DatabaseNode();
                        break;

                    case Node.Type.Proc:
                        node = new ProcNode();
                        break;

                    case Node.Type.DivQuery:
                        node = new DivQueryNode();
                        break;

                    case Node.Type.InternalQuery:
                        node = new InternalQueryNode();
                        break;

                    case Node.Type.And:
                        node = new AndNode();
                        break;

                    case Node.Type.NotAnd:
                        node = new NotAndNode();
                        break;

                    case Node.Type.RelOp:
                        node = new RelOpNode();
                        break;

                    case Node.Type.Rule:
                        node = new RuleNode();
                        break;

                    case Node.Type.UserQuery:
                        node = new UserQueryNode();
                        break;

                    default:
                        throw new NotImplementedException("No serializer found for this node type");
                }

                node.Read(reader);
                nodes.Add(nodeId, node);
            }

            return nodes;
        }