package net.pterodactylus.rhynodge.engine;
-import static com.google.common.base.Optional.absent;
-import static com.google.common.base.Optional.of;
import static com.google.common.collect.Maps.newTreeMap;
import static java.lang.String.format;
+import static java.util.Optional.empty;
+import static java.util.Optional.of;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Optional;
import java.util.SortedMap;
import net.pterodactylus.rhynodge.Filter;
import net.pterodactylus.rhynodge.states.FailedState;
import net.pterodactylus.rhynodge.states.StateManager;
-import com.google.common.base.Optional;
import com.google.common.util.concurrent.AbstractExecutionThreadService;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.log4j.Logger;
return of(new NextReaction(keyReaction.getKey(), keyReaction.getValue(), nextReactions.firstKey()));
}
}
- return absent();
+ return empty();
}
private static class NextReaction {
package net.pterodactylus.rhynodge.states;
-import static com.google.common.base.Optional.absent;
-import static com.google.common.base.Optional.fromNullable;
+import static java.util.Optional.empty;
+import static java.util.Optional.ofNullable;
import java.io.File;
import java.io.IOException;
+import java.util.Optional;
import net.pterodactylus.rhynodge.State;
-import com.google.common.base.Optional;
import org.apache.log4j.Logger;
import com.fasterxml.jackson.core.JsonGenerationException;
*
* @param reactionName
* The name of the reaction
- * @return The loaded state, or {@link Optional#absent()} if the state could not be
+ * @return The loaded state, or {@link Optional#empty()} if the state could not be
* loaded
*/
public Optional<State> loadLastState(String reactionName) {
*
* @param reactionName
* The name of the reaction
- * @return The loaded state, or {@link Optional#absent()} if the state could not be
+ * @return The loaded state, or {@link Optional#empty()} if the state could not be
* loaded
*/
public Optional<State> loadLastSuccessfulState(String reactionName) {
* @param successful
* {@code true} to load the last successful state, {@code false}
* to load the last state
- * @return The loaded state, or {@link Optional#absent()} if the state could not be
+ * @return The loaded state, or {@link Optional#empty()} if the state could not be
* loaded
*/
private Optional<State> loadLastState(String reactionName, boolean successful) {
File stateFile = stateFile(reactionName, successful ? "success" : "last");
try {
State state = objectMapper.readValue(stateFile, AbstractState.class);
- return fromNullable(state);
+ return ofNullable(state);
} catch (JsonParseException jpe1) {
logger.warn(String.format("State for Reaction “%s” could not be parsed.", reactionName), jpe1);
} catch (JsonMappingException jme1) {
} catch (IOException ioe1) {
logger.info(String.format("State for Reaction “%s” could not be found.", reactionName));
}
- return absent();
+ return empty();
}
}