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

org.daisy.pipeline.tts.calabash.impl.ContiguousText Maven / Gradle / Ivy

There is a newer version: 7.2.0
Show newest version
package org.daisy.pipeline.tts.calabash.impl;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import org.daisy.pipeline.tts.Sentence;

/**
 * List of sentences adjacent to each other in the original document. Positions
 * in the document are kept so as to adequately name the sound files.
 */
class ContiguousText implements Comparable {

	ContiguousText(int documentPosition, File audioOutputDir) {
		mDocumentPosition = documentPosition;
		mAudioOutputDir = audioOutputDir;
		mDocumentSplitPosition = 0;
		sentences = new ArrayList();
	}

	void computeSize() {
		mSize = 0;
		for (Sentence speakable : sentences) {
			mSize += speakable.getSize();
		}
	}

	@Override
	public int compareTo(ContiguousText other) {
		return (other.mSize - mSize);
	}

	public void setDocumentSplitPosition(int pos) {
		mDocumentSplitPosition = pos;
	}

	public int getDocumentSplitPosition() {
		return mDocumentSplitPosition;
	}

	public int getDocumentPosition() {
		return mDocumentPosition;
	}

	public int getStringSize() {
		return mSize;
	}

	public void setStringsize(int size) {
		mSize = size;
	}

	public File getAudioOutputDir() {
		return mAudioOutputDir;
	}

	private File mAudioOutputDir;
	private int mDocumentSplitPosition;
	private int mDocumentPosition;
	private int mSize; //used for sorting
	List sentences;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy