Search in sources :

Example 1 with VariableExpression

use of edu.cmu.tetrad.calculator.expression.VariableExpression in project tetrad by cmu-phil.

the class GraphWrapper method findParameter.

// ==========================PRIVATE METaHODS===========================//
private static String findParameter(Expression expression, String name) {
    List<Expression> expressions = expression.getExpressions();
    if (expression.getToken().equals("*")) {
        Expression expression1 = expressions.get(1);
        VariableExpression varExpr = (VariableExpression) expression1;
        if (varExpr.getVariable().equals(name)) {
            Expression expression2 = expressions.get(0);
            VariableExpression constExpr = (VariableExpression) expression2;
            return constExpr.getVariable();
        }
    }
    for (Expression _expression : expressions) {
        String param = findParameter(_expression, name);
        if (param != null) {
            return param;
        }
    }
    return null;
}
Also used : VariableExpression(edu.cmu.tetrad.calculator.expression.VariableExpression) Expression(edu.cmu.tetrad.calculator.expression.Expression) VariableExpression(edu.cmu.tetrad.calculator.expression.VariableExpression)

Aggregations

Expression (edu.cmu.tetrad.calculator.expression.Expression)1 VariableExpression (edu.cmu.tetrad.calculator.expression.VariableExpression)1