/*
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

package macampcorp.macamp.game;

import java.io.Serializable;
import java.util.ArrayList;

public class Inventaire implements Serializable {
    protected ArrayList<Resource>   mAllResources = new ArrayList<Resource>();
    protected ArrayList<Resource>   mDisplayResources = new ArrayList<Resource>();

    public Inventaire()
    {

    }

    public void addResource(Resource r)
    {
        if(mAllResources.contains(r))
            return;

        mAllResources.add(r);
        if(r.isDisplay())
            mDisplayResources.add(r);
    }

    public void addResource(ArrayList<Resource> r)
    {
        for(int i=0; i<r.size(); i++)
            addResource(r.get(i));
    }

    public boolean contains(Resource r)
    {
        return mAllResources.contains(r);
    }

    public Resource get(int i)
    {
        return mAllResources.get(i);
    }

    public int size()
    {
        return getAllResources().size();
    }

    public ArrayList<Resource> getAllResources() {
        return mAllResources;
    }

    public ArrayList<Resource> getDisplayResources() {
        return mDisplayResources;
    }
}
