All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.dnbn.submerge.api.subtitle.srt.SRTLine Maven / Gradle / Ivy

The newest version!
package com.github.dnbn.submerge.api.subtitle.srt;

import java.util.List;

import com.github.dnbn.submerge.api.subtitle.common.SubtitleLine;

/**
 * Class  represents an abstract line of SRT, meaning text, timecodes and index
 *
 */
public class SRTLine extends SubtitleLine {

	private static final long serialVersionUID = -1220593401999895814L;

	private static final String NEW_LINE = "\n";

	private int id;

	public SRTLine(int id, SRTTime time, List textLines) {
		
		this.id = id;
		this.time = time;
		this.textLines = textLines;
	}

	@Override
	public String toString() {
		
		StringBuilder sb = new StringBuilder();
		sb.append(this.id).append(NEW_LINE);
		sb.append(this.time).append(NEW_LINE);
		this.textLines.forEach(textLine -> sb.append(textLine).append(NEW_LINE));
		return sb.append(NEW_LINE).toString();
	}

	// ===================== getter and setter start =====================

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy