Skip to content

Commit 13c81c7

Browse files
authored
Remove TimelineEnumerator/TimelineTreeEnumerator dead code (#9858)
1 parent 4f274d5 commit 13c81c7

File tree

2 files changed

+0
-298
lines changed

2 files changed

+0
-298
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Animation/Subtree.cs

Lines changed: 0 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -267,151 +267,4 @@ internal Clock Current
267267

268268
#endregion // Data
269269
}
270-
271-
/// <summary>
272-
/// An object that enumerates the timelines of a tree of Timeline
273-
/// objects.
274-
/// </summary>
275-
internal struct TimelineTreeEnumerator
276-
{
277-
#region Constructor
278-
/// <summary>
279-
/// Creates an enumerator that iterates over a subtree of timelines
280-
/// in prefix order.
281-
/// </summary>
282-
/// <param name="root">
283-
/// The timeline that is the root of the subtree to enumerate.
284-
/// </param>
285-
/// <param name="processRoot">
286-
/// True to include the root in the enumeration, false otherwise.
287-
/// </param>
288-
internal TimelineTreeEnumerator(Timeline root, bool processRoot)
289-
{
290-
_rootTimeline = root;
291-
_flags = processRoot ? (SubtreeFlag.Reset | SubtreeFlag.ProcessRoot) : SubtreeFlag.Reset;
292-
293-
// Start with stacks of capacity 10. That's relatively small, yet
294-
// it covers very large trees without reallocation of stack data.
295-
// Note that given the way we use the stacks we need one less entry
296-
// for indices than for timelines, as we don't care what the index
297-
// of the root timeline is.
298-
_indexStack = new Stack(9);
299-
_timelineStack = new Stack<Timeline>(10);
300-
}
301-
#endregion // Constructor
302-
303-
#region Methods
304-
305-
/// <summary>
306-
/// Causes the enumerator to not enumerate the timelines in the subtree rooted
307-
/// at the current timeline.
308-
/// </summary>
309-
internal void SkipSubtree()
310-
{
311-
_flags |= SubtreeFlag.SkipSubtree;
312-
}
313-
314-
/// <summary>
315-
/// Advances the enumerator to the next element of the collection.
316-
/// </summary>
317-
/// <returns>
318-
/// true if the enumerator was successfully advanced to the next element,
319-
/// false if the enumerator has passed the end of the collection.
320-
/// </returns>
321-
public bool MoveNext()
322-
{
323-
TimelineCollection children;
324-
325-
// Get the iteration started in the right place, if we are just starting
326-
if ((_flags & SubtreeFlag.Reset) != 0)
327-
{
328-
// The reset flag takes effect only once
329-
_flags &= ~SubtreeFlag.Reset;
330-
331-
// We are just getting started. The first timeline is the root
332-
_timelineStack.Push(_rootTimeline);
333-
334-
// If we are not supposed to return the root, simply skip it
335-
if ((_flags & SubtreeFlag.ProcessRoot) == 0)
336-
{
337-
MoveNext();
338-
}
339-
}
340-
else if (_timelineStack.Count > 0)
341-
{
342-
// Only TimelineGroup can have children
343-
TimelineGroup timelineGroup = _timelineStack.Peek() as TimelineGroup;
344-
345-
// The next timeline is possibly the first child of the current timeline
346-
// If we have children move to the first one, unless we were
347-
// asked to skip the subtree
348-
if ( ((_flags & SubtreeFlag.SkipSubtree) == 0)
349-
&& timelineGroup != null
350-
&& (children = timelineGroup.Children) != null
351-
&& children.Count > 0
352-
)
353-
{
354-
_timelineStack.Push(children[0]);
355-
_indexStack.Push((int)0);
356-
}
357-
else
358-
{
359-
// The skip subtree flag takes effect only once
360-
_flags &= ~SubtreeFlag.SkipSubtree;
361-
362-
// Move to the first ancestor that has unvisited children,
363-
// then move to the first unvisited child. If we get to
364-
// the root it means we are done.
365-
_timelineStack.Pop();
366-
while (_timelineStack.Count > 0)
367-
{
368-
timelineGroup = _timelineStack.Peek() as TimelineGroup;
369-
370-
// This has to be non-null since we already went down the tree
371-
children = timelineGroup.Children;
372-
373-
int index = (int)_indexStack.Pop() + 1;
374-
375-
if (index < children.Count)
376-
{
377-
// Move to the next child, and we are done
378-
_timelineStack.Push(children[index]);
379-
_indexStack.Push(index);
380-
break;
381-
}
382-
383-
_timelineStack.Pop();
384-
}
385-
}
386-
}
387-
388-
return _timelineStack.Count > 0;
389-
}
390-
391-
#endregion // Methods
392-
393-
#region Properties
394-
395-
/// <summary>
396-
/// Gets the current element in the collection.
397-
/// </summary>
398-
internal Timeline Current
399-
{
400-
get
401-
{
402-
return _timelineStack.Peek();
403-
}
404-
}
405-
406-
#endregion // Properties
407-
408-
#region Data
409-
410-
private Timeline _rootTimeline;
411-
private SubtreeFlag _flags;
412-
private Stack _indexStack;
413-
private Stack<Timeline> _timelineStack;
414-
415-
#endregion // Data
416-
}
417270
}

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Animation/TimelineEnumerator.cs

Lines changed: 0 additions & 151 deletions
This file was deleted.

0 commit comments

Comments
 (0)