class UserKey implements Serializable {

   @Override
   public boolean equals(Object o)
   {
      if (this == o)
      {
         return true;
      }
      if (o instanceof UserKey)
      {
         UserKey key = (UserKey) o;
         boolean result = true;
         for (UserSelection sel: this.selection)
         {
            switch (sel)
            {
               case LOGIN:
               case EMAIL:
                  result &= key.pi.getUsername() == null ? false :
                        key.pi.getUsername().equals(pi.getUsername());
                  break;
               case IP:
                  result &= key.pi.getRemoteAddress() == null ? false :
                        key.pi.getRemoteAddress().equals(pi.getRemoteAddress());
                  break;
               default:
                  result = false;
                  break;
            }
         }
         return result;
      }
      return false;
   }

   public  UserKey(ProcessingInformation pi, UserSelection[] selection);

}