package dnss.model;

public class SP {
    private int[] sp;

    public int[] getSp() {
        return sp;
    }

    public void setSp(int[] sp) {
        this.sp = sp;
    }

    public int forCap(int cap) {
        if (cap < 1 || cap > sp.length) {
            return -1;
        }

        return sp[cap-1];
    }
}

@@ -230,14 +230,8 @@
 1 %7C%7C
- cap %3E
  sp.
@@ -236,16 +236,22 @@
 p.length
+ %3C cap
 ) %7B%0A    
@@ -262,17 +262,78 @@
     
-return -1
+throw new RuntimeException(%22Invalid level cap passed in as argument.%22)
 ;%0A  

Throw an exception if a bad level cap was passed.