http://imagej.273.s1.nabble.com/If-condition-ignored-tp5007663p5007669.html
search). I will try if I get it running by changing all accordingly.
> Hi Jan,
>
> > if(Roundness!="0.00-1.00" & end==false) {
>
> You almost certainly want to be using "&&" for logical and, rather than
> "&" (bitwise AND).
http://stackoverflow.com/q/4014535>
> You almost certainly want to compare strings with "!s.equals(s2)" rather
> than "s != s2" since string comparison using the equality operator only
> works in certain very special cases (two string objects with the same
> content but different references will not test as equal).
>
http://stackoverflow.com/q/513832>
> Also, I suggest writing "!end" rather than "end==false".
>
> Regards,
> Curtis
>
>
> On Fri, May 9, 2014 at 10:45 AM, BioVoxxel <
[hidden email]>wrote:
>
>> 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>>
>
>
CEO: Dr. rer. nat. Jan Brocher