Main > Free Download Search >

Free sets software for linux

sets

Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 4743
Fuzzy sets for Ada 4.2

Fuzzy sets for Ada 4.2


Fuzzy sets for Ada is a library providing implementations of confidence factors. more>>
Fuzzy sets for Ada is a library providing implementations of confidence factors with the operations not, and, or, xor, +, and *, classical fuzzy sets with the set-theoretic operations and the operations of the possibility theory, intuitionistic fuzzy sets with the operations on them, fuzzy logic based on the intuitionistic fuzzy sets and the possibility theory; fuzzy numbers, both integer and floating-point with conventional arithmetical operations, and linguistic variables and sets of linguistic variables with operations on them. Fuzzy sets for Ada has support for string-oriented I/O.
Main features:
- Confidence factors with the operations not, and, or, xor, +, *;
- Classical fuzzy sets with the set-theoretic operations and the operations of the possibility theory;
- Intuitionistic fuzzy sets with the operations on them;
- Fuzzy logic based on the intuitionistic fuzzy sets and the possibility theory;
- Fuzzy numbers both integer and floating-point ones with conventional arithmetical operations;
- Dimensioned fuzzy numbers;
- Linguistic variables and sets of linguistic variables with operations on them;
- String-oriented I/O is supported.
Enhancements:
- The code was tested with GNAT Ada 2005 (GCC 4.0.2 20051125).
- A bug was fixed in Fuzzy.Linguistics.Sets.Defuzzify, which led to incorrect defuzzification with a descending membership function.
<<less
Download (1.0MB)
Added: 2006-05-25 License: LGPL (GNU Lesser General Public License) Price:
1263 downloads
WebService::Google::Sets 0.01

WebService::Google::Sets 0.01


WebService::Google::Sets is a Perl access to Google Labs Sets site. more>>
WebService::Google::Sets is a Perl access to Google Labs Sets site.

SYNOPSIS

use WebService::Google::Sets;

my @os_list = qw(Linux Windows Solaris);
my $expanded_os_list = get_gset(@os_list);

# check something came back
die "No results returned from server" unless $expanded_os_list;

foreach my $element (@$expanded_os_list) {
print $element, "n";
}

WebService::Google::Sets provides function based access to the Sets service hosted at Google Labs.

The Sets service attempts to expand the values you provide. The example provided in the SYNOPSIS would return an array that included "Windows NT", "HPUX" and "AIX" as values in addition to those supplied.

<<less
Download (0.003MB)
Added: 2006-11-21 License: Perl Artistic License Price:
1068 downloads
Bio::NEXUS::SetsBlock 0.67

Bio::NEXUS::SetsBlock 0.67


Bio::NEXUS::SetsBlock is a Perl module that represents SETS block of a NEXUS file. more>>
Bio::NEXUS::SetsBlock is a Perl module that represents SETS block of a NEXUS file.

SYNOPSIS

$block_object = new Bio::NEXUS::SetsBlock($block_type, $block, $verbose);

Parses Sets block of NEXUS file and stores Sets data.

METHODS

new

Title : new
Usage : $block_object = new Bio::NEXUS::SetsBlock($block_type, $commands, $verbose)
Function: Creates a new Bio::NEXUS::SetsBlock object
Returns : Bio::NEXUS::SetsBlock object
Args : type (string), the commands/comments to parse (array ref), and a verbose flag (0 or 1)

set_taxsets

Title : set_taxsets
Usage : $block->set_taxsets($taxsets);
Function: Set the taxsets hash
Returns : none
Args : hash of set name keys and element arrays

add_taxsets

Title : add_taxsets
Usage : $block->add_taxsets($taxsets);
Function: add taxa sets
Returns : none
Args : a reference to a hash of taxa sets

get_taxsets

Title : get_taxsets
Usage : $block->get_taxsets();
Function: Returns a hash of taxa sets
Returns : taxa sets
Args : none

get_taxset

Title : get_taxset
Usage : $block->get_taxset($setname);
Function: Returns a list of OTUs
Returns : OTUs
Args : none

get_taxset_names

Title : get_taxset_names
Usage : $block->get_taxset_names()
Function: gets the names of all sets
Returns : array of names
Args : none

print_all_taxsets

Title : print_all_taxsets
Usage : $block->print_all_taxsets($outfile)
Function: prints set names and elements
Returns : none
Args : filename or filehandle

delete_taxsets

Title : delete_taxsets
Usage : $block->delete_taxsets($set1 [$set2 $set3 ...])
Function: Removes the named sets from the Sets block
Returns : none
Args : Names of sets to be deleted

exclude_otus

Title : exclude_otus
Usage : $block->exclude_otus($otu_array_ref)
Function: Finds and deletes each of the given otus from any sets they appear in
Returns : none
Args : Names of otus to be removed

select_otus

Title : select_otus
Usage : $block->select_otus($otu_array_ref)
Function: Finds the given otus and removes all others from any sets they appear in
Returns : none
Args : Names of otus to be removed

rename_otus

Title : rename_otus
Usage : $block->rename_otus($names);
Function: rename all OTUs
Returns : none
Args : hash of OTU names

rename_taxsets

Title : rename_taxsets
Usage : $block->rename_taxsets($oldsetname1, $newsetname1, ...)
Function: Renames sets
Returns : none
Args : Oldname, newname pairs

equals

Name : equals
Usage : $setsblock->equals($another);
Function: compare if two Bio::NEXUS::SetsBlock objects are equal
Returns : boolean
Args : a Bio::NEXUS::SetsBlock object

<<less
Download (0.15MB)
Added: 2006-12-20 License: Perl Artistic License Price:
1038 downloads
Money::ChangeMaker::Presets 0.2

Money::ChangeMaker::Presets 0.2


Money::ChangeMaker::Presets Perl module contains preset currency sets for Money::ChangeMaker. more>>
Money::ChangeMaker::Presets Perl module contains preset currency sets for Money::ChangeMaker.

SYNOPSIS

See L< Money::ChangeMaker >

Simply contains the preset monetary sets used by the Money::ChangeMaker module. In general, users should not interact with this module at all, it is simply provided as separate so that users may modify it in their own installation to add/modify existing preset sets.

CAVEATS

When working with monetary amounts, it is common to want to represent them in the same terms as they are represented in life -- e.g. 12.45 to represent twelve dollars and 45 cents. However, in perl, floating point numbers are subject to certain inherent inconsitencies and as such should really be avoided when possible. It is therefore better to work only with integer values, by making sure that the smallest unit in a monetary set is represented by 1, not by 0.01. This is the standard as used by all presets in this module.

<<less
Download (0.009MB)
Added: 2007-08-05 License: Perl Artistic License Price:
823 downloads
jset 0.20

jset 0.20


jset project is an implementation of the Set board game. more>>
jset project is an implementation of the Set board game.

The game can be played alone or on the network. The Set board game is a card game whose goal is to find matching sets of cards.

The game is played using 81 (3^4) unique cards. On each card is drawn a set of identical shapes.

These sets of shapes have 4 properties, each shape property taken from a set of 3 possibilities: color (e.g. red, blue, and green), type (e.g. rectangle, circle, and triangle), fill (e.g. empty, full, and shaded), and number (e.g. one, two, and three).

The cards are disposed on the table in front of the players. The players must try to identify matching sets of cards.

<<less
Download (0.070MB)
Added: 2006-11-24 License: GPL (GNU General Public License) Price:
1064 downloads
Set::Hash 0.01

Set::Hash 0.01


Set::Hash is a Perl module with hashes as objects with lots of handy methods and support for method chaining. more>>
Set::Hash is a Perl module with hashes as objects with lots of handy methods (including set comparisons) and support for method chaining.

SYNOPSIS

use Set::Hash;
my $sh1 = Set::Hash->new(name=>"dan",age=>33);
my $sh2 = Set::Hash->new(qw/weight 185 height 72/);
$sh1->length->print; # 2
$sh1->push($sh2); # $sh1 now has weight=>185 and height=>72
$sh1->length->print; # 4
$sh2->values->join(",")->print(1); # 185, 72

Set::Hash allows you to create strings as objects and use OO-style methods on them. Many convenient methods are provided here that appear in the FAQs, the Perl Cookbook or posts from comp.lang.perl.misc. In addition, there are Set methods with corresponding (overloaded) operators for the purpose of Set comparison, i.e. +, ==, etc.

The purpose is to provide built-in methods for operations that people are always asking how to do, and which already exist in languages like Ruby. This should (hopefully) improve code readability and/or maintainability. The other advantage to this module is method-chaining by which any number of methods may be called on a single object in a single statement.

Note that Set::Hash is a subclass of Set::Array, although most of the methods of Set::Array have been overloaded, so youll want to check the documentation for what each method does exactly.

<<less
Download (0.007MB)
Added: 2006-12-18 License: Perl Artistic License Price:
1040 downloads
Set::Scalar 1.20

Set::Scalar 1.20


Set::Scalar Perl module contains a basic set of operations. more>>
Set::Scalar Perl module contains a basic set of operations.

SYNOPSIS

use Set::Scalar;
$s = Set::Scalar->new;
$s->insert(a, b);
$s->delete(b);
$t = Set::Scalar->new(x, y, $z);

Creating

$s = Set::Scalar->new;
$s = Set::Scalar->new(@members);

$t = $s->clone;
$t = $s->copy; # clone of clone

Modifying

$s->insert(@members);
$s->delete(@members);
$s->invert(@members); # insert if hasnt, delete if has

$s->clear; # removes all the elements

Note that clear() only releases the memory used by the set to be reused by Perl; it will not reduce the overall memory use.

<<less
Download (0.016MB)
Added: 2007-07-03 License: Perl Artistic License Price:
844 downloads
ShellTer 1.0

ShellTer 1.0


ShellTer is an iptables-based firewall. more>>
ShellTer is an iptables-based firewall. What sets it apart from the rest is that it has built-in SSH brute force protection.
ShellTer project is easy to configure and has an interactive CLI installer.
To install ShellTer, simply execute the "installer" file in this directory.
Enjoy and feel free to email me with questions/comments/patches/etc.
Enhancements:
- Simple bugfix
<<less
Download (0.010MB)
Added: 2007-07-17 License: GPL (GNU General Public License) Price:
830 downloads
Set::CrossProduct 1.92

Set::CrossProduct 1.92


Set::CrossProduct is a Perl module that allows you to work with the cross product of two or more sets. more>>
Set::CrossProduct is a Perl module that allows you to work with the cross product of two or more sets.

SYNOPSIS

my $iterator = Set::CrossProduct->new( ARRAY_OF_ARRAYS );

# get the next tuple
my $number_of_tuples = $iterator->cardinality;

# get the next tuple
my $tuple = $iterator->get;

# move back one position
my $tuple = $iterator->unget;

# get the previous tuple without resetting
# the cursor (peek at it)
my $next_tuple = $iterator->next;

# get the previous tuple without resetting
# the cursor
my $last_tuple = $iterator->previous;

# get a random tuple
my $tuple = $iterator->random;

# in list context returns a list of all tuples
my @tuples = $iterator->combinations;

# in scalar context returns an array reference to all tuples
my $tuples = $iterator->combinations;

Given sets S(1), S(2), ..., S(k), each of cardinality n(1), n(2), ..., n(k) respectively, the cross product of the sets is the set CP of ordered tuples such that { | s1 => S(1), s2 => S(2), .... sk => S(k). }
If you do not like that description, how about:

Create a list by taking one item from each array, and do that for all possible ways that can be done, so that the first item in the list is always from the first array, the second item from the second array, and so on.

<<less
Download (0.007MB)
Added: 2007-07-04 License: Perl Artistic License Price:
842 downloads
Set::Array 0.14

Set::Array 0.14


Set::Array Perl module contains arrays as objects with lots of handy methods and support for method chaining. more>>
Set::Array Perl module contains arrays as objects with lots of handy methods (including Set comparisons) and support for method chaining.

SYNOPSIS

my $sao1 = Set::Array->new(1,2,4,"hello",undef);
my $sao2 = Set::Array->new(qw(a b c a b c));
print $sao1->length; # prints 5
$sao2->unique->length->print; # prints 3

Set::Array allows you to create arrays as objects and use OO-style methods on them. Many convenient methods are provided here that appear in the FAQs, the Perl Cookbook or posts from comp.lang.perl.misc. In addition, there are Set methods with corresponding (overloaded) operators for the purpose of Set comparison, i.e. +, ==, etc.

The purpose is to provide built-in methods for operations that people are always asking how to do, and which already exist in languages like Ruby. This should (hopefully) improve code readability and/or maintainability. The other advantage to this module is method-chaining by which any number of methods may be called on a single object in a single statement.

OBJECT BEHAVIOR

The exact behavior of the methods depends largely on the calling context.
Here are the rules:

* If a method is called in void context, the object itself is modified.
* If the method called is not the last method in a chain (i.e. its called in object context), the object itself is modified by that method regardless of the final context or method call.
* If a method is called in list or scalar context, a list or list refererence is returned, respectively. The object itself is NOT modified.

Heres a quick example:

my $sao = Set::Array->new(1,2,3,2,3);
my @uniq = $sao->unique(); # Object unmodified. @uniq contains 3 values.
$sao->unique(); # Object modified, now contains 3 values

Here are the exceptions:

* Methods that report a value, such as boolean methods like exists() or other methods such as at() or as_hash(), never modify the object.
* The methods clear(), delete(), delete_at(), and splice will always modify the object. It seemed much too counterintuitive to call these methods in any context without actually deleting/clearing/substituting the items!
* The methods shift() and pop() will modify the object AND return the value that was shifted or popped from the array. Again, it seemed much too counterintuitive for something like $val = $sao->shift to return a value while leaving the objects list unchanged. If you really want the first or last value without modifying the object, you can always use the first() or last() method, respectively.
* The join() method always returns a string and is really meant for use in conjunction with the print() method.

BOOLEAN METHODS

exists(val) - Returns 1 if val exists within the array, 0 otherwise. If no value (or undef) is passed, then this method will test for the existence of undefined values within the array.
is_empty() - Returns 1 if the array is empty, 0 otherwise. Empty is defined as having a length of 0.

STANDARD METHODS

at(index) - Returns the item at the given index (or undef). A negative index may be used to count from the end of the array. If no value (or undef) is specified, it will look for the first item that is not defined.

clear() - Empties the array (i.e. length becomes 0). You may pass a 1 to this method to set each element of the array to undef rather than truly empty it.

compact() - Removes undefined elements from the array.

count(?val?) - Returns the number of instances of val within the array. If val is not specified (or is undef), the method will return the number of undefined values within the array.

delete(list) - Deletes all items within list from the array that match. This method will crash if list is not defined. If your goal is to delete undefined values from your object, use the compact() method instead.

delete_at(index, ?index?) - Deletes the item at the specified index. If a second index is specified, a range of items is deleted. You may use -1 or the string end to refer to the last element of the array.

duplicates - Returns a list of N-1 elements for each element N in the set. For example, if you have set "X X Y Y Y", this method would return a the list "X Y Y".

fill(val,?start?,?length?) - Sets the selected elements of the array (which may be the entire array) to val. The default value for start is 0. If length is not specified the entire array, however long it may be at the time of the call, will be filled. Alternatively, a quoted integer range may be used.

e.g. $sao->fill(x,3-5);

The array length/size may not be expanded with this call - it is only meant to fill in already-existing elements.

first() - Returns the first element of the array (or undef).

flatten() - Causes a one-dimensional flattening of the array, recursively. That is, for every element that is an array (or hash, or a ref to either an array or hash), extract its elements into the array.

e.g. my $sa = Set::Array->new([1,3,2],{one=>a,two=>b},x,y,z);

$sao->flatten->join(,)->print; # prints "1,3,2,one,a,two,b,x,y,z"

foreach(sub ref) - Iterates over an array, executing the subroutine for each element in the array. If you wish to modify or otherwise act directly on the contents of the array, use $_ within your sub reference.

e.g. To increment all elements in the array by one...

$sao->foreach(sub{ ++$_ });

get - Alias for the indices() method.

index(val) - Returns the index of the first element of the array object that contains val. Returns undef if no value is found.

Note that there is no dereferencing here so if youre looking for an item nested within a ref, use the flatten method first.

indices(val1,?val2?, ?val...?) - Returns an array consisting of the elements at the specified indices or undef if the element is out of range.

A range may also be used. It must be a quoted string in 0..3 format.

join(?char?) - Joins the individual elements of the list into a single string with the elements separated by the value of char. Useful in conjunction with the print() method. If no character is specified, then char defaults to a comma.

e.g. $sao->join(-)->print;

last() - Returns the last element of the array (or undef).

length() - Returns the number of elements within the array.

max() - Returns the maximum value of an array. No effort is made to check for non-numeric data.

pack(template) - Packs the contents of the array into a string (in scalar context) or a single array element (in object or void context).

pop() - Removes the last element from the array. Returns the popped element.

print(?1?) - Prints the contents of the array. If a 1 is provided as an argument, the output will automatically be terminated with a newline.

This also doubles as a contents method, if you just want to make a copy of the array, e.g. my @copy = $sao->print;

Can be called in void or list context, e.g.

$sao->print(); # or... print "Contents of array are: ", $sao->print();

push(list) - Adds list to the end of the array, where list is either a scalar value or a list. Returns an array or array reference in list or scalar context, respectively. Note that it does not return the length in scalar context. Use the length method for that.

reverse() - Reverses the order of the contents of the array.

rindex(val) - Similar to the index() method, except that it returns the index of the last val found within the array.

set(index,value) - Sets the element at index to value, replacing whatever may have already been there.

shift() - Shifts the first element of the array and returns the shifted element.

sort(?coderef?) - Sorts the contents of the array in alphabetical order, or in the order specified by the optional coderef. Use your standard $a and $b variables within your calling program, e.g:

my $sao = Set::Array->new( { name => Berger, salary => 20000 }, { name => Berger, salary => 15000 }, { name => Vera, salary => 25000 }, );
my $subref = sub{ $b->{name} cmp $a->{name} || $b->{salary} $a->{salary} };
$sao14->sort($subref)->flatten->join->print(1);

splice(?offset?,?length?,?list?) - Splice the array starting at position offset up to length elements, and replace them with list. If no list is provided, all elements are deleted. If length is omitted, everything from offset onward is removed.

Returns an array or array ref in list or scalar context, respectively. This method always modifies the object, regardless of context. If your goal was to grab a range of values without modifying the object, use the indices method instead.

unique() - Removes/returns non-unique elements from the list.

unshift(list) - Prepends a scalar or list to array. Note that this method returns an array or array reference in list or scalar context, respectively. It does not return the length of the array in scalar context. Use the length method for that.

ODDBALL METHODS

as_hash() - Returns a hash based on the current array, with each even numbered element (including 0) serving as the key, and each odd element serving as the value. This can be switched by using the key_order option and setting it to odd, in which case the even values serve as the values, and the odd elements serve as the keys. The default is even.

Of course, if you dont care about insertion order, you could just as well do something like, $sao-reverse->as_hash;>

Carp::croaks if the array contains an odd number of elements. This method does not actually modify the object itself in any way. It just returns a plain hash in list context or a hash reference in scalar context. The reference is not blessed, therefore if this method is called as part of a chain, it must be the last method called.

impose(?append/prepend?,string) - Appends or prepends the specified string to each element in the array. Specify the method by using either the keyword append or prepend. The default is append.

randomize() - Randomizes the order of the elements within the array.

rotate(direction) - Moves the last item of the list to the front and shifts all other elements one to the right, or vice-versa, depending on what you pass as the direction - ftol (first to last) or ltof (last to first). The default is ltof.

e.g. my $sao = Set::Array->new(1,2,3);

$sao->rotate(); # order is now 3,1,2

$sao->rotate(ftol); # order is back to 1,2,3

<<less
Download (0.023MB)
Added: 2007-07-23 License: Perl Artistic License Price:
823 downloads
Set CD-ROM Speed 1.1.6

Set CD-ROM Speed 1.1.6


Set CD-ROM Speed is written in Kommander as a helpful application to set CD-ROM and DVD-ROM drive speed more>> Set CD-ROM Speed 1.1.6 is written in Kommander as a helpful application to set CD-ROM and DVD-ROM drive speed. Since the issues mentioned here apply to CD-ROM and DVD-ROM drives as well as to recorders for these types of media, in this document the name 'CD-ROM drive' will be used to refer to all of these drive types.

Major Features:

  1. Fast CD-ROM drives have one big disadvantage over older and slower models. In order to be able to support high data transfer speeds, the CD-ROM disk must spin very quickly in the disk drive, which results in a lot of noise. This loud humming can make listening to MP3 or OGG music from CD-ROMs a very unpleasant experience and is very annoying at best for other tasks which don't require the CD-ROM to work at full speed.
  2. Using set-cd-rom-speed, you can decrease the drive's speed and thus reduce the annoying noise. The GUI allows choosing three predefined speeds suitable for different tasks and custom speeds provided by the user. The list of available CD-ROM drives is generated based on information from /etc/fstab. This works even if you use supermount-ng or subfs for mounting the CD-ROMs. The program supports multiple languages and several translations are available. It also integrates with KDE by adding an item which allows setting drive speed to the context menu of CD-ROM and DVD-ROM drive icons displayed on the desktop.
Enhancements:
  • Added Czech translation (thanks to Jozef Riha)
  • Fixes in Slovak translation (thanks to Jozef Riha)
  • Two variants of Brazilian Portuguese translation merged into one (thanks to Dherik Barison)

<<less
Added: 2006-10-05 License: GPL Price: FREE
1 downloads
Stratagus 2.2.3

Stratagus 2.2.3


Stratagus is a free cross-platform real-time strategy gaming engine. more>>
Stratagus is a free cross-platform real-time strategy gaming engine. Stratagus includes support for playing over the internet/LAN, or playing a computer opponent.

The engine is configurable and can be used to create games with a wide-range of features specific to your needs. See the data sets page for a list of current games using the stratagus engine.

<<less
Download (0.79MB)
Added: 2007-03-04 License: GPL (GNU General Public License) Price:
974 downloads
Xystray 0.9beta

Xystray 0.9beta


Xystray is a simple implementation of the freedesktop.org systray specification. more>>
Xystray is a simple implementation of the freedesktop.org systray specification (a.k.a. notification area) for the X Window system.

It is meant for use in simple desktop environments which do not provide such facility by default, such as FVWM. Xystray project may also run under GNOME or KDE if the default tray program is disabled.

Installation

Is very simple. Just download, untar, make and copy xystray where you like (/usr/X11/bin, ~/bin/ etc.). Then make your window manager start it automatically when you start your session.

Command line options

-iconmax n

Sets xystray to contain maximum of n arranged in one row or column depending on -vertical option. It is a synonym for -iconcols n -iconrows 1.

-iconrows n

Sets the number of rows to keep icons (default: 2).

-iconcols n

Sets the number of columns to keep icons (default 4).

-iconpadding n

Sets the spacing around icons (default: 0).

-iconsize n

Sets the size of each icon. The default value is 22 pixels. It is not recomended to change it.

-vertical

Now it is useful only with -iconmax option. When used both, Xystray form its window a single column of icons.

Since Xystray uses Xt Toolkit it also accepts generic options like -bg or -geometry.
<<less
Download (0.012MB)
Added: 2006-02-01 License: GPL (GNU General Public License) Price:
1360 downloads
Set::IntSpan::Fast 0.0.5

Set::IntSpan::Fast 0.0.5


Set::IntSpan::Fast is a Perl module for fast handling of sets containing integer spans. more>>
Set::IntSpan::Fast is a Perl module for fast handling of sets containing integer spans.

SYNOPSIS

use Set::IntSpan::Fast;

my $set = Set::IntSpan::Fast->new();
$set->add(1, 3, 5, 7, 9);
$set->add_range(100, 1_000_000);
print $set->as_string(), "n"; # prints 1,3,5,7,9,100-1000000

The Set::IntSpan module represents sets of integers as a number of inclusive ranges, for example 1-10,19-23,45-48. Because many of its operations involve linear searches of the list of ranges its overall performance tends to be proportional to the number of distinct ranges. This is fine for small sets but suffers compared to other possible set representations (bit vectors, hash keys) when the number of ranges grows large.

This module also represents sets as ranges of values but stores those ranges in order and uses a binary search for many internal operations so that overall performance tends towards O log N where N is the number of ranges.

The internal representation used by this module is extremely simple: a set is represented as a list of integers. Integers in even numbered positions (0, 2, 4 etc) represent the start of a run of numbers while those in odd numbered positions represent the ends of runs. As an example the set (1, 3-7, 9, 11, 12) would be represented internally as (1, 2, 3, 8, 11, 13).

Sets may be infinite - assuming youre prepared to accept that infinity is actually no more than a fairly large integer. Specifically the constants Set::IntSpan::Fast::NEGATIVE_INFINITY and Set::IntSpan::Fast::POSITIVE_INFINITY are defined to be -(2^31-1) and (2^31-2) respectively. To create an infinite set invert an empty one:

my $inf = Set::IntSpan::Fast->new()->complement();

Sets need only be bounded in one direction - for example this is the set of all positive integers (assuming you accept the slightly feeble definition of infinity were using):

my $pos_int = Set::IntSpan::Fast->new();
$pos_int->add_range(1, $pos_int->POSITIVE_INFINITY);

<<less
Download (0.10MB)
Added: 2007-01-24 License: Perl Artistic License Price:
1003 downloads
Set::IntSpan::Island 0.03

Set::IntSpan::Island 0.03


Set::IntSpan::Island is a Perl extension for Set::IntSpan to handle islands and covers. more>>
Set::IntSpan::Island is a Perl extension for Set::IntSpan to handle islands and covers.

SYNOPSIS

use Set::IntSpan::Island

# inherits normal behaviour from Set::IntSpan
$set = Set::IntSpan::Island->new( $set_spec );
# special two-value input creates a range a-b
$set = Set::IntSpan::Island->new( $a,$b );

# equivalent to $set->cardinality($another_set)->size;
if ($set->overlap( $another_set )) { ... }

# negative if overlap, positive if no overlap
$distance = $set->distance( $another_set );

# remove islands shorter than $minlength
$set = $set->remove_short( $minlength );

# fill holes up to $maxholesize
$set = $set->fill( $maxholesize );

# return a set composed of islands of $set that overlap $another_set
$set = $set->find_island( $another_set );

# return a set comopsed of the nearest non-overlapping island(s) to $another_set
$set = $set->nearest_island( $another_set );

# construct a list of covers by exhaustively intersecting all sets
@covers = Set::IntSpan::Island->extract_cover( { id1=>$set1, id2=>set2, ... } );
for $cover (@covers) {
($coverset,@ids) = ($cover->[0], @{$cover->[1]});
print "cover",$coverset->run_list,"contains sets",join(",",@ids);
}

This module extends the Set::IntSpan module by Steve McDougall. It implementing methods that are specific to islands and covers. Set::IntSpan::Island inherits from Set::IntSpan.

Terminology

An integer set, as represented by Set::IntSpan, is a collection of islands (or spans) on the integer line

...-----xxxx----xxxxxxxx---xxxxxxxx---xx---x----....

Islands are disjoint and contiguous, by definition, and may be represented by their own Set::IntSpan object. Regions not in the set that fall between adjacent spans are termed holes. For example, the integer set above is composed of 5 islands and 4 holes. The two infinite regions on either side of the set are not counted as holes within the context of this module.

METHODS

$set = Set::IntSpan::Island->new( $set_spec )

Constructs a set using the set specification as supported by Set::IntSpan.

$set = Set::IntSpan::Island->new( $a, $b )

Extension to Set::IntSpan new method, this double-argument version creates a set formed by the range a-b. This is equivalent to

$set = Set::IntSpan::Island->new("$a-$b")

but permits initialization from a list instead of a string.

$set_copy = $set->duplicate()

Creates a copy of $set.

$overlap_amount = $set->overlap( $another_set );

Returns the size of intersection of two sets. Equivalent to

$set->intersect( $another_set )->size;

$d = $set->distance( $another_set )

Returns the distance between sets, measured as follows. If the sets overlap, then the distance is negative and given by

$d = - $set->overlap( $another_set )

If the sets do not overlap, $d is positive and given by the distance on the integer line between the two closest islands of the sets.

$d = $set->sets()

Returns all spans in $set as Set::IntSpan::Island objects. This method overrides the sets method in Set::IntSpan in order to return sets as Set::IntSpan::Island objects.

$set = $set->excise( $minlength )

Removes all islands within $set smaller than $minlength.

$set = $set->fill( $maxlength )

Fills in all holes in $set smaller than $maxlength.

$set = $set->find_islands( $integer )

Returns a set containing the island in $set containing $integer. If $integer is not in $set, an empty set is returned.

$set = $set->find_islands( $another_set )

Returns a set containing all islands in $set intersecting $another_set. If $set and $another_set have an empty intersection, an empty set is returned.

$set = $set->nearest_island( $integer )

Returns the nearest island(s) in $set that contains, but does not overlap with, $integer. If $integer lies exactly between two islands, then the returned set contains these two islands.

$set = $set->nearest_island( $another_set );

Returns the nearest island(s) in $set that intersects, but does not overlap with, $another_set. If $another_set lies exactly between two islands, then the returned set contains these two islands.

$cover_data = Set::IntSpan::Island->extract_covers( $set_hash_ref )

Given a $set_hash reference

{ id1=>$set1, id2=>$set2, ..., idn=>$setn}

where $setj is a finite Set::IntSpan::Island object and idj is a unique key, extract_covers performs an exhaustive intersection of all sets and returns a list of all covers and set memberships. For example, given the id/runlist combination

a 10-15
b 12
c 14-20
d 25

The covers are

10-11 a
12 a b
13 a
14-15 a c
16-20 c
21-24 -
25 d

The cover data is returned as an array reference and its structure is

[ [ $cover_set1, [ id11, id12, id13, ... ] ],
[ $cover_set2, [ id21, id22, id23, ... ] ],
...
]

If a cover contains no elements, then its entry is

[ $cover_set, [ ] ]

$island = $set->num_islands

Returns the number of islands in the set.

$island = $set->at_island( $island_index )

Returns the island indexed by $island_index. Islands are 0-indexed. For a set with N islands, the first island (ordered left-to-right) has index 0 and the last island has index N-1.

If $island_index is negative, counting is done back from the last island (c.f. negative indexes of Perl arrays).

$island = $set->first_island

Returns the first island of the set as a Set::IntSpan::Island object. As a side-effect, sets the iterator to the first island.

If the set is empty, returns undef.

$island = $set->last_island

Returns the last island of the set as a Set::IntSpan::Island object. As a side-effect, sets the iterator to the last island.
If the set is empty, returns undef.

$island = $set->next_island

Advances the iterator forward by one island, and returns the next island. If the iterator is undefined (e.g. not previously set by first()), the first island is returned.
Returns undef if the set is empty or if no more islands are available.

$island = $set->prev_island

Reverses the iterator backward by one island, and returns the previous island. If the iterator is undefined (e.g. not previously set by last()), the last island is returned.

Returns undef if the set is empty or if no more islands are available.

$island = $set->current_island

Returns the island at the current iterator position.

Returns undef if the set is empty or if the iterator is not defined.

<<less
Download (0.009MB)
Added: 2007-07-23 License: Perl Artistic License Price:
824 downloads
Secleted [ 0 ] software to compare
  • Page: 1 of 5
  • 1
  • 2
  • 3
  • 4
  • 5