add

Usage    - $set->add()
Returns  - true if the element was successfully added
Args     - the element to be added
Function - adds an element to this set

remove

Usage    - $set->remove($element)
Returns  - the removed element
Args     - the element to be removed
Function - removes an element from this set

add_all

Usage    - $set->add_all()
Returns  - true if the elements were successfully added
Args     - the elements to be added
Function - adds the given elements to this set

get_set

Usage    - $set->get_set()
Returns  - this set
Args     - none
Function - returns this set

contains

Usage    - $set->contains()
Returns  - true if this set contains the given element
Args     - the element to be checked
Function - checks if this set constains the given element

size

Usage    - print $set->size()
Returns  - the size of this set
Args     - 
Function - tells the number of elements held by this set

clear

Usage    - $set->clear()
Returns  - none
Args     - none
Function - clears this set

is_empty

Usage    - $set->is_empty()
Returns  - 1 (true) if this set is empty
Args     - none
Function - checks if this set is empty

equals

Usage    - $set->equals()
Returns  - true or false
Args     - the set to compare with
Function - tells whether this set is equal to the given one

NAME CCO::Util::SynonymSet - a Set implementation =head1 SYNOPSIS

use CCO::Util::SynonymSet; use CCO::Core::Synonym; use strict;

my $my_set = CCO::Util::SynonymSet->new;

my @arr = $my_set->get_set();

# three new terms my $n1 = CCO::Core::Synonym->new; my $n2 = CCO::Core::Synonym->new; my $n3 = CCO::Core::Synonym->new;

$n1->id("CCO:P0000001"); $n2->id("CCO:P0000002"); $n3->id("CCO:P0000003");

$n1->name("One"); $n2->name("Two"); $n3->name("Three");

# remove from my_set $my_set->remove($n1); $my_set->add($n1); $my_set->remove($n1);

### set versions ### $my_set->add($n1); $my_set->add($n2); $my_set->add($n3);

my $n4 = CCO::Core::Synonym->new; my $n5 = CCO::Core::Synonym->new; my $n6 = CCO::Core::Synonym->new;

$n4->id("CCO:P0000004"); $n5->id("CCO:P0000005"); $n6->id("CCO:P0000006");

$n4->name("Four"); $n5->name("Five"); $n6->name("Six");

$my_set->add_all($n4, $n5, $n6);

$my_set->add_all($n4, $n5, $n6);

# remove from my_set $my_set->remove($n4);

my $n7 = $n4; my $n8 = $n5; my $n9 = $n6;

my $my_set2 = CCO::Util::SynonymSet->new;

$my_set->add_all($n4, $n5, $n6); $my_set2->add_all($n7, $n8, $n9, $n1, $n2, $n3);

$my_set2->clear();

DESCRIPTION A set of synonyms for a term or relationship type.

AUTHOR

Erick Antezana, <erant@psb.ugent.be>

COPYRIGHT AND LICENSE

Copyright (C) 2006 by erant

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.