@Test public void expand() { final TreePattern<String> pattern = TreePattern.compile("add($x,$y,1)"); final Map<Var<String>, Tree<String, ?>> vars = new HashMap<>(); vars.put(TreePattern.Var.of("x"), TreeNode.parse("sin(x)")); vars.put(TreePattern.Var.of("y"), TreeNode.parse("sin(y)")); final Tree<String, ?> tree = pattern.expand(vars); Assert.assertEquals(tree.toParenthesesString(), "add(sin(x),sin(y),1)"); }
public TreeNode<V> expand(final Map<Var<V>, Tree<V, ?>> vars) { return expand(_pattern, vars); }
TreePattern implements Serializable { public TreeNode<V> expand(final Map<Var<V>, Tree<V, ?>> vars) { return expand(_pattern, vars); } }
TreePattern implements Serializable { public TreeNode<V> expand(final Map<Var<V>, Tree<V, ?>> vars) { return expand(_pattern, vars); } TreePattern(final Tree<Decl<V>, ?> pattern); }
TreePattern implements Serializable { public TreeNode<V> expand(final Map<Var<V>, Tree<V, ?>> vars) { return expand(_pattern, vars); } TreePattern(final Tree<Decl<V>, ?> pattern); SortedSet<Var<V>> vars(); TreePattern<B> map(final Function<? super V, ? extends B> mapper); TreeMatcher<V> matcher(final Tree<V, ?> tree); Optional<TreeMatchResult<V>> match(final Tree<V, ?> tree); boolean matches(final Tree<V, ?> tree); TreeNode<V> expand(final Map<Var<V>, Tree<V, ?>> vars); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString(); static TreePattern<String> compile(final String pattern); static TreePattern<V> compile(
		final String pattern,
		final Function<? super String, ? extends V> mapper
	); }
TreePattern implements Serializable { public TreeNode<V> expand(final Map<Var<V>, Tree<V, ?>> vars) { return expand(_pattern, vars); } TreePattern(final Tree<Decl<V>, ?> pattern); SortedSet<Var<V>> vars(); TreePattern<B> map(final Function<? super V, ? extends B> mapper); TreeMatcher<V> matcher(final Tree<V, ?> tree); Optional<TreeMatchResult<V>> match(final Tree<V, ?> tree); boolean matches(final Tree<V, ?> tree); TreeNode<V> expand(final Map<Var<V>, Tree<V, ?>> vars); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString(); static TreePattern<String> compile(final String pattern); static TreePattern<V> compile(
		final String pattern,
		final Function<? super String, ? extends V> mapper
	);  }