Esempio n. 1
0
 public void Write(OtherNode node, XmlWriter writer)
 {
     writer.WriteElement("other", delegate
     {
         var residents = node.GetBasketCountries();
         foreach (var resident in residents)
         {
             this.WriteOnceResolved(resident, writer);
         }
     });
 }
Esempio n. 2
0
        public OtherNode Copy(OtherNode node)
        {
            var result          = new OtherNode();
            var basketCountries = node.GetBasketCountries();

            foreach (var basketCountry in basketCountries)
            {
                var copied = this.Copy(basketCountry);
                result.RegisterResident(copied);
            }
            return(result);
        }
        public IEnumerable <INode> TraverseOther(OtherNode otherNode)
        {
            yield return(otherNode);

            var residents = otherNode.GetBasketCountries();

            foreach (var resident in residents)
            {
                var nodes = this.TraverseOnceResolved(resident);
                foreach (var node in nodes)
                {
                    yield return(node);
                }
            }
        }
Esempio n. 4
0
        protected OtherNode ReadOtherNode(IElement element, BasketRepository basketRepository, CountryRepository countryRepository)
        {
            var result = new OtherNode();

            if (!element.IsAtomic)
            {
                var someElementOpt = element.TryLockOn(BasketCountryElementName);
                while (someElementOpt != null)
                {
                    var basketCountry = this.ReadBasketCountryNode(someElementOpt, basketRepository);
                    result.RegisterResident(basketCountry);
                    someElementOpt = someElementOpt.ReleaseAndTryLockOnNext(someElementOpt.Name);
                }
            }
            return(result);
        }
Esempio n. 5
0
        protected OtherNode ReadOtherNode(BasketRepository basketRepository, IElement element)
        {
            var expectedElementNames = new String[] { BasketCountryElementName, UnsavedBasketCountryElementName };
            var result = new OtherNode();

            if (!element.IsAtomic)
            {
                var someElementOpt = element.TryMultiLockOn(expectedElementNames);
                while (someElementOpt != null)
                {
                    IOtherNodeResident resident;
                    switch (someElementOpt.Name)
                    {
                    case BasketCountryElementName:
                    {
                        var basketCountry = this.ReadBasketCountryNode(basketRepository, someElementOpt);
                        resident = basketCountry;
                        break;
                    }

                    case UnsavedBasketCountryElementName:
                    {
                        var unsavedBasketCountry = this.ReadUnsavedBasketCountry(someElementOpt);
                        resident = unsavedBasketCountry;
                        break;
                    }

                    default: throw new ApplicationException("Unexpected element name: " + someElementOpt.Name);
                    }

                    result.RegisterResident(resident);
                    someElementOpt = someElementOpt.ReleaseAndTryMultiLockOnNext(someElementOpt.Name, expectedElementNames);
                }
            }
            return(result);
        }
Esempio n. 6
0
 public void Resolve(OtherNode node)
 {
     this.parent.Write(node, this.writer);
 }
 public void Resolve(OtherNode node)
 {
     this.Result = this.traverser.TraverseOther(node);
 }
 public void Resolve(OtherNode other)
 {
     this.Result = No.IsoCodes;
 }
Esempio n. 9
0
 public void Resolve(OtherNode node)
 {
     this.Result = this.copier.Copy(node);
 }