DatumEncoder { public void copy(DatumEncoder other) { attributeDimensionNameMap.clear(); for (Map.Entry<Integer, String> entry : other.attributeDimensionNameMap.entrySet()) { attributeDimensionNameMap.put(entry.getKey(), entry.getValue()); } integerEncoding.clear(); for (Map.Entry<Integer, Map<String, Integer>> entry : other.integerEncoding.entrySet()) { integerEncoding.put(entry.getKey(), entry.getValue()); } integerToColumn.clear(); for (Map.Entry<Integer, Integer> entry : other.integerToColumn.entrySet()) { integerToColumn.put(entry.getKey(), entry.getValue()); } nextKey = other.nextKey; } DatumEncoder(); void copy(DatumEncoder other); void recordAttributeName(int dimension, String attribute); String getAttributeName(Integer dimension); ColumnValue getAttribute(int encodedAttr); List<ColumnValue> getColsFromAttrSet(Set<Integer> attrs); List<ColumnValue> getColsFromAttr(Integer item); int getIntegerEncoding(int dimension, String attr); int getNextKey();  }
@Test public void copyTest() { DatumEncoder e1 = new DatumEncoder(); e1.recordAttributeName(0, "foo"); int encoded1 = e1.getIntegerEncoding(0, "attrValue1"); int encoded2 = e1.getIntegerEncoding(0, "attrValue2"); e1.recordAttributeName(1, "bar"); int encoded3 = e1.getIntegerEncoding(1, "attrValue3"); DatumEncoder e2 = new DatumEncoder(); e2.copy(e1); assertEquals("foo", e2.getAttribute(encoded1).getColumn()); assertEquals("bar", e2.getAttribute(encoded3).getColumn()); assertEquals("attrValue3", e2.getAttribute(encoded3).getValue()); int encoded4 = e2.getIntegerEncoding(1, "attrValue4"); assertEquals("attrValue4", e2.getAttribute(encoded4).getValue()); }