Changeset 1395


Ignore:
Timestamp:
03/12/12 18:49:05 (13 years ago)
Author:
wschamai
Message:

ADD: experiment annotation generation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modelicaml/org.openmodelica.modelicaml.helper/src/org/openmodelica/modelicaml/helper/impl/VerificationModelsGenerator.java

    r1253 r1395  
    1616import org.eclipse.uml2.uml.Class;
    1717import org.eclipse.uml2.uml.Classifier;
     18import org.eclipse.uml2.uml.Comment;
    1819import org.eclipse.uml2.uml.Element;
    1920import org.eclipse.uml2.uml.NamedElement;
     
    543544            Object tolerance = testScenarioModel.getValue(sTestScenario, Constants.propertyName_tolerance);
    544545            simulationModel.setValue(sSimulation, Constants.propertyName_tolerance, tolerance);
     546           
     547            Comment annotationExperimentComment = simulationModel.createOwnedComment();
     548            Stereotype annotationStereotype = annotationExperimentComment.getApplicableStereotype(Constants.stereotypeQName_Annotation);
     549            if (annotationStereotype != null) {
     550               
     551                // apply stereotype
     552                annotationExperimentComment.applyStereotype(annotationStereotype);
     553               
     554                // Example of a Modelica annotation string: annotation(experiment(StartTime = 0.0, StopTime = 150));
     555               
     556                String annotationString = "experiment(";
     557               
     558                if (startTime!= null) {annotationString = annotationString + "StartTime=" + startTime.toString(); }
     559                if (stopTime!= null) {annotationString = annotationString + ", StopTime=" + stopTime.toString(); }
     560                //if (numberOfIntervals!= null) {annotationString = annotationString + ", Output=" + numberOfIntervals.toString(); }
     561                if (tolerance!= null) {annotationString = annotationString + ", Tolerance=" + tolerance.toString(); }
     562               
     563                annotationString = annotationString + ")";
     564                annotationExperimentComment.setBody(annotationString);
     565                annotationExperimentComment.setValue(annotationStereotype, Constants.propertyName_fullAnnotationString, (Object)annotationString);
     566            }
     567            else {
     568//              System.err.println("Could not access the annotation stereotype");
     569            }
    545570        }
    546571    }
Note: See TracChangeset for help on using the changeset viewer.