org.openprovenance.prov.template.emitter.minilanguage.BinaryOp Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of prov-template-compiler Show documentation
Show all versions of prov-template-compiler Show documentation
A template system for PROV bundles.
The newest version!
package org.openprovenance.prov.template.emitter.minilanguage;
import org.openprovenance.prov.template.emitter.Element;
import org.openprovenance.prov.template.emitter.minilanguage.emitters.Python;
import java.util.List;
public class BinaryOp extends Expression {
private final Object left;
private final String op;
private final Object right;
public BinaryOp(Object left, String op, Object right, List elements) {
super(elements);
this.left=left;
this.op=op;
this.right=right;
}
public void emit(Python emitter, boolean continueLine, List classVariables, List instanceVariables) {
emitter.emitLine("(" + left.toString(),continueLine);
if (right==null) {
emitter.emitContinueLine(" is ");
emitter.emitContinueLine("None");
} else {
emitter.emitContinueLine(" "+op+" ");
emitter.emitContinueLine(localized(right.toString(),classVariables, instanceVariables));
}
emitter.emitContinueLine(")");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy