m.walkInRowOrder(new SetVisitor(), 1, rows - 2, 1, columns - 2);
getVisitor = new GetVisitor();
m.walkInOptimizedOrder(getVisitor, 1, rows - 2, 1, columns - 2);
Assert.assertEquals((rows - 2) * (columns - 2), getVisitor.getCount());
for (int i = 0; i < rows; ++i) {
Assert.assertEquals(new Fraction(0), m.getEntry(i, 0));
Assert.assertEquals(new Fraction(0), m.getEntry(i, columns - 1));
}
for (int j = 0; j < columns; ++j) {
Assert.assertEquals(new Fraction(0), m.getEntry(0, j));
Assert.assertEquals(new Fraction(0), m.getEntry(rows - 1, j));
}
m = new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
m.walkInColumnOrder(new SetVisitor());
getVisitor = new GetVisitor();
m.walkInOptimizedOrder(getVisitor);
Assert.assertEquals(rows * columns, getVisitor.getCount());
m = new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
m.walkInColumnOrder(new SetVisitor(), 1, rows - 2, 1, columns - 2);
getVisitor = new GetVisitor();
m.walkInOptimizedOrder(getVisitor, 1, rows - 2, 1, columns - 2);
Assert.assertEquals((rows - 2) * (columns - 2), getVisitor.getCount());
for (int i = 0; i < rows; ++i) {
Assert.assertEquals(new Fraction(0), m.getEntry(i, 0));
Assert.assertEquals(new Fraction(0), m.getEntry(i, columns - 1));
}
for (int j = 0; j < columns; ++j) {
Assert.assertEquals(new Fraction(0), m.getEntry(0, j));
Assert.assertEquals(new Fraction(0), m.getEntry(rows - 1, j));
}
m = new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
m.walkInOptimizedOrder(new SetVisitor());
getVisitor = new GetVisitor();
m.walkInRowOrder(getVisitor);
Assert.assertEquals(rows * columns, getVisitor.getCount());
m = new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
m.walkInOptimizedOrder(new SetVisitor(), 1, rows - 2, 1, columns - 2);
getVisitor = new GetVisitor();
m.walkInRowOrder(getVisitor, 1, rows - 2, 1, columns - 2);
Assert.assertEquals((rows - 2) * (columns - 2), getVisitor.getCount());
for (int i = 0; i < rows; ++i) {
Assert.assertEquals(new Fraction(0), m.getEntry(i, 0));
Assert.assertEquals(new Fraction(0), m.getEntry(i, columns - 1));
}
for (int j = 0; j < columns; ++j) {
Assert.assertEquals(new Fraction(0), m.getEntry(0, j));
Assert.assertEquals(new Fraction(0), m.getEntry(rows - 1, j));
}
m = new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
m.walkInOptimizedOrder(new SetVisitor());
getVisitor = new GetVisitor();
m.walkInColumnOrder(getVisitor);
Assert.assertEquals(rows * columns, getVisitor.getCount());
m = new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
m.walkInOptimizedOrder(new SetVisitor(), 1, rows - 2, 1, columns - 2);
getVisitor = new GetVisitor();
m.walkInColumnOrder(getVisitor, 1, rows - 2, 1, columns - 2);
Assert.assertEquals((rows - 2) * (columns - 2), getVisitor.getCount());
for (int i = 0; i < rows; ++i) {
Assert.assertEquals(new Fraction(0), m.getEntry(i, 0));
Assert.assertEquals(new Fraction(0), m.getEntry(i, columns - 1));
}
for (int j = 0; j < columns; ++j) {
Assert.assertEquals(new Fraction(0), m.getEntry(0, j));
Assert.assertEquals(new Fraction(0), m.getEntry(rows - 1, j));
}
}