/* Programme classique du triangle

retourne 1 si le triangle est quelconque
retourne 2 si le triangle est isocele
retourne 3 si le triangle est equilateral
retourne 4 si ce n est pas un triangle

*/


public class TritypInteger
{
  public static int f(Integer IV, Integer JV, Integer KV)
  {
      int i = IV.intValue();
      int j = JV.intValue();
      int k = KV.intValue();
    int trityp ;
    if ( (i == 0) || (j == 0) || (k == 0))
      trityp = 4 ;
    else
      {
        trityp = 0 ;
        if ( i == j)
          trityp = trityp + 1 ;
        if ( i == k) 
          trityp = trityp + 2 ;
        if ( j == k )
          trityp = trityp + 3 ;
        if (trityp == 0)        
          {
            if ( (i+j <= k) || (j+k <= i) || (i+k <= j))
              trityp = 4 ;
            else
              trityp = 1 ;
          }
        else
          {
            if (trityp > 3)
              trityp = 3 ;
            else
              if ( (trityp == 1) && (i+j > k) )
                trityp = 2 ;
              else
                if ( (trityp == 2) && (i+k > j) )
                  trityp = 2 ;
                else
                  if ( (trityp == 3) && (j+k > i))
                    trityp  = 2 ;
                  else
                    trityp = 4 ;
            
          }
      }
    return(trityp) ;
  }
}
    

