1 chuck 1.2 //%2003////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development
4 // Company, L. P., IBM Corp., The Open Group, Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.;
6 // IBM Corp.; EMC Corporation, The Open Group.
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to
10 // deal in the Software without restriction, including without limitation the
11 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 // sell copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
16 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
17 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
18 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 chuck 1.2 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 //
24 //==============================================================================
25 //
26 // Authors: David Rosckes (rosckes@us.ibm.com)
27 // Bert Rivero (hurivero@us.ibm.com)
28 // Chuck Carmack (carmack@us.ibm.com)
29 // Brian Lucier (lucier@us.ibm.com)
30 //
31 // Modified By:
32 //
33 //%/////////////////////////////////////////////////////////////////////////////
34
35 #include "CQLSimplePredicate.h"
36 #include "CQLSimplePredicateRep.h"
37 #include <Pegasus/CQL/CQLExpression.h>
38 #include <Pegasus/CQL/CQLFactory.h>
39 #include <Pegasus/Query/QueryCommon/QueryContext.h>
40
41 PEGASUS_NAMESPACE_BEGIN
42
43 chuck 1.2 CQLSimplePredicate::CQLSimplePredicate(){
44 _rep = new CQLSimplePredicateRep();
45 }
46
47 CQLSimplePredicate::CQLSimplePredicate(const CQLExpression& inExpression)
48 {
49 _rep = new CQLSimplePredicateRep(inExpression);
50 }
51
52 CQLSimplePredicate::CQLSimplePredicate(const CQLExpression& inExpression,
53 const ExpressionOpType inOperator)
54 {
55 _rep = new CQLSimplePredicateRep(inExpression,inOperator);
56 }
57
58 CQLSimplePredicate::CQLSimplePredicate(const CQLExpression& leftSideExpression,
59 const CQLExpression& rightSideExpression,
60 ExpressionOpType inOperator)
61 {
62 _rep = new CQLSimplePredicateRep(leftSideExpression,rightSideExpression,inOperator);
63 }
64 chuck 1.2
65 CQLSimplePredicate::CQLSimplePredicate(const CQLSimplePredicate& inSimplePredicate){
66 _rep = new CQLSimplePredicateRep(inSimplePredicate._rep);
67 }
68
69 CQLSimplePredicate::~CQLSimplePredicate(){
70 if(_rep)
71 delete _rep;
72 }
73
74 Boolean CQLSimplePredicate::evaluate(CIMInstance CI, QueryContext& QueryCtx)
75 {
76 return _rep->evaluate(CI,QueryCtx);
77 }
78
79 CQLExpression CQLSimplePredicate::getLeftExpression()const
80 {
81 return _rep->getLeftExpression();
82 }
83
84 CQLExpression CQLSimplePredicate::getRightExpression()const
85 chuck 1.2 {
86 return _rep->getRightExpression();
87 }
88
89 enum ExpressionOpType CQLSimplePredicate::getOperation()const
90 {
91 return _rep->getOperation();
92 }
93
94 void CQLSimplePredicate::applyContext(QueryContext& queryContext)
95 {
96 _rep->applyContext(queryContext);
97 }
98
99 String CQLSimplePredicate::toString()const
100 {
101 return _rep->toString();
102 }
103 Boolean CQLSimplePredicate::isSimple()const{
104 return _rep->isSimple();
105 }
106 chuck 1.2 Boolean CQLSimplePredicate::isSimpleValue()const{
107 return _rep->isSimpleValue();
108 }
109
110 CQLSimplePredicate& CQLSimplePredicate::operator=(const CQLSimplePredicate& rhs){
111 if(&rhs != this){
112 if(_rep) delete _rep;
113 _rep = new CQLSimplePredicateRep(rhs._rep);
114 }
115 return *this;
116 }
117
118 Boolean CQLSimplePredicate::operator==(const CQLSimplePredicate& rhs)const{
119 if(_rep->getLeftExpression() == rhs._rep->getLeftExpression() &&
120 _rep->getRightExpression() == rhs._rep->getRightExpression() &&
121 _rep->getOperation() == rhs._rep->getOperation()
122 )
123 return true;
124 return false;
125 }
126
127 chuck 1.2 void CQLSimplePredicate::setOperation(ExpressionOpType op){
128 _rep->setOperation(op);
129 }
130
131 PEGASUS_NAMESPACE_END
|