예제 #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);
         }
     });
 }
예제 #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);
        }
예제 #3
0
        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);
                }
            }
        }
예제 #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);
        }
예제 #5
0
 public void Resolve(RegionNode node)
 {
     this.parent.Write(node, writer);
 }
예제 #6
0
 public void Resolve(RegionNode node)
 {
     this.Result = this.traverser.TraverseRegion(node);
 }
 public void Resolve(RegionNode region)
 {
     this.Result = No.IsoCodes;
 }
예제 #8
0
 public void Resolve(RegionNode node)
 {
     this.Result = this.copier.Copy(node);
 }