TODO : rdoc rewrite needed

 This method is mostly used by the worker when looking up
 a process name or participant name bound under a variable.
551568
def iterative_var_lookup(k)

      v = lookup_variable(k)

      return [ k, v ] unless (v.is_a?(String) or v.is_a?(Symbol))

      iterative_var_lookup(v)
    end
384592
public Long getProcessId(String procname) throws Exception {
        Process proc = ProcessCache.getProcess(procname, 0);
        if (proc == null)
            throw new DataAccessException(0, "Cannot find process with name "
                    + procname + ", version 0");

        return proc.getId();
    }
1093635
def lookup_in_scope(name, scope)
      loop do
        tn = scope.path_with_task_name(name)
        task = @tasks[tn]
        return task if task
        break if scope.empty?
        scope = scope.tail
      end
      nil
    end
279809
protected void checkVariableName(GraphRewrite event, EvaluationContext context)
    {
        if (variableName == null)
        {
            setVariableName(Iteration.getPayloadVariableName(event, context));
        }
    }
1163661
function getProcessName(app, processName, index) {
  if (index > 0) {
    return app + '-' + processName + '-' + index;
  } else {
    return app + '-' + processName;
  }
}
51395
@Override
    public R visitVariable(VariableTree node, P p) {
        R r = scan(node.getModifiers(), p);
        r = scanAndReduce(node.getType(), p, r);
        r = scanAndReduce(node.getNameExpression(), p, r);
        r = scanAndReduce(node.getInitializer(), p, r);
        return r;
    }
778917
def _lookup_nslookup(name, rdtype, timeout=None, server=None):
    '''
    
    '''
    cmd = 'nslookup -query={0} {1}'.format(rdtype, name)

    if timeout is not None:
        cmd += ' -timeout={0}'.format(int(timeout))
    if server is not None:
        cmd += ' {0}'.format(server)

    cmd = __salt__['cmd.run_all'](cmd, python_shell=False, output_loglevel='quiet')

    if cmd['retcode'] != 0:
        log.warning(
            'nslookup returned (%s): %s',
            cmd['retcode'],
            cmd['stdout'].splitlines()[-1].strip(string.whitespace + ';')
        )
        return False

    lookup_res = iter(cmd['stdout'].splitlines())
    res = []
    try:
        line = next(lookup_res)
        if 'unknown query type' in line:
            raise ValueError('Invalid DNS type {}'.format(rdtype))

        while True:
            if name in line:
                break
            line = next(lookup_res)

        while True:
            line = line.strip()
            if not line or line.startswith('*'):
                break
            elif rdtype != 'CNAME' and 'canonical name' in line:
                name = line.split()[-1][:-1]
                line = next(lookup_res)
                continue
            elif rdtype == 'SOA':
                line = line.split('=')
            elif line.startswith('Name:'):
                line = next(lookup_res)
                line = line.split(':', 1)
            elif line.startswith(name):
                if '=' in line:
                    line = line.split('=', 1)
                else:
                    line = line.split(' ')

            res.append(_data_clean(line[-1]))
            line = next(lookup_res)

    except StopIteration:
        pass

    if rdtype == 'SOA':
        return [' '.join(res[1:])]
    else:
        return res
403045
private static String getWorkerMetricName(String name) {
    String result = CACHED_METRICS.get(name);
    if (result != null) {
      return result;
    }
    return CACHED_METRICS.computeIfAbsent(name,
        n -> getMetricNameWithUniqueId(InstanceType.WORKER, name));
  }
938897
private void visit(VariableRestrictionDescr descr) {

        PatternVariable patternVariable = (PatternVariable) data.getVariableByRuleAndVariableName(pattern.getRuleName(),
                descr.getIdentifier());
        VariableRestriction restriction = new VariableRestriction(pattern);

        restriction.setPatternIsNot(pattern.isPatternNot());
        restriction.setFieldPath(field.getPath());
        restriction.setOperator(Operator.determineOperator(descr.getEvaluator(),
                descr.isNegated()));
        restriction.setVariable(patternVariable);
        restriction.setOrderNumber(orderNumber);
        restriction.setParentPath(pattern.getPath());
        restriction.setParentType(pattern.getVerifierComponentType());

        // Set field value, if it is unset.
        field.setFieldType(Field.VARIABLE);

        data.add(restriction);
        solvers.addPatternComponent(restriction);
    }
241704
public final void lookupNameCompletionHints(
		SqlValidatorScope scope,
		List<String> names,
		SqlParserPos pos,
		Collection<SqlMoniker> hintList) {
		// Remove the last part of name - it is a dummy
		List<String> subNames = Util.skipLast(names);

		if (subNames.size() > 0) {
			// If there's a prefix, resolve it to a namespace.
			SqlValidatorNamespace ns = null;
			for (String name : subNames) {
				if (ns == null) {
					final SqlValidatorScope.ResolvedImpl resolved =
						new SqlValidatorScope.ResolvedImpl();
					final SqlNameMatcher nameMatcher = catalogReader.nameMatcher();
					scope.resolve(ImmutableList.of(name), nameMatcher, false, resolved);
					if (resolved.count() == 1) {
						ns = resolved.only().namespace;
					}
				} else {
					ns = ns.lookupChild(name);
				}
				if (ns == null) {
					break;
				}
			}
			if (ns != null) {
				RelDataType rowType = ns.getRowType();
				if (rowType.isStruct()) {
					for (RelDataTypeField field : rowType.getFieldList()) {
						hintList.add(
							new SqlMonikerImpl(
								field.getName(),
								SqlMonikerType.COLUMN));
					}
				}
			}

			// builtin function names are valid completion hints when the
			// identifier has only 1 name part
			findAllValidFunctionNames(names, this, hintList, pos);
		} else {
			// No prefix; use the children of the current scope (that is,
			// the aliases in the FROM clause)
			scope.findAliases(hintList);

			// If there's only one alias, add all child columns
			SelectScope selectScope =
				SqlValidatorUtil.getEnclosingSelectScope(scope);
			if ((selectScope != null)
				&& (selectScope.getChildren().size() == 1)) {
				RelDataType rowType =
					selectScope.getChildren().get(0).getRowType();
				for (RelDataTypeField field : rowType.getFieldList()) {
					hintList.add(
						new SqlMonikerImpl(
							field.getName(),
							SqlMonikerType.COLUMN));
				}
			}
		}

		findAllValidUdfNames(names, this, hintList);
	}
1059696
public void parseCollaboration() {
    Element collaboration = rootElement.element("collaboration");
    if (collaboration != null) {
      for (Element participant : collaboration.elements("participant")) {
        String processRef = participant.attribute("processRef");
        if (processRef != null) {
          ProcessDefinitionImpl procDef = getProcessDefinition(processRef);
          if (procDef != null) {
            // Set participant process on the procDef, so it can get rendered
            // later on if needed
            ParticipantProcess participantProcess = new ParticipantProcess();
            participantProcess.setId(participant.attribute("id"));
            participantProcess.setName(participant.attribute("name"));
            procDef.setParticipantProcess(participantProcess);

            participantProcesses.put(participantProcess.getId(), processRef);
          }
        }
      }
    }
  }
296307
private void processVirtualHostName(HttpMethod httpMethodProxyRequest, HttpServletRequest httpServletRequest) {
        String virtualHostName;
        if (httpMethodProxyRequest.getRequestHeader(STRING_HOST_HEADER_NAME) != null) {
            virtualHostName = HttpUtilities.removePortFromHostHeaderString(httpMethodProxyRequest.getRequestHeader(STRING_HOST_HEADER_NAME).getValue());
        } else {
            virtualHostName = HttpUtilities.getHostNameFromURL(httpServletRequest.getRequestURL().toString());
        }
        httpMethodProxyRequest.getParams().setVirtualHost(virtualHostName);
    }
1351876
def get_name_for(self, dynamic_part):
        
        name = self.format % dynamic_part
        if not self._accept_name(name):
            raise ImplementationError('It seems that pattern and format do not '
                                      'match for the field "%s"' % self.name)
        return name
508688
private void checkNameVisibility(Scope scope, Node name) {
    if (!name.isName()) {
      return;
    }

    Var var = scope.getVar(name.getString());
    if (var == null) {
      return;
    }

    Visibility v = checkPrivateNameConvention(
        AccessControlUtils.getEffectiveNameVisibility(
            name, var, defaultVisibilityForFiles), name);

    switch (v) {
      case PACKAGE:
        if (!isPackageAccessAllowed(var, name)) {
          compiler.report(
              JSError.make(
                  name,
                  BAD_PACKAGE_PROPERTY_ACCESS,
                  name.getString(),
                  var.getSourceFile().getName()));
        }
        break;
      case PRIVATE:
        if (!isPrivateAccessAllowed(var, name)) {
          compiler.report(
              JSError.make(
                  name,
                  BAD_PRIVATE_GLOBAL_ACCESS,
                  name.getString(),
                  var.getSourceFile().getName()));
        }
        break;
      default:
        // Nothing to do for PUBLIC and PROTECTED
        // (which is irrelevant for names).
        break;
    }
  }
395566
def by_participant(participant_name, opts={})

      return @context.storage.by_participant(
        'workitems', participant_name, opts
      ) if @context.storage.respond_to?(:by_participant)

      do_select(opts) do |hwi|
        hwi['participant_name'] == participant_name
      end
    end
35458
@Override
	public RandomVariable getProcessValue(int timeIndex, int componentIndex) {
		// Thread safe lazy initialization
		synchronized(this) {
			if (discreteProcess == null || discreteProcess.length == 0) {
				doPrecalculateProcess();
			}
		}

		if(discreteProcess[timeIndex][componentIndex] == null) {
			throw new NullPointerException("Generation of process component " + componentIndex + " at time index " + timeIndex + " failed. Likely due to out of memory");
		}

		// Return value of process
		return discreteProcess[timeIndex][componentIndex];
	}
1019984
public static String getLocalNodeName(AlluxioConfiguration conf) {
    switch (CommonUtils.PROCESS_TYPE.get()) {
      case JOB_MASTER:
        if (conf.isSet(PropertyKey.JOB_MASTER_HOSTNAME)) {
          return conf.get(PropertyKey.JOB_MASTER_HOSTNAME);
        }
        break;
      case JOB_WORKER:
        if (conf.isSet(PropertyKey.JOB_WORKER_HOSTNAME)) {
          return conf.get(PropertyKey.JOB_WORKER_HOSTNAME);
        }
        break;
      case CLIENT:
        if (conf.isSet(PropertyKey.USER_HOSTNAME)) {
          return conf.get(PropertyKey.USER_HOSTNAME);
        }
        break;
      case MASTER:
        if (conf.isSet(PropertyKey.MASTER_HOSTNAME)) {
          return conf.get(PropertyKey.MASTER_HOSTNAME);
        }
        break;
      case WORKER:
        if (conf.isSet(PropertyKey.WORKER_HOSTNAME)) {
          return conf.get(PropertyKey.WORKER_HOSTNAME);
        }
        break;
      default:
        break;
    }
    return getLocalHostName((int) conf.getMs(PropertyKey.NETWORK_HOST_RESOLUTION_TIMEOUT_MS));
  }