예제 #1
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = string.Empty;

            if (this.Ctx.Corpus.blockDeclaredPathChanges == false)
            {
                path = this.DeclaredPath;
                if (string.IsNullOrEmpty(path))
                {
                    path = pathFrom + "operationCombineAttributes";
                    this.DeclaredPath = path;
                }
            }

            if (preChildren?.Invoke(this, path) == true)
            {
                return(false);
            }

            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }

            return(false);
        }
예제 #2
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = string.Empty;

            if (this.Ctx.Corpus.blockDeclaredPathChanges == false)
            {
                path = this.DeclaredPath;
                if (string.IsNullOrEmpty(path))
                {
                    path = pathFrom; // name of arg is forced down from trait ref. you get what you get and you don't throw a fit.
                    this.DeclaredPath = path;
                }
            }
            //trackVisits(path);

            if (preChildren != null && preChildren.Invoke(this, path))
            {
                return(false);
            }
            if (this.Value != null)
            {
                if (this.Value is CdmObject valueAsJObject)
                {
                    if (valueAsJObject.Visit($"{path}/value/", preChildren, postChildren))
                    {
                        return(true);
                    }
                }
            }
            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }
            return(false);
        }
예제 #3
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = this.UpdateDeclaredPath(pathFrom);

            if (preChildren?.Invoke(this, path) == true)
            {
                return(false);
            }

            if (this.TraitsToAdd != null && CdmObjectBase.VisitList(this.TraitsToAdd, $"{path}/traitsToAdd/", preChildren, postChildren))
            {
                return(true);
            }

            if (this.TraitsToRemove != null && CdmObjectBase.VisitList(this.TraitsToRemove, $"{path}/traitsToRemove/", preChildren, postChildren))
            {
                return(true);
            }

            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }

            return(false);
        }
예제 #4
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = string.Empty;

            if (this.Ctx.Corpus.blockDeclaredPathChanges == false)
            {
                path = this.DeclaredPath;
                if (string.IsNullOrEmpty(path))
                {
                    path = pathFrom + $"operationReplaceAsForeignKey";
                    this.DeclaredPath = path;
                }
            }

            if (preChildren != null && preChildren.Invoke(this, path))
            {
                return(false);
            }

            if (this.ReplaceWith != null)
            {
                if (this.ReplaceWith.Visit(pathFrom + "foreignKeyAttribute/", preChildren, postChildren))
                {
                    return(true);
                }
            }

            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }

            return(false);
        }
예제 #5
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = string.Empty;

            if (this.Ctx.Corpus.blockDeclaredPathChanges == false)
            {
                path = this.DeclaredPath;
                if (string.IsNullOrEmpty(path))
                {
                    path = pathFrom + "projection";
                    this.DeclaredPath = path;
                }
            }

            if (preChildren?.Invoke(this, path) == true)
            {
                return(false);
            }

            if (this.Source != null)
            {
                if (this.Source.Visit(path + "/source/", preChildren, postChildren))
                {
                    return(true);
                }
            }

            bool result = false;

            if (this.Operations != null && this.Operations.Count > 0)
            {
                // since this.Operations.VisitList results is non-unique attribute context paths if there are 2 or more operations of the same type.
                // e.g. with composite keys
                // the solution is to add a unique identifier to the path by adding the operation index or opIdx
                for (int opIndex = 0; opIndex < this.Operations.Count; opIndex++)
                {
                    this.Operations[opIndex].Index = opIndex + 1;
                    if ((this.Operations.AllItems[opIndex] != null) &&
                        (this.Operations.AllItems[opIndex].Visit($"{path}/operation/index{opIndex + 1}/", preChildren, postChildren)))
                    {
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
                if (result)
                {
                    return(true);
                }
            }

            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }

            return(false);
        }
예제 #6
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = this.DeclaredPath;

            if (string.IsNullOrEmpty(path))
            {
                path = pathFrom + this.Name;
                this.DeclaredPath = path;
            }
            //trackVisits(path);

            if (preChildren?.Invoke(this, path) == true)
            {
                return(false);
            }
            if (this.DataType?.Visit(path + "/dataType/", preChildren, postChildren) == true)
            {
                return(true);
            }
            if (this.AttributeContext?.Visit(path + "/attributeContext/", preChildren, postChildren) == true)
            {
                return(true);
            }
            if (this.VisitAtt(path, preChildren, postChildren))
            {
                return(true);
            }
            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }
            return(false);
        }
예제 #7
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            // name of arg is forced down from trait ref. you get what you get and you don't throw a fit.
            string path = pathFrom;

            //trackVisits(path);

            if (preChildren != null && preChildren.Invoke(this, path))
            {
                return(false);
            }
            if (this.Value != null)
            {
                if (this.Value is CdmObject valueAsJObject)
                {
                    if (valueAsJObject.Visit($"{path}/value/", preChildren, postChildren))
                    {
                        return(true);
                    }
                }
            }
            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }
            return(false);
        }
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = string.Empty;
            if (this.Ctx.Corpus.blockDeclaredPathChanges == false)
            {
                path = this.DeclaredPath;
                if (string.IsNullOrEmpty(path))
                {
                    path = pathFrom + this.Name;
                    this.DeclaredPath = path;
                }
            }
            //trackVisits(path);

            if (preChildren?.Invoke(this, path) == true)
                return false;
            if (this.DataType?.Visit(path + "/dataType/", preChildren, postChildren) == true)
                return true;
            if (this.AttributeContext?.Visit(path + "/attributeContext/", preChildren, postChildren) == true)
                return true;
            if (this.VisitAtt(path, preChildren, postChildren))
                return true;
            if (postChildren != null && postChildren.Invoke(this, path))
                return true;
            return false;
        }
예제 #9
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = this.DeclaredPath;

            if (string.IsNullOrEmpty(path))
            {
                path = pathFrom + this.DataTypeName;
                this.DeclaredPath = path;
            }
            //trackVisits(path);

            if (preChildren?.Invoke(this, path) == true)
            {
                return(false);
            }
            if (this.ExtendsDataType?.Visit(path + "/extendsDataType/", preChildren, postChildren) == true)
            {
                return(true);
            }
            if (this.VisitDef(path, preChildren, postChildren))
            {
                return(true);
            }
            if (postChildren?.Invoke(this, path) == true)
            {
                return(true);
            }
            return(false);
        }
예제 #10
0
 /// <inheritdoc />
 public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
 {
     if (preChildren != null && preChildren.Invoke(this, pathFrom))
     {
         return(false);
     }
     if (this.Definitions != null)
     {
         if (this.Definitions.VisitList(pathFrom, preChildren, postChildren))
         {
             return(true);
         }
     }
     if (this.Entities != null)
     {
         if (this.Entities.VisitList(pathFrom, preChildren, postChildren))
         {
             return(true);
         }
     }
     if (this.SubManifests != null)
     {
         if (this.SubManifests.VisitList(pathFrom, preChildren, postChildren))
         {
             return(true);
         }
     }
     if (postChildren != null && postChildren.Invoke(this, pathFrom))
     {
         return(true);
     }
     return(false);
 }
예제 #11
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = string.Empty;

            if (this.Ctx.Corpus.blockDeclaredPathChanges == false)
            {
                path = this.DeclaredPath;
                if (string.IsNullOrEmpty(path))
                {
                    path = pathFrom + this.Name;
                    this.DeclaredPath = path;
                }
            }
            //trackVisits(path);

            if (preChildren != null && preChildren.Invoke(this, path))
            {
                return(false);
            }

            if (this.Entity.Visit(path + "/entity/", preChildren, postChildren))
            {
                return(true);
            }
            if (this.VisitAtt(path, preChildren, postChildren))
            {
                return(true);
            }
            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }
            return(false);
        }
예제 #12
0
        internal override bool VisitRef(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            bool result = false;

            if (this.Arguments?.Count > 0)
            {
                // custom enumeration of args to force a path onto these things that just might not have a name
                int lItem = this.Arguments.Count;
                for (int iItem = 0; iItem < lItem; iItem++)
                {
                    CdmArgumentDefinition element = this.Arguments[iItem];
                    if (element != null)
                    {
                        string argPath = $"{pathFrom}/arguments/a{iItem}";
                        if (element.Visit(argPath, preChildren, postChildren))
                        {
                            result = true;
                            break;
                        }
                    }
                }
            }

            return(result);
        }
예제 #13
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            if (string.IsNullOrEmpty(this.DeclaredPath))
            {
                this.DeclaredPath = pathFrom + this.Name;
            }

            var path = this.DeclaredPath;

            if (preChildren != null && preChildren.Invoke(this, path))
            {
                return(false);
            }

            if (this.VisitDef(path, preChildren, postChildren))
            {
                return(true);
            }

            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }

            return(false);
        }
예제 #14
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = string.Empty;

            if (this.Ctx.Corpus.blockDeclaredPathChanges == false)
            {
                path = this.DeclaredPath;
                if (string.IsNullOrEmpty(path))
                {
                    path = pathFrom + (!string.IsNullOrEmpty(this.ConstantEntityName) ? this.ConstantEntityName : "(unspecified)");
                    this.DeclaredPath = path;
                }
            }
            //trackVisits(path);

            if (preChildren != null && preChildren.Invoke(this, path))
            {
                return(false);
            }
            if (this.EntityShape != null)
            {
                this.EntityShape.Owner = this;
                if (this.EntityShape.Visit(path + "/entityShape/", preChildren, postChildren))
                {
                    return(true);
                }
            }
            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }
            return(false);
        }
예제 #15
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = this.DeclaredPath;

            if (string.IsNullOrEmpty(path))
            {
                path = pathFrom + this.TraitName;
                this.DeclaredPath = path;
            }
            //trackVisits(path);

            if (preChildren != null && preChildren.Invoke(this, path))
            {
                return(false);
            }
            if (this.ExtendsTrait != null)
            {
                if (this.ExtendsTrait.Visit(path + "/extendsTrait/", preChildren, postChildren))
                {
                    return(true);
                }
            }
            if (this.Parameters != null)
            {
                if (this._hasParameters.VisitList(path + "/hasParameters/", preChildren, postChildren))
                {
                    return(true);
                }
            }
            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }
            return(false);
        }
예제 #16
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = this.UpdateDeclaredPath(pathFrom);

            //trackVisits(path);

            if (preChildren != null && preChildren.Invoke(this, path))
            {
                return(false);
            }
            if (this.DefaultValue != null)
            {
                Type defaultValueType = this.DefaultValue.GetType();

                if ((this.DefaultValue is CdmObject) && (this.DefaultValue as CdmObject).Visit(path + "/defaultValue/", preChildren, postChildren))
                {
                    return(true);
                }
            }

            if (this.DataTypeRef != null)
            {
                if (this.DataTypeRef.Visit(path + "/dataType/", preChildren, postChildren))
                {
                    return(true);
                }
            }
            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }
            return(false);
        }
예제 #17
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = this.UpdateDeclaredPath(pathFrom);

            //trackVisits(path);

            if (preChildren?.Invoke(this, path) == true)
            {
                return(false);
            }
            if (this.ExtendsPurpose != null)
            {
                this.ExtendsPurpose.Owner = this;
                if (this.ExtendsPurpose.Visit(path + "/extendsPurpose/", preChildren, postChildren))
                {
                    return(true);
                }
            }
            if (this.VisitDef(path, preChildren, postChildren))
            {
                return(true);
            }
            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }
            return(false);
        }
예제 #18
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = this.UpdateDeclaredPath(pathFrom);

            if (preChildren != null && preChildren.Invoke(this, path))
            {
                return(false);
            }
            if (this.ExtendsTrait != null)
            {
                this.ExtendsTrait.Owner = this;
                if (this.ExtendsTrait.Visit(path + "/extendsTrait/", preChildren, postChildren))
                {
                    return(true);
                }
            }
            if (this.Parameters != null)
            {
                if (this.Parameters.VisitList(path + "/hasParameters/", preChildren, postChildren))
                {
                    return(true);
                }
            }
            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }
            return(false);
        }
예제 #19
0
        internal bool VisitAtt(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            if (this.Purpose?.Visit(pathFrom + "/purpose/", preChildren, postChildren) == true)
            {
                return(true);
            }
            if (this.AppliedTraits != null)
            {
                if (this.AppliedTraits.VisitList(pathFrom + "/appliedTraits/", preChildren, postChildren))
                {
                    return(true);
                }
            }
            if (this.ResolutionGuidance != null)
            {
                if (this.ResolutionGuidance.Visit(pathFrom + "/resolutionGuidance/", preChildren, postChildren))
                {
                    return(true);
                }
            }

            if (this.VisitDef(pathFrom, preChildren, postChildren))
            {
                return(true);
            }
            return(false);
        }
예제 #20
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = string.Empty;

            if (this.Ctx.Corpus.blockDeclaredPathChanges == false)
            {
                path = this.DeclaredPath;
                if (path == null)
                {
                    path = pathFrom + (this.GetName() ?? "UNNAMED");
                    this.DeclaredPath = path;
                }
            }

            if (preChildren != null && preChildren.Invoke(this, path))
            {
                return(false);
            }

            if (this.VisitDef(path, preChildren, postChildren))
            {
                return(true);
            }

            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(false);
            }
            return(false);
        }
예제 #21
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = string.Empty;

            if (this.Ctx.Corpus.blockDeclaredPathChanges == false)
            {
                if (string.IsNullOrEmpty(this.DeclaredPath))
                {
                    this.DeclaredPath = pathFrom + this.Name;
                }

                path = this.DeclaredPath;
            }
            if (preChildren != null && preChildren.Invoke(this, path))
            {
                return(false);
            }
            if (this.VisitDef(path, preChildren, postChildren))
            {
                return(true);
            }
            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }

            return(false);
        }
예제 #22
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = this.DeclaredPath;

            if (string.IsNullOrEmpty(path))
            {
                path = pathFrom + (this.Value != null ? "value/" : "");
                this.DeclaredPath = path;
            }
            //trackVisits(path);

            if (preChildren != null && preChildren.Invoke(this, path))
            {
                return(false);
            }
            if (this.Value != null)
            {
                Type valueType = this.Value.GetType();
                if (this.Value is CdmObject valueAsJObject)
                {
                    if (valueAsJObject.Visit(path, preChildren, postChildren))
                    {
                        return(true);
                    }
                }
            }
            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }
            return(false);
        }
예제 #23
0
 internal override bool VisitRef(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
 {
     if (this.Arguments != null)
     {
         if (this.Arguments.VisitList(pathFrom + "/arguments/", preChildren, postChildren))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #24
0
 internal bool VisitDef(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
 {
     if (this.ExhibitsTraits != null)
     {
         if (this.ExhibitsTraits.VisitList(pathFrom + "/exhibitsTraits/", preChildren, postChildren))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #25
0
 /// <inheritdoc />
 public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
 {
     if (preChildren != null && preChildren.Invoke(this, pathFrom))
     {
         return(false);
     }
     if (postChildren != null && postChildren.Invoke(this, pathFrom))
     {
         return(true);
     }
     return(false);
 }
예제 #26
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = this.UpdateDeclaredPath(pathFrom);

            if (preChildren != null && preChildren.Invoke(this, path))
            {
                return(false);
            }

            if (this.DataPartitions != null)
            {
                if (this.DataPartitions.VisitList(path + "/dataPartitions/", preChildren, postChildren))
                {
                    return(true);
                }
            }

            if (this.DataPartitionPatterns != null)
            {
                if (this.DataPartitionPatterns.VisitList(path + "/dataPartitionPatterns/", preChildren, postChildren))
                {
                    return(true);
                }
            }

            if (this.IncrementalPartitions != null)
            {
                if (this.IncrementalPartitions.VisitList(path + "/incrementalPartitions/", preChildren, postChildren))
                {
                    return(true);
                }
            }

            if (this.IncrementalPartitionPatterns != null)
            {
                if (this.IncrementalPartitionPatterns.VisitList(path + "/incrementalPartitionPatterns/", preChildren, postChildren))
                {
                    return(true);
                }
            }

            if (this.VisitDef(path, preChildren, postChildren))
            {
                return(true);
            }

            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }
            return(false);
        }
예제 #27
0
파일: QuadTree.cs 프로젝트: dfengwji/unity
        public QuadTree VisitAfter(VisitCallback callback)
        {
            Queue <Quad> quads = new Queue <Quad>(10);
            Queue <Quad> next  = new Queue <Quad>(10);

            if (root != null)
            {
                quads.Enqueue(new Quad(root, tlX, tlY, brX, brY));
            }

            Quad     q;
            TreeNode child;

            while (quads.Count > 0)
            {
                q = quads.Dequeue();
                TreeNode node = q.node;
                if (!node.IsLeaf())
                {
                    double x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1;
                    double xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
                    if ((child = node.quadrants[0]) != null)
                    {
                        quads.Enqueue(new Quad(child, x0, y0, xm, ym));
                    }
                    if ((child = node.quadrants[1]) != null)
                    {
                        quads.Enqueue(new Quad(child, xm, y0, x1, ym));
                    }
                    if ((child = node.quadrants[2]) != null)
                    {
                        quads.Enqueue(new Quad(child, x0, ym, xm, y1));
                    }
                    if ((child = node.quadrants[3]) != null)
                    {
                        quads.Enqueue(new Quad(child, xm, ym, x1, y1));
                    }
                }
                next.Enqueue(q);
            }

            while (next.Count > 0)
            {
                q = next.Dequeue();
                callback.Invoke(q.node, q.x0, q.y0, q.x1, q.y1);
            }

            return(this);
        }
예제 #28
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = string.Empty;

            if (this.Ctx.Corpus.blockDeclaredPathChanges == false)
            {
                path = this.DeclaredPath;
                if (!string.IsNullOrEmpty(this.NamedReference))
                {
                    path = pathFrom + this.NamedReference;
                }
                else
                {
                    path = pathFrom;
                }
                this.DeclaredPath = path;
            }

            if (preChildren != null && preChildren.Invoke(this, path))
            {
                return(false);
            }
            if (this.ExplicitReference != null && string.IsNullOrEmpty(this.NamedReference))
            {
                if (this.ExplicitReference.Visit(path, preChildren, postChildren))
                {
                    return(true);
                }
            }
            if (this.VisitRef(path, preChildren, postChildren))
            {
                return(true);
            }

            if (this.AppliedTraits != null)
            {
                if (this.AppliedTraits.VisitList(path + "/appliedTraits/", preChildren, postChildren))
                {
                    return(true);
                }
            }

            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }
            return(false);
        }
예제 #29
0
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = this.UpdateDeclaredPath(pathFrom);

            if (preChildren?.Invoke(this, path) == true)
            {
                return(false);
            }

            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }

            return(false);
        }
        /// <inheritdoc />
        public override bool Visit(string pathFrom, VisitCallback preChildren, VisitCallback postChildren)
        {
            string path = string.Empty;

            if (this.Ctx.Corpus.blockDeclaredPathChanges == false)
            {
                path = this.DeclaredPath;
                if (path == null)
                {
                    path = pathFrom + this.EntityName;
                    this.DeclaredPath = path;
                }
            }

            if (preChildren != null && preChildren.Invoke(this, path))
            {
                return(false);
            }

            if (this.DataPartitions != null)
            {
                if (this.DataPartitions.VisitList(path + "/dataPartitions/", preChildren, postChildren))
                {
                    return(true);
                }
            }

            if (this.DataPartitionPatterns != null)
            {
                if (this.DataPartitionPatterns.VisitList(path + "/dataPartitionPatterns/", preChildren, postChildren))
                {
                    return(true);
                }
            }

            if (this.VisitDef(path, preChildren, postChildren))
            {
                return(true);
            }

            if (postChildren != null && postChildren.Invoke(this, path))
            {
                return(true);
            }
            return(false);
        }
예제 #31
0
 /// <summary>
 /// This method will visit each object once
 /// </summary>
 /// <param name="root">Pass in a collection or an entity</param>
 /// <param name="callback">Your callback method</param>
 /// <param name="userState">Pass in anything you like, it will be available to your callback method</param>
 /// <returns></returns>
 public static bool Visit(object root, VisitCallback callback, object userState)
 {
     return new tgVisitor(callback).Visit(root, userState);
 }
 private esVisitor(VisitCallback callback)
 {
     enterCallback = callback;
 }
 private esVisitor(VisitCallback enterCallback, VisitCallback exitCallback)
 {
     this.enterCallback = enterCallback;
     this.exitCallback = exitCallback;
 }
 /// <summary>
 /// This method will visit each object once
 /// </summary>
 /// <param name="root">Pass in a collection or an entity</param>
 /// <param name="callback">Your callback method</param>
 /// <returns></returns>
 public static bool Visit(object root, VisitCallback callback)
 {
     return new esVisitor(callback).Visit(root, (object)null);
 }
 /// <summary>
 /// This method will visit objects in a sandwich mode, EnterCallback, operate on children, ExitCallback.
 /// </summary>
 /// <param name="root">Pass in a collection or an entity</param>
 /// <param name="enterCallback">The enter callback method</param>
 /// <param name="exitCallback">The exit callback method</param>
 /// <returns></returns>
 public static bool Visit(object root, VisitCallback enterCallback, VisitCallback exitCallback)
 {
     return new esVisitor(enterCallback, exitCallback).Visit(root, (object)null);
 }
 /// <summary>
 /// This method will visit objects in a sandwich mode, EnterCallback, operate on children, ExitCallback.
 /// </summary>
 /// <param name="root">Pass in a collection or an entity</param>
 /// <param name="enterCallback">The enter callback method</param>
 /// <param name="exitCallback">The exit callback method</param>
 /// <param name="userState">Pass in anything you like, it will be available to your callback methods</param>
 /// <returns></returns>
 public static bool Visit(object root, VisitCallback enterCallback, VisitCallback exitCallback, object userState)
 {
     return new esVisitor(enterCallback, exitCallback).Visit(root, userState);
 }