public static void dumpTupleIndexes(TupleIndex[] tupleIndexes) { for ( TupleIndex tIdx : tupleIndexes ) dumpTupleIndex(tIdx) ; }
/** Apply to a <em>mapped</em> tuple to get a tuple with the column mapping reverse-applied */ public <T> Tuple<T> unmap(Tuple<T> src) { return map(src, fetchOrder) ; }
/** * Encode and write a {@link Node} to the {@link ObjectFile}. Returns the location, * suitable for use with {@link #fetchDecode}. */ public static long encodeStore(Node node, ObjectFile file) { return encodeStore(node, file, null); }
@Test public void compile1() { int[] x = ColumnMap.compileMapping("SPO", "POS") ; // SPO -> POS so col 0 goes to col 2, col 1 goes to col 0 and col 2 goes to col 1 int[] expected = { 2,0,1 } ; assertArrayEquals(expected, x) ; }
private void test(String x, String y, StringAbbrev abbrev) { String z1 = abbrev.abbreviate(x) ; assertEquals(y, z1) ; String z2 = abbrev.expand(z1) ; assertEquals(x, z2) ; } }
@Test public void abbrev_03() { StringAbbrev abbrev = new StringAbbrev() ; test("::Hello", ":_::Hello", abbrev) ; }
@Test public void abbrev_04() { StringAbbrev abbrev = new StringAbbrev() ; abbrev.add("x", "He") ; test("Hello", ":x:llo", abbrev) ; test("hello", "hello", abbrev) ; test(":hello", ":_:hello", abbrev) ; }
/** Construct a column mapping that maps the input (one col, one char) to the output */ public ColumnMap(String input, String output) { this(input+"->"+output, compileMapping(input, output)) ; }
/** Reorder the letters of a string by the same rules as this column map (backward, fetch direction) */ public String unmapName(String word) { return mapString(word, fetchOrder) ; }
@Test public void compile2() { int[] x = ColumnMap.compileMapping("SPOG", "GOPS") ; int[] expected = { 3, 2, 1, 0 } ; assertArrayEquals(expected, x) ; }
private void test(String x, String y, StringAbbrev abbrev) { String z1 = abbrev.abbreviate(x) ; assertEquals(y, z1) ; String z2 = abbrev.expand(z1) ; assertEquals(x, z2) ; } }
@Test public void abbrev_02() { StringAbbrev abbrev = new StringAbbrev() ; test(":Hello", ":_:Hello", abbrev) ; }
public <T> ColumnMap(String label, List<T> input, List<T> output) { this(label, compileMapping(input, output)) ; }
/** Apply to an <em>unmapped</em> tuple to get a tuple with the column mapping applied */ public <T> Tuple<T> map(Tuple<T> src) { return map(src, insertOrder) ; }
/** Reorder the letters of a string by the same rules as this column map (forward, map direction)*/ public String mapName(String word) { return mapString(word, insertOrder) ; }
@Test public void compile1() { int[] x = ColumnMap.compileMapping("SPO", "POS") ; // SPO -> POS so col 0 goes to col 2, col 1 goes to col 0 and col 2 goes to col 1 int[] expected = { 2,0,1 } ; assertArrayEquals(expected, x) ; }
@Test public void abbrev_01() { StringAbbrev abbrev = new StringAbbrev() ; test("Hello", "Hello", abbrev) ; }
public <T> ColumnMap(String label, T[] input, T[] output) { this(label, compileMapping(input, output)) ; }
@Test public void compile2() { int[] x = ColumnMap.compileMapping("SPOG", "GOPS") ; int[] expected = { 3, 2, 1, 0 } ; assertArrayEquals(expected, x) ; }
@Test public void abbrev_01() { StringAbbrev abbrev = new StringAbbrev() ; test("Hello", "Hello", abbrev) ; }