@Test(expected = SRTEditorException.class) public void testRemoveSubtitleInvalidSubtitleNumber() throws Exception { SRTInfo srtInfo = new SRTInfo(); for (int i = 1; i <= 5; i++) { srtInfo.add(new SRT(i, SRTTimeFormat.parse("00:00:24,600"), SRTTimeFormat.parse("00:00:26,600"), "Foo" + i)); } SRTEditor.removeSubtitle(srtInfo, 100); }
public static void removeSubtitle(SRTInfo info, int subtitleNumber) { if (!info.contains(subtitleNumber)) { throw new SRTEditorException(subtitleNumber + " could not be found"); } int originalSize = info.size(); for (int i = subtitleNumber+1; i <= originalSize; i++) { SRT tmp = info.get(i); info.add(new SRT(tmp.number-1, tmp.startTime, tmp.endTime, tmp.text)); } info.remove(info.size()); }
SRTEditor { public static void removeSubtitle(SRTInfo info, int subtitleNumber) { if (!info.contains(subtitleNumber)) { throw new SRTEditorException(subtitleNumber + " could not be found"); } int originalSize = info.size(); for (int i = subtitleNumber+1; i <= originalSize; i++) { SRT tmp = info.get(i); info.add(new SRT(tmp.number-1, tmp.startTime, tmp.endTime, tmp.text)); } info.remove(info.size()); } }
SRTEditor { public static void removeSubtitle(SRTInfo info, int subtitleNumber) { if (!info.contains(subtitleNumber)) { throw new SRTEditorException(subtitleNumber + " could not be found"); } int originalSize = info.size(); for (int i = subtitleNumber+1; i <= originalSize; i++) { SRT tmp = info.get(i); info.add(new SRT(tmp.number-1, tmp.startTime, tmp.endTime, tmp.text)); } info.remove(info.size()); } private  SRTEditor(); }
SRTEditor { public static void removeSubtitle(SRTInfo info, int subtitleNumber) { if (!info.contains(subtitleNumber)) { throw new SRTEditorException(subtitleNumber + " could not be found"); } int originalSize = info.size(); for (int i = subtitleNumber+1; i <= originalSize; i++) { SRT tmp = info.get(i); info.add(new SRT(tmp.number-1, tmp.startTime, tmp.endTime, tmp.text)); } info.remove(info.size()); } private  SRTEditor(); static void updateTime(SRTInfo info, int subtitleNumber,
        SRTTimeFormat.Type type, int value); static void updateTimes(SRTInfo info, SRTTimeFormat.Type type, int value); static void updateText(SRTInfo info, int subtitleNumber, int width); static void updateTexts(SRTInfo info, int width); static void appendSubtitle(SRTInfo info, String startTime,
        String endTime, List<String> text); static void prependSubtitle(SRTInfo info, String startTime,
        String endTime, List<String> text); static void insertSubtitle(SRTInfo info, int subtitleNumber,
        String startTime, String endTime, List<String> text); static void insertSubtitle(SRTInfo info, SRT newSRT); static void removeSubtitle(SRTInfo info, int subtitleNumber); static void updateSubtitle(SRTInfo info, SRT srt); }
SRTEditor { public static void removeSubtitle(SRTInfo info, int subtitleNumber) { if (!info.contains(subtitleNumber)) { throw new SRTEditorException(subtitleNumber + " could not be found"); } int originalSize = info.size(); for (int i = subtitleNumber+1; i <= originalSize; i++) { SRT tmp = info.get(i); info.add(new SRT(tmp.number-1, tmp.startTime, tmp.endTime, tmp.text)); } info.remove(info.size()); } private  SRTEditor(); static void updateTime(SRTInfo info, int subtitleNumber,
        SRTTimeFormat.Type type, int value); static void updateTimes(SRTInfo info, SRTTimeFormat.Type type, int value); static void updateText(SRTInfo info, int subtitleNumber, int width); static void updateTexts(SRTInfo info, int width); static void appendSubtitle(SRTInfo info, String startTime,
        String endTime, List<String> text); static void prependSubtitle(SRTInfo info, String startTime,
        String endTime, List<String> text); static void insertSubtitle(SRTInfo info, int subtitleNumber,
        String startTime, String endTime, List<String> text); static void insertSubtitle(SRTInfo info, SRT newSRT); static void removeSubtitle(SRTInfo info, int subtitleNumber); static void updateSubtitle(SRTInfo info, SRT srt);  }