line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dallycot::Value::Boolean; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JSMITH'; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: True or False |
5
|
|
|
|
|
|
|
|
6
|
23
|
|
|
23
|
|
15239
|
use strict; |
|
23
|
|
|
|
|
38
|
|
|
23
|
|
|
|
|
775
|
|
7
|
23
|
|
|
23
|
|
95
|
use warnings; |
|
23
|
|
|
|
|
30
|
|
|
23
|
|
|
|
|
502
|
|
8
|
|
|
|
|
|
|
|
9
|
23
|
|
|
23
|
|
82
|
use utf8; |
|
23
|
|
|
|
|
30
|
|
|
23
|
|
|
|
|
118
|
|
10
|
23
|
|
|
23
|
|
407
|
use parent 'Dallycot::Value::Any'; |
|
23
|
|
|
|
|
27
|
|
|
23
|
|
|
|
|
105
|
|
11
|
|
|
|
|
|
|
|
12
|
23
|
|
|
23
|
|
1174
|
use Promises qw(deferred); |
|
23
|
|
|
|
|
34
|
|
|
23
|
|
|
|
|
128
|
|
13
|
|
|
|
|
|
|
|
14
|
23
|
|
|
23
|
|
5010
|
use Readonly; |
|
23
|
|
|
|
|
37
|
|
|
23
|
|
|
|
|
11560
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Readonly my $TRUE => bless [ !!1 ] => __PACKAGE__; |
17
|
|
|
|
|
|
|
Readonly my $FALSE => bless [ !!0 ] => __PACKAGE__; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub new { |
20
|
0
|
|
|
0
|
0
|
|
my ( $class, $f ) = @_; |
21
|
|
|
|
|
|
|
|
22
|
0
|
0
|
|
|
|
|
return $f ? $TRUE : $FALSE; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub to_rdf { |
26
|
0
|
|
|
0
|
0
|
|
my( $self, $model ) = @_; |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
return RDF::Trine::Node::Literal->new( |
29
|
|
|
|
|
|
|
$self->[0] ? 'true' : 'false', |
30
|
|
|
|
|
|
|
'', |
31
|
|
|
|
|
|
|
$model -> meta_uri('xsd:boolean') |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub as_text { |
36
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
37
|
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
|
if ( $self->[0] ) { |
39
|
0
|
|
|
|
|
|
return 'true'; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
else { |
42
|
0
|
|
|
|
|
|
return 'false'; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub id { |
47
|
0
|
0
|
|
0
|
0
|
|
if ( shift->value ) { |
48
|
0
|
|
|
|
|
|
return "true^^Boolean"; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
else { |
51
|
0
|
|
|
|
|
|
return "false^^Boolean"; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub calculate_length { |
56
|
0
|
|
|
0
|
0
|
|
my ( $self, $engine ) = @_; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
return $engine->ONE; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub is_equal { |
62
|
0
|
|
|
0
|
0
|
|
my ( $self, $engine, $other ) = @_; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my $d = deferred; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
$d->resolve( $self->value == $other->value ); |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
return $d; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub is_less { |
72
|
0
|
|
|
0
|
0
|
|
my ( $self, $engine, $other ) = @_; |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
my $d = deferred; |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
$d->resolve( $self->value < $other->value ); |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
return $d; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub is_less_or_equal { |
82
|
0
|
|
|
0
|
0
|
|
my ( $self, $engine, $other ) = @_; |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
my $d = deferred; |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
$d->resolve( $self->value <= $other->value ); |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
return $d; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub is_greater { |
92
|
0
|
|
|
0
|
0
|
|
my ( $self, $engine, $other ) = @_; |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
my $d = deferred; |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
$d->resolve( $self->value > $other->value ); |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
return $d->promise; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub is_greater_or_equal { |
102
|
0
|
|
|
0
|
0
|
|
my ( $self, $engine, $other ) = @_; |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
my $d = deferred; |
105
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
$d->resolve( $self->value >= $other->value ); |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
return $d; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; |