f7
f7 is a spreadsheet formula execution library
git clone https://git.vogt.world/f7.git
Log | Files | README.md | LICENSE.md
← All files
name: src/main/java/io/protobase/f7/models/GridColumnRowKey.java
-rw-r--r--
1505
 1package io.protobase.f7.models;
 2
 3import com.google.common.base.MoreObjects;
 4
 5/**
 6 * Represents a single location in a 3D grid: {column=x, row=y, grid=z}.
 7 */
 8public class GridColumnRowKey extends BaseObject {
 9  private String grid;
10  private ColumnRowKey subKey;
11
12  /**
13   * Create a new key from column row key and grid.
14   *
15   * @param grid         - name of the grid
16   * @param columnRowKey - column row key.
17   */
18  public GridColumnRowKey(String grid, ColumnRowKey columnRowKey) {
19    this.grid = grid;
20    subKey = columnRowKey;
21  }
22
23  /**
24   * Grid index.
25   *
26   * @return grid index.
27   */
28  public String getGridIndex() {
29    return grid;
30  }
31
32  /**
33   * Column index.
34   *
35   * @return column index.
36   */
37  public Integer getColumnIndex() {
38    return subKey.getColumnIndex();
39  }
40
41  /**
42   * Row index.
43   *
44   * @return row index.
45   */
46  public Integer getRowIndex() {
47    return subKey.getRowIndex();
48  }
49
50  /**
51   * Get the column row key.
52   *
53   * @return column row key.
54   */
55  public ColumnRowKey toColumnRowKey() {
56    return new ColumnRowKey(getColumnIndex(), getRowIndex());
57  }
58
59  @Override
60  public String toString() {
61    return MoreObjects.toStringHelper(this)
62        .add("grid", grid)
63        .add("column", subKey.getColumnIndex())
64        .add("row", subKey.getRowIndex())
65        .toString();
66  }
67
68  @Override
69  public Object[] significantAttributes() {
70    return new Object[]{
71        grid,
72        subKey.getColumnIndex(),
73        subKey.getRowIndex()
74    };
75  }
76}