summaryrefslogtreecommitdiff
path: root/fml/lib/File/Sequence.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-11-20 06:59:00 +0000
committerfukachan <fukachan>2001-11-20 06:59:00 +0000
commit773026b2df55ca5a76779ca4e240ebed71bbfaac (patch)
tree96dddaab33d18ad000a411382fcb0e4d17d59d7b /fml/lib/File/Sequence.pm
parent4c7018e5a6470e53388a2daa1e6094340e8299c4 (diff)
downloadfml8-773026b2df55ca5a76779ca4e240ebed71bbfaac.tar.gz
fml8-773026b2df55ca5a76779ca4e240ebed71bbfaac.tar.bz2
fml8-773026b2df55ca5a76779ca4e240ebed71bbfaac.zip
implement search_max_id() in hash key
Diffstat (limited to 'fml/lib/File/Sequence.pm')
-rw-r--r--fml/lib/File/Sequence.pm41
1 files changed, 40 insertions, 1 deletions
diff --git a/fml/lib/File/Sequence.pm b/fml/lib/File/Sequence.pm
index 1a5261bc..f252edc4 100644
--- a/fml/lib/File/Sequence.pm
+++ b/fml/lib/File/Sequence.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Sequence.pm,v 1.8 2001/05/27 14:27:55 fukachan Exp $
+# $FML: Sequence.pm,v 1.9 2001/10/17 03:05:58 fukachan Exp $
#
package File::Sequence;
@@ -186,6 +186,45 @@ sub get_id
}
+=head2 search_max_id($args)
+
+To search max_id in hash key,
+
+ $self->search_max_id( { hash => \%hash_table });
+
+=cut
+
+
+# Descriptions: search max id number
+# Arguments: $self $args
+# Side Effects: none
+# Return Value: number
+sub search_max_id
+{
+ my ($self, $args) = @_;
+ my ($pebot, $k, $v);
+ my $unit = 50;
+
+ if (defined $args->{ hash }) {
+ my $hash = $args->{ hash };
+ ($pebot, $v) = each %$hash;
+
+ PEBOT_SEARCH:
+ while (1) {
+ last PEBOT_SEARCH unless defined $hash->{ $pebot + $unit };
+ $pebot += $unit;
+ }
+
+ # increment by 1.
+ do {
+ $pebot++;
+ } while (defined $hash->{ $pebot + 1 });
+
+ return $pebot;
+ }
+}
+
+
=head1 AUTHOR
Ken'ichi Fukamachi