r59839 - in /branches/upstream/libset-intspan-perl/current: Changes IntSpan.pm META.yml README t/index.t
ansgar-guest at users.alioth.debian.org
ansgar-guest at users.alioth.debian.org
Sun Jun 27 07:00:04 UTC 2010
Author: ansgar-guest
Date: Sun Jun 27 06:59:16 2010
New Revision: 59839
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=59839
Log:
[svn-upgrade] new version libset-intspan-perl (1.14)
Modified:
branches/upstream/libset-intspan-perl/current/Changes
branches/upstream/libset-intspan-perl/current/IntSpan.pm
branches/upstream/libset-intspan-perl/current/META.yml
branches/upstream/libset-intspan-perl/current/README
branches/upstream/libset-intspan-perl/current/t/index.t
Modified: branches/upstream/libset-intspan-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libset-intspan-perl/current/Changes?rev=59839&op=diff
==============================================================================
--- branches/upstream/libset-intspan-perl/current/Changes (original)
+++ branches/upstream/libset-intspan-perl/current/Changes Sun Jun 27 06:59:16 2010
@@ -1,4 +1,7 @@
-jRevision history for Perl extension Set::IntSpan
+Revision history for Perl extension Set::IntSpan
+
+1.14 2010 Jun 22
+ - added ord() method
1.13 2007 Oct 27
- recoded member(), insert(), and remove() to use a binary search
Modified: branches/upstream/libset-intspan-perl/current/IntSpan.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libset-intspan-perl/current/IntSpan.pm?rev=59839&op=diff
==============================================================================
--- branches/upstream/libset-intspan-perl/current/IntSpan.pm (original)
+++ branches/upstream/libset-intspan-perl/current/IntSpan.pm Sun Jun 27 06:59:16 2010
@@ -6,7 +6,7 @@
use base qw(Exporter);
use Carp;
-our $VERSION = '1.13';
+our $VERSION = '1.14';
our @EXPORT_OK = qw(grep_set map_set grep_spans map_spans);
use overload
@@ -1334,7 +1334,6 @@
$i < 0 ? $set->_at_neg($i) : $set->_at_pos($i)
}
-
sub _at_pos
{
my($set, $i) = @_;
@@ -1381,6 +1380,38 @@
@edges ? $edges[0] + $i : undef
}
+
+sub ord
+{
+ my($set, $n) = @_;
+
+ $set->{negInf} and
+ croak "Set::IntSpan::ord: negative infinite set\n";
+
+ defined $n or return undef;
+
+ my $i = 0;
+ my @edges = @{$set->{edges}};
+
+ while (@edges)
+ {
+ my($lower, $upper) = splice(@edges, 0, 2);
+
+ $n <= $lower and return undef;
+
+ if (defined $upper and $upper < $n)
+ {
+ $i += $upper - $lower;
+ next;
+ }
+
+ return $i + $n - $lower - 1;
+ }
+
+ undef
+}
+
+
sub slice
{
@@ -1612,6 +1643,7 @@
$n = $set->at($i);
$slice = $set->slice($from, $to);
+ $i = $set->ord($n);
=head2 Operator overloads
@@ -2278,6 +2310,14 @@
=back
+=item I<$i> = I<$set>->C<ord>($n)
+
+The inverse of C<at>.
+
+Returns the index I<$i> of the integer I<$n> in I<$set>,
+or C<undef> if I<$n> if not an element of I<$set>.
+
+Dies if I<$set> is C<neg_inf>.
=back
@@ -2473,6 +2513,10 @@
(F) C<slice> was called with I<$from> negative on a positive infinite set.
+=item C<Set::IntSpan::ord: negative infinite set>
+
+(F) C<ord> was called on a negative infinite set.
+
=item Out of memory!
(X) C<elements> I<$set> can generate an "Out of memory!"
@@ -2608,7 +2652,7 @@
=head1 COPYRIGHT
-Copyright (c) 1996-2007 by Steven McDougall. This module is free
+Copyright (c) 1996-2010 by Steven McDougall. This module is free
software; you can redistribute it and/or modify it under the same
terms as Perl itself.
Modified: branches/upstream/libset-intspan-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libset-intspan-perl/current/META.yml?rev=59839&op=diff
==============================================================================
--- branches/upstream/libset-intspan-perl/current/META.yml (original)
+++ branches/upstream/libset-intspan-perl/current/META.yml Sun Jun 27 06:59:16 2010
@@ -1,13 +1,21 @@
--- #YAML:1.0
-name: Set-IntSpan
-version: 1.13
-abstract: Manages sets of integers, newsrc style
-license: ~
-generated_by: ExtUtils::MakeMaker version 6.32
-distribution_type: module
-requires:
-meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.2.html
- version: 1.2
+name: Set-IntSpan
+version: 1.14
+abstract: Manages sets of integers, newsrc style
author:
- Steven McDougall (swmcd at world.std.com)
+license: unknown
+distribution_type: module
+configure_requires:
+ ExtUtils::MakeMaker: 0
+build_requires:
+ ExtUtils::MakeMaker: 0
+requires: {}
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version 6.56
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
Modified: branches/upstream/libset-intspan-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libset-intspan-perl/current/README?rev=59839&op=diff
==============================================================================
--- branches/upstream/libset-intspan-perl/current/README (original)
+++ branches/upstream/libset-intspan-perl/current/README Sun Jun 27 06:59:16 2010
@@ -27,7 +27,7 @@
COPYRIGHT
-Copyright (c) 1996-2007 by Steven McDougall. This module is free
+Copyright (c) 1996-2010 by Steven McDougall. This module is free
software; you can redistribute it and/or modify it under the same
terms as Perl itself.
Modified: branches/upstream/libset-intspan-perl/current/t/index.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libset-intspan-perl/current/t/index.t?rev=59839&op=diff
==============================================================================
--- branches/upstream/libset-intspan-perl/current/t/index.t (original)
+++ branches/upstream/libset-intspan-perl/current/t/index.t Sun Jun 27 06:59:16 2010
@@ -22,8 +22,8 @@
(
[ "(-0", 42, "<die>" ],
[ "0-)", -42, "<die>" ],
-)
-;
+);
+
my @At_test =
(
[ "-" , 0, undef ],
@@ -376,7 +376,7 @@
{
my($run_list, $i) = @$test;
- eval { Set::IntSpan->net($run_list)->at($i) };
+ eval { Set::IntSpan->new($run_list)->at($i) };
$@ or Not; OK("at", $test);
}
More information about the Pkg-perl-cvs-commits
mailing list