コード例 #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);
         }
     });
 }
コード例 #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);
        }
コード例 #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);
                }
            }
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #6
0
 public void Resolve(OtherNode node)
 {
     this.parent.Write(node, this.writer);
 }
コード例 #7
0
 public void Resolve(OtherNode node)
 {
     this.Result = this.traverser.TraverseOther(node);
 }
コード例 #8
0
 public void Resolve(OtherNode other)
 {
     this.Result = No.IsoCodes;
 }
コード例 #9
0
 public void Resolve(OtherNode node)
 {
     this.Result = this.copier.Copy(node);
 }