-
Notifications
You must be signed in to change notification settings - Fork 0
/
DuplicateChecker.pm
61 lines (50 loc) · 1.48 KB
/
DuplicateChecker.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/perl
##########################################################################
# Table Duplicate Checker
# Copyright (C) 2012 Tomonobu Saito All Rights Reserverd.
package DuplicateChecker;
use strict;
use Carp qw(croak);
use integer;
sub new {
my $pkg = shift;
bless {
table_id => undef,
table_extension_id => undef,
section_number => undef,
version_number => undef,
}, $pkg;
}
sub Set {
my $self = shift;
my $table_id = shift;
my $table_id_extension = shift;
my $section_number = shift;
my $version_number = shift;
$self->{ table_id } = $table_id;
$self->{ table_id_extension } = $table_id_extension;
$self->{ section_number } = $section_number;
$self->{ version_number } = $version_number;
}
sub Equal {
my $self = shift;
my $table_id = shift;
my $table_id_extension = shift;
my $section_number = shift;
return
$self->{ table_id } == $table_id &&
$self->{ table_id_extension } == $table_id_extension &&
$self->{ section_number } == $section_number;
}
sub GetNextVersion {
my $self = shift;
return ($self->{ version_number } + 1) % 32;
}
sub SetVersion {
my $self = shift;
my $version_number = shift;
$self->{ version_number } = $version_number;
}
1;