ColumnVisibility { public byte[] flatten() { Node normRoot = normalize(node, expression); StringBuilder builder = new StringBuilder(expression.length); stringify(normRoot, expression, builder); return builder.toString().getBytes(UTF_8); } ColumnVisibility();  ColumnVisibility(String expression);  ColumnVisibility(byte[] expression); byte[] getExpression(); static Node normalize(Node root, byte[] expression); static Node normalize(Node root, byte[] expression, NodeComparator comparator); static void stringify(Node root, byte[] expression, StringBuilder out); byte[] flatten(); @Override String toString(); @Override boolean equals(Object obj); boolean equals(ColumnVisibility otherLe); @Override int hashCode(); Node getParseTree(); static String quote(String term); static byte[] quote(byte[] term);  }
@Test public void testEmptyFlatten() { new ColumnVisibility().flatten(); new ColumnVisibility("").flatten(); }
@Test public void testParseTreesOrdering() { byte[] expression = "(b&c&d)|((a|m)&y&z)|(e&f)".getBytes(UTF_8); byte[] flattened = new ColumnVisibility(expression).flatten(); String flat = new String(flattened, UTF_8); assertTrue("shortest expressions sort first", flat.indexOf('e') < flat.indexOf('|')); assertTrue("shortest children sort first", flat.indexOf('b') < flat.indexOf('a')); }