Skip to content

Instantly share code, notes, and snippets.

View StartUnitVisitorExample.cs
var visitor = new StartUnitVisitor();
Console.WriteLine("Process unit {0} started", processUnitToStart);
View StartUnitVisitor.cs
public class StartUnitVisitor : IVisitor
public void VisitProcessUnit(ProcessUnit unit)
foreach (var childUnit in unit.ChildUnits)
public void VisitAgentUnit(AgentUnit unit)
View IVisitor.cs
public interface IVisitor
void VisitProcessUnit(ProcessUnit unit);
void VisitAgentUnit(AgentUnit unit);
kosanmil / Unit.cs
Last active Feb 2, 2019
Snippet containing implementation of Unit, ProcessUnit and AgentUnit
View Unit.cs
public abstract class Unit
public string Name;
public State State;
public abstract void AcceptVisitor(IVisitor visitor);
public class ProcessUnit : Unit
View HandymanVisitorExample.cs
using System.Collections.Generic;
public class House
public List<Room> Rooms;
public void AcceptVisitor(IVisitor visitor)
//The handyman will perform checks on this house
//(e.g. check the outside walls)