1# See bottom of file for license and copyright information
2
3=begin TML
4
5---+ package Foswiki::Query::OP_not
6
7=cut
8
9package Foswiki::Query::OP_not;
10
11use strict;
12use warnings;
13
14use Foswiki::Query::UnaryOP ();
15our @ISA = ('Foswiki::Query::UnaryOP');
16
17sub new {
18    my $class = shift;
19    return $class->SUPER::new( name => 'not', prec => 300, arity => 1 );
20}
21
22sub evaluate {
23    my $this = shift;
24    my $node = shift;
25    my $a    = $node->{params}[0]->evaluate(@_);
26    if ( ref($a) eq 'ARRAY' ) {
27        return [];
28    }
29    return $a ? 0 : 1;
30}
31
321;
33__END__
34Author: Crawford Currie http://c-dot.co.uk
35
36Foswiki - The Free and Open Source Wiki, http://foswiki.org/
37
38Copyright (C) 2008-2011 Foswiki Contributors. Foswiki Contributors
39are listed in the AUTHORS file in the root of this distribution.
40NOTE: Please extend that file, not this notice.
41
42Additional copyrights apply to some or all of the code in this
43file as follows:
44
45Copyright (C) 2005-2007 TWiki Contributors. All Rights Reserved.
46TWiki Contributors are listed in the AUTHORS file in the root
47of this distribution. NOTE: Please extend that file, not this notice.
48
49This program is free software; you can redistribute it and/or
50modify it under the terms of the GNU General Public License
51as published by the Free Software Foundation; either version 2
52of the License, or (at your option) any later version. For
53more details read LICENSE in the root of this distribution.
54
55This program is distributed in the hope that it will be useful,
56but WITHOUT ANY WARRANTY; without even the implied warranty of
57MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
58
59As per the GPL, removal of this notice is prohibited.
60