aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Data/Serialize/ElementCollection.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/WixToolset.Data/Serialize/ElementCollection.cs54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/WixToolset.Data/Serialize/ElementCollection.cs b/src/WixToolset.Data/Serialize/ElementCollection.cs
index 1d64c5eb..c2236627 100644
--- a/src/WixToolset.Data/Serialize/ElementCollection.cs
+++ b/src/WixToolset.Data/Serialize/ElementCollection.cs
@@ -429,13 +429,13 @@ namespace WixToolset.Data.Serialize
429 { 429 {
430 if (this.collectionStack != null && this.collectionStack.Count > 0) 430 if (this.collectionStack != null && this.collectionStack.Count > 0)
431 { 431 {
432 CollectionTuple tuple = (CollectionTuple)this.collectionStack.Peek(); 432 CollectionSymbol symbol = (CollectionSymbol)this.collectionStack.Peek();
433 object container = tuple.Collection.items[tuple.ContainerIndex]; 433 object container = symbol.Collection.items[symbol.ContainerIndex];
434 434
435 CollectionItem collectionItem = container as CollectionItem; 435 CollectionItem collectionItem = container as CollectionItem;
436 if (collectionItem != null) 436 if (collectionItem != null)
437 { 437 {
438 return collectionItem.Elements[tuple.ItemIndex]; 438 return collectionItem.Elements[symbol.ItemIndex];
439 } 439 }
440 440
441 throw new InvalidOperationException(String.Format( 441 throw new InvalidOperationException(String.Format(
@@ -474,12 +474,12 @@ namespace WixToolset.Data.Serialize
474 } 474 }
475 475
476 this.collectionStack = new Stack(); 476 this.collectionStack = new Stack();
477 this.collectionStack.Push(new CollectionTuple(this.collection)); 477 this.collectionStack.Push(new CollectionSymbol(this.collection));
478 } 478 }
479 479
480 CollectionTuple tuple = (CollectionTuple)this.collectionStack.Peek(); 480 CollectionSymbol symbol = (CollectionSymbol)this.collectionStack.Peek();
481 481
482 if (this.FindNext(tuple)) 482 if (this.FindNext(symbol))
483 { 483 {
484 return true; 484 return true;
485 } 485 }
@@ -507,50 +507,50 @@ namespace WixToolset.Data.Serialize
507 elementCollection.Count)); 507 elementCollection.Count));
508 } 508 }
509 509
510 CollectionTuple tuple = new CollectionTuple(elementCollection); 510 CollectionSymbol symbol = new CollectionSymbol(elementCollection);
511 this.collectionStack.Push(tuple); 511 this.collectionStack.Push(symbol);
512 this.FindNext(tuple); 512 this.FindNext(symbol);
513 } 513 }
514 514
515 /// <summary> 515 /// <summary>
516 /// Finds the next item from a given tuple. 516 /// Finds the next item from a given symbol.
517 /// </summary> 517 /// </summary>
518 /// <param name="tuple">The tuple to start looking from.</param> 518 /// <param name="symbol">The symbol to start looking from.</param>
519 /// <returns>True if a next element is found, false otherwise.</returns> 519 /// <returns>True if a next element is found, false otherwise.</returns>
520 private bool FindNext(CollectionTuple tuple) 520 private bool FindNext(CollectionSymbol symbol)
521 { 521 {
522 object container = tuple.Collection.items[tuple.ContainerIndex]; 522 object container = symbol.Collection.items[symbol.ContainerIndex];
523 523
524 CollectionItem collectionItem = container as CollectionItem; 524 CollectionItem collectionItem = container as CollectionItem;
525 if (collectionItem != null) 525 if (collectionItem != null)
526 { 526 {
527 if (tuple.ItemIndex + 1 < collectionItem.Elements.Count) 527 if (symbol.ItemIndex + 1 < collectionItem.Elements.Count)
528 { 528 {
529 tuple.ItemIndex++; 529 symbol.ItemIndex++;
530 return true; 530 return true;
531 } 531 }
532 } 532 }
533 533
534 ElementCollection elementCollection = container as ElementCollection; 534 ElementCollection elementCollection = container as ElementCollection;
535 if (elementCollection != null && elementCollection.Count > 0 && tuple.ItemIndex == -1) 535 if (elementCollection != null && elementCollection.Count > 0 && symbol.ItemIndex == -1)
536 { 536 {
537 tuple.ItemIndex++; 537 symbol.ItemIndex++;
538 this.PushCollection(elementCollection); 538 this.PushCollection(elementCollection);
539 return true; 539 return true;
540 } 540 }
541 541
542 tuple.ItemIndex = 0; 542 symbol.ItemIndex = 0;
543 543
544 for (int i = tuple.ContainerIndex + 1; i < tuple.Collection.items.Count; ++i) 544 for (int i = symbol.ContainerIndex + 1; i < symbol.Collection.items.Count; ++i)
545 { 545 {
546 object nestedContainer = tuple.Collection.items[i]; 546 object nestedContainer = symbol.Collection.items[i];
547 547
548 CollectionItem nestedCollectionItem = nestedContainer as CollectionItem; 548 CollectionItem nestedCollectionItem = nestedContainer as CollectionItem;
549 if (nestedCollectionItem != null) 549 if (nestedCollectionItem != null)
550 { 550 {
551 if (nestedCollectionItem.Elements.Count > 0) 551 if (nestedCollectionItem.Elements.Count > 0)
552 { 552 {
553 tuple.ContainerIndex = i; 553 symbol.ContainerIndex = i;
554 return true; 554 return true;
555 } 555 }
556 } 556 }
@@ -558,7 +558,7 @@ namespace WixToolset.Data.Serialize
558 ElementCollection nestedElementCollection = nestedContainer as ElementCollection; 558 ElementCollection nestedElementCollection = nestedContainer as ElementCollection;
559 if (nestedElementCollection != null && nestedElementCollection.Count > 0) 559 if (nestedElementCollection != null && nestedElementCollection.Count > 0)
560 { 560 {
561 tuple.ContainerIndex = i; 561 symbol.ContainerIndex = i;
562 this.PushCollection(nestedElementCollection); 562 this.PushCollection(nestedElementCollection);
563 return true; 563 return true;
564 } 564 }
@@ -571,23 +571,23 @@ namespace WixToolset.Data.Serialize
571 /// Class representing a single point in the collection. Consists of an ElementCollection, 571 /// Class representing a single point in the collection. Consists of an ElementCollection,
572 /// a container index, and an index into the container. 572 /// a container index, and an index into the container.
573 /// </summary> 573 /// </summary>
574 private class CollectionTuple 574 private class CollectionSymbol
575 { 575 {
576 private ElementCollection collection; 576 private ElementCollection collection;
577 private int containerIndex; 577 private int containerIndex;
578 private int itemIndex = -1; 578 private int itemIndex = -1;
579 579
580 /// <summary> 580 /// <summary>
581 /// Creates a new CollectionTuple. 581 /// Creates a new CollectionSymbol.
582 /// </summary> 582 /// </summary>
583 /// <param name="collection">The collection for the tuple.</param> 583 /// <param name="collection">The collection for the symbol.</param>
584 public CollectionTuple(ElementCollection collection) 584 public CollectionSymbol(ElementCollection collection)
585 { 585 {
586 this.collection = collection; 586 this.collection = collection;
587 } 587 }
588 588
589 /// <summary> 589 /// <summary>
590 /// Gets the collection for the tuple. 590 /// Gets the collection for the symbol.
591 /// </summary> 591 /// </summary>
592 public ElementCollection Collection 592 public ElementCollection Collection
593 { 593 {