Parse sequence parameter.

@param params the params
@param paramName the param name
@return the string [ ]
@throws TemplateModelException the template model exception
164298
@SuppressWarnings("rawtypes")
    protected String[] parseSequenceParameter(Map params, String paramName) throws TemplateModelException {
        Object paramModel = params.get(paramName);
        if (paramModel == null) {
            return null;
        }
        if (!(paramModel instanceof SimpleSequence)) {
            throw new IllegalArgumentException(paramName + " must be sequence");
        }
        List<String> list = transformSimpleSequenceAsStringList((SimpleSequence)paramModel, paramName);
        return list.toArray(new String[0]);
    }
106054
public Template parseTemplate(String source, Object parameterTypes) throws ParseException {
        String name = "/$" + Digest.getMD5(source);
        if (!hasResource(name)) {
            stringLoader.add(name, source);
        }
        try {
            return getTemplate(name, parameterTypes);
        } catch (IOException e) {
            throw new IllegalStateException(e.getMessage(), e);
        }
    }
472232
protected Hashtable<String, String> parseParameter(String param){
        // 
        Hashtable<String, String> table = new Hashtable<>();
        
        try{	  
            matcher2 = pSeparator.matcher(param);
            while (matcher2.find()){
                // start of a request
                table.put(matcher2.group(1), matcher2.group(2));
                
            }
        } catch(Exception e){
        	logger.error(e.getMessage(), e);
        }
        return table;
        
    }
752952
private Map<String, String[]> parseParams(I_CmsXmlContentLocation root) {

        // first use multimap for convenience, to group values for the same key,
        // and then convert to result format
        ArrayListMultimap<String, String> mmap = ArrayListMultimap.create();
        for (I_CmsXmlContentLocation location : root.getSubValues(N_PARAMETER)) {
            String key = location.getSubValue(N_KEY).getValue().getStringValue(m_cms);
            String value = location.getSubValue(N_VALUE).getValue().getStringValue(m_cms);
            mmap.put(key, value);
        }
        Map<String, String[]> result = new HashMap<>();
        String[] emptyArray = new String[] {}; // need this for toArray
        for (String key : mmap.keySet()) {
            List<String> values = mmap.get(key);
            String[] valuesArray = values.toArray(emptyArray);
            result.put(key, valuesArray);
        }
        return result;

    }
329612
private void parseTemplateVariables() throws MiniTemplator.TemplateSyntaxException {
        int p = 0;
        while (true) {
            p = templateText.indexOf("${", p);
            if (p == -1) {
                break;
            }
            int p0 = p;
            p = templateText.indexOf("}", p);
            if (p == -1) {
                throw new MiniTemplator.TemplateSyntaxException(
                        "Invalid variable reference in template at offset " + p0 + ".");
            }
            p++;
            String varName = templateText.substring(p0 + 2, p - 1).trim();
            if (varName.length() == 0) {
                throw new MiniTemplator.TemplateSyntaxException(
                        "Empty variable name in template at offset " + p0 + ".");
            }
            registerVariableReference(varName, p0, p);
        }
    }
330967
public TypeName getAdapterForParam(String paramName) {
		if (this.hasAdapterForParam(paramName)) {
			return TypeUtility.typeName(this.parameterName2Adapter.get(paramName));
		} else {
			return null;
		}
	}
924338
public static QueryParameter getParameterByName(List<QueryParameter> params, String parameterName) {
        for (QueryParameter parameter : params) {
            if (parameter.getName().equals(parameterName)) {
                return parameter;
            }
        }
        return null;
    }
399483
public String getFirstExistingParamName(String[] paramNames) {
    for (final String paramName : paramNames) {
      if (isPresent(paramName)) {
        return paramName;
      }
    }
    throw new ParameterException("One of " + Arrays.toString(paramNames)
        + " must be present");
  }
375753
protected void parseTemplateString() throws MalformedUriTemplateException
    {
        final String templateString = getTemplate();
        final UriTemplateParser scanner = new UriTemplateParser();
        this.components = scanner.scan(templateString);
        initExpressions();
    }
123459
protected AstParameters params() throws ScanException, ParseException {
		consumeToken(LPAREN);
		List<AstNode> l = Collections.emptyList();
		AstNode v = expr(false);
		if (v != null) {
			l = new ArrayList<AstNode>();
			l.add(v);
			while (token.getSymbol() == COMMA) {
				consumeToken();
				l.add(expr(true));
			}
		}
		consumeToken(RPAREN);
		return new AstParameters(l);
	}
941357
@SuppressWarnings("rawtypes")
    protected String parseStringParameter(Map params, String paramName) {
        Object paramModel = params.get(paramName);
        if (paramModel == null) {
            return null;
        }
        if (!(paramModel instanceof SimpleScalar)) {
            throw new IllegalArgumentException(paramName + " must be string");
        }
        return ((SimpleScalar)paramModel).getAsString();
    }
1074439
public static String formatParamList(String ... params) {
		StringBuilder s = new StringBuilder();
		for(String p : params) {
			if (s.length() != 0) {
				s.append(", ");
			}
			s.append(p);
		}
		return s.toString();
	}
709172
private List<String> getParameterAsList(String name) {
        String[] values = getParameterValues(name);
        if (values == null) {
            return null;
        }

        List<String> valueList = new ArrayList<>(values.length);
        Collections.addAll(valueList, values);
        return valueList;
    }
163044
private static ImmutableList<Segment> parseTemplate(String template) {
    // Skip useless leading slash.
    if (template.startsWith("/")) {
      template = template.substring(1);
    }

    // Extract trailing custom verb.
    Matcher matcher = CUSTOM_VERB_PATTERN.matcher(template);
    String customVerb = null;
    if (matcher.find()) {
      customVerb = matcher.group(1);
      template = template.substring(0, matcher.start(0));
    }

    ImmutableList.Builder<Segment> builder = ImmutableList.builder();
    String varName = null;
    int freeWildcardCounter = 0;
    int pathWildCardBound = 0;

    for (String seg : Splitter.on('/').trimResults().split(template)) {
      // If segment starts with '{', a binding group starts.
      boolean bindingStarts = seg.startsWith("{");
      boolean implicitWildcard = false;
      if (bindingStarts) {
        if (varName != null) {
          throw new ValidationException("parse error: nested binding in '%s'", template);
        }
        seg = seg.substring(1);

        int i = seg.indexOf('=');
        if (i <= 0) {
          // Possibly looking at something like "{name}" with implicit wildcard.
          if (seg.endsWith("}")) {
            // Remember to add an implicit wildcard later.
            implicitWildcard = true;
            varName = seg.substring(0, seg.length() - 1).trim();
            seg = seg.substring(seg.length() - 1).trim();
          } else {
            throw new ValidationException("parse error: invalid binding syntax in '%s'", template);
          }
        } else {
          // Looking at something like "{name=wildcard}".
          varName = seg.substring(0, i).trim();
          seg = seg.substring(i + 1).trim();
        }
        builder.add(Segment.create(SegmentKind.BINDING, varName));
      }

      // If segment ends with '}', a binding group ends. Remove the brace and remember.
      boolean bindingEnds = seg.endsWith("}");
      if (bindingEnds) {
        seg = seg.substring(0, seg.length() - 1).trim();
      }

      // Process the segment, after stripping off "{name=.." and "..}".
      switch (seg) {
        case "**":
        case "*":
          if ("**".equals(seg)) {
            pathWildCardBound++;
          }
          Segment wildcard = seg.length() == 2 ? Segment.PATH_WILDCARD : Segment.WILDCARD;
          if (varName == null) {
            // Not in a binding, turn wildcard into implicit binding.
            // "*" => "{$n=*}"
            builder.add(Segment.create(SegmentKind.BINDING, "$" + freeWildcardCounter));
            freeWildcardCounter++;
            builder.add(wildcard);
            builder.add(Segment.END_BINDING);
          } else {
            builder.add(wildcard);
          }
          break;
        case "":
          if (!bindingEnds) {
            throw new ValidationException("parse error: empty segment not allowed in '%s'",
                template);
          }
          // If the wildcard is implicit, seg will be empty. Just continue.
          break;
        default:
          builder.add(Segment.create(SegmentKind.LITERAL, seg));
      }

      // End a binding.
      if (bindingEnds) {
        // Reset varName to null for next binding.
        varName = null;

        if (implicitWildcard) {
          // Looking at something like "{var}". Insert an implicit wildcard, as it is the same
          // as "{var=*}".
          builder.add(Segment.WILDCARD);
        }
        builder.add(Segment.END_BINDING);
      }

      if (pathWildCardBound > 1) {
        // Report restriction on number of '**' in the pattern. There can be only one, which
        // enables non-backtracking based matching.
        throw new ValidationException(
            "parse error: pattern must not contain more than one path wildcard ('**') in '%s'",
            template);
      }

    }

    if (customVerb != null) {
      builder.add(Segment.create(SegmentKind.CUSTOM_VERB, customVerb));
    }
    return builder.build();
  }
1039544
@SafeVarargs
    public static <S, E extends Event> InputMapTemplate<S, E> sequence(InputMapTemplate<S, ? extends E>... templates) {
        return new TemplateChain<>(templates);
    }
569465
public Parse getParse(String params) throws Exception {
    String action = "parse";
    Api api = getActionResult(action, params);
    super.handleError(api);
    return api.getParse();
  }
958058
private static function _parseIfXxxWith1ParamMultiStrings($paramstr, $validatorName)
    {
        $params = explode(',', $paramstr);
        $c = count($params);
        if ($c < 2)
            return false;

        $varName = $params[0];
        $vals = [];
        for ($i = 1; $i < $c; $i++) {
            $vals[] = $params[$i];
        }
        return [$varName, $vals];
    }