2 * DesfireApplication.java
4 * Copyright (C) 2011 Eric Butler
7 * Eric Butler <eric@codebutler.com>
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 package com.codebutler.farebot.card.desfire;
25 import android.os.Parcel;
26 import android.os.Parcelable;
28 public class DesfireApplication implements Parcelable {
30 private DesfireFile[] mFiles;
32 public DesfireApplication (int id, DesfireFile[] files) {
41 public DesfireFile[] getFiles () {
45 public DesfireFile getFile (int fileId) {
46 for (DesfireFile file : mFiles) {
47 if (file.getId() == fileId)
53 public static final Parcelable.Creator<DesfireApplication> CREATOR = new Parcelable.Creator<DesfireApplication>() {
54 public DesfireApplication createFromParcel(Parcel source) {
55 int id = source.readInt();
57 DesfireFile[] files = new DesfireFile[source.readInt()];
58 source.readTypedArray(files, DesfireFile.CREATOR);
60 return new DesfireApplication(id, files);
63 public DesfireApplication[] newArray (int size) {
64 return new DesfireApplication[size];
68 public void writeToParcel (Parcel parcel, int flags) {
70 parcel.writeInt(mFiles.length);
71 parcel.writeTypedArray(mFiles, flags);
74 public int describeContents () {