ColumnsMask { public ColumnType getCategory(int colNumber) { if (colNumber < columns.size()) { return columns.get(colNumber); } return columns.get(columns.size() - 1); } ColumnsMask(String str); @Override String toString(); ColumnType getCategory(int colNumber);  }
@Test public void testParse1() { ColumnsMask mask = new ColumnsMask("lc[37]n"); assertEquals(ColumnType.LABEL, mask.getCategory(0)); assertEquals(ColumnType.CATEGORICAL, mask.getCategory(30)); assertEquals(ColumnType.NUMERICAL, mask.getCategory(47)); assertEquals(ColumnType.NUMERICAL, mask.getCategory(1024)); }
@Test public void testParse2() { ColumnsMask mask = new ColumnsMask("lc"); assertEquals(ColumnType.LABEL, mask.getCategory(0)); assertEquals(ColumnType.CATEGORICAL, mask.getCategory(30)); assertEquals(ColumnType.CATEGORICAL, mask.getCategory(47)); assertEquals(ColumnType.CATEGORICAL, mask.getCategory(1024)); }
@Test public void testParse3() { ColumnsMask mask = new ColumnsMask("ilcccccnnnnn"); assertEquals(ColumnType.ID, mask.getCategory(0)); assertEquals(ColumnType.LABEL, mask.getCategory(1)); assertEquals(ColumnType.CATEGORICAL, mask.getCategory(4)); assertEquals(ColumnType.NUMERICAL, mask.getCategory(1024)); }