Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class FindEmptyProcessUnitsVisitor : IVisitor
{
//Return value list
public List<ProcessUnit> EmptyProcessUnits { get; private set; }
public FindEmptyProcessUnitsVisitor()
{
EmptyProcessUnits = new List<ProcessUnit>();
}
public void VisitProcessUnit(ProcessUnit unit)
{
if (unit.ChildUnits.Count() > 0)
{
foreach (var childUnit in unit.ChildUnits)
childUnit.AcceptVisitor(this);
}
else
{
//Add the process unit to the return value list
EmptyProcessUnits.Add(unit);
}
}
public void VisitAgentUnit(AgentUnit unit)
{
//Is not a process unit, ignored.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.