I just whipped these up: /** * Replace instances of one value to another. * @param from any element that matches this value will be replaced * @param to with this value */ public void replace(int from, int to) { for (int x = 0; x < width; x++) for (int y = 0; y < height; y++) if (field[x][y] == from) field[x][y] = to; } --- /** * Replace instances of one value to another. * @param from any element that matches this value will be replaced * @param to with this value */ public void replace(double from, double to) { for (int x = 0; x < width; x++) for (int y = 0; y < height; y++) if (field[x][y] == from) field[x][y] = to; } With Sean's permission, I'll check them in. Joey On Mon, Jul 8, 2013 at 10:38 PM, Joey Harrison <[log in to unmask]>wrote: > I just whipped these up: > > > /** > * Replace instances of one value to another. > * @param from any element that matches this value will be replaced > * @param to with this value > */ > public void replace(int from, int to) > { > for (int x = 0; x < width; x++) > for (int y = 0; y < height; y++) > if (field[x][y] == from) > field[x][y] = to; > } > > --- > > /** > * Replace instances of one value to another. > * @param from any element that matches this value will be replaced > * @param to with this value > */ > public void replace(double from, double to) > { > for (int x = 0; x < width; x++) > for (int y = 0; y < height; y++) > if (field[x][y] == from) > field[x][y] = to; > } > > With Sean's permission, I'll check them in. > > Joey > > On Mon, Jul 8, 2013 at 8:46 PM, Mark Coletti <[log in to unmask]> wrote: > >> I'd like, as a convenience, for these member functions: >> >> IntGrid2D.replace(int from, int to); // change all values of 'from' to >> 'to' >> DoubleGrid2D.replace(double from, double to); >> >> (I'd do it myself, but this is outside GeoMason's bailiwick.) >> >> -- >> [log in to unmask] >> >> >