00001 /* 00002 * Copyright (C) 2003-2007 Funambol 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 */ 00018 #ifndef INCL_LOGICALCLAUSE 00019 #define INCL_LOGICALCLAUSE 00020 00022 #include "base/util/ArrayList.h" 00023 #include "filter/Clause.h" 00024 00025 typedef enum { 00026 NOT = 0, 00027 AND = 1, 00028 OR = 2 00029 } LogicalClauseOperator; 00030 00031 class LogicalClause : public Clause { 00032 00033 // ------------------------------------------------------- Private interface 00034 private: 00035 00036 LogicalClauseOperator op; 00037 ArrayList* operands; 00038 00039 00040 00041 // ----------------------------------------------------- Protected interface 00042 protected: 00043 /* 00044 * LogicalClause constructor 00045 * 00046 */ 00047 LogicalClause(); 00048 00049 00050 00051 // -------------------------------------------------------- Public interface 00052 public: 00053 00054 ~LogicalClause(); 00055 00056 00057 /* 00058 * LogicalClause constructor 00059 * 00060 * @param o the logical operator 00061 * @param ops the operands ArrayList 00062 * @param n how many operands are passed in ops 00063 */ 00064 LogicalClause(LogicalClauseOperator o, ArrayList& ops); 00065 00066 /* 00067 * getOperator 00068 * 00069 */ 00070 LogicalClauseOperator getOperator(); 00071 00072 00073 /* 00074 * setOperator 00075 * 00076 * @param p0 00077 */ 00078 void setOperator(LogicalClauseOperator p0); 00079 00080 00081 /* 00082 * getOperands 00083 * 00084 */ 00085 ArrayList* getOperands(); 00086 00087 00088 /* 00089 * setOperands 00090 * 00091 * @param ops the operands ArrayList 00092 */ 00093 void setOperands(ArrayList& ops); 00094 00095 00096 /* 00097 * isUnaryOperator 00098 * 00099 */ 00100 BOOL isUnaryOperator(); 00101 00102 /* 00103 * Creates a new instance of this Clause 00104 * 00105 * @return the clone 00106 */ 00107 ArrayElement* clone(); 00108 00109 00110 }; 00111 00112 00114 #endif