org.bidib.wizard.api.model.function.InputFunction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bidibwizard-api Show documentation
Show all versions of bidibwizard-api Show documentation
jBiDiB BiDiB Wizard API POM
package org.bidib.wizard.api.model.function;
import org.bidib.jbidibc.exchange.lcmacro.InputPortActionType;
import org.bidib.jbidibc.exchange.lcmacro.InputPortPoint;
import org.bidib.jbidibc.exchange.lcmacro.LcMacroPointType;
import org.bidib.wizard.model.ports.InputPort;
import org.bidib.wizard.model.status.InputStatus;
public class InputFunction extends SystemFunction {
private InputPort input;
public InputFunction() {
this(InputStatus.QUERY0);
}
public InputFunction(InputStatus action) {
this(action, null);
}
public InputFunction(InputStatus action, InputPort input) {
super(action, KEY_INPUT);
this.input = input;
}
public InputPort getInput() {
return input;
}
public void setInput(InputPort input) {
this.input = input;
}
public String getDebugString() {
int id = 0;
if (getInput() != null) {
id = getInput().getId();
}
return "Input=" + getAction().name().substring(5) + "? Port=" + id;
}
@Override
public LcMacroPointType toLcMacroPoint() {
InputPortPoint inputPortPoint = new InputPortPoint();
inputPortPoint.setInputNumber(getInput().getId());
inputPortPoint.setInputPortActionType(InputPortActionType.fromValue(getAction().name()));
return inputPortPoint;
}
}