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

com.github.simy4.xpath.expr.AbstractOperationExpr Maven / Gradle / Ivy

There is a newer version: 2.3.9
Show newest version
package com.github.simy4.xpath.expr;

import com.github.simy4.xpath.XmlBuilderException;
import com.github.simy4.xpath.navigator.Node;
import com.github.simy4.xpath.view.View;
import com.github.simy4.xpath.view.ViewContext;

abstract class AbstractOperationExpr implements Expr {

    private final Expr leftExpr;
    private final Expr rightExpr;

    AbstractOperationExpr(Expr leftExpr, Expr rightExpr) {
        this.leftExpr = leftExpr;
        this.rightExpr = rightExpr;
    }

    @Override
    public final  View resolve(ViewContext context) throws XmlBuilderException {
        final View leftView = leftExpr.resolve(context);
        final View rightView = rightExpr.resolve(context);
        return resolve(context, leftView, rightView);
    }

    abstract  View resolve(ViewContext context, View left, View right)
            throws XmlBuilderException;

    abstract String operator();

    @Override
    public final String toString() {
        return leftExpr.toString() + operator() + rightExpr.toString();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy