package lt.ktu.gmj.tasks;

import java.util.*;
import lt.ktu.gmj.tasks.*;
import lt.ktu.gmj.*;

public class KnapsackResult implements IResult
{
	private double m_value;
	private ArrayList<Item> m_items;
	//
	public KnapsackResult()
	{
		m_items = new ArrayList<Item>();
	}
	public double fx()
	{
		return m_value;
	}
	public void value(double value)
	{
		m_value = value;
	}
	public void add(Item item)
	{
		m_items.add(item);
	}
	public ArrayList<Item> items()
	{
		return m_items;
	}
	public double totalWeight()
	{
		double total = 0.0D;
		for ( Item item : m_items )
			total += item.weight();
		return total;
	}
	public double totalCost()
	{
		double total = 0.0D;
		for ( Item item : m_items )
			total += item.price();
		return total;
	}
} 
