Skip to main content
summaryrefslogtreecommitdiffstats
blob: 2e88dcca4c42e4ef1566a442fc2d84f321b45ab2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*******************************************************************************
 * Copyright (c) 2004 - 2005 University Of British Columbia and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     University Of British Columbia - initial API and implementation
 *******************************************************************************/
package org.eclipse.mylar.tasks.tests;

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


public class People {
	private List<Person> list = new ArrayList<Person>();
	
	public People() {
		// don't need to do any initialization
	}
	
	public void createDefault() {
		Person p = new Person("Ken Sueda", "ksueda@hotmail.com", "123-4567", 22, 1);
		Job j = new Job("UBCCS", "developer", 1000, "ksueda@cs.ubc.ca", "foo");
		p.setJob(j);
		list.add(p);
		
		p = new Person("Shawn Minto", "minto@hotmail.com", "798-1234", 23, 2);
		j = new Job("UBCCS", "grad student", 3000, "minto@cs.ubc.ca", "foo");
		p.setJob(j);
		list.add(p);
		
		
		p = new Person("Mik Kersten", "kersten@hotmail.com", "456-7891", 24, 3);
		j = new Job("UBCCS", "PhD", 1000000, "kersten@cs.ubc.ca", "foo");
		p.setJob(j);
		list.add(p);
		
		p = new Person("Gail Murphy", "murphy@hotmail.com", "987-6543", 25, 4);
		j = new Job("UBCCS", "Professor", 100000000, "", "");
		p.setJob(j);
		list.add(p);
	}
	
	public boolean equals(People people) {
		boolean result = true;		
		if (list.size() == people.list.size()) {
			Iterator<Person> itr = list.iterator();
			Iterator<Person> itr2 = people.list.iterator();
			
			while(itr.hasNext()) {
				Person p = itr.next();
				Person p2 = itr2.next();
				result = result && p.equals(p2);
				if (!result) {
					break;
				}
			}
		} else {
			result = false;
		}
		return result;
	}
}

Back to the top