Esempio n. 1
0
        private void VisitComposite(CompositeParticle seq)
        {
            var  stack = new Stack <ParticleConstraint>(seq.Reverse());
            byte count = 0;

            while (stack.Count > 0)
            {
                var item = stack.Pop();

                if (item.ParticleType == ParticleType.Group && item is CompositeParticle group)
                {
                    foreach (var child in group)
                    {
                        stack.Push(child);
                    }
                }
                else
                {
                    _values.Push(ParticlePathItem.Create(seq, count));
                    count++;
                    Visit(item);
                    _values.Pop();
                }
            }
        }
Esempio n. 2
0
        private void Visit(ElementParticle element)
        {
            var newValues = new ParticlePathItem[_values.Count];

            _values.CopyTo(newValues, 0);
            Array.Reverse(newValues);

            var particlePath = ParticlePath.Create(newValues);

            _path.Add(new LookupItem(element.ElementType, particlePath));
        }