
/*******************************************
****    File generated by Tree2C V1.0   ****
**** (c) 2017-2019, Alessandro Pedretti ****
*******************************************/


/**** Model class ****/

class random_tree {

  /**** Constructor ****/

  constructor() {

    /**** Output values ****/

    this.C_FALSE = 0;
    this.C_TRUE = 1;

    /**** Values of the attributes ****/

    this.C_FG_CON2_NO = 0;
    this.C_FG_CON2_YES = 1;
    this.C_FG_COOH_NO = 0;
    this.C_FG_COOH_YES = 1;
    this.C_FG_COOR_NO = 0;
    this.C_FG_COOR_YES = 1;
    this.C_FG_F_NO = 0;
    this.C_FG_F_YES = 1;
    this.C_FG_PHOH_NO = 0;
    this.C_FG_PHOH_YES = 1;

    /**** Attributes ****/

    this.Angles = 0.0;
    this.Atoms = 0.0;
    this.Bonds = 0.0;
    this.ChiralAtms = 0.0;
    this.Dipole = 0.0;
    this.EzBnds = 0.0;
    this.FG_CON2 = 0;
    this.FG_COOH = 0;
    this.FG_COOR = 0;
    this.FG_F = 0;
    this.FG_PhOH = 0;
    this.FlexTorsions = 0.0;
    this.Gyrrad = 0.0;
    this.HbAcc = 0.0;
    this.HbDon = 0.0;
    this.HeavyAtoms = 0.0;
    this.Lipole = 0.0;
    this.Mass = 0.0;
    this.Ovality = 0.0;
    this.Psa = 0.0;
    this.Rings = 0.0;
    this.Sas = 0.0;
    this.Sav = 0.0;
    this.Sdiam = 0.0;
    this.Torsions = 0.0;
    this.Vdiam = 0.0;
    this.VirtualLogP = 0.0;
  }


  /**** Classification method ****/

  Classify() {
    var    Res;

    if (this.HbDon < 0.5000) {
      if (this.Sas < 756.1100) {
        if (this.FG_COOR == this.C_FG_COOR_YES) {
          if (this.Angles < 106.5000) {
            if (this.Atoms < 48.0000) {
              Res = this.C_TRUE;
            } else {
              if (this.Atoms < 51.0000) {
                Res = this.C_FALSE;
              } else {
                Res = this.C_TRUE;
              }
            }
          } else {
            Res = this.C_FALSE;
          }
        } else {
          if (this.HeavyAtoms < 13.5000) {
            if (this.Gyrrad < 2.8500) {
              Res = this.C_TRUE;
            } else {
              Res = this.C_FALSE;
            }
          } else {
            Res = this.C_TRUE;
          }
        }
      } else {
        Res = this.C_FALSE;
      }
    } else {
      if (this.Angles < 92.5000) {
        if (this.Gyrrad < 3.6800) {
          if (this.Torsions < 17.5000) {
            if (this.Sas < 283.4200) {
              Res = this.C_TRUE;
            } else {
              if (this.FlexTorsions < 0.5000) {
                if (this.Sas < 301.9000) {
                  Res = this.C_FALSE;
                } else {
                  Res = this.C_TRUE;
                }
              } else {
                if (this.FG_CON2 == this.C_FG_CON2_YES) {
                  if (this.Lipole < 2.1200) {
                    Res = this.C_TRUE;
                  } else {
                    Res = this.C_FALSE;
                  }
                } else {
                  if (this.HbAcc < 2.5000) {
                    if (this.Rings < 1.5000) {
                      if (this.Sav < 575.0000) {
                        Res = this.C_TRUE;
                      } else {
                        if (this.Sdiam < 8.5700) {
                          Res = this.C_FALSE;
                        } else {
                          Res = this.C_TRUE;
                        }
                      }
                    } else {
                      if (this.Torsions < 15.5000) {
                        Res = this.C_FALSE;
                      } else {
                        if (this.HeavyAtoms < 15.5000) {
                          Res = this.C_TRUE;
                        } else {
                          Res = this.C_FALSE;
                        }
                      }
                    }
                  } else {
                    if (this.HeavyAtoms < 12.5000) {
                      Res = this.C_FALSE;
                    } else {
                      if (this.Angles < 39.5000) {
                        Res = this.C_TRUE;
                      } else {
                        if (this.Torsions < 14.5000) {
                          Res = this.C_FALSE;
                        } else {
                          if (this.HeavyAtoms < 16.5000) {
                            if (this.ChiralAtms < 1.5000) {
                              Res = this.C_FALSE;
                            } else {
                              Res = this.C_TRUE;
                            }
                          } else {
                            Res = this.C_TRUE;
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          } else {
            if (this.Vdiam < 7.3000) {
              Res = this.C_FALSE;
            } else {
              if (this.Sas < 561.9500) {
                if (this.HeavyAtoms < 19.5000) {
                  if (this.Torsions < 19.5000) {
                    if (this.FG_COOH == this.C_FG_COOH_YES) {
                      Res = this.C_FALSE;
                    } else {
                      Res = this.C_TRUE;
                    }
                  } else {
                    Res = this.C_TRUE;
                  }
                } else {
                  Res = this.C_TRUE;
                }
              } else {
                Res = this.C_FALSE;
              }
            }
          }
        } else {
          if (this.Ovality < 1.6900) {
            if (this.HbAcc < 3.5000) {
              if (this.Rings < 1.5000) {
                Res = this.C_FALSE;
              } else {
                if (this.Mass < 303.4100) {
                  if (this.Ovality < 1.5900) {
                    Res = this.C_FALSE;
                  } else {
                    Res = this.C_TRUE;
                  }
                } else {
                  Res = this.C_FALSE;
                }
              }
            } else {
              if (this.Mass < 356.3800) {
                Res = this.C_FALSE;
              } else {
                if (this.EzBnds < 0.5000) {
                  Res = this.C_FALSE;
                } else {
                  if (this.Mass < 362.3900) {
                    Res = this.C_TRUE;
                  } else {
                    Res = this.C_FALSE;
                  }
                }
              }
            }
          } else {
            if (this.Sdiam < 10.9700) {
              if (this.Lipole < 2.3800) {
                if (this.HbAcc < 3.5000) {
                  Res = this.C_TRUE;
                } else {
                  Res = this.C_FALSE;
                }
              } else {
                Res = this.C_FALSE;
              }
            } else {
              if (this.VirtualLogP < 3.4100) {
                if (this.Dipole < 2.8300) {
                  Res = this.C_FALSE;
                } else {
                  Res = this.C_TRUE;
                }
              } else {
                Res = this.C_TRUE;
              }
            }
          }
        }
      } else {
        if (this.FlexTorsions < 1.0000) {
          Res = this.C_TRUE;
        } else {
          if (this.Ovality < 1.7300) {
            Res = this.C_FALSE;
          } else {
            if (this.Psa < 59.6600) {
              if (this.HeavyAtoms < 31.0000) {
                if (this.Bonds < 51.5000) {
                  Res = this.C_FALSE;
                } else {
                  Res = this.C_TRUE;
                }
              } else {
                if (this.FlexTorsions < 9.0000) {
                  Res = this.C_FALSE;
                } else {
                  Res = this.C_TRUE;
                }
              }
            } else {
              if (this.FG_PhOH == this.C_FG_PHOH_YES) {
                if (this.Angles < 119.5000) {
                  Res = this.C_TRUE;
                } else {
                  if (this.Angles < 230.0000) {
                    Res = this.C_FALSE;
                  } else {
                    if (this.ChiralAtms < 21.5000) {
                      Res = this.C_FALSE;
                    } else {
                      Res = this.C_TRUE;
                    }
                  }
                }
              } else {
                if (this.FG_F == this.C_FG_F_YES) {
                  if (this.ChiralAtms < 1.5000) {
                    Res = this.C_TRUE;
                  } else {
                    if (this.Vdiam < 9.0700) {
                      Res = this.C_FALSE;
                    } else {
                      Res = this.C_TRUE;
                    }
                  }
                } else {
                  if (this.Lipole < 2.3100) {
                    if (this.FlexTorsions < 8.5000) {
                      if (this.Sas < 977.1200) {
                        if (this.EzBnds < 0.5000) {
                          if (this.ChiralAtms < 0.5000) {
                            if (this.Mass < 441.2400) {
                              Res = this.C_TRUE;
                            } else {
                              Res = this.C_FALSE;
                            }
                          } else {
                            Res = this.C_FALSE;
                          }
                        } else {
                          if (this.Bonds < 59.0000) {
                            Res = this.C_FALSE;
                          } else {
                            Res = this.C_TRUE;
                          }
                        }
                      } else {
                        Res = this.C_TRUE;
                      }
                    } else {
                      Res = this.C_FALSE;
                    }
                  } else {
                    Res = this.C_FALSE;
                  }
                }
              }
            }
          }
        }
      }
    }

    return Res;
  }


  /**** Domain check method ****/

  /*
   * Return the number of domain violations
   */

  DomCheck() {
    var Violations = 0;

    if ((this.Angles < 6.00000000) || (this.Angles > 374.00000000)) Violations++;
    if ((this.Atoms < 5.00000000) || (this.Atoms > 203.00000000)) Violations++;
    if ((this.Bonds < 4.00000000) || (this.Bonds > 206.00000000)) Violations++;
    if ((this.ChiralAtms < 0.00000000) || (this.ChiralAtms > 25.00000000)) Violations++;
    if ((this.Dipole < 0.00001200) || (this.Dipole > 22.36607000)) Violations++;
    if ((this.EzBnds < 0.00000000) || (this.EzBnds > 7.00000000)) Violations++;
    if ((this.FlexTorsions < 0.00000000) || (this.FlexTorsions > 28.00000000)) Violations++;
    if ((this.Gyrrad < 1.41856400) || (this.Gyrrad > 10.56297000)) Violations++;
    if ((this.HbAcc < 0.00000000) || (this.HbAcc > 26.00000000)) Violations++;
    if ((this.HbDon < 0.00000000) || (this.HbDon > 21.00000000)) Violations++;
    if ((this.HeavyAtoms < 3.00000000) || (this.HeavyAtoms > 101.00000000)) Violations++;
    if ((this.Lipole < 0.00000300) || (this.Lipole > 6.34667600)) Violations++;
    if ((this.Mass < 70.08984000) || (this.Mass > 1449.25400000)) Violations++;
    if ((this.Ovality < 1.16274900) || (this.Ovality > 2.74024100)) Violations++;
    if ((this.Psa < 0.00000000) || (this.Psa > 544.81690000)) Violations++;
    if ((this.Rings < 0.00000000) || (this.Rings > 10.00000000)) Violations++;
    if ((this.Sas < 203.40610000) || (this.Sas > 2006.11400000)) Violations++;
    if ((this.Sav < 252.97150000) || (this.Sav > 3811.29900000)) Violations++;
    if ((this.Sdiam < 5.14906200) || (this.Sdiam > 22.48208000)) Violations++;
    if ((this.Torsions < 0.00000000) || (this.Torsions > 94.00000000)) Violations++;
    if ((this.Vdiam < 4.77512900) || (this.Vdiam > 13.58132000)) Violations++;
    if ((this.VirtualLogP < -7.13032600) || (this.VirtualLogP > 9.48374900)) Violations++;

    return Violations;
  }
}


/**** Remove this line if you don't want to import the class as module ****/

module.exports = random_tree
