Path Predicates | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Path predicates are used to connect their neighbouring predicates by a binary relation. In order to do this, they have both an open in-parameter and an open out-parameter, these are merged with the in- and out-parameters of their neighbouring predicates (Section 17.3.3, “Connecting Primary Predicates”).
A path predicate is specified by its direction
and a path specification. The direction is indicated by the
tokens around the path specification:
For - -
, it is undirected,
for - ->
, it is forward,
for <- -
, it is backward.
If the direction is backward, the in- and out-parameters of the
contained path specification are swapped.
Method Path Predicates | |||||
---|---|---|---|---|---|
|
Expression Edge Predicates | |||||
---|---|---|---|---|---|
|
An expression edge predicate contains a single expression. It allows
to specify an edge pattern which consists of a single value. At first,
the expression is converted by method invocation conversion
to the type E
returned by
m
.getEdgeClassFor
(T
),
where m
is the current compile-time model
(Section 3.1, “Compile-Time Model”) and T
the
original type of the expression. If such a conversion does not exist,
a compile-time error occurs.
If the resulting expression is a compile-time constant,
and if its type E
is primitive or has
java.io.Serializable
as superinterface,
then the expression edge predicate is reclassified as
a constant edge predicate (Section 17.5.6, “Constant Edge Predicates”) having
the constant value of the expression as its value.
Standard Edge Predicates | |||||
---|---|---|---|---|---|
|
Standard edge predicates provide simple means to specify a connectivity relation between their neighbouring predicates. They are shorthands for constant edge predicates (Section 17.5.6, “Constant Edge Predicates”). The translation is defined by the following table:
Table 17.1. Reclassification as constant edge predicate
Predicate token | Constant X | Direction |
---|---|---|
> | SUCCESSOR_EDGE | forward |
< | SUCCESSOR_EDGE | backward |
+> | BRANCH_EDGE | forward |
<+ | BRANCH_EDGE | backward |
--> | ANY_EDGE | forward |
<-- | ANY_EDGE | backward |
-- | ANY_EDGE | undirected |
The constant of the reclassified constant edge predicate is obtained by
m
.getStandardEdgeFor
(de.grogra.xl.qnp.EdgePredicate
.X
),
where m
is the current compile-time model
(Section 3.1, “Compile-Time Model”). The returned value has to be an instance of
the type returned by
m
.getStandardEdgeClass()
or an instance of the boxing type if the returned type is primitive.
In the latter case, unboxing conversion is applied to the constant
before reclassification.
A constant edge predicate results from the reclassification of an expression edge predicate (Section 17.5.4, “Expression Edge Predicates”) or a standard edge predicate (Section 17.5.5, “Standard Edge Predicates”).