NAME
Meta::Ds::Oset - 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: Oset.pm
PROJECT: meta
VERSION: 0.33
SYNOPSIS
package foo;
use Meta::Ds::Oset qw();
my($oset)=Meta::Ds::Oset->new();
$oset->insert("mark");
DESCRIPTION
This is a set object which is also ordered. This means you can access the n'th element. You get performance penalties in this implementation (especially upon removal of elements) so if you dont need the ordered feature please use the Meta::Ds::Set class.
FUNCTIONS
BEGIN()
new($)
clear($)
insert($$)
remove($$)
has($$)
hasnt($$)
check_has($$)
check_hasnt($$)
size($)
elem($$)
sort($$)
filter($$)
clone($)
add_set($$)
remove_set($$)
foreach($$)
add_prefix($$)
TEST($)
FUNCTION DOCUMENTATION
- BEGIN()
-
Bootstrap method for "name", "description" and "default" atrributes.
- new($)
-
Gives you a new Oset object.
- clear($)
-
Clears out the set so that it is empty.
- 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_has($$)
-
Thie method receives: 0. An Oset 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_hasnt($$)
-
Thie method receives: 0. An Oset 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.
- size($)
-
This method returns the size of the set.
- elem($$)
-
This method receives: 0. An Oset object. 1. A location. And retrieves the element at that location.
- sort($$)
-
This method receives: 0. An Oset object. 1. A comparison function. And sorts the set according to the comparison function.
- filter($$)
-
This method receives: 0. An Oset object. 1. A code reference. The method will run the code reference on each element of the set and will return a new set which only has the elements for which the code reference returned a value which evaluated to true.
- clone($)
-
This metho clones the current object.
- add_set($$)
-
This method will add a set to the current set.
- remove_set($$)
-
This method will remove a set from the current set.
- foreach($$)
-
This method will run a piece of code given to it on every element in the set.
- add_prefix($$)
-
This method creates and returns a new set which has all the elements of the old set with some prefix added.
- TEST($)
-
Test suite for this module. currently it just constructs a Oset object and prints it out.
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 add enumerated types to options
0.01 MV more on tests/more checks to perl
0.02 MV fix all tests change
0.03 MV change new methods to have prototypes
0.04 MV UI for Opts.pm
0.05 MV perl code quality
0.06 MV more perl quality
0.07 MV more perl quality
0.08 MV get basic Simul up and running
0.09 MV perl documentation
0.10 MV more perl quality
0.11 MV perl qulity code
0.12 MV more perl code quality
0.13 MV revision change
0.14 MV better general cook schemes
0.15 MV languages.pl test online
0.16 MV PDMT/SWIG support
0.17 MV Pdmt stuff
0.18 MV perl packaging
0.19 MV PDMT
0.20 MV md5 project
0.21 MV database
0.22 MV perl module versions in files
0.23 MV movies and small fixes
0.24 MV more thumbnail code
0.25 MV thumbnail user interface
0.26 MV more thumbnail issues
0.27 MV website construction
0.28 MV web site automation
0.29 MV SEE ALSO section fix
0.30 MV download scripts
0.31 MV finish papers
0.32 MV more pdmt stuff
0.33 MV md5 issues
SEE ALSO
Meta::Class::MethodMaker(3), Meta::Ds::Array(3), Meta::Error::Simple(3), Meta::Types::String(3), Meta::Utils::Output(3), Meta::Utils::String(3), strict(3)
TODO
-implement this as a two way map and get much better performance. The sort method may have difficulties.