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

nl.vpro.domain.subtitles.ParseResult Maven / Gradle / Ivy

Go to download

Subtitles are related to media, but are implemented completely parallel. Classes to contain, parse, and assemble subtitle objects are here.

There is a newer version: 8.3.0
Show newest version
package nl.vpro.domain.subtitles;

import lombok.Getter;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collector;
import java.util.stream.Stream;

import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;

/**
 * @author Michiel Meeuwissen
 * @since 5.11
 */
@Getter
public class ParseResult implements Iterable {

    private final List headers;

    @NonNull
    private final Stream<@Nullable Cue> cues;

    private ParseResult(@NonNull Stream<@NonNull Cue> cues, List headers) {
        this.cues = cues;
        this.headers = headers;
    }
    private ParseResult(@NonNull Stream<@NonNull Cue> cues) {
        this(cues, new ArrayList<>());
    }

    public static ParseResult of(Stream<@NonNull Cue> cues) {
        return new ParseResult(cues);
    }

    public static ParseResult of(Stream<@NonNull Cue> cues, List headers) {
        return new ParseResult(cues, headers);
    }

    @Override
    @NonNull
    public Iterator iterator() {
        return cues.iterator();
    }

    public  R collect(Collector collector) {
        return cues.collect(collector);
    }

    @Override
    public String toString() {
        return "headers: " + headers;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy