/**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 public Behavior getBehavior() {
   if (behavior != null && behavior.eIsProxy()) {
     InternalEObject oldBehavior = (InternalEObject) behavior;
     behavior = (Behavior) eResolveProxy(oldBehavior);
     if (behavior != oldBehavior) {
       if (eNotificationRequired())
         eNotify(
             new ENotificationImpl(
                 this,
                 Notification.RESOLVE,
                 UMLPackage.CALL_BEHAVIOR_ACTION__BEHAVIOR,
                 oldBehavior,
                 behavior));
     }
   }
   return behavior;
 }
Exemplo n.º 2
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public Behavior getBase_Behavior() {
   if (base_Behavior != null && base_Behavior.eIsProxy()) {
     InternalEObject oldBase_Behavior = (InternalEObject) base_Behavior;
     base_Behavior = (Behavior) eResolveProxy(oldBase_Behavior);
     if (base_Behavior != oldBase_Behavior) {
       if (eNotificationRequired()) {
         eNotify(
             new ENotificationImpl(
                 this,
                 Notification.RESOLVE,
                 TimePackage.TIMED_PROCESSING__BASE_BEHAVIOR,
                 oldBase_Behavior,
                 base_Behavior));
       }
     }
   }
   return base_Behavior;
 }
Exemplo n.º 3
0
  public ArrayList<SM> getRefModelDetails(ModelFile modelFile) throws Exception {
    ArrayList<SM> stateMachineDetails = new ArrayList<>();
    UMLModelLoader umlModel = new UMLModelLoader();
    EList<PackageableElement> packageableElements;
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    byte[] buffer = new byte[1024];
    int len;
    while ((len = modelFile.getModel().read(buffer)) > -1) {
      baos.write(buffer, 0, len);
    }
    baos.flush();
    modelFile.setModel(new BufferedInputStream(new ByteArrayInputStream(baos.toByteArray())));
    Model _model =
        umlModel.loadModel(
            new ModelFile(new BufferedInputStream(new ByteArrayInputStream(baos.toByteArray()))));

    if (_model == null) {
      Package _package = umlModel.loadPackage(modelFile);
      packageableElements = _package.getPackagedElements();
    } else {
      packageableElements = _model.getPackagedElements();
    }

    for (PackageableElement element : packageableElements) {
      if (element.eClass() == UMLPackage.Literals.CLASS) {
        Class c = (Class) element;
        EList<Behavior> ownedBehaviors = c.getOwnedBehaviors();
        for (Behavior beh : ownedBehaviors) {
          if (beh.eClass() == UMLPackage.Literals.STATE_MACHINE) {

            // System.out.println("Class Name : "+parentClassName);
            // if (element.eClass() == UMLPackage.Literals.STATE_MACHINE) {
            StateMachine stateMachine = (StateMachine) beh;
            // System.out.println("Parent  :  "+parentClassName);

            EList<Region> regions = stateMachine.getRegions();
            for (Region reg : regions) {
              // System.out.println("Region : " + reg.getLabel());
              EList<Vertex> vertices = reg.getSubvertices();

              for (Vertex vertex : vertices) {
                SM smDetails = new SM();
                if (vertex.eClass() == UMLPackage.Literals.STATE) {
                  //		System.out.println("Vertex : "+vertex.getName());

                  smDetails.setName(vertex.getLabel());
                  ArrayList<TransitionDetails> transition = new ArrayList<>();
                  transition = readVertices(vertex, smDetails);
                  smDetails.setTransitions(transition);
                  stateMachineDetails.add(smDetails);
                }
              }
            }

            //			EList<Behavior> ownedBehaviors = c.getOwnedBehaviors();
            //			for (Behavior beh : ownedBehaviors) {
            //				if (beh.eClass() == UMLPackage.Literals.STATE_MACHINE){
            //					System.out.println(beh.getName());
            //					readBehaviours(beh);
          }
        }
      }
    }

    return stateMachineDetails;
  }
 public static boolean isParametrizedConstraint(Constraint constraint) {
   Behavior toExecute = ActivityUtils.resolveBehaviorReference(constraint.getSpecification());
   return toExecute.getOwnedParameters().size() > 1;
 }