/* * Copyright 2012 Tallinn University Centre for Educational Technology * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ee.htk.dippler.app.entities; import android.os.Parcel; import android.os.Parcelable; public class Answer implements Parcelable{ private String grade; private String feedback; private String maxpoints; private String title; public String getGrade() { if ( grade == null ) { grade = ""; } return grade; } public void setGrade(String grade) { this.grade = grade; } public String getFeedback() { if ( feedback == null ) { feedback = ""; } return feedback; } public void setFeedback(String feedback) { this.feedback = feedback; } public String getMaxpoints() { if ( maxpoints == null ) { maxpoints = ""; } return maxpoints; } public void setMaxpoints(String maxpoints) { this.maxpoints = maxpoints; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public Answer getInstance() { Answer new_instance = new Answer(); new_instance.setTitle(this.getTitle()); new_instance.setGrade(this.getGrade()); new_instance.setFeedback(this.getFeedback()); new_instance.setMaxpoints(this.getMaxpoints()); return new_instance; } @Override public int describeContents() { // TODO Auto-generated method stub return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(title); dest.writeString(grade); dest.writeString(feedback); dest.writeString(maxpoints); } public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { public Answer createFromParcel(Parcel in) { return new Answer(in); } public Answer[] newArray(int size) { return new Answer[size]; } }; private Answer(Parcel in) { title = in.readString(); grade = in.readString(); feedback = in.readString(); maxpoints = in.readString(); } public Answer() { } }