Esempio n. 1
0
 public void Write(RegionNode node, XmlWriter writer)
 {
     writer.WriteElement("region", delegate
     {
         writer.WriteAttribute("name", node.Name);
         var residents = node.GetResidents();
         foreach (var resident in residents)
         {
             this.WriteOnceResolved(resident, writer);
         }
     });
 }
Esempio n. 2
0
        public RegionNode Copy(RegionNode node)
        {
            var result    = new RegionNode(node.Name);
            var residents = node.GetResidents();

            foreach (var resident in residents)
            {
                var copied = this.CopyOnceResolved(resident);
                result.RegisterResident(resident);
            }
            return(result);
        }
        public IEnumerable <INode> TraverseRegion(RegionNode regionNode)
        {
            yield return(regionNode);

            var residents = regionNode.GetResidents();

            foreach (var resident in residents)
            {
                var nodes = this.TraverseOnceResolved(resident);
                foreach (var node in nodes)
                {
                    yield return(node);
                }
            }
        }
Esempio n. 4
0
        protected RegionNode ReadRegionNode(IElement element, BasketRepository basketRepository)
        {
            var name   = element.ReadAttributeAsNotEmptyString("name");
            var result = new RegionNode(name);

            var expectedElements = new String[] { RegionElementName, BasketCountryElementName, BasketRegionElementName };
            var someElementOpt   = element.TryMultiLockOn(expectedElements);

            while (someElementOpt != null)
            {
                IRegionNodeResident resident;
                switch (someElementOpt.Name)
                {
                case RegionElementName:
                {
                    resident = this.ReadRegionNode(someElementOpt, basketRepository);
                    break;
                }

                case BasketCountryElementName:
                {
                    resident = this.ReadBasketCountryNode(someElementOpt, basketRepository);
                    break;
                }

                case BasketRegionElementName:
                {
                    resident = this.ReadBasketRegionNode(someElementOpt, basketRepository);
                    break;
                }

                default:
                {
                    throw new ApplicationException();
                }
                }
                result.RegisterResident(resident);
                someElementOpt = someElementOpt.ReleaseAndTryMultiLockOnNext(someElementOpt.Name, expectedElements);
            }
            return(result);
        }
Esempio n. 5
0
 public void Resolve(RegionNode node)
 {
     this.parent.Write(node, writer);
 }
 public void Resolve(RegionNode node)
 {
     this.Result = this.traverser.TraverseRegion(node);
 }
 public void Resolve(RegionNode region)
 {
     this.Result = No.IsoCodes;
 }
Esempio n. 8
0
 public void Resolve(RegionNode node)
 {
     this.Result = this.copier.Copy(node);
 }