com.softicar.platform.common.container.matrix.simple.SimpleMatrixCell Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-common Show documentation
Show all versions of platform-common Show documentation
The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.
package com.softicar.platform.common.container.matrix.simple;
import com.softicar.platform.common.container.matrix.IMatrixCell;
import com.softicar.platform.common.core.utils.CastUtils;
import java.util.Objects;
class SimpleMatrixCell implements IMatrixCell {
private final R row;
private final C column;
private final V value;
public SimpleMatrixCell(R row, C column, V value) {
this.row = row;
this.column = column;
this.value = value;
}
@Override
public boolean equals(Object other) {
if (other instanceof IMatrixCell) {
IMatrixCell otherCell = CastUtils.cast(other);
return Objects.equals(getRow(), otherCell.getRow()) && Objects.equals(getColumn(), otherCell.getColumn())
&& Objects.equals(getValue(), otherCell.getValue());
} else {
return false;
}
}
@Override
public int hashCode() {
return Objects.hash(row, column, value);
}
@Override
public String toString() {
return new StringBuilder()//
.append(getRow())
.append(", ")
.append(getColumn())
.append(", ")
.append(getValue())
.toString();
}
@Override
public C getColumn() {
return column;
}
@Override
public R getRow() {
return row;
}
@Override
public V getValue() {
return value;
}
}