line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CAE::Nastran::Nasmod::Entity; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
28
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
133
|
|
4
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
111
|
|
5
|
4
|
|
|
4
|
|
19
|
use vars qw($VERSION $DATE); |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
5091
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$VERSION = '0.26'; |
8
|
|
|
|
|
|
|
$DATE = 'Fri Apr 25 13:17:31 2014'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new |
11
|
|
|
|
|
|
|
{ |
12
|
116
|
|
|
116
|
1
|
278
|
my $this = shift; |
13
|
116
|
|
33
|
|
|
474
|
my $class = ref($this) || $this; |
14
|
116
|
|
|
|
|
166
|
my $self={}; |
15
|
|
|
|
|
|
|
|
16
|
116
|
|
|
|
|
474
|
$self = |
17
|
|
|
|
|
|
|
{ |
18
|
|
|
|
|
|
|
"content" => [], |
19
|
|
|
|
|
|
|
"comment" => [], |
20
|
|
|
|
|
|
|
}; |
21
|
|
|
|
|
|
|
|
22
|
116
|
|
|
|
|
421
|
bless ($self, $class); |
23
|
116
|
|
|
|
|
317
|
return $self; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
#--------------------- |
27
|
|
|
|
|
|
|
# adds a line to the comment |
28
|
|
|
|
|
|
|
#--------------------- |
29
|
|
|
|
|
|
|
sub addComment |
30
|
|
|
|
|
|
|
{ |
31
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
32
|
0
|
|
|
|
|
0
|
my $refa_comment = shift; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
0
|
push (@{$self->{'comment'}}, @$refa_comment); |
|
0
|
|
|
|
|
0
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
#--------------------- |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#--------------------- |
39
|
|
|
|
|
|
|
# sets the comment to a certain value |
40
|
|
|
|
|
|
|
# setComment(\@commentlines) |
41
|
|
|
|
|
|
|
# setComment(\@commentlines, $commentline, \@anotherText, ...) |
42
|
|
|
|
|
|
|
#--------------------- |
43
|
|
|
|
|
|
|
sub setComment |
44
|
|
|
|
|
|
|
{ |
45
|
113
|
|
|
113
|
1
|
128
|
my $self = shift; |
46
|
|
|
|
|
|
|
|
47
|
113
|
|
|
|
|
116
|
undef(@{$self->{'comment'}}); |
|
113
|
|
|
|
|
311
|
|
48
|
|
|
|
|
|
|
|
49
|
113
|
|
|
|
|
446
|
foreach (@_) |
50
|
|
|
|
|
|
|
{ |
51
|
36
|
50
|
|
|
|
68
|
if(ref($_) =~ /array/) |
52
|
|
|
|
|
|
|
{ |
53
|
0
|
|
|
|
|
0
|
foreach my $line (@$_) |
54
|
|
|
|
|
|
|
{ |
55
|
0
|
|
|
|
|
0
|
push (@{$self->{'comment'}}, $line); |
|
0
|
|
|
|
|
0
|
|
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
else |
59
|
|
|
|
|
|
|
{ |
60
|
36
|
|
|
|
|
41
|
push (@{$self->{'comment'}}, $_); |
|
36
|
|
|
|
|
356
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
#--------------------- |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
#--------------------- |
67
|
|
|
|
|
|
|
# sets a certain column to a certain value |
68
|
|
|
|
|
|
|
# setCol(, ) |
69
|
|
|
|
|
|
|
#--------------------- |
70
|
|
|
|
|
|
|
sub setCol |
71
|
|
|
|
|
|
|
{ |
72
|
735
|
|
|
735
|
1
|
1351
|
my $self = shift; |
73
|
735
|
|
|
|
|
816
|
my $col = shift; |
74
|
735
|
|
|
|
|
1131
|
my $string = shift; |
75
|
|
|
|
|
|
|
|
76
|
735
|
|
|
|
|
4134
|
$self->{content}->[$col-1] = $string; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
#--------------------- |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
#--------------------- |
81
|
|
|
|
|
|
|
# get a col |
82
|
|
|
|
|
|
|
# getCol() |
83
|
|
|
|
|
|
|
# return: |
84
|
|
|
|
|
|
|
#--------------------- |
85
|
|
|
|
|
|
|
sub getCol |
86
|
|
|
|
|
|
|
{ |
87
|
14
|
|
|
14
|
1
|
25
|
my $self = shift; |
88
|
14
|
|
|
|
|
45
|
my $col = shift; |
89
|
|
|
|
|
|
|
|
90
|
14
|
50
|
|
|
|
37
|
if ($self->{content}->[$col-1]) |
91
|
0
|
|
|
|
|
0
|
{ |
92
|
14
|
|
|
|
|
58
|
return $self->{content}->[$col-1]; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
else {return""}; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
#--------------------- |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
#--------------------- |
99
|
|
|
|
|
|
|
# get all data |
100
|
|
|
|
|
|
|
# getRow() |
101
|
|
|
|
|
|
|
# return: @ |
102
|
|
|
|
|
|
|
#--------------------- |
103
|
|
|
|
|
|
|
sub getRow |
104
|
|
|
|
|
|
|
{ |
105
|
1
|
|
|
1
|
1
|
5
|
my $self = shift; |
106
|
1
|
|
|
|
|
1
|
return @{$self->{'content'}} |
|
1
|
|
|
|
|
5
|
|
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
#--------------------- |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
#--------------------- |
111
|
|
|
|
|
|
|
# match an entity to a pattern |
112
|
|
|
|
|
|
|
# es muessen alle filter gefunden werden, sonst undef |
113
|
|
|
|
|
|
|
# falls es fuer einen row einen ganzen array an moeglichkeiten gibt gilt der filter als bestanden, wenn eine moeglichkeit davon matcht |
114
|
|
|
|
|
|
|
#--------------------- |
115
|
|
|
|
|
|
|
sub match |
116
|
|
|
|
|
|
|
{ |
117
|
185
|
|
|
185
|
1
|
282
|
my $self = shift; |
118
|
185
|
|
|
|
|
200
|
my $refa_filter = shift; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
# $self->print(); |
121
|
|
|
|
|
|
|
# print "FILTER: ".join("|", @$refa_filter)."\n"; |
122
|
|
|
|
|
|
|
# foreach my $column (1..15) |
123
|
|
|
|
|
|
|
# { |
124
|
|
|
|
|
|
|
# print "COLUMN $column: ".$self->getCol($column)."\n"; |
125
|
|
|
|
|
|
|
# } |
126
|
|
|
|
|
|
|
|
127
|
185
|
|
|
|
|
192
|
my @colFilterResults; |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
# falls ein filter fuer dem Kommentar gesetzt wurde, wir der vollstaendige kommentar untersucht |
130
|
|
|
|
|
|
|
# falls der filter dort greift wird auf "true" gesetzt. |
131
|
185
|
100
|
|
|
|
527
|
if ($$refa_filter[0]) |
132
|
|
|
|
|
|
|
{ |
133
|
32
|
100
|
|
|
|
93
|
if(!(ref($$refa_filter[0]) =~ m/array/i)) |
134
|
|
|
|
|
|
|
{ |
135
|
16
|
|
|
|
|
22
|
$colFilterResults[0] = "false"; |
136
|
16
|
|
|
|
|
18
|
foreach my $commentzeile (@{$self->{'comment'}}) |
|
16
|
|
|
|
|
38
|
|
137
|
|
|
|
|
|
|
{ |
138
|
|
|
|
|
|
|
# print "GREIFT COMMENTFILTER $$refa_filter[0] AN ZEILE $commentzeile\n"; |
139
|
5
|
100
|
|
|
|
37
|
if ( $commentzeile =~ m/$$refa_filter[0]/ ) |
140
|
|
|
|
|
|
|
{ |
141
|
|
|
|
|
|
|
# print "JA\n"; |
142
|
3
|
|
|
|
|
10
|
$colFilterResults[0] = "true"; |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
else |
145
|
|
|
|
|
|
|
{ |
146
|
|
|
|
|
|
|
# print "NEIN\n"; |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
else |
151
|
|
|
|
|
|
|
{ |
152
|
16
|
|
|
|
|
22
|
$colFilterResults[0] = "false"; |
153
|
16
|
|
|
|
|
14
|
foreach my $vergleichsString (@{${$refa_filter}[0]}) |
|
16
|
|
|
|
|
15
|
|
|
16
|
|
|
|
|
31
|
|
154
|
|
|
|
|
|
|
{ |
155
|
32
|
|
|
|
|
33
|
foreach my $commentzeile (@{$self->{'comment'}}) |
|
32
|
|
|
|
|
61
|
|
156
|
|
|
|
|
|
|
{ |
157
|
|
|
|
|
|
|
# print "TEST $vergleichsString on comment '" . $commentzeile ."'\n"; |
158
|
10
|
100
|
|
|
|
677
|
if ( $commentzeile =~ m/$vergleichsString/ ) |
159
|
|
|
|
|
|
|
{ |
160
|
|
|
|
|
|
|
# print "RESULT IS TRUE\n"; |
161
|
7
|
|
|
|
|
22
|
$colFilterResults[0] = "true"; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
# print "RESULTAFTERCOMMENT: @colFilterResults\n"; |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
# falls der kommentarfilter nicht gefunden wurde, kann hier schon undef zurueckgegeben werden |
171
|
185
|
100
|
|
|
|
374
|
if(grep { $_ eq "false"} @colFilterResults) {return undef;} |
|
32
|
|
|
|
|
98
|
|
|
24
|
|
|
|
|
102
|
|
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
# die filter fuer die spalten |
174
|
161
|
|
|
|
|
582
|
for(my $x=0, my $col=1; $x<=(@$refa_filter); $x++, $col++) |
175
|
|
|
|
|
|
|
{ |
176
|
|
|
|
|
|
|
# wenn es fuer die spalte einen filter gibt |
177
|
401
|
100
|
|
|
|
778
|
if ( $$refa_filter[$col] ) |
178
|
|
|
|
|
|
|
{ |
179
|
|
|
|
|
|
|
# mit 'false' beginnen |
180
|
90
|
|
|
|
|
124
|
$colFilterResults[$col] = "false"; |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
# und es sich dabei nicht um ein ARRAY handelt |
183
|
|
|
|
|
|
|
# print "IST ES EIN ARRAY? " . $$refa_filter[$row] . "||" .ref($$refa_filter[$row]) ."\n"; |
184
|
90
|
100
|
|
|
|
437
|
if(!(ref($$refa_filter[$col]) =~ m/array/i)) |
185
|
|
|
|
|
|
|
{ |
186
|
|
|
|
|
|
|
# wenn der filter dieses rows greift, dann auf 'true' setzen |
187
|
|
|
|
|
|
|
# print "TESTING CONTENT ". $self->{'content'}->[$x] . " on regex /^". $$refa_filter[$col] . "\$/\n"; |
188
|
70
|
100
|
100
|
|
|
504
|
if (($self->{'content'}->[$x]) && ($self->{'content'}->[$x] =~ /^$$refa_filter[$col]$/)) |
189
|
|
|
|
|
|
|
{ |
190
|
|
|
|
|
|
|
# print "RESULT: GOOD\n"; |
191
|
25
|
|
|
|
|
46
|
$colFilterResults[$col] = "true"; |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
# ansonsten kann direkt 'undef' zurueckgegeben werden |
194
|
|
|
|
|
|
|
else |
195
|
|
|
|
|
|
|
{ |
196
|
|
|
|
|
|
|
# print "RESULT: BAD\n"; |
197
|
45
|
|
|
|
|
209
|
return undef; |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
else |
201
|
|
|
|
|
|
|
{ |
202
|
|
|
|
|
|
|
# jeden eintrag im array durchgehen und ueberpruefen ob ein eintrag passt |
203
|
20
|
|
|
|
|
24
|
foreach my $vergleichsString (@{${$refa_filter}[$col]}) |
|
20
|
|
|
|
|
19
|
|
|
20
|
|
|
|
|
42
|
|
204
|
|
|
|
|
|
|
{ |
205
|
|
|
|
|
|
|
# wenn eintrag passt |
206
|
40
|
100
|
100
|
|
|
833
|
if(($self->{'content'}->[$x]) && ( $self->{'content'}->[$x] =~ /^$vergleichsString$/)) |
207
|
|
|
|
|
|
|
{ |
208
|
15
|
|
|
|
|
20
|
$colFilterResults[$col] = "true"; |
209
|
15
|
|
|
|
|
33
|
next; |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
# wenn der filter zur aktuellen spalte 'false' geliefert hat, kann man sich die ueberpruefung evtl. anderer spalten sparen |
215
|
45
|
100
|
|
|
|
159
|
if($colFilterResults[$col] eq "false") |
216
|
|
|
|
|
|
|
{ |
217
|
|
|
|
|
|
|
# print "filter fuer row = 'false'. return undef\n"; |
218
|
5
|
|
|
|
|
23
|
return undef; |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
else |
222
|
|
|
|
|
|
|
{ |
223
|
311
|
|
|
|
|
924
|
next; |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
|
227
|
111
|
100
|
|
|
|
270
|
if(grep { if ($_) {$_ eq "false"} } @colFilterResults) |
|
105
|
50
|
|
|
|
210
|
|
|
39
|
|
|
|
|
146
|
|
228
|
|
|
|
|
|
|
{ |
229
|
|
|
|
|
|
|
# print "Mindestens 1 Filter fuer Entity lieferte 'false' => return undef.\n"; |
230
|
|
|
|
|
|
|
# print "NOMATCH\n"; |
231
|
0
|
|
|
|
|
0
|
return undef; |
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
else |
234
|
|
|
|
|
|
|
{ |
235
|
|
|
|
|
|
|
# print "Alle Filter fuer Entity lieferten 'true' => return true.\n"; |
236
|
111
|
|
|
|
|
505
|
return "true"; |
237
|
|
|
|
|
|
|
# print "MATCH\n"; |
238
|
|
|
|
|
|
|
} |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
#--------------------- |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
#--------------------- |
243
|
|
|
|
|
|
|
# sprint entity |
244
|
|
|
|
|
|
|
#--------------------- |
245
|
|
|
|
|
|
|
sub sprint |
246
|
|
|
|
|
|
|
{ |
247
|
6
|
|
|
6
|
0
|
6
|
my $self = shift; |
248
|
|
|
|
|
|
|
|
249
|
6
|
|
|
|
|
7
|
my $return; |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
# print comment if available |
252
|
6
|
|
|
|
|
7
|
foreach (@{$self->{comment}}) |
|
6
|
|
|
|
|
17
|
|
253
|
|
|
|
|
|
|
{ |
254
|
2
|
50
|
|
|
|
13
|
unless ($_ =~ m/^\$/) {$_ = "\$".$_;} # falls noch kein Kommentarzeichen vorhanden, eines hinzufuegen |
|
0
|
|
|
|
|
0
|
|
255
|
2
|
|
|
|
|
8
|
$return .= $_."\n"; |
256
|
|
|
|
|
|
|
# print $_."\n"; |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
# print content |
261
|
|
|
|
|
|
|
# print "JUPP: ".(1+int((scalar(@{$self->{'content'}}))/10))."\n"; |
262
|
6
|
|
|
|
|
13
|
for (my $zeile=0; $zeile<(1+int((scalar(@{$self->{'content'}}))/10)); $zeile++) |
|
13
|
|
|
|
|
41
|
|
263
|
|
|
|
|
|
|
{ |
264
|
|
|
|
|
|
|
# 10er pack befuellen |
265
|
7
|
|
|
|
|
10
|
my $formatstring; |
266
|
|
|
|
|
|
|
my @ausgabe; |
267
|
7
|
|
100
|
|
|
12
|
for(my $x=(0+$zeile*10); ( ($x<@{$self->{content}}) && ($x<(10+$zeile*10)) ); $x++) |
|
50
|
|
|
|
|
761
|
|
268
|
|
|
|
|
|
|
{ |
269
|
43
|
100
|
|
|
|
45
|
if(defined ${$self->{content}}[$x]) |
|
43
|
|
|
|
|
107
|
|
270
|
|
|
|
|
|
|
{ |
271
|
39
|
|
|
|
|
42
|
push(@ausgabe, ${$self->{content}}[$x]); |
|
39
|
|
|
|
|
83
|
|
272
|
39
|
|
|
|
|
66
|
$formatstring .= "%-8.8s"; |
273
|
|
|
|
|
|
|
} |
274
|
|
|
|
|
|
|
} |
275
|
7
|
|
|
|
|
40
|
$return .= sprintf $formatstring."\n", @ausgabe; |
276
|
|
|
|
|
|
|
} |
277
|
6
|
|
|
|
|
16
|
return $return; |
278
|
|
|
|
|
|
|
} |
279
|
|
|
|
|
|
|
#--------------------- |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
#--------------------- |
282
|
|
|
|
|
|
|
# print entity |
283
|
|
|
|
|
|
|
#--------------------- |
284
|
|
|
|
|
|
|
sub print |
285
|
|
|
|
|
|
|
{ |
286
|
6
|
|
|
6
|
1
|
19
|
my $self = shift; |
287
|
6
|
|
|
|
|
14
|
my $ausgabe = $self->sprint(); |
288
|
6
|
|
|
|
|
129
|
print $ausgabe; |
289
|
|
|
|
|
|
|
} |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
1; |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
__END__ |