blob: 4d6716a827010409810ee2243059ee9268cecc0f [file] [log] [blame]
@xlia< system , 1.0 >:
system InformationSystem {
@property:
type NEWS enum {economy, politics, culture, sports}
@machine:
statemachine NewsAgency {
@public:
port input receivenews(NEWS);
port output forwardnews(NEWS);
var int news_count = 0;
var NEWS headline {
@on_write(newValue) {
news_count ++;
}
}
@region:
state<initial> source {transition startup --> idle;}
state idle {
transition receive_news --> idle {
input receivenews(headline);
output forwardnews(headline);
}
}
}
model statemachine SpecializedAgency {
@parameter:
public var NEWS specialization;
@public:
port input receivespecnews(NEWS);
var int spec_count = 0;
var NEWS specheadline {
@on_write(newValue) {
guard(newValue == specialization);
spec_count ++;
}
}
var NEWS otherheadline {
@on_write(newValue) {
guard(newValue != specialization);
}
}
@region:
state<initial> source {transition startup --> idle;}
state idle {
transition receive_specnews --> idle {
input receivespecnews(specheadline);
}
transition<else> notopic --> investigating {input receivespecnews(otherheadline);}
}
state<final> investigating;
}
@instance:
instance<SpecializedAgency> economychannel(specialization:economy);
@com:
connect<env> {
input NewsAgency->receivenews;
}
connect<rdv> {
output NewsAgency->forwardnews;
input economychannel->receivespecnews;
}
}