using System.Collections.Generic;
namespace QFSW.QC.Actions
{
///
/// Combines a sequence of actions into a single action.
///
public class Composite : ICommandAction
{
private ActionContext _context;
private readonly IEnumerator _actions;
public bool IsFinished => _actions.Execute(_context) == ActionState.Complete;
public bool StartsIdle => false;
/// The sequence of actions to create the composite from.
public Composite(IEnumerator actions)
{
_actions = actions;
}
/// The sequence of actions to create the composite from.
public Composite(IEnumerable actions) : this(actions.GetEnumerator())
{
}
public void Start(ActionContext context)
{
_context = context;
}
public void Finalize(ActionContext context) { }
}
}