summaryrefslogtreecommitdiffstats
path: root/RelationSet.pm
diff options
context:
space:
mode:
Diffstat (limited to 'RelationSet.pm')
-rw-r--r--RelationSet.pm37
1 files changed, 37 insertions, 0 deletions
diff --git a/RelationSet.pm b/RelationSet.pm
index 92e2158f2..b5cae289c 100644
--- a/RelationSet.pm
+++ b/RelationSet.pm
@@ -18,6 +18,7 @@
#
# Contributor(s): Dan Mosedale <dmose@mozilla.org>
# Terry Weissman <terry@mozilla.org>
+# Dave Miller <dave@intrec.com>
# This object models a set of relations between one item and a group
# of other items. An example is the set of relations between one bug
@@ -179,6 +180,42 @@ sub mergeFromString {
}
}
+# remove a set in string form from this set
+#
+sub removeItemsInString {
+ ($#_ == 1) || confess("invalid number of arguments");
+ my $self = shift();
+
+ # do the merge
+ #
+ foreach my $person (split(/[ ,]/, shift())) {
+ if ($person ne "") {
+ my $dbid = &::DBNameToIdAndCheck($person);
+ if (exists $$self{$dbid}) {
+ delete $$self{$dbid};
+ }
+ }
+ }
+}
+
+# remove a set in array form from this set
+#
+sub removeItemsInArray {
+ ($#_ > 0) || confess("invalid number of arguments");
+ my $self = shift();
+
+ # do the merge
+ #
+ while (my $person = shift()) {
+ if ($person ne "") {
+ my $dbid = &::DBNameToIdAndCheck($person);
+ if (exists $$self{$dbid}) {
+ delete $$self{$dbid};
+ }
+ }
+ }
+}
+
# return the number of elements in this set
#
sub size {