public double getSubStackWidth(int index1, int index2) {
        double width = 0;
        for (int i = index1; i <= index2; i++) {
            width += intervals.get(i).getWidth();
        }
        return width;
    }