为什么我的if else语句显示所有条件的结果?

时间:2018-11-21 12:07:24

标签: android-studio if-statement sharedpreferences rules

我不知道该如何解决。我已经排除了根据症状选择来建议可能的疾病的条件,但是不幸的是,它显示了所有结果。默认情况下,我已经将结果条件设置为false。

if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                        (radioYes && duration2 && !NoneOther1) &&
                        (condition1 || condition2 || condition3 || condition4) ||
                        (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
                { angina = true;


                    }
                if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                        (radioNo && duration2 && !NoneOther1) &&
                        (condition1 || condition2 || condition3 || condition4) ||
                        (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
                { highRiskMaleNo = true;


                }

                if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                        (radioYes && !NoneOther1) &&
                        (duration3 || duration4) &&
                        (condition1 || condition2 || condition3 || condition4) ||
                        (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
                { highRiskMaleYes = true;//unstable angina

                }
                if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                        (radioNo && !NoneOther1) &&
                        (duration3 || duration4) &&
                        (condition1 || condition2 || condition3 || condition4) ||
                        (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
                { highRiskMaleNo = true;

                }

                if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                        (radioYes && duration1 && !NoneOther1) &&
                        (condition1 || condition2 || condition3 || condition4) ||
                        (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
                { unlikely = true;

                }
                if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                        (radioNo && duration1 && !NoneOther1) &&
                        (condition1 || condition2 || condition3 || condition4) ||
                        (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
                { unlikely = true;


                }

                if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                        (radioYes && !NoneOther1) &&
                        (duration1 || duration2 || duration3 || duration4) &&
                        (condition5 || condition6 || condition7 || condition8) ||
                        (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
                { unlikely = true;

                }
                if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                        (radioNo && !NoneOther1) &&
                        (duration1 || duration2 || duration3 || duration4) &&
                        (condition5 || condition6 || condition7 || condition8) ||
                        (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
                { unlikely = true;

                }

                if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                        (radioYes && NoneOther1) &&
                        (duration1 || duration2 || duration3 || duration4) ||
                        (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
                { indeterminate = true;

                }
                if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                        (radioNo && NoneOther1) &&
                        (duration1 || duration2 || duration3 || duration4) &&
                        (condition5 || condition6 || condition7 || condition8) ||
                        (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
                { indeterminate = true;


                }

这是我的默认布尔值

            angina = false;
            unstableAngina = false;

            highRiskMaleNo = false;
            highRiskMonopauseNo = false;

            unlikely = false;
            indeterminate = false;

我的朋友告诉我在所有条件的真实值之后加上所有其他错误值,它起作用,它仅显示一个结果,但是对于所有条件刻度,结果显示仅是不确定的。例如

if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                    (radioYes && duration2 && !NoneOther1) &&
                    (condition1 || condition2 || condition3 || condition4) ||
                    (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
            { angina = true;
                highRiskMaleNo = false;
                highRiskMonopauseYes = false;//unstable angina
                unlikely = false;
                indeterminate = false;

                }
            if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                    (radioNo && duration2 && !NoneOther1) &&
                    (condition1 || condition2 || condition3 || condition4) ||
                    (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
            { highRiskMaleNo = true;
                angina = false;
                highRiskMaleYes = false;  //unstable angina
                //highRiskMaleNo = false;
                unlikely = false;
                indeterminate = false;

            }

            if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                    (radioYes && !NoneOther1) &&
                    (duration3 || duration4) &&
                    (condition1 || condition2 || condition3 || condition4) ||
                    (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
            { highRiskMaleYes = true;//unstable angina
                angina = false;
                //highRiskMaleYes = false;  //unstable angina
                highRiskMaleNo = false;
                unlikely = false;
                indeterminate = false;
            }
            if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                    (radioNo && !NoneOther1) &&
                    (duration3 || duration4) &&
                    (condition1 || condition2 || condition3 || condition4) ||
                    (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
            { highRiskMaleNo = true;
                angina = false;
                highRiskMaleYes = false;  //unstable angina
                //highRiskMaleNo = false;
                indeterminate = false;
                unlikely = false;
            }

            if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                    (radioYes && duration1 && !NoneOther1) &&
                    (condition1 || condition2 || condition3 || condition4) ||
                    (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
            { unlikely = true;
                highRiskMaleNo = false;
                highRiskMonopauseYes = false;//unstable angina
                //unlikely = false;
                indeterminate = false;
            }
            if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                    (radioNo && duration1 && !NoneOther1) &&
                    (condition1 || condition2 || condition3 || condition4) ||
                    (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
            { unlikely = true;
                angina = false;
                highRiskMaleYes = false;  //unstable angina
                highRiskMaleNo = false;
                //unlikely = false;
                indeterminate = false;

            }

            if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                    (radioYes && !NoneOther1) &&
                    (duration1 || duration2 || duration3 || duration4) &&
                    (condition5 || condition6 || condition7 || condition8) ||
                    (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
            { unlikely = true;
                highRiskMaleNo = false;
                highRiskMonopauseYes = false;//unstable angina
                //unlikely = false;
                indeterminate = false;
            }
            if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                    (radioNo && !NoneOther1) &&
                    (duration1 || duration2 || duration3 || duration4) &&
                    (condition5 || condition6 || condition7 || condition8) ||
                    (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
            { unlikely = true;
                angina = false;
                highRiskMaleYes = false;  //unstable angina
                highRiskMaleNo = false;
                //unlikely = false;
                indeterminate = false;
            }

            if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                    (radioYes && NoneOther1) &&
                    (duration1 || duration2 || duration3 || duration4) ||
                    (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
            { indeterminate = true;
                highRiskMaleNo = false;
                highRiskMonopauseYes = false;//unstable angina
                unlikely = false;
               //indeterminate = false;
            }
            if ((radioMale || radioFemaleMonopause || radioFemaleNotMonopause) &&
                    (radioNo && NoneOther1) &&
                    (duration1 || duration2 || duration3 || duration4) &&
                    (condition5 || condition6 || condition7 || condition8) ||
                    (leftArm || bothArms || leftShoulder || bothShoulder || throatOrNeck || jaw || dizziness || shortnessOfBreath || stress || nausea || pulse || sweating || BP || notActive || diabetic || smoke || familyHistory || hadHeartAttackBefore || backNeck || fatigue || sleepDisturbance || NoneHead || overweight || NoneOther))
            { indeterminate = true;
                angina = false;
                highRiskMaleYes = false;  //unstable angina
                highRiskMaleNo = false;
                unlikely = false;
                //indeterminate = false;
            }

0 个答案:

没有答案