Skip to content

Instantly share code, notes, and snippets.

@sadv1r
Created August 7, 2014 03:56
Show Gist options
  • Save sadv1r/e7c70c4d97f51676af2b to your computer and use it in GitHub Desktop.
Save sadv1r/e7c70c4d97f51676af2b to your computer and use it in GitHub Desktop.
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/**
* Created by IntelliJ IDEA.
* User: Sadv1r
* Date: 8/6/14
* Time: 7:17
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class User {
public int id = 0;
public String first_name = null;
public String last_name = null;
public int sex = 0;
public String nickname = null;
public String screen_name = null;
public String bdate = null;
public String twitter = null;
public int verified = -1;
public String home_town = null; //maybe int
public int[] friends = null;
/*
In future:
public int vk = 0;
public long facebook = 0;
public String twitter = null;
public String skype = null;
public String instagram = null;
public int city = 0;
public String schoolName = null;
public Date from = new Date();
public Date to = new Date();
public Date graduationYear = new Date();
*/
public String equals(User user) {
/* Удостоверимся, что объекты не одинаковые */
if(user == this)
return "Same";
/* Удостоверимся, что объекты существуют */
if(user == null || this == null)
return "NULL Object";
/* Удостоверимся, что ссылки имеют тот же самый тип */
if(!(getClass() == user.getClass()))
return "Different Classes";
/* Удостоверимся, что проверяем одного пользователя */
if (!(this.id == user.id)) {
return "Different user_id";
} else {
if (!(this.first_name.equals(user.first_name)))
return "New first name: " + user.first_name;
if (!(this.last_name.equals(user.last_name)))
return "New last name: " + user.last_name;
if (this.sex != user.sex)
return "New sex: " + user.sex;
if (!(this.nickname.equals(user.nickname)))
return "New nickname/middle name: " + user.nickname;
if (!(this.screen_name.equals(user.screen_name)))
return "New screen name: " + user.screen_name;
if (!(this.bdate.equals(user.bdate)))
return "New birth date: " + user.bdate;
if (!(this.twitter.equals(user.twitter)))
return "New twitter: " + user.twitter;
if (this.verified != user.verified)
return "New verified status: " + user.verified;
if (!(this.friends.equals(user.friends)))
return "ИЩЕМ ИЗМЕНЕНИЯ В ДРУЗЬЯХ"; //FIXME!
else
return "Same but not same. ВСЕ ПЛОХА!";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment