P
Philipp
Hello
I have a class which take a Number as argument. I want to store it by
making a copy in a member of the class. I thought about using clone, but
my Eclipse IDE gives me an "Type mismatch: cannot convert from Object to
Number" error.
How should I do it? Thanks for your answers.
Phil
code:
public class ConvolutionMatrixSetting {
private Number [][] coefficients;
private Number scale;
private Number offset;
private int height;
private int width;
private String name;
public ConvolutionMatrixSetting(String name, Number[][] coefficients,
Number scale, Number offset){
this.name = name;
height = coefficients.length;
width = coefficients[0].length;
coefficients = new Number[height][width];
System.arraycopy(coefficients, 0, this.coefficients, 0, height);
this.scale = scale.clone(); // DOES NOT WORK
this.offset = offset.clone(); // DOES NOT WORK
}
}
I have a class which take a Number as argument. I want to store it by
making a copy in a member of the class. I thought about using clone, but
my Eclipse IDE gives me an "Type mismatch: cannot convert from Object to
Number" error.
How should I do it? Thanks for your answers.
Phil
code:
public class ConvolutionMatrixSetting {
private Number [][] coefficients;
private Number scale;
private Number offset;
private int height;
private int width;
private String name;
public ConvolutionMatrixSetting(String name, Number[][] coefficients,
Number scale, Number offset){
this.name = name;
height = coefficients.length;
width = coefficients[0].length;
coefficients = new Number[height][width];
System.arraycopy(coefficients, 0, this.coefficients, 0, height);
this.scale = scale.clone(); // DOES NOT WORK
this.offset = offset.clone(); // DOES NOT WORK
}
}