juan_gandhi: (VP)
Вопрос джавщикам.

У меня там сериализация десериализация (RMI используется) хочет, чтобы каждый дурацкий мелкий класс имел публичный пустой конструктор. Так что рисовать безымянные классы уже как бы не получится. В результате дизайн совсем уже тупой.

А что, не в курсе, как это все покрасивше чтоб? Конечно, я надеюсь, недолго мне мучиться (тут объявили даже, что скоро от первичности материи шестой джавы откажутся. Но блин, мне как-то маловато будет.

Так вот, идейки? Хоть генерируй весь этот бойлерплейт.
juan_gandhi: (VP)
  // test how file can be unfolded into multiple columns
  public void testUnfoldingColumn() throws IOException {
    // Here's the file
    File file = getFile("smalldata/chicago/chicagoAllWeather.csv");

    // Get all its lines
    final List<String> lines = Files.readLines(file, Charset.defaultCharset());

    // Store it in H2O, with typed column as a wrapper (core H2O storage is a type-unaware Vec class)
    Column<String> source = willDrop(Strings.newColumn(lines));

    // Produce another (virtual) column that stores a list of strings as a row value
    Column<List<String>> split = new UnfoldingColumn<>(Functions.splitBy(","), source, 10);

    // now check that we have the right data
    for (int i = 0; i < lines.size(); i++) {
      // Since we specified width (10), the rest of the list is filled with nulls; have to ignore them.
      // It's important to have the same width for the whole frame..
      String actual = StringUtils.join(" ", Predicate.NOT_NULL.filter(split.apply(i)));
      // So, have we lost any data?
      assertEquals(lines.get(i).replaceAll("\\,", " ").trim(), actual);
    }
  }

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

November 2025

S M T W T F S
       1
23456 7 8
9 1011 12 1314 15
16171819 20 2122
23 24 2526272829
30      

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Nov. 26th, 2025 08:22 am
Powered by Dreamwidth Studios