TreePattern implements Serializable { public static TreePattern<String> compile(final String pattern) { return compile(pattern, Function.identity()); } 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
	);  }
@Test(dataProvider = "erroneousPatterns", expectedExceptions = IllegalArgumentException.class) public void compileError(final String pattern) { TreePattern.compile(pattern); }
@Test public void serialize() throws IOException { final TreePattern<String> pattern = TreePattern.compile("add($x,$y,1)"); final byte[] data = IO.object.toByteArray(pattern); Assert.assertEquals(IO.object.fromByteArray(data), pattern); }