We need a way to use this a
priori knowledge ??“ or other preferences ??“ in automated analysis and testing. But we
do not want to put limitations into the model program itself.We want to separate the
contract model program that describes all allowed behaviors from scenario control,
the limitations we introduce to focus on interesting runs. Then we can use the same
contract model program to analyze or test many different scenarios. Features and
composition make this possible.
7.2 Features
A feature is a cluster of related state variables and actions that can be selectively
included or excluded from a model program. Features make it possible to define
different configurations for a model program, which include different subsets of
features, in a single source program file (or collection of files). In addition, features
can be combined for purposes of scenario control.
118 Structuring Model Programs with Features and Composition
7.2.1 Defining features
To define a feature, declare its state variables, action methods, and enabling methods
in a class. The feature name is the class name. Label the class with the [Feature]
attribute.
Each feature can be selectively included or excluded from the model program.
Classes that are not labeled with the [Feature] attribute are always included. State
variables that are declared within a feature should only be used by that feature.
Pages:
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178