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); } }); }
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); } } }
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); }
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; }
public void Resolve(RegionNode node) { this.Result = this.copier.Copy(node); }