The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Meta::Ds::MapM1 - Many to 1 map data structure.

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: MapM1.pm
        PROJECT: meta
        VERSION: 0.01

SYNOPSIS

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

DESCRIPTION

This object is a many to 1 data structure. It allows you store, for instance , a mapping between social id numbers and age. You can efficiently retrieve the set of all social ids which have the same age as an ordered set. Any types of objects can be stored here.

The implementation stores two ordered hashes where the first stores the actual values while the other stores sets.

Have fun!

FUNCTIONS

        BEGIN()
        new($)
        insert($$$)
        has_a($$)
        has_b($$)
        get_a($$)
        get_b($$)
        remove($$$)
        remove_a($$)
        remove_b($$)
        TEST($)

FUNCTION DOCUMENTATION

BEGIN()

Bootstrap method which makes the attributes "hash_a" and "hash_b". This means you can get them using "get_hash_a" and "get_hash_b". Be careful with what you do with those. The best way is use them on a read only basis (if you are using them at all).

new($)

This is a constructor for the Meta::Ds::MapM1 object.

insert($$$)

This method inserts a new element. An exception will be raised if the first element is already present.

has_a($$)

Returns whether the map has a specific a type element.

has_b($$)

Returns whether the map has a specific b type element.

get_a($$)

Use this method to retrive the set of values which have a specific value in the b set. The result is a Meta::Ds::Noset type object which you can iterate or whatever. Use it as read only or be accountable.

get_b($$)

This method will retrive the single value associated with the given value. The result is a single value (unlike in get_a).

remove($$$)

Supply this method with an a side element and a b side element and it will be removed from the map.

remove_a($)

Supply this method with an a side element and it will be removed from the map. The method simply finds the b element associated with this a element and calls the above mentioned "remove" method.

remove_b($)

This method will remove *** ALL *** elements which map to a certain b element. Take heed.

TEST($)

This is a testing suite for the Meta::Ds::MapM1 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.

This test currently creates a map and toys with it.

SUPER CLASSES

None.

BUGS

None.

AUTHOR

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

HISTORY

        0.00 MV more pdmt stuff
        0.01 MV md5 issues

SEE ALSO

Meta::Class::MethodMaker(3), Meta::Ds::Noset(3), Meta::Ds::Ohash(3), Meta::Utils::Output(3), strict(3)

TODO

Nothing.