| 1 | package Dallycot::AST::Negation; | ||
| 2 | 29 | our $AUTHORITY = 'cpan:JSMITH'; | |
| 3 | |||
| 4 | # ABSTRACT: Negate a numeric value | ||
| 5 | |||
| 6 | 29 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 29 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 29 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 29 | ▶ | use parent 'Dallycot::AST'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | sub to_string { | ||
| 13 | 0 | ▶ | my ($self) = @_; |
|
Subroutine
to_string: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 14 | |||
| 15 | 0 | return "-" . $self->[0]->to_string; | |
| 16 | } | ||
| 17 | |||
| 18 | sub to_rdf { | ||
| 19 | 0 | ▶ | my($self, $model) = @_; |
|
Subroutine
to_rdf: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 20 | |||
| 21 | 0 | return $model -> apply( | |
| 22 | $model -> meta_uri('loc:negate'), | ||
| 23 | [ $self->[0] ], | ||
| 24 | {} | ||
| 25 | ); | ||
| 26 | # my $bnode = $model -> bnode; | ||
| 27 | # $model -> add_type($bnode, 'loc:Negation'); | ||
| 28 | # $model -> add_expression($self -> [0]); | ||
| 29 | # return $bnode; | ||
| 30 | } | ||
| 31 | |||
| 32 | sub execute { | ||
| 33 | 24 | ▶ | my ( $self, $engine ) = @_; |
|
Subroutine
execute: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 34 | |||
| 35 | return $engine->execute( $self->[0], ['Numeric'] )->then( | ||
| 36 | sub { | ||
| 37 | 24 | ▶ | return $_[0] -> negated; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 38 | } | ||
| 39 | 24 | ); | |
| 40 | } | ||
| 41 | |||
| 42 | 29 | 1; | |