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