[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GT] tweaks for I:G:MaxInPeriod and I:G:MinInPeriod
these patches ensure time period values prior to
time period index zero are not sought.
plus they add the package terminator statement 1;
yell if they interact unfavorably with something.
ras
ps -- the patch indentation is 'odd' because the files need to be
reformatted to the standard gt indent-4 practice. -- ras
gdiff -ubitwB ../svn_repo/GT/Indicators/Generic/MaxInPeriod.pm ../GT/Indicators/Generic/MaxInPeriod.pm
--- ../svn_repo/GT/Indicators/Generic/MaxInPeriod.pm Wed Oct 24 16:17:29 2007
+++ ../GT/Indicators/Generic/MaxInPeriod.pm Sat May 24 12:31:18 2008
@@ -6,6 +6,10 @@
# Standards-Version: 1.0
+# ras hack based on version dated 8jun05
+# plus the patch from mnovoseltsev
AT
swissonline.ch 26oct04
+# $Id: MaxInPeriod.pm,v 1.3 2008/05/02 14:25:23 ras Exp ras $
+
use strict;
use vars qw(@ISA @NAMES @DEFAULT_ARGS);
@@ -144,11 +148,13 @@
if ($arg =~ /^\d+$/) {
$res = $self->{'args'}->get_arg_values($calc, $i, 2);
for (my $n = 1; $n < $arg; $n++) {
+ if ( $i-$n >= 0 ) {
my $val = $self->{'args'}->get_arg_values($calc, $i - $n, 2);
if (defined($val) && defined($res)) {
$res = max($res, $val);
}
}
+ }
} elsif ($arg =~/^\d{4}-\d\d(-\d\d)?( \d\d:\d\d:\d\d)?$/) {
my $n = undef;
if ($calc->prices->has_date($arg)) {
@@ -171,3 +177,5 @@
$calc->indicators->set($name, $i, $res);
}
}
+
+1;
gdiff -ubitwB ../svn_repo/GT/Indicators/Generic/MinInPeriod.pm ../GT/Indicators/Generic/MinInPeriod.pm
--- ../svn_repo/GT/Indicators/Generic/MinInPeriod.pm Wed Oct 24 16:17:29 2007
+++ ../GT/Indicators/Generic/MinInPeriod.pm Tue Jul 1 20:59:36 2008
@@ -6,6 +6,10 @@
# Standards-Version: 1.0
+# ras hack based on version dated 8jun05
+# plus the patch from mnovoseltsev
AT
swissonline.ch 26oct04
+# $Id: MinInPeriod.pm,v 1.4 2008/07/02 03:59:36 ras Exp ras $
+
use strict;
use vars qw(@ISA @NAMES @DEFAULT_ARGS);
@@ -76,11 +80,13 @@
if ($arg =~ /^\d+$/) {
$res = $self->{'args'}->get_arg_values($calc, $i, 2);
for (my $n = 1; $n < $arg; $n++) {
+ if ( $i-$n >= 0 ) {
my $val = $self->{'args'}->get_arg_values($calc, $i - $n, 2);
if (defined($val) && defined($res)) {
$res = min($res, $val);
}
}
+ }
} elsif ($arg =~/^\d{4}-\d\d(-\d\d)?( \d\d:\d\d:\d\d)?$/) {
my $n = undef;
if ($calc->prices->has_date($arg)) {
@@ -171,3 +177,5 @@
}
}
}
+
+1;