NAME
Meta::Ds::Noset - Ordered hash 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: Noset.pm
PROJECT: meta
VERSION: 0.01
SYNOPSIS
package foo;
use Meta::Ds::Noset qw();
my($oset)=Meta::Ds::Noset->new();
$oset->insert("mark");
DESCRIPTION
This is a set object which is also ordered (meaning you can find the ordinal number of each element and also the reverse - move from an ordinal number to the element). The structure is able to hold any perl object or scalar as element. Duplicates are not allowed (this is a set after all...). The structure uses a 1-1 mapping to do its thing by mapping numbers to the elements that you put in. This means that you can iterate over all elements of the set quite easily with little performance penalty (except the hash function lookup every loop). The set also supports the remove operation by changing the ordinal of the last element to the element which is removed. This means that removing elements while traversing the ordinals is not supported. The removal is, however, O(1).
FUNCTIONS
insert($$)
remove($$)
has($$)
hasnt($$)
check_elem($$)
check_not_elem($$)
elem($$)
TEST($)
FUNCTION DOCUMENTATION
- insert($$)
-
This inserts a new element into the Set. If the element is already an element it is not an error.
- remove($$)
-
This removes an element from the Set. If the element is not an element of the set it is not an error.
- has($$)
-
This returns whether a specific element is a member of the set.
- hasnt($$)
-
This returns whether a specific element is not a member of the set.
- check_elem($$)
-
Thie method receives: 0. An Noset object. 1. An element to check fore. This method makes sure that the element is a member of the set and dies if it is not.
- check_not_elem($$)
-
Thie method receives: 0. An Noset object. 1. An element to check fore. This method makes sure that the element is a member of the set and dies if it is not.
- elem($$)
-
This method receives: 0. An Noset object. 1. A location. And retrieves the element at that location.
- TEST($)
-
Test suite for this module.
Currently creates a set and manipulates it a little.
SUPER CLASSES
Meta::Ds::Map(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 more pdmt stuff
SEE ALSO
Meta::Ds::Map(3), Meta::Utils::Output(3), strict(3)
TODO
Nothing.