NAME

Meta::Ds::PartitionedSet - A set which is partitioned according to an attribute value.

COPYRIGHT

Copyright (C) 2001, 2002 Mark Veltzer; All rights reserved.

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.

DETAILS

MANIFEST: PartitionedSet.pm
PROJECT: meta
VERSION: 0.01

SYNOPSIS

package foo;
use Meta::Ds::PartitionedSet qw();
my($object)=Meta::Ds::PartitionedSet->new();
my($result)=$object->method();

DESCRIPTION

This class is a partitioned set. Let say that you have set of objects but each object has an attribute (say a color). You want to maintain This set so that: 1. You could iterate over all its elements. 2. You could easily get from an object to it's attribute. 3. You could easily iterate over all object where the attribute has a certain value. This is what this partitioned set is all about.

Have fun!

FUNCTIONS

BEGIN()
new($)
insert($$$)
remove_value($$$)
remove($$)
get_set($$)
TEST($)

FUNCTION DOCUMENTATION

BEGIN()

Bootstrap function to set the following attributes: 0. value_hash - hash of values stored in the partition. 1. attribute_hash - hash of attributes stored in the partition.

new($)

constructor for this object.

insert($$$)

This is the basic insertion method. Insert an object and it's attribute.

remove_value($$$)

This method removes an element for which the attribute value is known.

remove($$)

This method removes an element for which the attribute value is unknown.

get_set($$)

This method returns the set of members which have a certain value.

TEST($)

This is a testing suite for the Meta::Ds::PartitionedSet module. This test is should be run by a higher level management system at integration or release time or just as a regular routine to check that all is well.

Currently this test just creates an object, inserts a few things and then dumps the resulting object.

SUPER CLASSES

Meta::Ds::Oset(3)

BUGS

None.

AUTHOR

Name: Mark Veltzer
Email: mailto:veltzer@cpan.org
WWW: http://www.veltzer.org
CPAN id: VELTZER

HISTORY

0.00 MV teachers project
0.01 MV md5 issues

SEE ALSO

Meta::Class::MethodMaker(3), Meta::Ds::Hash(3), Meta::Ds::Oset(3), Meta::Utils::Output(3), strict(3)

TODO

Nothing.