Commit 7d8d8bdd authored by Ahmed's avatar Ahmed

change the a variable name in erode and dilate

parent 7e90dbae
......@@ -18,7 +18,7 @@ import java.util.List;
* @author Ahmed Diab
*/
public class DilateCommand extends MathCommand{
public class DilateCommand extends ArgumentReturnMathCommand{
public DilateCommand() {
setMathCommandName("dilate");
}
......@@ -70,14 +70,14 @@ public class DilateCommand extends MathCommand{
Variable dilation_elem = new Variable();
dilation_elem.setName("erosion_elem");
dilation_elem.setVariableType(new VariableType("Integer", "int",""));
Variable iteration = new Variable();
iteration.setName("iteration");
iteration.setVariableType(new VariableType("Integer", "int", ""));
Variable iterations = new Variable();
iterations.setName("iterations");
iterations.setVariableType(new VariableType("Integer", "int", ""));
//add variable to method
method.addParameter(src);
method.addParameter(dst);
method.addParameter(dilation_elem);
method.addParameter(iteration);
method.addParameter(iterations);
//add an instruction to the method
method.addInstruction(methodBody());
......@@ -96,7 +96,7 @@ public class DilateCommand extends MathCommand{
" mat element = getStructuringElement( dilation_type,\n" +
" Size( 2*dilation_size + 1, 2*dilation_size+1 ),\n" +
" Point( dilation_size, dilation_size ) );\n" +
" dilate( src, dst, element, Point(-1,-1), iteration );";
" dilate( src, dst, element, Point(-1,-1), iterations );";
}
@Override
......
......@@ -71,14 +71,14 @@ public class ErodeCommand extends ArgumentReturnMathCommand{
Variable erosion_elem = new Variable();
erosion_elem.setName("erosion_elem");
erosion_elem.setVariableType(new VariableType("Integer", "int",""));
Variable iteration = new Variable();
iteration.setName("iteration");
iteration.setVariableType(new VariableType("Integer", "int", ""));
Variable iterations = new Variable();
iterations.setName("iterations");
iterations.setVariableType(new VariableType("Integer", "int", ""));
//add variable to method
method.addParameter(src);
method.addParameter(dst);
method.addParameter(erosion_elem);
method.addParameter(iteration);
method.addParameter(iterations);
//add an instruction to the method
method.addInstruction(methodBody());
......@@ -97,7 +97,7 @@ public class ErodeCommand extends ArgumentReturnMathCommand{
" mat element = getStructuringElement( erosion_type,\n" +
" Size( 2*erosion_size + 1, 2*erosion_size+1 ),\n" +
" Point( erosion_size, erosion_size ) );\n" +
" erode( src, dst, element, Point(-1,-1), iteration );";
" erode( src, dst, element, Point(-1,-1), iterations );";
}
@Override
......
......@@ -11,14 +11,14 @@ class test_math_dilateCommandTest{
public:
mat src;
int dilation_elem;
int iteration;
int iterations;
mat dst;
void init()
{
src=mat(n,m);
dst=mat(n,m);
}
void dilateHelper(mat src, mat dst, int erosion_elem, int iteration)
void dilateHelper(mat src, mat dst, int erosion_elem, int iterations)
{
int dilation_type = 0;
if( dilation_elem == 0 ){ dilation_type = MORPH_RECT; }
......@@ -28,10 +28,10 @@ void dilateHelper(mat src, mat dst, int erosion_elem, int iteration)
mat element = getStructuringElement( dilation_type,
Size( 2*dilation_size + 1, 2*dilation_size+1 ),
Point( dilation_size, dilation_size ) );
dilate( src, dst, element, Point(-1,-1), iteration );}
dilate( src, dst, element, Point(-1,-1), iterations );}
void execute()
{
dst = (dilateHelper(src, dilation_elem, iteration));
dilateHelper(src, dst, dilation_elem, iterations);
}
};
......
......@@ -12,14 +12,14 @@ class test_math_erodeCommandTest{
public:
mat src;
int erosion_elem;
int iteration;
int iterations;
mat dst;
void init()
{
src=mat(n,m);
dst=mat(n,m);
}
void erodeHelper(mat src, mat dst, int erosion_elem, int iteration)
void erodeHelper(mat src, mat dst, int erosion_elem, int iterations)
{
int erosion_type = 0;
if( erosion_elem == 0 ){ erosion_type = MORPH_RECT; }
......@@ -29,10 +29,10 @@ void erodeHelper(mat src, mat dst, int erosion_elem, int iteration)
mat element = getStructuringElement( erosion_type,
Size( 2*erosion_size + 1, 2*erosion_size+1 ),
Point( erosion_size, erosion_size ) );
erode( src, dst, element, Point(-1,-1), iteration );}
erode( src, dst, element, Point(-1,-1), iterations );}
void execute()
{
erodeHelper(src, dst, erosion_elem, iteration);
erodeHelper(src, dst, erosion_elem, iterations);
}
};
......
......@@ -5,10 +5,10 @@ component DilateCommandTest{
port
in Q^{n,m} src,
in Z dilation_elem,
in Z iteration,
in Z iterations,
out Q^{n,m} dst;
implementation Math{
dst = dilate(src, dilation_elem, iteration);
dst = dilate(src, dilation_elem, iterations);
}
}
......@@ -5,10 +5,10 @@ component ErodeCommandTest{
port
in Q^{n,m} src,
in Z erosion_elem,
in Z iteration,
in Z iterations,
out Q^{n,m} dst;
implementation Math{
dst = erode(src, erosion_elem, iteration);
dst = erode(src, erosion_elem, iterations);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment