The class IntCompSeq. | Lecture 8 - slide 34 : 37 Program 4 |
public class IntCompSeq: IntSequence{ private IntSequence s1, s2; // Binary sequence: Exactly two subsequences. public IntCompSeq(IntSequence s1, IntSequence s2) { this.s1 = s1; this.s2 = s2; } public IntSequence First{ get{return s1;} } public IntSequence Second{ get{return s2;} } public override int Min{ get {return Math.Min(s1.Min, s2.Min);} } public override int Max{ get {return Math.Max(s1.Max, s2.Max);} } public override int Sum(){ return s1.Sum() + s2.Sum(); } } |