summaryrefslogtreecommitdiff
path: root/pharo-mooc/contact-book/src/ContactBook/ContactBook.class.st
blob: 3c6ef694461f3d2b8c678d76ed61c6efd47b7f62 (plain)
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
Class {
	#name : 'ContactBook',
	#superclass : 'Object',
	#instVars : [
		'contacts'
	],
	#category : 'ContactBook',
	#package : 'ContactBook'
}

{ #category : 'demos' }
ContactBook class >> createDefault [
	^ self new
		addContact: (Contact newNamed: 'Damien Cassou' email: 'damien@cassou.me');
		addContact: (Contact newNamed: 'Marcus Denker' email: 'marcus.denker@inria.fr');
		addContact: (Contact newNamed: 'Tudor Girba' email: 'tudor@tudorgirba.com');
		addContact: (Contact newNamed: 'Clara Allende' email: 'clari.allende@gmail.com');
		yourself
]

{ #category : 'writing' }
ContactBook >> addContact: aContact [
	self contacts add: aContact
]

{ #category : 'reading' }
ContactBook >> contacts [
	^ contacts
]

{ #category : 'initialization' }
ContactBook >> initialize [
	super initialize.
	contacts := OrderedCollection new
]

{ #category : 'deleting' }
ContactBook >> removeContact: aContact [
	self contacts remove: aContact
]

{ #category : 'initialization' }
ContactBook >> size [
	^ contacts size
]