Created
July 12, 2018 20:02
-
-
Save greg-hellings/d13443fbf496cb9f4307407321311433 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Base { | |
protected List<Cell> cells = new ArrayList<>(); | |
protected Matrix matrix; | |
public Base(Matrix matrix) { | |
this.matrix = matrix; | |
for(int i = 0; i < matrix.dimension(); ++i) | |
// This call won't work, because Row.row isn't set until after the call to super(matrix); | |
this.cells.add(this.getCell(i)); | |
} | |
public abstract Cell getCell(int i); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Row { | |
private int row; | |
public Row(int row, Matrix matrix) { | |
super(matrix); | |
this.row = row; | |
} | |
public Cell getCell(int i) { | |
return this.matrix.getCell(row, i); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment