GeniusTrader/Graphics/DataSource/Systems.pm untested

filter: Statementstmt 0.0% 0 / 49 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 74 CC 3 SCAR 14.2
CC
3
Cov
0%
get
12.0
new
2.0
is_available
2.0
CRAP 4.1
1 package Finance::GeniusTrader::Graphics::DataSource::Systems;
2  
3 # Copyright 2000-2002 Raphaƫl Hertzog, Fabien Fulhaber
4 # This file is distributed under the terms of the General Public License
5 # version 2 or (at your option) any later version.
6  
7 use strict;
8 use vars qw(@ISA);
9  
10 @ISA = qw(Finance::GeniusTrader::Graphics::DataSource);
11  
12 use Finance::GeniusTrader::Eval;
13 use Finance::GeniusTrader::CacheValues;
14 use Finance::GeniusTrader::Prices;
15 use Finance::GeniusTrader::Graphics::DataSource;
16 use Finance::GeniusTrader::Tools qw(:math);
17 use Finance::GeniusTrader::Tools qw(extract_object_number);
18  
19 =head1 Finance::GeniusTrader::Graphics::DataSource::Systems
20  
21 This datasource is a generic module to handle any information provided by a
22 system.
23  
24 =cut
25  
26 sub new {
27 my $type = shift;
28 my $class = ref($type) || $type;
29 my ($calc, $system) = @_;
30
31 my $self = { 'calc' => $calc, 'system' => $system };
32
33 bless $self, $class;
34  
35 my $first = $system->days_required - 1;
36 my $last = $calc->prices->count - 1;
37
38 $self->set_available_range($first, $last);
39 $self->set_selected_range($self->get_available_range());
40
41 $system->precalculate_interval($calc, $first, $last);
42  
43 return $self;
44 }
45  
46 sub is_available {
47 my ($self, $index) = @_;
48 my $calc = $self->{'calc'};
49 my $system = $self->{'system'};
50
51 return $system->check_dependencies($calc, $index);
52 }
53  
54 sub get {
55 my ($self, $index) = @_;
56 my $calc = $self->{'calc'};
57 my $system = $self->{'system'};
58
59 if ($system->long_signal($calc, $index)) {
60 return 1;
61 } elsif ($system->short_signal($calc, $index)) {
62 return -1;
63 } else {
64 return 0;
65 }
66 }
67  
68 sub update_value_range {
69 my ($self) = @_;
70 }
71  
72 1;