KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > trading > constraint > NotNode


1
2 // Copyright (C) 1998-1999
3
// Object Oriented Concepts, Inc.
4

5 // **********************************************************************
6
//
7
// Copyright (c) 1997
8
// Mark Spruiell (mark@intellisoft.com)
9
//
10
// See the COPYING file for more information
11
//
12
// **********************************************************************
13

14 package org.jacorb.trading.constraint;
15
16 import java.io.*;
17
18
19 /** Represents logical "NOT" */
20 public class NotNode extends ExprNode
21 {
22   private ExprNode m_child;
23
24
25   private NotNode()
26   {
27   }
28
29
30   public NotNode(ExprNode child)
31   {
32     m_child = child;
33
34     setType(new ValueType(ValueType.BOOLEAN));
35   }
36
37
38   public void print(PrintStream ps)
39   {
40     ps.println("NotNode: type = " + getType());
41     ps.println("Child node:");
42     m_child.print(ps);
43   }
44
45
46   public Value evaluate(PropertySource source)
47     throws MissingPropertyException
48   {
49     Value result = null;
50
51     Value v = m_child.evaluate(source);
52
53     Boolean JavaDoc b = (Boolean JavaDoc)v.getValue();
54
55     result = ValueFactory.createBoolean(! b.booleanValue());
56
57     return result;
58   }
59 }
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Popular Tags