Package org.emftrace.metamodel.QUARCModel.Query

Examples of org.emftrace.metamodel.QUARCModel.Query.ApplicableElement


   * @param element
   *            an Element
   * @return the created ApplicableElement
   */
  public ApplicableElement createApplicableElement(Element element) {
    ApplicableElement result = applicableElementCache.createApplicableElement(element);
    notifyCacheChangeListeners();
    return result;
  }
View Full Code Here


   * @param element an Element
   * @return the created ApplicableElement
   *
   */
  private ApplicableElement createAndAddApplicableElement(Element element) {
    ApplicableElement newApplicableElement = cacheManager
        .createApplicableElement(element);
    return newApplicableElement;
  }
View Full Code Here

          targetApplicableElement, relation);
    } else

    if (element instanceof Goal) {
      checkedElements.put(element, LogicalValues.TRUE);
      ApplicableElement applicableElement = createAndAddApplicableElement(element);
      if (targetApplicableElement != null && relation != null) {

        cacheManager.addRelation(applicableElement,
            targetApplicableElement, relation);
      }
      checkRelations(element, applicableElement);

    } else { // instanceof ConstrainedElement

      if (!elementTypeIsIncluded(element))
        return;
      LogicalValues isApplicable = applicabilityTester
          .evaluatePrecondition((ConstrainedElement) element);
      if (isApplicable == LogicalValues.TRUE) {
        ApplicableElement applicableElement = createAndAddApplicableElement(element);
        cacheManager.addRelation(applicableElement,
            targetApplicableElement, relation);
        checkRelations(element, applicableElement);
      } else if (isApplicable == LogicalValues.FALSE) {
        // ignore source Element / Relation
View Full Code Here

   */
  private void pruneApplicableElements(
      Set<Entry<ApplicableElement, Element>> applicableElementsSet) {
    for (Entry<ApplicableElement, Element> entry : applicableElementsSet){
      Element element = entry.getValue();
      ApplicableElement applicableElement = entry.getKey();
      if (elementIsToPrune(element)){
        pruneApplicableElement(applicableElement);
      }
    }
   
View Full Code Here

  private void pruneApplicableElement(ApplicableElement applicableElement) {

    for (Relation relation : cacheManager.getAllApplicableOutgoingRelations(applicableElement)){
      Element target = cacheManager.getTargetOfRelation(relation);
      if (!elementIsToPrune(target)){
       ApplicableElement applicableTargetElement = cacheManager.getApplicableElementForElement(target);
       if (relation instanceof Impact)
         applicableTargetElement.getIncomingImpactRelations().remove(relation);
       else
       if (relation instanceof Offset)
         applicableTargetElement.getIncomingOffsetRelations().remove(relation);
       else
       if (relation instanceof Decomposition)
         applicableTargetElement.getIncomingDecompositionRelations().remove(relation);
       else
       if (relation instanceof isA)
         applicableTargetElement.getIncomingIsARelations().remove(relation);
      } //else no required due to Element is removed already or will be removed in future
    }
    queryResultSet.getApplicableElements().remove(applicableElement);
   
  }
View Full Code Here

  public void testGetElement() {
    Goal g1 = createGoal(gss, 1);
   
    executeRequiredPhases();
   
    ApplicableElement ag2 = QueryFactory.eINSTANCE.createApplicableElement();

    Goal g2 = createGoal(gss, 2);
    ag2.setElement(g2);
   
   
    assertEquals(g1, applicableElementCache.getElement(applicableElementCache.getApplicableElement(g1)));
    assertEquals(null, applicableElementCache.getElement(ag2));
  }
View Full Code Here

   
    applicableElementCache = new GSSQueryCache(queryResultSet, accessLayer);
    applicableElementCache.initCache();
 
   
    ApplicableElement aeg1 = applicableElementCache.createApplicableElement(g1);
    ApplicableElement aep1 =applicableElementCache.createApplicableElement(p1);
    ApplicableElement aep2 =applicableElementCache.createApplicableElement(p2);
    ApplicableElement aesi1 =applicableElementCache.createApplicableElement(si1);
    ApplicableElement aesi2 =applicableElementCache.createApplicableElement(si2);
   
    applicableElementCache.addRelation(aep1, aeg1, i1);
    applicableElementCache.addRelation(aesi1, aep2, i2);
   
    applicableElementCache.addRelation(aep2, aep1, d1);
View Full Code Here

   *            the parent QueryResultSet
   */
  protected void createApplicableElementsForEachElement(
      List<Element> elements, QueryResultSet resultSet) {
    for (Element element : elements) {
      ApplicableElement ae = QueryFactory.eINSTANCE
          .createApplicableElement();
      ae.setElement(element);
      resultSet.getApplicableElements().add(ae);
    }
  }
View Full Code Here

   * @param element
   *            an Element
   * @return the created ApplicableElement
   */
  public ApplicableElement createApplicableElement(Element element) {
    ApplicableElement newApplicableElement = QueryFactory.eINSTANCE
        .createApplicableElement();
    newApplicableElement.setElement(element);
    getQueryResultSet().getApplicableElements().add(newApplicableElement);
    addApplicableElementToCache(newApplicableElement, element);
    return newApplicableElement;
  }
View Full Code Here

TOP

Related Classes of org.emftrace.metamodel.QUARCModel.Query.ApplicableElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.