[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GT] SVN Commit r598 - trunk/GT/Indicators/Generic
Author: joao
Date: 2008-04-08 01:48:45 +0200 (Tue, 08 Apr 2008)
New Revision: 598
Added:
trunk/GT/Indicators/Generic/Abs.pm
Log:
Generic indicator, simply returns the absolute value of its first argument.
Added: trunk/GT/Indicators/Generic/Abs.pm
===================================================================
--- trunk/GT/Indicators/Generic/Abs.pm (rev 0)
+++ trunk/GT/Indicators/Generic/Abs.pm 2008-04-07 23:48:45 UTC (rev 598)
@@ -0,0 +1,40 @@
+package GT::Indicators::Generic::Abs;
+
+# Copyright 2008 Jo�Antunes Costa
+# This file is distributed under the terms of the General Public License
+# version 2 or (at your option) any later version.
+
+# Standards-Version: 1.0
+
+use strict;
+use vars qw(@ISA @NAMES);
+
+use GT::Indicators;
+
AT
ISA = qw(GT::Indicators);
+
+
AT
NAMES = ("Abs[#1]");
+
+=head1 NAME
+
+GT::Indicators::Generic::Abs - Return the absolute value of its 1st parameter
+
+=head1 DESCRIPTION
+
+
+
+=cut
+sub initialize {
+ my ($self) = @_;
+}
+
+sub calculate {
+ my ($self, $calc, $i) = @_;
+ my $name = $self->get_name;
+
+ return if ($calc->indicators->is_available($name, $i));
+
+ my $val = $self->{'args'}->get_arg_values($calc, $i, 1);
+ return unless (defined($val));
+ my $res = abs($val);
+ $calc->indicators->set($name, $i, $res);
+}
\ No newline at end of file