| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# Copyright (c) 2006 IBM Corporation. |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# All rights reserved. This program and the accompanying materials |
|
5
|
|
|
|
|
|
|
# are made available under the terms of the Eclipse Public License v1.0 |
|
6
|
|
|
|
|
|
|
# which accompanies this distribution, and is available at |
|
7
|
|
|
|
|
|
|
# http://www.eclipse.org/legal/epl-v10.html |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# File: $Source: /var/lib/cvs/ODO/lib/ODO/Graph/Simple.pm,v $ |
|
10
|
|
|
|
|
|
|
# Created by: Stephen Evanchik( evanchik@us.ibm.com ) |
|
11
|
|
|
|
|
|
|
# Created on: 11/21/2006 |
|
12
|
|
|
|
|
|
|
# Revision: $Id: Simple.pm,v 1.2 2009-11-25 17:58:25 ubuntu Exp $ |
|
13
|
|
|
|
|
|
|
# |
|
14
|
|
|
|
|
|
|
# Contributors: |
|
15
|
|
|
|
|
|
|
# IBM Corporation - initial API and implementation |
|
16
|
|
|
|
|
|
|
# |
|
17
|
|
|
|
|
|
|
package ODO::Graph::Simple; |
|
18
|
|
|
|
|
|
|
|
|
19
|
6
|
|
|
6
|
|
110438
|
use strict; |
|
|
6
|
|
|
|
|
13
|
|
|
|
6
|
|
|
|
|
211
|
|
|
20
|
6
|
|
|
6
|
|
33
|
use warnings; |
|
|
6
|
|
|
|
|
10
|
|
|
|
6
|
|
|
|
|
187
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
6
|
|
|
6
|
|
31
|
use base qw/ODO::Graph/; |
|
|
6
|
|
|
|
|
10
|
|
|
|
6
|
|
|
|
|
2595
|
|
|
23
|
6
|
|
|
6
|
|
45
|
use vars qw /$VERSION/; |
|
|
6
|
|
|
|
|
12
|
|
|
|
6
|
|
|
|
|
514
|
|
|
24
|
|
|
|
|
|
|
$VERSION = sprintf "%d.%02d", q$Revision: 1.2 $ =~ /: (\d+)\.(\d+)/; |
|
25
|
6
|
|
|
6
|
|
32
|
use ODO::Exception; |
|
|
6
|
|
|
|
|
12
|
|
|
|
6
|
|
|
|
|
2477
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 NAME |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
ODO::Graph::Simple - Simple graph implementation |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
use ODO::Graph::Simple; |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Create an ODO::Graph::Simple object backed by memory |
|
36
|
|
|
|
|
|
|
my $graph = ODO::Graph::Simple->Memory(); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
This a very simple implementation of ODO's graph inteface (see L) that defers to |
|
41
|
|
|
|
|
|
|
the underlying storage mechanism to execute the caller's request. |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 METHODS |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=over |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=item add( ) |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub add { |
|
52
|
16
|
|
|
16
|
1
|
1167
|
my $self = shift; |
|
53
|
|
|
|
|
|
|
|
|
54
|
16
|
|
|
|
|
28
|
my $statements = $_[0]; |
|
55
|
16
|
50
|
66
|
|
|
227
|
$statements = $self->params_to_array(\@_, 1) |
|
56
|
|
|
|
|
|
|
unless(scalar(@_) == 1 && UNIVERSAL::isa($_[0], 'ARRAY')); |
|
57
|
|
|
|
|
|
|
|
|
58
|
16
|
|
|
|
|
391
|
return $self->{'storage'}->add($statements); |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item remove( ) |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub remove { |
|
67
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
|
68
|
|
|
|
|
|
|
|
|
69
|
1
|
|
|
|
|
3
|
my $statements = $_[0]; |
|
70
|
1
|
50
|
33
|
|
|
15
|
$statements = $self->params_to_array(\@_, 1) |
|
71
|
|
|
|
|
|
|
unless(scalar(@_) == 1 && UNIVERSAL::isa($_[0], 'ARRAY')); |
|
72
|
|
|
|
|
|
|
|
|
73
|
1
|
|
|
|
|
24
|
return $self->{'storage'}->remove($statements); |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item clear( ) |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub clear { |
|
82
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
|
83
|
1
|
|
|
|
|
7
|
return $self->{'storage'}->clear(); |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item size( ) |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub size { |
|
92
|
3
|
|
|
3
|
1
|
10
|
my $self = shift; |
|
93
|
3
|
|
|
|
|
17
|
return $self->{'storage'}->size(); |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item query( ) |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub query { |
|
102
|
130
|
|
|
130
|
1
|
641
|
my $self = shift; |
|
103
|
130
|
|
|
|
|
544
|
return $self->{'storage'}->issue_query(@_); |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item contains( ) |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=cut |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub contains { |
|
112
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
113
|
0
|
|
|
|
|
|
my $results = $self->{'storage'}->issue_query(@_); |
|
114
|
0
|
0
|
|
|
|
|
return (scalar(@{ $results }) > 0) ? 1 : 0; |
|
|
0
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item intersection( ) |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub intersection { |
|
122
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=item union( ) |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=cut |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub union { |
|
130
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
131
|
|
|
|
|
|
|
} |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=back |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
L, L, L, L, L |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Copyright (c) 2006 IBM Corporation. |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
All rights reserved. This program and the accompanying materials |
|
144
|
|
|
|
|
|
|
are made available under the terms of the Eclipse Public License v1.0 |
|
145
|
|
|
|
|
|
|
which accompanies this distribution, and is available at |
|
146
|
|
|
|
|
|
|
http://www.eclipse.org/legal/epl-v10.html |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=cut |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
1; |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
__END__ |