Search in sources :

Example 1 with MNSynchStatement

use of com.rockwellcollins.atc.agree.agree.MNSynchStatement in project AGREE by loonwerks.

the class AgreeValidator method checkSynchStatement.

@Check(CheckType.FAST)
public void checkSynchStatement(SynchStatement sync) {
    Classifier container = sync.getContainingClassifier();
    if (!(container instanceof ComponentImplementation)) {
        error(sync, "Synchrony statements can appear only in component implementations");
    }
    if (sync instanceof CalenStatement || sync instanceof MNSynchStatement || sync instanceof AsynchStatement || sync instanceof LatchedStatement) {
        return;
    }
    // So this may be redundant
    if (Integer.valueOf(sync.getVal()) < 0) {
        error(sync, "The value of synchrony statments must be positive");
    }
    String val2 = sync.getVal2();
    if (val2 != null) {
        if (Integer.valueOf(val2) <= 0) {
            error(sync, "The second value of a synchrony statment must be greater than zero");
        }
        if (Integer.valueOf(sync.getVal()) <= Integer.valueOf(val2)) {
            error(sync, "The second value of a synchrony argument must be less than the first");
        }
    }
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) MNSynchStatement(com.rockwellcollins.atc.agree.agree.MNSynchStatement) LatchedStatement(com.rockwellcollins.atc.agree.agree.LatchedStatement) AsynchStatement(com.rockwellcollins.atc.agree.agree.AsynchStatement) ComponentClassifier(org.osate.aadl2.ComponentClassifier) Classifier(org.osate.aadl2.Classifier) CalenStatement(com.rockwellcollins.atc.agree.agree.CalenStatement) Check(org.eclipse.xtext.validation.Check)

Aggregations

AsynchStatement (com.rockwellcollins.atc.agree.agree.AsynchStatement)1 CalenStatement (com.rockwellcollins.atc.agree.agree.CalenStatement)1 LatchedStatement (com.rockwellcollins.atc.agree.agree.LatchedStatement)1 MNSynchStatement (com.rockwellcollins.atc.agree.agree.MNSynchStatement)1 Check (org.eclipse.xtext.validation.Check)1 Classifier (org.osate.aadl2.Classifier)1 ComponentClassifier (org.osate.aadl2.ComponentClassifier)1 ComponentImplementation (org.osate.aadl2.ComponentImplementation)1