Skip to content

Instantly share code, notes, and snippets.

@simekadam
Created October 2, 2013 06:09
Show Gist options
  • Save simekadam/6789724 to your computer and use it in GitHub Desktop.
Save simekadam/6789724 to your computer and use it in GitHub Desktop.
public class Parallel implements IEntity{
public static final String EXTRA = "parallels";
public String id = "", updated = "", course = "", courseURL = "", semester = "", semesterURL = "", teacher = "", teacherURL = "",
parity = "", room = "", roomURL = "", parallelType = "", studentsCode = "", link = "";
public int capacity, code, day, duration, firstHour, occupied;
public boolean capacityOverfill, enrollment;
public Parallel() {
}
public static final Creator<Parallel> CREATOR = new Creator<Parallel>() {
@Override
public Parallel createFromParcel(Parcel parcel) {
return new Parallel(parcel);
}
@Override
public Parallel[] newArray(int size) {
return new Parallel[size];
}
};
public Parallel(Parallel p) {
this.id = p.id;
this.updated = p.updated;
this.course = p.course;
this.courseURL = p.courseURL;
this.semester = p.semester;
this.semesterURL = p.semesterURL;
this.teacher = p.teacher;
this.teacherURL = p.teacherURL;
this.parity = p.parity;
this.room = p.room;
this.roomURL = p.roomURL;
this.parallelType = p.parallelType;
this.studentsCode = p.studentsCode;
this.link = p.link;
this.capacity = p.capacity;
this.code = p.code;
this.day = p.day;
this.duration = p.duration;
this.firstHour = p.firstHour;
this.occupied = p.occupied;
this.capacityOverfill = p.capacityOverfill;
this.enrollment = p.enrollment;
}
public Parallel(Parcel p) {
Bundle data = p.readBundle(Parallel.class.getClassLoader());
data.setClassLoader(Parallel.class.getClassLoader());
this.id = data.getString("id");
this.updated = data.getString("id");
this.course = data.getString("course");
this.courseURL = data.getString("courseURL");
this.semester = data.getString("semester");
this.semesterURL = data.getString("semesterURL");
this.teacher = data.getString("teacher");
this.teacherURL = data.getString("teacherURL");
this.parity = data.getString("parity");
this.room = data.getString("room");
this.roomURL = data.getString("roomURL");
this.parallelType = data.getString("parallelType");
this.studentsCode = data.getString("studentsCode");
this.link = data.getString("link");
this.capacity = data.getInt("capacity");
this.code = data.getInt("code");
this.day = data.getInt("day");
this.duration = data.getInt("duration");
this.firstHour = data.getInt("firstHour");
this.occupied = data.getInt("occupied");
this.capacityOverfill = data.getByte("capacityOverfill") == 1;
this.enrollment = data.getByte("enrollment") == 1;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
Bundle data = new Bundle(Parallel.class.getClassLoader());
data.putString("id", id);
data.putString("udpated", updated);
data.putString("course", course);
data.putString("courseURL", courseURL);
data.putString("senester", semester);
data.putString("semesterURL", semesterURL);
data.putString("teacher", teacher);
data.putString("teacherURL", teacherURL);
data.putString("parity", parity);
data.putString("room", room);
data.putString("roomURL", roomURL);
data.putString("parallelType", parallelType);
data.putString("studentsCode", studentsCode);
data.putString("link", link);
data.putInt("capacity", capacity);
data.putInt("code", code);
data.putInt("day", day);
data.putInt("duration", duration);
data.putInt("firstHour", firstHour);
data.putInt("occupied", occupied);
data.putInt("capacityOverfill", (byte) (capacityOverfill ? 1 : 0));
data.putInt("enrollment", (byte) (enrollment ? 1 : 0));
parcel.writeBundle(data);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment