All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hydra.langs.tabular.Table Maven / Gradle / Ivy

There is a newer version: 0.8.0
Show newest version
// Note: this is an automatically generated file. Do not edit.

package hydra.langs.tabular;

import java.io.Serializable;

/**
 * A simple table as in a CSV file, having an optional header row and any number of data rows
 */
public class Table implements Serializable {
  public static final hydra.core.Name TYPE_NAME = new hydra.core.Name("hydra/langs/tabular.Table");
  
  public static final hydra.core.Name FIELD_NAME_HEADER = new hydra.core.Name("header");
  
  public static final hydra.core.Name FIELD_NAME_DATA = new hydra.core.Name("data");
  
  /**
   * The optional header row of the table. If present, the header must have the same number of cells as each data row.
   */
  public final hydra.util.Opt header;
  
  /**
   * The data rows of the table. Each row must have the same number of cells.
   */
  public final java.util.List> data;
  
  public Table (hydra.util.Opt header, java.util.List> data) {
    java.util.Objects.requireNonNull((header));
    java.util.Objects.requireNonNull((data));
    this.header = header;
    this.data = data;
  }
  
  @Override
  public boolean equals(Object other) {
    if (!(other instanceof Table)) {
      return false;
    }
    Table o = (Table) (other);
    return header.equals(o.header) && data.equals(o.data);
  }
  
  @Override
  public int hashCode() {
    return 2 * header.hashCode() + 3 * data.hashCode();
  }
  
  public Table withHeader(hydra.util.Opt header) {
    java.util.Objects.requireNonNull((header));
    return new Table(header, data);
  }
  
  public Table withData(java.util.List> data) {
    java.util.Objects.requireNonNull((data));
    return new Table(header, data);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy