Given a variable expression, returns the ultimately accessed variable.

@param ve a variable expression
@return the target variable
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;
    }
894321
public String[] getVariables()
    {
        if (variables == null)
        {
            variables = new LinkedHashSet<String>();
            for (Expression e : getExpressions())
            {
                for (VarSpec v : e.getVarSpecs())
                {
                    variables.add(v.getVariableName());
                }
            }
        }
        return variables.toArray(new String[variables.size()]);
    }
142339
public final int getVariableByName(String variableName) {
    int index = getVariableIndex(variableName);
    if (index == -1) {
      return index;
    } else {
      return nums[index];
    }
  }
329533
VariablePointerValue resolveVariablePointer(VariablePointerValue varPointer) throws Exception {
		int contextIndex = varPointer.getContextIndex();
		if (contextIndex == -1)
			contextIndex = getContextIndexOfVariableNamed(varPointer.getVariableName());

		RTObject valueOfVariablePointedTo = getRawVariableWithName(varPointer.getVariableName(), contextIndex);
		// Extra layer of indirection:
		// When accessing a pointer to a pointer (e.g. when calling nested or
		// recursive functions that take a variable references, ensure we don't
		// create
		// a chain of indirection by just returning the final target.
		VariablePointerValue doubleRedirectionPointer = valueOfVariablePointedTo instanceof VariablePointerValue
				? (VariablePointerValue) valueOfVariablePointedTo
				: (VariablePointerValue) null;
		if (doubleRedirectionPointer != null) {
			return doubleRedirectionPointer;
		} else {
			return new VariablePointerValue(varPointer.getVariableName(), contextIndex);
		}
	}
352554
public Object getSource(VariableScope variableScope) {

    if (sourceValueProvider instanceof ConstantValueProvider) {
      String variableName = (String) sourceValueProvider.getValue(variableScope);

      return variableScope.getVariableTyped(variableName);
    }
    else {
      return sourceValueProvider.getValue(variableScope);
    }

  }
1025694
private static String getStringValueFromRow(QuerySolution resultRow, String variableName) {
        // Check the input and exit immediately if null
        if (resultRow == null) {
            return null;
        }

        String result = null;

        Resource res = resultRow.getResource(variableName);
        if (res != null && res.isLiteral()) {
            result = res.asLiteral().getString();
        }

        return result;
    }
1231233
public BytecodeVariable defineVariable(Variable v, boolean initFromStack) {
        return defineVariable(v, v.getOriginType(), initFromStack);
    }
786546
public List<T> getVariable() throws InitializationTypeConflictException {
		if (!materialized) {
			throw new IllegalStateException("The Broadcast Variable has not yet been materialized.");
		}
		if (disposed) {
			throw new IllegalStateException("The Broadcast Variable has been disposed");
		}

		synchronized (references) {
			if (transformed != null) {
				if (transformed instanceof List) {
					@SuppressWarnings("unchecked")
					List<T> casted = (List<T>) transformed;
					return casted;
				} else {
					throw new InitializationTypeConflictException(transformed.getClass());
				}
			}
			else {
				return data;
			}
		}
	}
1009174
private static String typeVariableToString(final TypeVariable<?> v) {
        final StringBuilder buf = new StringBuilder(v.getName());
        final Type[] bounds = v.getBounds();
        if (bounds.length > 0 && !(bounds.length == 1 && Object.class.equals(bounds[0]))) {
            buf.append(" extends ");
            appendAllTo(buf, " & ", v.getBounds());
        }
        return buf.toString();
    }
347066
public IVarDef findVarPath( String pathName)
    {
    String[] path = DefUtils.toPath( pathName);
    IVarDef  var;

    return
      path == null?
      null :

      (var = getVarDef( StringUtils.trimToNull( path[0]))) == null?
      null :

      var.find( Arrays.copyOfRange( path, 1, path.length));
    }
1232974
private WyilFile.Expr.VariableAccess extractAssignedVariable(WyilFile.LVal lval) {
		//
		switch (lval.getOpcode()) {
		case WyilFile.EXPR_arrayaccess:
		case WyilFile.EXPR_arrayborrow:
			Expr.ArrayAccess ae = (Expr.ArrayAccess) lval;
			return extractAssignedVariable((LVal) ae.getSource());
		case WyilFile.EXPR_dereference:
			return null;
		case WyilFile.EXPR_recordaccess:
		case WyilFile.EXPR_recordborrow:
			Expr.RecordAccess ar = (Expr.RecordAccess) lval;
			return extractAssignedVariable((LVal) ar.getSource());
		case WyilFile.EXPR_variablemove:
		case WyilFile.EXPR_variablecopy:
			return (WyilFile.Expr.VariableAccess) lval;
		default:
			throw new SyntacticException("unknown lval encountered (" + lval + ")", ((WyilFile) lval.getHeap()).getEntry(),
					lval);
		}
	}
1299505
private static Expression getParam(
      LocalVariable paramsVar,
      LocalVariable ijVar,
      TemplateParam param,
      @Nullable SoyExpression defaultValue) {
    Expression fieldName = BytecodeUtils.constant(param.name());
    Expression record = param.isInjected() ? ijVar : paramsVar;
    // NOTE: for compatibility with Tofu and jssrc we do not check for missing required parameters
    // here instead they will just turn into null.  Existing templates depend on this.
    if (defaultValue == null) {
      return MethodRef.RUNTIME_GET_FIELD_PROVIDER.invoke(record, fieldName);
    } else {
      return MethodRef.RUNTIME_GET_FIELD_PROVIDER_DEFAULT.invoke(
          record, fieldName, defaultValue.box());
    }
  }
864013
function getVariable(variable) {

  if ( cached.data == null ) {
    getData();
  }

  if (variable.toUpperCase() in cached.data ) {
    return cached.data[variable.toUpperCase()];
  } else if (variable in cached.data) {
    return cached.data[variable];
  }
}
262614
public Variable newVariable() {
    if (this.miniSat == null && this.cleaneLing == null)
      return this.f.newCCVariable();
    else if (this.miniSat != null) {
      final int index = this.miniSat.underlyingSolver().newVar(!this.miniSat.initialPhase(), true);
      final String name = FormulaFactory.CC_PREFIX + "MINISAT_" + index;
      this.miniSat.underlyingSolver().addName(name, index);
      return new EncodingAuxiliaryVariable(name, false);
    } else
      return new EncodingAuxiliaryVariable(this.cleaneLing.createNewVariableOnSolver(FormulaFactory.CC_PREFIX + "CLEANELING"), false);
  }
505225
public List<Variable> getUsedVariables() {
        ArrayList<Variable> vars = new ArrayList<Variable>();

        for (Operand o : getOperands()) {
            o.addUsedVariables(vars);
        }

        return vars;
    }
1299840
public static PathType getVariableType(String var) {
        if (var == null) {
            return PathType.UNKNOWN;
        }
        //String path = AcePathfinder.INSTANCE.getPath(var);
        AcePathfinder instance = getInstance();
        String path = instance.getPath(var);
        LOG.debug("Current var: "+var+", Current Path: "+path);
        if (path == null) {
        	return PathType.UNKNOWN;
        }
        if (path.contains("weather")) {
            return PathType.WEATHER;
        } else if (path.contains("soil")) {
            if (path.contains("initial_conditions")) {
                return PathType.EXPERIMENT;
            }
            return PathType.SOIL;
        } else {
            return PathType.EXPERIMENT;
        }
    }
1359363
public static String getVariablesMapExpression(Collection variables) {
        StringBuilder variablesMap = new StringBuilder("new  " + PropertiesMap.class.getName() + "()");
        for (Object variable : variables) {
            JRVariable jrvar = (JRVariable) variable;
            String varname = jrvar.getName();
            variablesMap.append(".with(\"").append(varname).append("\",$V{").append(varname).append("})");
        }
        return variablesMap.toString();
    }