// Path: chapter9-criminalintent/app/src/main/java/com/olerass/pfexample/android/criminalintent/domain/crimes/CrimeLab.java
// public class CrimeLab {
//     private static CrimeLab instance;
//     private List<Crime> crimes;
// 
//     public static CrimeLab get() {
//         if (instance == null) {
//             instance = new CrimeLab();
//         }
//         return instance;
//     }
// 
//     private CrimeLab() {
//         crimes = new ArrayList<>();
//         for (int i = 0; i < 100; i++) {
//             Crime crime = new Crime();
//             crime.setTitle("Crime #" + i);
//             crime.setSolved(i % 2 == 0);
//             crimes.add(crime);
//         }
//     }
// 
//     public List<Crime> getCrimes() {
//         return crimes;
//     }
// 
//     public Crime getCrime(UUID id) {
//         for (Crime crime : crimes) {
//             if (crime.getId().equals(id)) {
//                 return crime;
//             }
//         }
//         return null;
//     }
// }
// 
// Path: chapter9-criminalintent/app/src/main/java/com/olerass/pfexample/android/criminalintent/domain/crimes/CrimeListModel.java
// public interface CrimeListModel {
//     List<Crime> getCrimes();
//     Crime getCrime(UUID uuid);
// }
// 
// Path: chapter9-criminalintent/app/src/main/java/com/olerass/pfexample/android/criminalintent/domain/crimes/CrimeListPresenter.java
// public class CrimeListPresenter {
//     private CrimeListView view;
//     private CrimeListModel model;
// 
//     public CrimeListPresenter(CrimeListView view, CrimeListModel model) {
//         this.view = view;
//         this.model = model;
//         initialize();
//     }
// 
//     private void initialize() {
//         view.setCrimes(model.getCrimes());
//         view.whenCrimeSelected(uuid -> {
//             Crime selected = model.getCrime(uuid);
//             view.showCrimeMessage(selected.getTitle());
//         });
//     }
// }
// 
// Path: chapter9-criminalintent/app/src/main/java/com/olerass/pfexample/android/criminalintent/domain/crimes/StandardCrimeListModel.java
// public class StandardCrimeListModel implements CrimeListModel {
//     private CrimeLab lab;
// 
//     public StandardCrimeListModel(CrimeLab lab) {
//         this.lab = lab;
//     }
// 
//     @Override
//     public List<Crime> getCrimes() {
//         return lab.getCrimes();
//     }
// 
//     @Override
//     public Crime getCrime(UUID uuid) {
//         return lab.getCrime(uuid);
//     }
// }


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.olerass.pfexample.android.criminalintent.domain.crimes.CrimeLab;
import com.olerass.pfexample.android.criminalintent.domain.crimes.CrimeListModel;
import com.olerass.pfexample.android.criminalintent.domain.crimes.CrimeListPresenter;
import com.olerass.pfexample.android.criminalintent.domain.crimes.StandardCrimeListModel;
package com.olerass.pfexample.android.criminalintent.platform.crimes;



public class CrimeListFragment extends Fragment {
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        CrimeListModel model = new StandardCrimeListModel(CrimeLab.get());
        FragmentCrimeListView fragment = new FragmentCrimeListView(inflater, container);
        new CrimeListPresenter(fragment, model);

// Path: chapter9-criminalintent/app/src/main/java/com/olerass/pfexample/android/criminalintent/domain/crimes/CrimeLab.java
// public class CrimeLab {
//     private static CrimeLab instance;
//     private List<Crime> crimes;
// 
//     public static CrimeLab get() {
//         if (instance == null) {
//             instance = new CrimeLab();
//         }
//         return instance;
//     }
// 
//     private CrimeLab() {
//         crimes = new ArrayList<>();
//         for (int i = 0; i < 100; i++) {
//             Crime crime = new Crime();
//             crime.setTitle("Crime #" + i);
//             crime.setSolved(i % 2 == 0);
//             crimes.add(crime);
//         }
//     }
// 
//     public List<Crime> getCrimes() {
//         return crimes;
//     }
// 
//     public Crime getCrime(UUID id) {
//         for (Crime crime : crimes) {
//             if (crime.getId().equals(id)) {
//                 return crime;
//             }
//         }
//         return null;
//     }
// }
// 
// Path: chapter9-criminalintent/app/src/main/java/com/olerass/pfexample/android/criminalintent/domain/crimes/CrimeListModel.java
// public interface CrimeListModel {
//     List<Crime> getCrimes();
//     Crime getCrime(UUID uuid);
// }
// 
// Path: chapter9-criminalintent/app/src/main/java/com/olerass/pfexample/android/criminalintent/domain/crimes/CrimeListPresenter.java
// public class CrimeListPresenter {
//     private CrimeListView view;
//     private CrimeListModel model;
// 
//     public CrimeListPresenter(CrimeListView view, CrimeListModel model) {
//         this.view = view;
//         this.model = model;
//         initialize();
//     }
// 
//     private void initialize() {
//         view.setCrimes(model.getCrimes());
//         view.whenCrimeSelected(uuid -> {
//             Crime selected = model.getCrime(uuid);
//             view.showCrimeMessage(selected.getTitle());
//         });
//     }
// }
// 
// Path: chapter9-criminalintent/app/src/main/java/com/olerass/pfexample/android/criminalintent/domain/crimes/StandardCrimeListModel.java
// public class StandardCrimeListModel implements CrimeListModel {
//     private CrimeLab lab;
// 
//     public StandardCrimeListModel(CrimeLab lab) {
//         this.lab = lab;
//     }
// 
//     @Override
//     public List<Crime> getCrimes() {
//         return lab.getCrimes();
//     }
// 
//     @Override
//     public Crime getCrime(UUID uuid) {
//         return lab.getCrime(uuid);
//     }
// }


// Path: chapter9-criminalintent/app/src/main/java/com/olerass/pfexample/android/criminalintent/platform/crimes/CrimeListFragment.java
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.olerass.pfexample.android.criminalintent.domain.crimes.CrimeLab;
import com.olerass.pfexample.android.criminalintent.domain.crimes.CrimeListModel;
import com.olerass.pfexample.android.criminalintent.domain.crimes.CrimeListPresenter;
import com.olerass.pfexample.android.criminalintent.domain.crimes.StandardCrimeListModel;

package com.olerass.pfexample.android.criminalintent.platform.crimes;



public class CrimeListFragment extends Fragment {
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        CrimeListModel model = new StandardCrimeListModel(CrimeLab.get());
        FragmentCrimeListView fragment = new FragmentCrimeListView(inflater, container);
        new CrimeListPresenter(fragment, model);

        return fragment.getView();