BrightSide Workbench Full Report + Source Code
Elephant/elephant-plugins/src/main/java/org/turro/plugin/contacts/ContactList.java
Go to the documentation of this file.
1
/*
2
* TurrĂ³ i Cutiller Foundation. License notice.
3
* Copyright (C) 2011 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU Affero General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU Affero General Public License for more details.
14
*
15
* You should have received a copy of the GNU Affero General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
package
org.turro.plugin.contacts;
19
20
import
java.util.ArrayList;
21
import
org.turro.util.PhraseBuilder;
22
27
public
class
ContactList
extends
ArrayList<IContact> {
28
29
@Override
30
public
boolean
add
(
IContact
e) {
31
if
(e ==
null
|| !e.
isValid
())
return
false
;
32
if
(!
contains
(e)) {
33
return
super.add(e);
34
}
35
return
false
;
36
}
37
38
public
boolean
contains
(
IContact
e) {
39
if
(e ==
null
|| !e.
isValid
())
return
false
;
40
for
(
IContact
ic :
this
) {
41
if
(ic.
getId
().equals(e.
getId
())) {
42
return
true
;
43
}
44
}
45
return
false
;
46
}
47
48
public
String
getCommaSeparatedId
() {
49
PhraseBuilder pb =
new
PhraseBuilder();
50
for
(
IContact
c :
this
) {
51
pb.addWord(
"'"
+ c.
getId
() +
"'"
);
52
pb.addPendingSeparator(
","
);
53
}
54
return
pb.toString();
55
}
56
57
}
org.turro.plugin.contacts.ContactList.getCommaSeparatedId
String getCommaSeparatedId()
Definition:
Elephant/elephant-plugins/src/main/java/org/turro/plugin/contacts/ContactList.java:48
org.turro.plugin.contacts.ContactList.contains
boolean contains(IContact e)
Definition:
Elephant/elephant-plugins/src/main/java/org/turro/plugin/contacts/ContactList.java:38
org.turro.plugin.contacts.ContactList.add
boolean add(IContact e)
Definition:
Elephant/elephant-plugins/src/main/java/org/turro/plugin/contacts/ContactList.java:30
org.turro.plugin.contacts.IContact
Definition:
elephant/src/main/java/org/turro/plugin/contacts/IContact.java:33
org.turro.plugin.contacts.IContact.isValid
boolean isValid()
org.turro.plugin.contacts.IContact.getId
String getId()
TurroProjects
Public
Elephant
elephant-plugins
src
main
java
org
turro
plugin
contacts
ContactList.java
Generated on Tue Mar 12 2024 07:01:18 for BrightSide by
1.9.1