Advertisement
Guest User

Untitled

a guest
Apr 25th, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.04 KB | None | 0 0
  1. public class EqualsTree {
  2.  
  3.  private String info;
  4.  private EqualsTree sinistro;
  5.  private EqualsTree destro;
  6.  @Override
  7.  public boolean equals(Object o) {
  8.  if (this == o)
  9.     return true;
  10.  if(this==null)
  11.      return false;
  12.    
  13.  if (!(o instanceof EqualsTree))
  14.     return false;
  15.    
  16.  EqualsTree a = (EqualsTree) o;
  17.  
  18.  
  19.  if ((info==null && a.info != null) || (info!=null && a.info == null))
  20.     return false;
  21.  
  22.  if((sinistro==null && a.sinistro!=null) || ((sinistro!=null && a.sinistro==null)) || (destro==null && a.destro!=null) || ((destro!=null && a.destro==null)))
  23.      return false;
  24.  
  25.  if(sinistro==null && a.sinistro==null && destro==null && a.destro==null && info.equals(a.info))
  26.      return true;
  27.  
  28.  if(info.equals(a.info) && sinistro==null && a.sinistro==null)
  29.      return destro.equals(a.destro);
  30.  
  31.  if(info.equals(a.info) && destro==null && a.destro==null)
  32.      return sinistro.equals(a.sinistro);
  33.  
  34.  if(info.equals(a.info))
  35.      return sinistro.equals(a.sinistro) && destro.equals(a.destro);
  36.  
  37.  return false;
  38.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement