package com.medlinker.photopicker;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by heaven7 on 2016/4/5.
 * @version 1.0
 */
public class PhotoDirectory<T extends IPhotoFileEntity> {

    private String id;
    private String name;
    private String path;
    private long date;
    private List<T> photos = new ArrayList<>();

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof PhotoDirectory)) return false;

        PhotoDirectory that = (PhotoDirectory) o;

        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        return !(path != null ? !path.equals(that.path) : that.path != null);

    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (path != null ? path.hashCode() : 0);
        return result;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public long getDate() {
        return date;
    }

    public void setDate(long date) {
        this.date = date;
    }

    public List<T> getPhotos() {
        return photos;
    }

    public void setPhotos(List<T> photos) {
        this.photos = photos;
    }

    public List<String> getPhotoPaths() {
        List<String> paths = new ArrayList<String>(photos.size());
        for (T photo : photos) {
            paths.add(photo.getPath());
        }
        return paths;
    }

    public void addPhoto(int id, String path) {
        photos.add((T) PhotoPickerFactory.getPhotoFileEntityFactory().create(id,path));
    }
}

@@ -556,24 +556,25 @@
   if
- 
 (id 
-!= 
+==
 null 
-?
+%7C%7C 
  !
+ 
 id.e
@@ -591,27 +591,22 @@
 .id)
- : that.id != null)
+)%7B%0A           
  ret
@@ -628,33 +628,39 @@
     
-return !
+%7D%0A        if
 (path 
-!= 
+==
 null 
-?
+%7C%7C 
  !
+ 
 path
@@ -681,29 +681,66 @@
 ath)
- : that.path != null)
+)%7B%0A            return false;%0A        %7D%0A        return true
 ;%0A%0A 

change photo dir