public String getNthSegment(int n){
        if(n == 0){
            return operator;
        } else if(segments.size() < n){
            return null;
        } else {
            return segments.get(n-1);
        }
    }