Exemplo 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);
         }
     });
 }
Exemplo 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);
        }
Exemplo n.º 3
0
        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);
                }
            }
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo n.º 6
0
 public void Resolve(OtherNode node)
 {
     this.parent.Write(node, this.writer);
 }
Exemplo n.º 7
0
 public void Resolve(OtherNode node)
 {
     this.Result = this.traverser.TraverseOther(node);
 }
 public void Resolve(OtherNode other)
 {
     this.Result = No.IsoCodes;
 }
Exemplo n.º 9
0
 public void Resolve(OtherNode node)
 {
     this.Result = this.copier.Copy(node);
 }