Java language help needed.(Not any more)
diafysal
Posts: 92
Java language help needed.
Hi
I'm going to use the uM-FPU IDE eventually.
But first I read through some of the code from www.micromegacorp.com/downloads/software/uMFPU-V2-Javelin.zip
I am not that good at Java so I wonder if someone could have an opinion.
I read this from Fpu.java (I2C):
And compared with PCF8574.java (io class):
Is Fpu.java really right ? (“bus” , “this.”[noparse];)[/noparse]
Post Edited (diafysal) : 9/21/2005 8:34:52 PM GMT
Hi
I'm going to use the uM-FPU IDE eventually.
But first I read through some of the code from www.micromegacorp.com/downloads/software/uMFPU-V2-Javelin.zip
I am not that good at Java so I wonder if someone could have an opinion.
I read this from Fpu.java (I2C):
public static boolean reset(I2C i2cBus, int devAddr) { bus = bus; if (devAddr == 0) addr = I2C_ADDR; else addr = devAddr; return(reset()); }
And compared with PCF8574.java (io class):
public PCF8574 (I2C bus, int devAddr, int dirs) { this.bus = bus; this.addr = this.addr | ((devAddr & 0x07) << 1); this.dirs = dirs; }
Is Fpu.java really right ? (“bus” , “this.”[noparse];)[/noparse]
Post Edited (diafysal) : 9/21/2005 8:34:52 PM GMT
Comments
The 'reset' method actually is incorrect -- the "bus = bus;" line should be "bus = i2cBus". Otherwise, it doesn't HAVE to use the 'this' reference, but it could.
Personally, whenever I'm referring to a 'native' class property, I ALWAYS use the 'this' reference to make it crystal clear what's going on. I don't know that it would have saved the author of 'reset' above, though.
I have notified the author.
(edit)
The code/site is updated.
Post Edited (diafysal) : 9/21/2005 2:42:21 PM GMT