*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

be a concrete subclass of`P`

`ClassPredicate`

. Ifhas a static method`P`

named`m`

`signature`

as a member, proceed as follows. Otherwise, no class predicate is declared.Let

, ...,`U`

_{1}be the types of`U`

_{n}'s parameters. The signature and in-/out-parameters of the class predicates declared in the later steps are determined as follows:`m`

If a

equals`U`

_{k}`ClassPredicate.InOut`

, then the signature is the subsequence of, ...,`U`

_{1}where`U`

_{n}has been removed. The in-out-parameter of the predicates is at index`U`

_{k}(thus corresponds to the parameter following`k`

). It is a compile-time error if`U`

_{k}equals`k`

, i.e., if`n`

is the last parameter type.`U`

_{k}Otherwise, if a

equals`U`

_{i}`ClassPredicate.In`

, then there must be awhich equals`U`

_{o}`ClassPredicate.Out`

, or a compile-time error occurs. The signature is the subsequence of, ...,`U`

_{1}where`U`

_{n}and`U`

_{i}have been removed. The in-parameter of the predicates has the index of`U`

_{o}in this sequence, the out-parameter of the predicates has the index of`U`

_{i+1}in this sequence. It is a compile-time error if`U`

_{o+1}and`U`

_{i}are neighbouring, or if`U`

_{o}or`i`

equals`o`

.`n`

Otherwise, the signature is

, ...,`U`

_{1}, and there are no in-/out-parameters.`U`

_{n}

Let

be the entity of which`T`

is a member (thus,`P`

is a package or a type). A class predicate is declared as a member of`T`

whose simple name is the simple name of`T`

. Its accessibility is the same as for`P`

.`P`

In addition, if

is a type, let`T`

be the entity of which`E`

is a member. A class predicate is declared as a member of`T`

whose simple name is the simple name of`E`

. Its accessibility is the same as for`T`

.`P`