Class predicates are used as
predicates in queries (Chapter 17, Queries). They
are declared by a declaration of a concrete subclass of
de.grogra.xl.qnp.ClassPredicate
in the following way:
Let P
be a concrete
subclass of ClassPredicate
.
If P
has a static
method m
named signature
as a member,
proceed as follows. Otherwise,
no class predicate is declared.
Let U1
, ...,
Un
be the types of
m
's parameters. The signature and in-/out-parameters
of the class predicates declared in the later steps are
determined as follows:
If a
Uk
equals
ClassPredicate.InOut
, then
the signature is the subsequence of
U1
, ...,
Un
where
Uk
has been removed.
The in-out-parameter of the predicates is at index
k
(thus corresponds to the parameter
following Uk
). It is
a compile-time error if k
equals
n
, i.e., if
Uk
is the last parameter
type.
Otherwise, if a
Ui
equals
ClassPredicate.In
, then
there must be a
Uo
which equals
ClassPredicate.Out
,
or a compile-time error occurs.
The signature is the subsequence of
U1
, ...,
Un
where
Ui
and
Uo
have
been removed. The in-parameter of the predicates has the index of
Ui+1
in this sequence,
the out-parameter of the predicates has the index of
Uo+1
in this sequence.
It is a compile-time error if
Ui
and
Uo
are
neighbouring, or if i
or
o
equals
n
.
Otherwise, the signature is
U1
, ...,
Un
, and there
are no in-/out-parameters.
Let T
be the entity of which
P
is a member (thus,
T
is a package or a type).
A class predicate is declared as a member of T
whose simple name is the simple name of P
.
Its accessibility is the same as for P
.
In addition, if T
is a type,
let E
be the entity of which
T
is a member.
A class predicate is declared as a member of E
whose simple name is the simple name of T
.
Its accessibility is the same as for P
.