Login  Register

If condition ignored

Posted by gankaku on May 09, 2014; 3:45pm
URL: http://imagej.273.s1.nabble.com/If-condition-ignored-tp5007663.html

Hi all again,

in addition to the problem I described in my last post I also have the
problem that if-conditions are ignored in several parts of my code such as
the following snippet:

if(Roundness!="0.00-1.00" & end==false) {

double RoundnessMin = Double.parseDouble(Roundness.substring(0,
Roundness.indexOf("-")));
double RoundnessMax =
Double.parseDouble(Roundness.substring(Roundness.indexOf("-")+1));
if(resultsTable.getValue("Round", n)<RoundnessMin ||
resultsTable.getValue("Round", n)>RoundnessMax) {

filledImage.fill8(X[n], Y[n]);

end=true;

IJ.log("Roundness");

}

}

The statement should only be done if: Roundness!="0.00-1.00" (which is
defined by a prior dialog) AND if end==false.
Problem is that the statement is also performed when Roundness exactly is
"0.00-1.00".

I read that Java is normally checking from left to right and stops checking
conditions if one is met. Is this the case?

Furthermore, I tried other operators (&& and || and |) and several
different bracket settings but none was able to block the program from
running the code.

Any suggestions where my assumptions are wrong or how to specify the
condition to be able to block running the statement.

Thanks in advance,
Jan

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html