Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block kosanmil

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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 StartUnitVisitor.cs
public class StartUnitVisitor : IVisitor
public void VisitProcessUnit(ProcessUnit unit)
foreach (var childUnit in unit.ChildUnits)
public void VisitAgentUnit(AgentUnit unit)
View StartUnitVisitorExample.cs
var visitor = new StartUnitVisitor();
Console.WriteLine("Process unit {0} started", processUnitToStart);
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)
You can’t perform that action at this time.