// While regex matcher can find matching values, set them as variables in exp4j expressionbuilder
private Expression _buildExpression() {
    	// Make base Exp4j ExpressionBuilder using _formulaEquation string as input
    	ExpressionBuilder _formulaExpressionBuilder = new ExpressionBuilder(this._formulaEquation);
    	// Setup regex pattern we want to use to isolate formula variables from _formulaEquation string
    	// ==In terms of modularity, should we keep the regex string we use as a field for formulas that can be changed by config? Dunno, probably not, would be interesting though
    	Pattern _formulaRegex = new Pattern.compile("\s?_[a-zA-z0-9_]*_\s?");
    	// Make a matcher to get the variables out of the formula equation string given, using above pattern
    	Matcher _formulaVarMatcher = new _formulaRegex.matcher(this._formulaEquation);
    	// While regex matcher can find matching values, set them as variables in exp4j expressionbuilder
    	while (_formulaVarMatcher.find()) {
    		// While index i, starting at 1, is less than matcher.groupCount(), which inherently does not include groupCount(0)
    		for (int i=1; i<=_formulaVarMatcher.groupCount(); i++) {
    			// Set ith match from regex as a variable in the formula expression builder
    			_formulaExpressionBuilder.variable(_formulaVarMatcher.group(i));
    		}
    	}
    	// Once regex stuff is done and variables are set, properly build the expression.
    	Expression _formulaExpression = _formulaExpressionBuilder.build();
    	return _formulaExpression;
    }
// Make a matcher to get the variables out of the formula equation string given, using above pattern
Matcher _formulaVarMatcher = new _formulaRegex.matcher(this._formulaEquation);
// While regex matcher can find matching values, set them as variables in exp4j expressionbuilder
while (_formulaVarMatcher.find()) {
// While index i, starting at 1, is less than matcher.groupCount(), which inherently does not include groupCount(0)
private Expression _buildExpression() {
// Make base Exp4j ExpressionBuilder using _formulaEquation string as input
ExpressionBuilder _formulaExpressionBuilder = new ExpressionBuilder(this._formulaEquation);
// Setup regex pattern we want to use to isolate formula variables from _formulaEquation string
// ==In terms of modularity, should we keep the regex string we use as a field for formulas that can be changed by config? Dunno, probably not, would be interesting though
Pattern _formulaRegex = new Pattern.compile("\s?_[a-zA-z0-9_]*_\s?");
// Make a matcher to get the variables out of the formula equation string given, using above pattern
Matcher _formulaVarMatcher = new _formulaRegex.matcher(this._formulaEquation);
// While regex matcher can find matching values, set them as variables in exp4j expressionbuilder
while (_formulaVarMatcher.find()) {
// While index i, starting at 1, is less than matcher.groupCount(), which inherently does not include groupCount(0)
for (int i=1; i<=_formulaVarMatcher.groupCount(); i++) {
// Set ith match from regex as a variable in the formula expression builder
_formulaExpressionBuilder.variable(_formulaVarMatcher.group(i));
}
}
// Once regex stuff is done and variables are set, properly build the expression.
Expression _formulaExpression = _formulaExpressionBuilder.build();
return _formulaExpression;
private Expression _buildExpression() {
// Make base Exp4j ExpressionBuilder using _formulaEquation string as input
ExpressionBuilder _formulaExpressionBuilder = new ExpressionBuilder(this._formulaEquation);
// Setup regex pattern we want to use to isolate formula variables from _formulaEquation string
// ==In terms of modularity, should we keep the regex string we use as a field for formulas that can be changed by config? Dunno, probably not, would be interesting though
Pattern _formulaRegex = new Pattern.compile("\s?_[a-zA-z0-9_]*_\s?");
// Make a matcher to get the variables out of the formula equation string given, using above pattern
Matcher _formulaVarMatcher = new _formulaRegex.matcher(this._formulaEquation);
// While regex matcher can find matching values, set them as variables in exp4j expressionbuilder
while (_formulaVarMatcher.find()) {
// While index i, starting at 1, is less than matcher.groupCount(), which inherently does not include groupCount(0)
for (int i=1; i<=_formulaVarMatcher.groupCount(); i++) {
// Set ith match from regex as a variable in the formula expression builder
_formulaExpressionBuilder.variable(_formulaVarMatcher.group(i));
}
}
// Once regex stuff is done and variables are set, properly build the expression.
Expression _formulaExpression = _formulaExpressionBuilder.build();
return _formulaExpression;
}