This will return the ActionInsertFact that a variable is bound to.

@param var The bound fact variable (NOT bound field).
@return null or the ActionInsertFact found.
510424
public ActionInsertFact getRHSBoundFact(final String var) {
        if (this.rhs == null) {
            return null;
        }
        for (int i = 0; i < this.rhs.length; i++) {
            if (this.rhs[i] instanceof ActionInsertFact) {
                final ActionInsertFact p = (ActionInsertFact) this.rhs[i];
                if (p.getBoundName() != null && var.equals(p.getBoundName())) {
                    return p;
                }
            }
        }
        return null;
    }
1212708
@Override
    public Object resolveVariable(QName variableName) {
        final Map<String, ?> variables = this.localVariables.get();
        if (variables == null) {
            return null;
        }

        final String localPart = variableName.getLocalPart();
        return variables.get(localPart);
    }
411125
protected Variable getImportedVar(final String name) throws UtilEvalError {
        Variable var = null;
        // Try object imports
        for (final Object object : this.importedObjects) {
            final Invocable field = Reflect.resolveJavaField(object.getClass(),
                    name, false/* onlyStatic */);
            if (field != null)
                var = this.createVariable(name, field.getReturnType(), new LHS(object, field));
            else if (this.isClass) {
                // try find inherited loose-typed instance fields
                Class<?> supr = object.getClass();
                while (Reflect.isGeneratedClass(supr = supr.getSuperclass())) {
                    This ths = Reflect.getClassInstanceThis(object, supr.getSimpleName());
                    if (null != ths && null != (var = ths.getNameSpace().variables.get(name)))
                        break;
                }
            }
            if (null != var) {
                this.variables.put(name, var);
                return var;
            }
        }
        // Try static imports
        for (final Class<?> stat : this.importedStatic) {
            final Invocable field = Reflect.resolveJavaField(stat,
                    name, true/* onlyStatic */);
            if (field != null) {
                var = this.createVariable(name, field.getReturnType(),
                        new LHS(field));
                this.variables.put(name, var);
                return var;
            }
        }
        return null;
    }
732013
static boolean hasSystemPropertyVariable(String variable) {
        final String path = System.getProperty(variable);
        if (path != null) {
            return true;
        }
        return false;
    }
175535
public function getParam($var = null)
    {
        $param = $this->_parameters;
        if (null !== $var) {
            if (isset($this->_parameters[$var])) {
                $param = $this->_parameters[$var];
            } else {
                $param = null;
            }
        }

        return $param;
    }
808712
private VarDef findVarPath( List<VarDef> combinedVars, String varPath)
    {
    int i;
    for( i = 0;
         i < combinedVars.size()
           && !varPath.equals( combinedVars.get(i).getPathName());
         i++);

    return
      i < combinedVars.size()
      ? combinedVars.get(i)
      : null;
    }
981283
public FactPattern getLHSParentFactPatternForBinding(final String var) {
        if (this.lhs == null) {
            return null;
        }
        for (int i = 0; i < this.lhs.length; i++) {
            IPattern pat = this.lhs[i];
            if (pat instanceof FromCompositeFactPattern) {
                pat = ((FromCompositeFactPattern) pat).getFactPattern();
            }
            if (pat instanceof FactPattern) {
                final FactPattern p = (FactPattern) pat;
                if (p.getBoundName() != null && var.equals(p.getBoundName())) {
                    return p;
                }
                for (int j = 0; j < p.getFieldConstraints().length; j++) {
                    FieldConstraint fc = p.getFieldConstraints()[j];
                    List<String> fieldBindings = getFieldBinding(fc);
                    if (fieldBindings.contains(var)) {
                        return p;
                    }
                }
            }
        }
        return null;
    }
1112685
public VariableInfo findVariable(String name) {
    for (ContextLayer contextLayer : contextLayers) {
      VariableInfo variableInfo = contextLayer.getVariableInfo(name);
      if (variableInfo != null) {
        return variableInfo;
      }
    }

    return null;
  }
487487
private void fixVar(Variable var) {
        if (getTarget(var) == null && var instanceof VariableExpression && getState() != null && var.getName() != null) {
            for (Variable v: getState().keySet()) {
                if (var.getName().equals(v.getName())) {
                    ((VariableExpression)var).setAccessedVariable(v);
                    break;
                }
            }
        }
    }
420033
protected static Variable findTargetVariable(VariableExpression ve) {
        final Variable accessedVariable = ve.getAccessedVariable() != null ? ve.getAccessedVariable() : ve;
        if (accessedVariable != ve) {
            if (accessedVariable instanceof VariableExpression)
                return findTargetVariable((VariableExpression) accessedVariable);
        }
        return accessedVariable;
    }
828713
@SuppressWarnings("unchecked")
  public <T extends TypedValue> T getVariableTyped(String variableName) {
    TypedValue variable = associationManager.getVariable(variableName);
    return variable != null ? (T) (variable) : null;
  }
548885
@Override
    public ConditionBuilder as(String variable)
    {
        Assert.notNull(variable, "Variable name must not be null.");
        this.setOutputVariablesName(variable);
        return this;
    }
1242770
public String getVariableShortName(VariableElement var) {
    String baseName = getVariableBaseName(var);
    if (var.getKind().isField() && !ElementUtil.isGlobalVar(var)) {
      return baseName + '_';
    }
    return baseName;
  }
532163
public static Object getVariable(PageContext pc, Collection collection, String var) throws PageException {
	StringList list = parse(pc, new ParserString(var), false);
	if (list == null) throw new InterpreterException("invalid variable declaration [" + var + "]");

	while (list.hasNextNext()) {
	    collection = Caster.toCollection(collection.get(KeyImpl.init(list.next())));
	}
	return collection.get(KeyImpl.init(list.next()));
    }
830903
public SDVariable getVariable(String name) {
        Variable v = variables.get(name);
        return v == null ? null : v.getVariable();
    }
606539
private function isResultVariable($variable, $variableClassUri)
    {
        $responseVariableClass = \taoResultServer_models_classes_ResponseVariable::class;
        $outcomeVariableClass = \taoResultServer_models_classes_OutcomeVariable::class;
        $class = isset($variable->class) ? $variable->class : get_class($variable->variable);

        return (null != $variable->item ||  null != $variable->test)
            && (
                $class == $outcomeVariableClass
                && $variableClassUri == $outcomeVariableClass
            ) || (
                $class == $responseVariableClass
                && $variableClassUri == $responseVariableClass
            );
    }
824346
public function getProperty($var = null)
    {
        if (null === $var) {
            return $this->properties;
        }

        if (isset($this->properties[$var])) {
            return $this->properties[$var];
        }

        return;
    }