123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- package epson.print.copy.Component.ecopycomponent;
- import android.os.Parcel;
- import android.os.Parcelable;
- import epson.print.copy.Component.ecopycomponent.ECopyComponent;
- import epson.print.copy.Component.ecopycomponent.ECopyOptionItem;
- import epson.print.copy.Component.eremoteoperation.ERemoteCopy;
- import java.util.ArrayList;
- import java.util.Iterator;
- import org.json.JSONException;
- import org.json.JSONObject;
- public class ECopyOptionContext implements Parcelable {
- public static final Parcelable.Creator<ECopyOptionContext> CREATOR = new Parcelable.Creator<ECopyOptionContext>() {
- public ECopyOptionContext createFromParcel(Parcel parcel) {
- return new ECopyOptionContext(parcel);
- }
- public ECopyOptionContext[] newArray(int i) {
- return new ECopyOptionContext[i];
- }
- };
- ERemoteCopy.ERemoteCopyOptionsResult copyOptionsResult;
- ECopyComponent.ECopyType copyType;
- ArrayList<ECopyOptionItem> optionItems;
- public int describeContents() {
- return 0;
- }
- public void writeToParcel(Parcel parcel, int i) {
- parcel.writeString(this.copyType.name());
- parcel.writeInt(this.optionItems.size());
- Iterator<ECopyOptionItem> it = this.optionItems.iterator();
- while (it.hasNext()) {
- parcel.writeParcelable(it.next(), 0);
- }
- parcel.writeString(this.copyOptionsResult.toString());
- }
- ECopyOptionContext(Parcel parcel) {
- this.optionItems = new ArrayList<>();
- this.copyType = ECopyComponent.ECopyType.valueOf(parcel.readString());
- int readInt = parcel.readInt();
- for (int i = 0; i < readInt; i++) {
- this.optionItems.add((ECopyOptionItem) parcel.readParcelable(ECopyOptionItem.class.getClassLoader()));
- }
- try {
- JSONObject jSONObject = new JSONObject(parcel.readString());
- ERemoteCopy eRemoteCopy = new ERemoteCopy();
- eRemoteCopy.getClass();
- this.copyOptionsResult = new ERemoteCopy.ERemoteCopyOptionsResult(jSONObject);
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
- private boolean isNull() {
- return this.copyType == null;
- }
- ECopyOptionContext() {
- this.optionItems = new ArrayList<>();
- this.copyType = null;
- }
- ECopyOptionContext(ECopyComponent.ECopyType eCopyType) {
- this.optionItems = new ArrayList<>();
- this.copyType = eCopyType;
- }
- ECopyOptionContext(ECopyOptionContext eCopyOptionContext) {
- this.optionItems = new ArrayList<>();
- this.copyType = null;
- if (eCopyOptionContext != null) {
- this.copyType = eCopyOptionContext.copyType;
- Iterator<ECopyOptionItem> it = eCopyOptionContext.optionItems.iterator();
- while (it.hasNext()) {
- this.optionItems.add(new ECopyOptionItem(it.next()));
- }
- this.copyOptionsResult = eCopyOptionContext.copyOptionsResult;
- }
- }
- private ECopyComponent.ECopyType getCopyType() {
- return this.copyType;
- }
- private ArrayList<ECopyOptionItem> getCopyOptionItems() {
- return this.optionItems;
- }
- private ECopyOptionItem getCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey eCopyOptionItemKey) {
- Iterator<ECopyOptionItem> it = this.optionItems.iterator();
- while (it.hasNext()) {
- ECopyOptionItem next = it.next();
- if (next.key == eCopyOptionItemKey) {
- return next;
- }
- }
- return null;
- }
- private void add(ECopyOptionItem eCopyOptionItem) {
- this.optionItems.add(eCopyOptionItem);
- }
- public ECopyOptionItem replace(ECopyOptionItem eCopyOptionItem) {
- Iterator<ECopyOptionItem> it = this.optionItems.iterator();
- int i = 0;
- while (it.hasNext()) {
- if (it.next().key == eCopyOptionItem.key) {
- return this.optionItems.set(i, eCopyOptionItem);
- }
- i++;
- }
- return null;
- }
- private boolean isChanged(ECopyOptionItem eCopyOptionItem) {
- Iterator<ECopyOptionItem> it = this.optionItems.iterator();
- while (true) {
- if (!it.hasNext()) {
- break;
- }
- ECopyOptionItem next = it.next();
- if (next.key == eCopyOptionItem.key) {
- if (!next.equals(eCopyOptionItem)) {
- return true;
- }
- }
- }
- return false;
- }
- private void setCopyOptionsResult(ERemoteCopy.ERemoteCopyOptionsResult eRemoteCopyOptionsResult) {
- this.copyOptionsResult = eRemoteCopyOptionsResult;
- }
- private ERemoteCopy.ERemoteCopyOptionsResult getCopyOptionsResult() {
- return this.copyOptionsResult;
- }
- }
|