@Test(dataProvider = "patterns") public void expand( final String pattern, final String[] trees, final String expanded ) { final TreePattern<String> tp = TreePattern.compile(pattern); final Map<Var<String>, Tree<String, ?>> vars = IntStream.range(0, trees.length) .mapToObj(i -> new Object() { final Var<String> name = Var.of(VARS[i]); final Tree<String, ?> tree = TreeNode.parse(trees[i]); }) .collect(Collectors.toMap(o -> o.name, o -> o.tree)); Assert.assertEquals(tp.expand(vars).toParenthesesString(), expanded); }
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
	);  }