Meta::Ds::Dhash - data structure that represents a 1-1 hash table.


Meta documentation  | view source Contained in the Meta distribution.

Index


NAME

Top

Meta::Ds::Dhash - data structure that represents a 1-1 hash table.

COPYRIGHT

Top

LICENSE

Top

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

Top

	MANIFEST: Dhash.pm
	PROJECT: meta
	VERSION: 0.32

SYNOPSIS

Top

	package foo;
	use Meta::Ds::Dhash qw();
	my($hash)=Meta::Ds::Dhash->new();
	$hash->insert("mark","veltzer");
	$hash->insert("linus","torvalds");
	$hash->remove("mark");
	$hash->get_a("mark");
	$hash->get_b("linus");

DESCRIPTION

Top

This is a 1-1 mapping which is held by two hash tables.

FUNCTIONS

Top

	new($)
	insert($$$)
	remove_a($$)
	remove_b($$)
	size($)
	has_a($$)
	has_b($$)
	get_a($$)
	get_b($$)
	print($$)
	read($$)
	write($$)
	TEST($)

FUNCTION DOCUMENTATION

Top

new($)

Gives you a new Dhash object.

insert($$$)

Inserts an element into the 1-1. This receives: 0. Dhash object. 1. Element_a to insert. 2. Element_b to insert. This returns whether the value was actually inserted.

remove_a($$)

Remove an element from the a side of the 1-1. This receives: 0. Dhash object. 1. Element to remove. This method throws an exception if the value is not in the hash.

remove_b($$)

Remove an element from the b side of the 1-1. This receives: 0. Dhash object. 1. Element to remove. This method throws an exception if the value is not in the hash.

size($)

Return the number of elements in the hash. This receives: 0. Dhash object.

has_a($$)

Returns a boolean value according to whether the specified element is in the hash or not. This receives: 0. Dhash object. 1. Element_a to check for.

has_b($$)

Returns a boolean value according to whether the specified element is in the hash or not. This receives: 0. Dhash object. 1. Element_a to check for.

get_a($$)

This returns a certain element from the 1-1. This receives: 0. Dhash object. 1. Elemenet_a to retrieve.

get_b($$)

This returns a certain element from the 1-1. This receives: 0. Dhash object. 1. Elemenet_b to retrieve.

print($$)

Print the current graph to a file. This rourine receives: 0. Dhash object. 1. File to print to.

read($$)

This will read a hash from a file assuming that file has an entry for the hash as two string separated by a space on each line until the end of the file.

write($$)

This will write a hash table as in the read method. See that methods documentation for details.

TEST($)

Test suite for this module.

SUPER CLASSES

Top

None.

BUGS

Top

None.

AUTHOR

Top

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

HISTORY

Top

	0.00 MV handle architectures better
	0.01 MV ok. This is for real
	0.02 MV make quality checks on perl code
	0.03 MV more perl checks
	0.04 MV make Meta::Utils::Opts object oriented
	0.05 MV check that all uses have qw
	0.06 MV fix todo items look in pod documentation
	0.07 MV more on tests/more checks to perl
	0.08 MV more perl code quality
	0.09 MV change new methods to have prototypes
	0.10 MV correct die usage
	0.11 MV perl code quality
	0.12 MV more perl quality
	0.13 MV more perl quality
	0.14 MV perl documentation
	0.15 MV more perl quality
	0.16 MV perl qulity code
	0.17 MV more perl code quality
	0.18 MV revision change
	0.19 MV languages.pl test online
	0.20 MV PDMT/SWIG support
	0.21 MV perl packaging
	0.22 MV md5 project
	0.23 MV database
	0.24 MV perl module versions in files
	0.25 MV movies and small fixes
	0.26 MV more thumbnail stuff
	0.27 MV thumbnail user interface
	0.28 MV more thumbnail issues
	0.29 MV website construction
	0.30 MV web site automation
	0.31 MV SEE ALSO section fix
	0.32 MV md5 issues

SEE ALSO

Top

Meta::Development::Assert(3), Meta::Error::Simple(3), Meta::IO::File(3), strict(3)

TODO

Top

-add/subtract a hash.

-read/write a hash from a file.

-get a list from a hash.

-get a set from a hash.

-get a hash from a list.

-get a hash from a set.

-insert an element and make sure that he wasnt there.

-remove an element and make sure that he was there.

-add a limitation on the types of objects going into the hash (they must be inheritors from some kind of object).

-make option for hash to be strict (that insert twice will yell).


Meta documentation  | view source Contained in the Meta distribution.