package org.javarosa.xpath.expr;

import org.javarosa.core.model.condition.EvaluationContext;
import org.javarosa.core.model.instance.DataInstance;
import org.javarosa.xpath.parser.XPathSyntaxException;

public class XPathPiFunc extends XPathFuncExpr {
    public static final String NAME = "pi";
    private static final int EXPECTED_ARG_COUNT = 0;

    public XPathPiFunc() {
        name = NAME;
        expectedArgCount = EXPECTED_ARG_COUNT;
    }

    public XPathPiFunc(XPathExpression[] args) throws XPathSyntaxException {
        super(NAME, args, EXPECTED_ARG_COUNT, false);
    }

    @Override
    public Object evalBody(DataInstance model, EvaluationContext evalContext) {
        return Math.PI;
    }

    @Override
    public String getDocumentation() {
        return "";
    }
}

package org.javarosa.xpath.expr;

import org.javarosa.core.model.condition.EvaluationContext;
import org.javarosa.core.model.instance.DataInstance;
import org.javarosa.xpath.parser.XPathSyntaxException;

public class XPathPiFunc extends XPathFuncExpr {
    public static final String NAME = "pi";
    private static final int EXPECTED_ARG_COUNT = 0;

    public XPathPiFunc() {
        name = NAME;
        expectedArgCount = EXPECTED_ARG_COUNT;
    }

    public XPathPiFunc(XPathExpression[] args) throws XPathSyntaxException {
        super(NAME, args, EXPECTED_ARG_COUNT, false);
    }

    @Override
    public Object evalBody(DataInstance model, EvaluationContext evalContext) {
        return Math.PI;
    }

    @Override
    public String getDocumentation() {
        return getDocHeader()
                + "Behavior: Returns Pi\n"
                + "Return: Pi\n"
                + "Arguments: None\n"
                + "Syntax: pi()";

    }
}

Document the pi func