package net.pterodactylus.rhynodge;
+import org.jetbrains.annotations.NotNull;
+
/**
* Defines a filter that runs between {@link Query}s and {@link Trigger}s and
* can be used to convert a {@link State} into another {@link State}. This can
* The state to convert
* @return The new state
*/
- State filter(State state);
+ @NotNull
+ State filter(@NotNull State state);
}
import net.pterodactylus.rhynodge.states.TorrentState.TorrentFile;
import com.google.common.base.Predicate;
+import org.jetbrains.annotations.NotNull;
/**
* Filter for {@link TorrentState}s that removes all {@link TorrentFile}s whose
this.filterWords = filterWords;
}
+ @NotNull
@Override
- public State filter(State state) {
+ public State filter(@NotNull State state) {
if (!state.success()) {
return FailedState.from(state);
}
import net.pterodactylus.rhynodge.states.HtmlState;
import com.google.common.base.Optional;
+import org.jetbrains.annotations.NotNull;
import org.jsoup.nodes.Document;
/**
*/
public abstract class ComicSiteFilter implements Filter {
+ @NotNull
@Override
- public State filter(State state) {
+ public State filter(@NotNull State state) {
checkArgument(state instanceof HtmlState, "state must be an HTML state");
/* initialize states: */
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import org.apache.log4j.Logger;
+import org.jetbrains.annotations.NotNull;
/**
* {@link Filter} implementation that extracts {@link Episode} information from
/**
* {@inheritDoc}
*/
+ @NotNull
@Override
- public State filter(State state) {
+ public State filter(@NotNull State state) {
if (!state.success()) {
return FailedState.from(state);
}
import net.pterodactylus.rhynodge.states.StringState;
import com.google.common.base.Optional;
+import org.jetbrains.annotations.NotNull;
import org.jsoup.nodes.Document;
/**
*/
public abstract class ExtractUrlFilter implements Filter {
+ @NotNull
@Override
- public State filter(State state) {
+ public State filter(@NotNull State state) {
checkArgument(state instanceof HtmlState, "state must be an HTML state");
HtmlState htmlState = (HtmlState) state;
import net.pterodactylus.rhynodge.states.HttpState;
import org.apache.log4j.Logger;
+import org.jetbrains.annotations.NotNull;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
/**
* {@inheritDoc}
*/
+ @NotNull
@Override
- public State filter(State state) {
+ public State filter(@NotNull State state) {
if (!state.success()) {
return FailedState.from(state);
}
import net.pterodactylus.rhynodge.states.HttpState;
import net.pterodactylus.rhynodge.states.StringState;
+import org.jetbrains.annotations.NotNull;
+
/**
* {@link Filter} implementation that uses the {@link StringState#value() value}
* of a {@link StringState} as a URL for {@link HttpQuery}, turning it into an
*/
public class HttpQueryFilter implements Filter {
+ @NotNull
@Override
- public State filter(State state) {
+ public State filter(@NotNull State state) {
checkArgument(state instanceof StringState, "state must be a String state");
StringState stringState = (StringState) state;
import net.pterodactylus.rhynodge.states.TorrentState;
import net.pterodactylus.rhynodge.states.TorrentState.TorrentFile;
+import org.jetbrains.annotations.NotNull;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
/**
* {@inheritDoc}
*/
+ @NotNull
@Override
- public State filter(State state) {
+ public State filter(@NotNull State state) {
if (!state.success()) {
return FailedState.from(state);
}
import net.pterodactylus.rhynodge.states.HtmlState;
import net.pterodactylus.rhynodge.states.OutputState;
+import org.jetbrains.annotations.NotNull;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.Node;
private DateTimeFormatter timeFormatter = ofPattern("HH:mm");
private DateTimeFormatter dateTimeFormatter = ofPattern("dd.MM.uuuu, HH:mm");
+ @NotNull
@Override
- public State filter(State state) {
+ public State filter(@NotNull State state) {
checkArgument(state instanceof HtmlState, "state must be HTML");
HtmlState htmlState = (HtmlState) state;
private val dateTimeFormatter = DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm")
- override fun filter(state: State?): State {
- if (state?.success()?.not() ?: true) {
+ override fun filter(state: State): State {
+ if (state.success().not()) {
return FailedState.from(state)
}
if (state !is HtmlState) {