org.openprovenance.prov.template.emitter.minilanguage.Assignment 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.LinkedList;
import java.util.List;
public class Assignment extends Statement {
private final Object type;
private final Expression variable;
private final Expression value;
public Assignment(Object type, Expression variable, Expression value, List elementList) {
super(elementList);
this.type = type;
this.variable = variable;
this.value = value;
}
@Override
public String toString() {
return "Assignment{" +
"type=" + type +
", variable=" + variable +
", value=" + value +
'}';
}
public void emit(Python emitter, List classVariables, List instanceVariables) {
if (variable instanceof Symbol && ((Symbol) variable).symbol.equals("self")) {
return;
}
emitter.emitBeginLine("");
variable.emit(emitter, true, classVariables, instanceVariables);
emitter.emitContinueLine("=");
value.emit(emitter, true, classVariables, instanceVariables);
emitter.emitNewline();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy