-
-
Save kosanmil/028ee471b8ff9c477ca8d4e0d37cdf83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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