line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: GenericArrayAdapter.pm,v 1.6 2006/06/16 15:20:56 tonyb Exp $ |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Copyright (c) 2002-2005 Cunningham & Cunningham, Inc. |
4
|
|
|
|
|
|
|
# Released under the terms of the GNU General Public License version 2 or later. |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Perl translation by Dave W. Smith |
7
|
|
|
|
|
|
|
# Modified by Tony Byrne |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package Test::C2FIT::GenericArrayAdapter; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
816
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
40
|
|
12
|
1
|
|
|
1
|
|
5
|
use vars qw(@ISA); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
249
|
|
13
|
|
|
|
|
|
|
@ISA = qw(Test::C2FIT::TypeAdapter); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub parse { |
16
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
17
|
0
|
|
|
|
|
|
my ($s) = @_; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
return [ split( /,/, $s ) ]; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub toString { |
23
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
24
|
0
|
|
|
|
|
|
my ($o) = @_; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
return join( ',', @$o ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub equals { |
30
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
31
|
0
|
|
|
|
|
|
my ( $a, $b ) = @_; |
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
return 0 unless ref($a) eq "ARRAY"; |
34
|
0
|
0
|
|
|
|
|
return 0 unless ref($b) eq "ARRAY"; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#DEBUG print "ArrayArrayAdapter::equals ", ref($a), ", ", ref($b), "\n"; |
37
|
0
|
0
|
|
|
|
|
return 0 if scalar @$a != scalar @$b; |
38
|
0
|
|
|
|
|
|
for ( my $i = 0 ; $i < scalar @$a ; ++$i ) { |
39
|
0
|
0
|
|
|
|
|
return 0 if $$a[$i] ne $$b[$i]; |
40
|
|
|
|
|
|
|
} |
41
|
0
|
|
|
|
|
|
return 1; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |