Skip to content

Instantly share code, notes, and snippets.

@kosanmil
Last active February 2, 2019 20:07
Show Gist options
  • Save kosanmil/bb88a711e468732ec1d0099ae07ca4ec to your computer and use it in GitHub Desktop.
Save kosanmil/bb88a711e468732ec1d0099ae07ca4ec to your computer and use it in GitHub Desktop.
Snippet containing implementation of Unit, ProcessUnit and AgentUnit
public abstract class Unit
{
public string Name;
public State State;
public abstract void AcceptVisitor(IVisitor visitor);
}
public class ProcessUnit : Unit
{
public IEnumerable<Unit> ChildUnits;
public override void AcceptVisitor(IVisitor visitor)
{
visitor.VisitProcessUnit(this);
}
}
public class AgentUnit : Unit
{
public void SendCommand(Command command)
{
//Implementation ommited due to simplicity of the example
}
public override void AcceptVisitor(IVisitor visitor)
{
visitor.VisitAgentUnit(this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment