| 1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2009 - 2010 Cloudsmith Inc. and others. |
| 3 |
* |
| 4 |
* This program and the accompanying materials |
| 5 |
* are made available under the terms of the Eclipse Public License 2.0 |
| 6 |
* which accompanies this distribution, and is available at |
| 7 |
* https://www.eclipse.org/legal/epl-2.0/ |
| 8 |
* |
| 9 |
* SPDX-License-Identifier: EPL-2.0 |
| 10 |
* |
| 11 |
* Contributors: |
| 12 |
* Cloudsmith Inc. - initial API and implementation |
| 13 |
*******************************************************************************/ |
| 14 |
package org.eclipse.equinox.p2.metadata.expression; |
| 15 |
|
| 16 |
/** |
| 17 |
* A node in the expression tree |
| 18 |
* @since 2.0 |
| 19 |
* @noimplement This interface is not intended to be implemented directly by clients. |
| 20 |
* @noextend This interface is not intended to be extended directly by clients. |
| 21 |
*/ |
| 22 |
public interface IExpression { |
| 23 |
int TYPE_ALL = 1; |
| 24 |
int TYPE_AND = 2; |
| 25 |
int TYPE_AT = 3; |
| 26 |
int TYPE_EQUALS = 4; |
| 27 |
int TYPE_EXISTS = 5; |
| 28 |
int TYPE_GREATER = 6; |
| 29 |
int TYPE_GREATER_EQUAL = 7; |
| 30 |
int TYPE_LAMBDA = 8; |
| 31 |
int TYPE_LESS = 9; |
| 32 |
int TYPE_LESS_EQUAL = 10; |
| 33 |
int TYPE_LITERAL = 11; |
| 34 |
int TYPE_MATCHES = 12; |
| 35 |
int TYPE_MEMBER = 13; |
| 36 |
int TYPE_NOT = 14; |
| 37 |
int TYPE_NOT_EQUALS = 15; |
| 38 |
int TYPE_OR = 16; |
| 39 |
int TYPE_PARAMETER = 17; |
| 40 |
int TYPE_VARIABLE = 18; |
| 41 |
int TYPE_ARRAY = 20; |
| 42 |
int TYPE_ASSIGNMENT = 21; |
| 43 |
int TYPE_COLLECT = 22; |
| 44 |
int TYPE_CONDITION = 23; |
| 45 |
int TYPE_FIRST = 24; |
| 46 |
int TYPE_FLATTEN = 25; |
| 47 |
int TYPE_FUNCTION = 26; |
| 48 |
int TYPE_INTERSECT = 27; |
| 49 |
int TYPE_LATEST = 28; |
| 50 |
int TYPE_LIMIT = 29; |
| 51 |
int TYPE_PIPE = 30; |
| 52 |
int TYPE_SELECT = 31; |
| 53 |
int TYPE_TRAVERSE = 32; |
| 54 |
int TYPE_UNION = 33; |
| 55 |
int TYPE_UNIQUE = 34; |
| 56 |
|
| 57 |
/** |
| 58 |
* Let the visitor visit this instance and all expressions that this |
| 59 |
* instance contains. |
| 60 |
* @param visitor The visiting visitor. |
| 61 |
* @return <code>true</code> if the visitor should continue visiting, <code>false</code> otherwise. |
| 62 |
*/ |
| 63 |
boolean accept(IExpressionVisitor visitor); |
| 64 |
|
| 65 |
/** |
| 66 |
* Evaluate this expression with given context and variables. |
| 67 |
* @param context The evaluation context |
| 68 |
* @return The result of the evaluation. |
| 69 |
*/ |
| 70 |
Object evaluate(IEvaluationContext context); |
| 71 |
|
| 72 |
/** |
| 73 |
* Returns the expression type (see TYPE_xxx constants). |
| 74 |
*/ |
| 75 |
int getExpressionType(); |
| 76 |
|
| 77 |
/** |
| 78 |
* Appends the string representation of this expression to the collector <code>collector</code>. |
| 79 |
*/ |
| 80 |
void toString(StringBuffer collector); |
| 81 |
|
| 82 |
/** |
| 83 |
* Appends the an LDAP filter representation of this expression to the <code>collector</code>. |
| 84 |
* @throws UnsupportedOperationException if the expression contains nodes |
| 85 |
* that cannot be represented in an LDAP filter |
| 86 |
*/ |
| 87 |
void toLDAPString(StringBuffer collector); |
| 88 |
} |