Closed Thread
Results 1 to 4 of 4

Thread: Number Cloning

  1. #1
    Ronin is offline Programming Professional
    Join Date
    Apr 2006
    Posts
    309
    Rep Power
    24

    Number Cloning

    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
       }

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,486
    Blog Entries
    75
    Rep Power
    143
    What data-type does scale.clone() produce? You may have to do a data-type conversion.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  4. #3
    Ronin is offline Programming Professional
    Join Date
    Apr 2006
    Posts
    309
    Rep Power
    24
    Not sure, I'll look and post on here.

  5. #4
    Zlaire is offline Newbie
    Join Date
    Dec 2006
    Posts
    5
    Rep Power
    0
    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();

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. ****Offering!!! Website Cloning/Programming!!!****
    By HtmlMasterSeo in forum Services for Buy/Sell/Trade
    Replies: 0
    Last Post: 01-16-2011, 12:57 PM
  2. Replies: 1
    Last Post: 05-26-2010, 08:06 PM
  3. PHP: only number
    By usmanzm in forum Classes and Code Snippets
    Replies: 2
    Last Post: 08-22-2008, 09:10 AM
  4. NaN - Not a Number
    By funkey_monkey in forum General Programming
    Replies: 0
    Last Post: 03-31-2008, 07:44 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts