Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.computerScience.model;
- /**
- * Created by Sky_el on 31.05.2017.
- */
- public class User {
- private int userId;
- private String name;
- private String secondName;
- private int age;
- private boolean sex; // true - мужчина, false - женщина
- private String school;
- private String className;
- private String email;
- private String phone;
- private String password;
- private boolean isOnline;
- public User() { }
- public User(int userId, String name, String secondName, int age, boolean sex, String school,
- String className, String email, String phone, String password, boolean isOnline) {
- this.userId = userId;
- this.name = name;
- this.secondName = secondName;
- this.age = age;
- this.sex = sex;
- this.school = school;
- this.className = className;
- this.email = email;
- this.phone = phone;
- this.password = password;
- this.isOnline = isOnline;
- }
- public boolean isOnline() {
- return isOnline;
- }
- public void setOnline(boolean online) {
- isOnline = online;
- }
- public String getPhone() {
- return phone;
- }
- public void setPhone(String phone) {
- this.phone = phone;
- }
- public boolean getSex() {
- return sex;
- }
- public void setSex(boolean sex) {
- this.sex = sex;
- }
- public int getUserId() {
- return userId;
- }
- public void setUserId(int userId) {
- this.userId = userId;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getSecondName() {
- return secondName;
- }
- public void setSecondName(String secondName) {
- this.secondName = secondName;
- }
- public int getAge() {
- return age;
- }
- public void setAge(int age) {
- this.age = age;
- }
- public String getSchool() {
- return school;
- }
- public void setSchool(String school) {
- this.school = school;
- }
- public String getClassName() {
- return className;
- }
- public void setClassName(String className) {
- this.className = className;
- }
- public String getEmail() {
- return email;
- }
- public void setEmail(String email) {
- this.email = email;
- }
- public String getPassword() {
- return password;
- }
- public void setPassword(String password) {
- this.password = password;
- }
- @Override
- public String toString() {
- return "User{" +
- "userId=" + userId +
- ", name='" + name + '\'' +
- ", secondName='" + secondName + '\'' +
- ", age=" + age +
- ", sex=" + sex +
- ", school='" + school + '\'' +
- ", className='" + className + '\'' +
- ", email='" + email + '\'' +
- ", phone='" + phone + '\'' +
- ", password='" + password + '\'' +
- ", isOnline=" + isOnline +
- '}';
- }
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- User user = (User) o;
- if (userId != user.userId) return false;
- if (age != user.age) return false;
- if (sex != user.sex) return false;
- if (isOnline != user.isOnline) return false;
- if (name != null ? !name.equals(user.name) : user.name != null) return false;
- if (secondName != null ? !secondName.equals(user.secondName) : user.secondName != null) return false;
- if (school != null ? !school.equals(user.school) : user.school != null) return false;
- if (className != null ? !className.equals(user.className) : user.className != null) return false;
- if (email != null ? !email.equals(user.email) : user.email != null) return false;
- if (phone != null ? !phone.equals(user.phone) : user.phone != null) return false;
- return password != null ? password.equals(user.password) : user.password == null;
- }
- @Override
- public int hashCode() {
- int result = userId;
- result = 31 * result + (name != null ? name.hashCode() : 0);
- result = 31 * result + (secondName != null ? secondName.hashCode() : 0);
- result = 31 * result + age;
- result = 31 * result + (sex ? 1 : 0);
- result = 31 * result + (school != null ? school.hashCode() : 0);
- result = 31 * result + (className != null ? className.hashCode() : 0);
- result = 31 * result + (email != null ? email.hashCode() : 0);
- result = 31 * result + (phone != null ? phone.hashCode() : 0);
- result = 31 * result + (password != null ? password.hashCode() : 0);
- result = 31 * result + (isOnline ? 1 : 0);
- return result;
- }
- }
Add Comment
Please, Sign In to add comment