package generics;

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

public class JKArray<E extends JKElement> {

	List<E> elements;

	public JKArray() {
		elements = new ArrayList<E>();
	}

	public void add(E e) {
		elements.add(e);
	}

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

	public int numsize() {
		int sum = 0;

		for (E e : elements) {
			sum += e.getNum();
		}

		return sum;
	}

	public int stringsize() {
		int sum = 0;

		for (E e : elements) {
			sum += e.getString().length();
		}

		return sum;
	}

	public String getStrings() {
		String str = "";

		for (E e : elements) {
			str += e.getString();
		}

		return str;
	}
}
