2017-07-13 19:50:11 +02:00
|
|
|
package de.jotomo.ruffyscripter.commands;
|
|
|
|
|
2017-07-19 13:29:02 +02:00
|
|
|
import java.util.Date;
|
|
|
|
|
2017-07-16 15:28:39 +02:00
|
|
|
import de.jotomo.ruffyscripter.History;
|
2017-07-26 18:11:45 +02:00
|
|
|
import de.jotomo.ruffyscripter.PumpCapabilities;
|
2017-07-16 15:28:39 +02:00
|
|
|
import de.jotomo.ruffyscripter.PumpState;
|
|
|
|
|
2017-07-13 19:50:11 +02:00
|
|
|
public class CommandResult {
|
|
|
|
public boolean success;
|
|
|
|
public boolean enacted;
|
2017-07-19 13:29:02 +02:00
|
|
|
public long completionTime;
|
2017-07-13 19:50:11 +02:00
|
|
|
public Exception exception;
|
|
|
|
public String message;
|
2017-07-15 13:56:31 +02:00
|
|
|
public PumpState state;
|
2017-07-15 12:40:06 +02:00
|
|
|
public History history;
|
2017-07-26 18:11:45 +02:00
|
|
|
public PumpCapabilities capabilities;
|
2017-07-13 19:50:11 +02:00
|
|
|
|
|
|
|
public CommandResult() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public CommandResult success(boolean success) {
|
|
|
|
this.success = success;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public CommandResult enacted(boolean enacted) {
|
|
|
|
this.enacted = enacted;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2017-07-19 13:29:02 +02:00
|
|
|
public CommandResult completionTime(long completionTime) {
|
|
|
|
this.completionTime = completionTime ;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2017-07-13 19:50:11 +02:00
|
|
|
public CommandResult exception(Exception exception) {
|
|
|
|
this.exception = exception;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public CommandResult message(String message) {
|
|
|
|
this.message = message;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2017-07-15 13:56:31 +02:00
|
|
|
public CommandResult state(PumpState state) {
|
2017-07-15 12:40:06 +02:00
|
|
|
this.state = state;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public CommandResult history(History history) {
|
|
|
|
this.history = history;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2017-07-26 18:11:45 +02:00
|
|
|
public CommandResult capabilities(PumpCapabilities capabilities) {
|
|
|
|
this.capabilities = capabilities;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2017-07-13 19:50:11 +02:00
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
return "CommandResult{" +
|
|
|
|
"success=" + success +
|
|
|
|
", enacted=" + enacted +
|
2017-07-19 13:29:02 +02:00
|
|
|
", completienTime=" + completionTime + "(" + new Date(completionTime) + ")" +
|
2017-07-13 19:50:11 +02:00
|
|
|
", exception=" + exception +
|
|
|
|
", message='" + message + '\'' +
|
2017-07-15 13:34:37 +02:00
|
|
|
", state=" + state +
|
2017-07-13 19:50:11 +02:00
|
|
|
'}';
|
|
|
|
}
|
|
|
|
}
|