I get a "Type mismatch: cannot convert from Object to Number" error when using this code below:
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 }
What data-type does scale.clone() produce? You may have to do a data-type conversion.
Not sure, I'll look and post on here.
Isn't the return type of clone() "Object"?
So basically you're trying to assign "Object" to "Number". Maybe you could try:
Code:this.scale = (Number)scale.clone(); this.offset = (Number)offset.clone();
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks