hydra.langs.tabular.Table Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hydra-java Show documentation
Show all versions of hydra-java Show documentation
The Hydra language for strongly-typed transformations
// 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);
}
}