NODE_TYPE
- Type of the node in the QueryEnvironment
this expression should be
evaluated in the context of.public abstract class QueryExpression<NODE_TYPE> extends Object
All queries return a set of targets that match the query expression.
All queries must ensure that sufficient graph edges are created in the QueryEnvironment so that all nodes in the result are correctly ordered according to the type of query. For example, "deps" queries require that all the nodes in the transitive closure of its argument set are correctly ordered w.r.t. each other algebraic set operations such as intersect and union are inherently unordered.
This package consists of two basic class hierarchies. The first, QueryExpression
, is
the set of different query expressions in the language, and the eval(com.facebook.buck.query.QueryEvaluator<NODE_TYPE>, com.facebook.buck.query.QueryEnvironment<NODE_TYPE>)
method of each
defines the semantics. The result of evaluating a query is set of Buck QueryTarget
s (a
file or build target). The set may be interpreted as either a set or as nodes of a DAG, depending
on the context.
Modifier | Constructor and Description |
---|---|
protected |
QueryExpression() |
Modifier and Type | Method and Description |
---|---|
void |
collectTargetPatterns(Collection<String> literals)
Collects all target patterns that are referenced anywhere within this query expression and adds
them to the given collection, which must be mutable.
|
Set<QueryTarget> |
getTargets(QueryEnvironment<NODE_TYPE> env)
Returns a set of all targets referenced from literals within this query expression.
|
static <NODE_TYPE> |
parse(String query,
QueryEnvironment<NODE_TYPE> env)
Scan and parse the specified query expression.
|
abstract String |
toString()
Returns this query expression pretty-printed.
|
abstract void |
traverse(com.facebook.buck.query.QueryExpression.Visitor<NODE_TYPE> visitor)
Accepts and applies the given visitor.
|
public static <NODE_TYPE> QueryExpression<NODE_TYPE> parse(String query, QueryEnvironment<NODE_TYPE> env) throws QueryException
QueryException
public void collectTargetPatterns(Collection<String> literals)
This is intended to accumulate patterns from multiple expressions for preloading at once.
public abstract void traverse(com.facebook.buck.query.QueryExpression.Visitor<NODE_TYPE> visitor)
public Set<QueryTarget> getTargets(QueryEnvironment<NODE_TYPE> env)