Lost Password?

Go Back   CodeCall Programming Forum > Software Development > Java Help

Java Help Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-29-2006, 07:25 PM
Ronin Ronin is offline
Programming Professional
 
Join Date: Apr 2006
Posts: 299
Rep Power: 10
Ronin is on a distinguished road
Default 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
   }
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 11-30-2006, 11:36 AM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 2,047
Last Blog:
NaNoWriMo Summary
Rep Power: 24
WingedPanther is a jewel in the roughWingedPanther is a jewel in the roughWingedPanther is a jewel in the roughWingedPanther is a jewel in the rough
Default

What data-type does scale.clone() produce? You may have to do a data-type conversion.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-04-2006, 11:13 AM
Ronin Ronin is offline
Programming Professional
 
Join Date: Apr 2006
Posts: 299
Rep Power: 10
Ronin is on a distinguished road
Default

Not sure, I'll look and post on here.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-21-2006, 07:23 AM
Zlaire Zlaire is offline
Newbie
 
Join Date: Dec 2006
Posts: 5
Rep Power: 0
Zlaire is on a distinguished road
Default

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();
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Floating Point random number generator Paradine PHP Tutorials 0 08-26-2007 02:09 PM
How to calculate the number of pixels in a polygon extreme Java Help 5 04-17-2007 10:34 AM
I need to generate a random number in PHP dirkfirst PHP Forum 7 07-05-2006 09:58 PM
Number of Lines on a RichText Box Lop Managed C++ 3 06-16-2006 05:19 PM
Number of files and directories in folder dirkfirst PHP Forum 4 05-30-2006 10:06 AM


All times are GMT -5. The time now is 11:25 PM.

Contest Stats

John ........ 223.00000
dargueta ........ 168.00000
Xav ........ 164.00000
LogicKills ........ 20.00000
gaylo565 ........ 18.00000
WingedPanther ........ 15.00000
|pH| ........ 15.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 67%

Ads