Concatenates the given {@link TemplateVariable}s to the current one.

@param variables must not be {@literal null}.
@return
774282
public TemplateVariables concat(Collection<TemplateVariable> variables) {

		List<TemplateVariable> result = new ArrayList<>(this.variables.size() + variables.size());
		result.addAll(this.variables);

		List<TemplateVariable> filtered = variables.stream() //
				.filter(variable -> !containsEquivalentFor(variable)).collect(Collectors.toList());

		result.addAll(filtered);

		return new TemplateVariables(result);
	}
303575
protected void generateJsOptionsForTemplateContent(final Map<String, Object> variables,
		final StringBuilder sb)
	{
		sb.append("{\n");
		int count = 1;
		Object localComponentId = null;
		if (withComponentId)
		{
			localComponentId = variables.get(COMPONENT_ID);
			variables.remove(COMPONENT_ID);
		}
		for (final Map.Entry<String, Object> entry : variables.entrySet())
		{
			final String key = entry.getKey();
			sb.append(key).append(": ${").append(key).append("}");
			if (count < variables.size())
			{
				sb.append(",\n");
			}
			else
			{
				sb.append("\n");
			}
			count++;
		}
		if (withComponentId)
		{
			variables.put(COMPONENT_ID, localComponentId);
		}
		sb.append("}");
	}
218160
public Context merge(final Map<String, Object> vars) {
        return merge(Vars.of(vars));
    }
35196
public function addTemplateVariablesFor($template, array $contentVariables)
    {
        if (!array_key_exists($template, $this->paramArrays)) {
            $this->paramArrays[$template] = $this->getParamArrayFor($template);
        }

        // add vars for main template
        $contentVariables = array_merge($this->paramArrays[$template], $contentVariables);

        // add the template-variables to the contentItem-params-arrays
        if (array_key_exists(self::CONTENT_ITEMS, $contentVariables)) {
            foreach ($contentVariables[self::CONTENT_ITEMS] as $key => $contentItem) {
                // get the key (=> template)
                reset($contentItem);
                $itemTemplate = key($contentItem);

                // get the params
                $itemParams = $contentItem[$itemTemplate];

                // add params for this template
                $contentItem[$itemTemplate] = $this->addTemplateVariablesFor($itemTemplate, $itemParams);

                // store back into the main array
                $contentVariables[self::CONTENT_ITEMS][$key] = $contentItem;
            }
        }

        return $contentVariables;
    }
1102221
public static TemplatePathInfo forTemplatePath(@NotNull String templatePath, @NotNull TemplatePathInfo @NotNull... templates) {
    if (templatePath == null || templates == null || templates.length == 0) {
      return null;
    }
    for (TemplatePathInfo template : templates) {
      if (StringUtils.equals(template.getTemplatePath(), templatePath)) {
        return template;
      }
    }
    return null;
  }
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);
        }
    }
192932
public String expand(Map<String, Object> vars) throws VariableExpansionException
    {
        this.values = vars;
        return expand();
    }
1299299
public QueryContext with( Map<String, Object> variables ) {
        return new QueryContext(context, repositoryCache, workspaceNames, overriddenNodeCachesByWorkspaceName, schemata,
                                indexDefns, nodeTypes, bufferManager, hints, problems, variables);
    }
971031
def expand(template, variables):
    
    def _sub(match):
        expression = match.group(1)
        operator = ""
        if expression[0] in OPERATOR:
            operator = expression[0]
            varlist = expression[1:]
        else:
            varlist = expression

        safe = ""
        if operator in ["+", "#"]:
            safe = RESERVED
        varspecs = varlist.split(",")
        varnames = []
        defaults = {}
        for varspec in varspecs:
            default = None
            explode = False
            prefix = None
            if "=" in varspec:
                varname, default = tuple(varspec.split("=", 1))
            else:
                varname = varspec
            if varname[-1] == "*":
                explode = True
                varname = varname[:-1]
            elif ":" in varname:
                try:
                    prefix = int(varname[varname.index(":")+1:])
                except ValueError:
                    raise ValueError("non-integer prefix '{0}'".format(
                       varname[varname.index(":")+1:]))
                varname = varname[:varname.index(":")]
            if default:
                defaults[varname] = default
            varnames.append((varname, explode, prefix))

        retval = []
        joiner = operator
        start = operator
        if operator == "+":
            start = ""
            joiner = ","
        if operator == "#":
            joiner = ","
        if operator == "?":
            joiner = "&"
        if operator == "&":
            start = "&"
        if operator == "":
            joiner = ","
        for varname, explode, prefix in varnames:
            if varname in variables:
                value = variables[varname]
                if not value and value != "" and varname in defaults:
                    value = defaults[varname]
            elif varname in defaults:
                value = defaults[varname]
            else:
                continue
            expanded = TOSTRING[operator](
              varname, value, explode, prefix, operator, safe=safe)
            if expanded is not None:
                retval.append(expanded)
        if len(retval) > 0:
            return start + joiner.join(retval)
        else:
            return ""

    return TEMPLATE.sub(_sub, template)
1336252
def variables(template):
    ''''''
    vars = set()
    for varlist in TEMPLATE.findall(template):
        if varlist[0] in OPERATOR:
            varlist = varlist[1:]
        varspecs = varlist.split(',')
        for var in varspecs:
            # handle prefix values
            var = var.split(':')[0]
            # handle composite values
            if var.endswith('*'):
                var = var[:-1]
            vars.add(var)
    return vars
572629
@Override
	public TransformContext addBindVariables(final Object[] bindValiables) {
		for (Object bindValiable : bindValiables) {
			this.bindValiables.add(bindValiable);
		}
		return this;
	}
222740
public static Variable[] getVariables(NameSpace ns, String[] names) {
        if (null == ns || null == names)
            return new Variable[0];
        return Stream.of(names).map(name->getVariable(ns, name))
            .filter(Objects::nonNull).toArray(Variable[]::new);
    }
31811
private HashMap<String, String[]>[] expandedQueryVariables(
      HashMap<String, String[]> queryVariables) {
    ArrayList<HashMap<String, String[]>> result = new ArrayList<>();
    Set<String> keys = queryVariables.keySet();
    generatePermutationsQueryVariables(result, keys, queryVariables);
    return result.toArray(new HashMap[result.size()]);
  }
1293511
public SDVariable[] updateVariableNamesAndReferences(SDVariable[] variablesToUpdate, String[] newVariableNames) {

        int numVariables = variablesToUpdate.length;
        SDVariable[] updatedVariables = new SDVariable[numVariables];

        for (int i = 0; i < numVariables; i++) {
            SDVariable varToUpdate = variablesToUpdate[i];
            String name = newVariableNames == null ? null : newVariableNames[i];
            updatedVariables[i] = updateVariableNameAndReference(varToUpdate, name);
        }

        return updatedVariables;
    }
312342
private void unExposeVariables() {
        if (deferredExpression == null) {
            // "nested" variables are now simply removed
            if (itemId != null) {
                pageContext.removeAttribute(itemId, PageContext.PAGE_SCOPE);
            }
        } else {
            //we're deferred ... remove variable mapping
            ELContext myELContext = pageContext.getELContext();
            VariableMapper vm = myELContext.getVariableMapper();
            vm.setVariable(itemId, null);
        }
        if (statusId != null) {
            pageContext.removeAttribute(statusId, PageContext.PAGE_SCOPE);
        }
    }
1060843
protected function mergeTemplate(array $variables)
    {
        $prepared_variables = [];
        foreach ($variables as $name => $value) {
            $prepared_variables[sprintf("{:%s:}", $name)] = $value;
        }

        return strtr(
            $this->getCodeTemplate(),
            $prepared_variables
        );
    }
1025402
private Map<String, JSType> buildTypeVariables(
      Map<TemplateType, JSType> inferredTypes) {
    Map<String, JSType> typeVars = new LinkedHashMap<>();
    for (Entry<TemplateType, JSType> e : inferredTypes.entrySet()) {
      // Only add the template type that do not have a type transformation
      if (!e.getKey().isTypeTransformation()) {
        typeVars.put(e.getKey().getReferenceName(), e.getValue());
      }
    }
    return typeVars;
  }