All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openprovenance.prov.template.emitter.minilanguage.BinaryOp Maven / Gradle / Ivy

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