public void Make_1Row1Column_False() { string[] rows = new string[] { "F" }; bool[,] array = Bool.Make2DimArray(rows, "TtYy1"); AssertDimensions(rows, array); Assert.AreEqual(false, array[0, 0]); }
//--------------------------------------------------------------------- static DisturbedSites() { // columns: 123456789 string[] rows = new string[] { "---------", // row 1 "---aaDa--", // row 2 "--aDDaa--", // row 3 "--aaaaaa-", // row 4 "-aaa--DD-", // row 5 "-Da---aaa", // row 6 "--aa--D--" }; // row 7 bool[,] array = Bool.Make2DimArray(rows, "aD"); DataGrid <bool> grid = new DataGrid <bool>(array); mixedLandscape = new Landscape(grid); List <Location> locList = new List <Location>(); foreach (ActiveSite site in mixedLandscape) { int row = (int)(site.Location.Row); int column = (int)(site.Location.Column); if (rows[row - 1][column - 1] == 'D') { locList.Add(site.Location); } } locations = locList.ToArray(); }
//--------------------------------------------------------------------- private ILandscape MakeLandscape(params string[] rows) { bool[,] array = Bool.Make2DimArray(rows, "X"); DataGrid <bool> grid = new DataGrid <bool>(array); return(new Landscape.Landscape(grid)); }
//--------------------------------------------------------------------- private ILandscape MakeHomogeneousLandscape(string activeSiteChars) { string[] rows = new string[] { "XXXXXXXX", "XXXXXXXX", "XXXXXXXX", "XXXXXXXX", "XXXXXXXX" }; bool[,] array = Bool.Make2DimArray(rows, activeSiteChars); DataGrid <bool> grid = new DataGrid <bool>(array); return(new Landscape.Landscape(grid)); }
public void Init() { string[] rows = new string[] { "....X..", "...XX.X", ".......", "...XXX.", "X.X.X.X", "XXXXXXX" }; bool [,] activeSites = Bool.Make2DimArray(rows, "X"); mixedGrid = new DataGrid <bool>(activeSites); mixedMap = new ActiveSiteMap(mixedGrid); }
public void Make_DifferentRowLens() { try { string[] rows = new string[] { "ABC", "123", "abcdef" }; bool[,] array = Bool.Make2DimArray(rows, ""); } catch (System.Exception e) { Data.Output.WriteLine(e.Message); throw; } }
public void Init() { // 12345678 string[] rows = new string[] { "...XX...", // 1 "..XXX..X", // 2 ".XXXX.XX", // 3 "...XXXX.", // 4 "....XX..", // 5 "........" }; // 6 activeSites = Bool.Make2DimArray(rows, "X"); DataGrid <bool> grid = new DataGrid <bool>(activeSites); landscape = new Landscape.Landscape(grid); }
//--------------------------------------------------------------------- static DisturbedSites() { // columns: 123456789 string[] rows = new string[] { "---------", // row 1 "---aaDa--", // row 2 "--aDDaa--", // row 3 "--aaaaaa-", // row 4 "-aaa--DD-", // row 5 "-Da---aaa", // row 6 "--aa--D--" }; // row 7 bool[,] array = Bool.Make2DimArray(rows, "aD"); int rowCount = array.GetLength(0); int colCount = array.GetLength(1); DataGrid <EcoregionCode> grid = new DataGrid <EcoregionCode>(rowCount, colCount); for (int row = 1; row <= rowCount; row++) { for (int col = 1; col <= colCount; col++) { if (array[row - 1, col - 1]) { grid[row, col] = new EcoregionCode(1, true); } else { grid[row, col] = new EcoregionCode(0, false); } } } mixedLandscape = new Landscape(grid, 1); List <Location> locList = new List <Location>(); foreach (ActiveSite site in mixedLandscape) { int row = site.Location.Row; int column = site.Location.Column; if (rows[row - 1][column - 1] == 'D') { locList.Add(site.Location); } } locations = locList.ToArray(); }
public void Init() { string[] rows = new string[] { "....X..", "...XX.X", ".......", "...XXX.", "X.X.X.X", "XXXXXXX" }; bool [,] activeSites = Bool.Make2DimArray(rows, "X"); mixedGrid = new DataGrid <bool>(activeSites); mixedMap = new ActiveSiteMap(mixedGrid); bool found_1stActive = false; bool found_1stInactive = false; for (uint row = 1; row <= mixedGrid.Rows; ++row) { for (uint column = 1; column <= mixedGrid.Columns; ++column) { if (mixedGrid[row, column]) { if (!found_1stActive) { mixed_1stActive = new Location(row, column); found_1stActive = true; } } else { if (!found_1stInactive) { mixed_1stInactive = new Location(row, column); found_1stInactive = true; } } } } }
public void Make_MixedArray() { bool[,] array = Bool.Make2DimArray(rowsMixed, rowsMixed_trueChars); AssertArraysMatch(arrayMixed, array); }
public void Make_3x5AllFalse() { string[] rows = rows3x5AllFalse; bool[,] array = Bool.Make2DimArray(rows, "TtYy1"); AssertArraysMatch(array3x5AllFalse, array); }
public void Make_1Row0Columns() { string[] rows = new string[] { "" }; bool[,] array = Bool.Make2DimArray(rows, ""); AssertDimensions(rows, array); }
public void Make_0Rows() { string[] rows = new string[0]; bool[,] array = Bool.Make2DimArray(rows, ""); AssertDimensions(rows, array); }