// This file defines an implementation of the Add interface. The meaning
// of the annotations is described in that interface.

package Impl;

import CTL.Annotate.*;
import java.util.*;

@const_ public class AddImpl implements common.Add
{
	// As you can see, the exported methods are not inherited from the 
	// interface. Be careful and mark all methods as exported which were
	// marked as such in the interface, but not more. Apart from that, 
	// this class should be straightforward.
	@export public int add (int a, int b)
	{
		return a+b;
	}

	@export public int[] add (int[] v1, int[] v2)
	{
		int len = 0;
		if (v1.length == v2.length)
			len = v1.length;
		int[] res = new int[len];
		for (int i=0;i<len;i++)
			res[i] = v1[i]+v2[i];
		return res;
	}

	@export public List<Integer> add (List<Integer> v1, List<Integer> v2)
	{
		int len = 0;
		if (v1.size() == v2.size())
			len = v1.size();
		Vector<Integer> res = new Vector<Integer>(len);
		for (int i=0;i<len;i++)
			res.add(v1.get(i)+v2.get(i));
		return res;
	}
}
