The class MinVisitor. | Lecture 8 - slide 36 : 37 Program 6 |
public class MinVisitor: Visitor{ public int Visit (IntInterval iv){ return Math.Min(iv.From, iv.To); } public int Visit (IntSingular iv){ return iv.TheInt; } public int Visit (IntCompSeq iv){ return Math.Min(iv.First.Accept(this), iv.Second.Accept(this)); } } |