Package org.emftrace.metamodel.QUARCModel.Query

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


    Goal g1 = createGoal(gss, 1);
    Goal g2 = createGoal(gss, 2);
   
    Decomposition d1 = createDecomposition(gss, g2, g1);
   
    PrioritizedElement selectedGoal1 = createSelectedGoal(gssQuery, g1, 0);
    PrioritizedElement selectedGoal2 = createSelectedGoal(gssQuery, g2, 0);
   
    createPriorizedDecomposition(gssQuery, d1, 0);

    new RemovePrioritizedElementCommand(gssQuery.getSelectedGoalsSet(), selectedGoal2).runWithoutUnicaseCommand();
   
View Full Code Here


    Goal g3 = createGoal(gss, 3);
   
    Decomposition d1 = createDecomposition(gss, g2, g1);
    Decomposition d2 = createDecomposition(gss, g3, g2);
   
    PrioritizedElement selectedGoal1 = createSelectedGoal(gssQuery, g1, 0);
    PrioritizedElement selectedGoal2 = createSelectedGoal(gssQuery, g2, 0);
    PrioritizedElement selectedGoal3 = createSelectedGoal(gssQuery, g3, 0);
   
    createPriorizedDecomposition(gssQuery, d1, 0);
    createPriorizedDecomposition(gssQuery, d2, 0);
 
    new RemovePrioritizedElementCommand(gssQuery.getSelectedGoalsSet(), selectedGoal2).runWithoutUnicaseCommand();
View Full Code Here

    Goal g3 = createGoal(gss, 3);
   
    Decomposition d1 = createDecomposition(gss, g2, g1);
    Decomposition d2 = createDecomposition(gss, g3, g1);
   
    PrioritizedElement selectedGoal1 = createSelectedGoal(gssQuery, g1, 0);
    PrioritizedElement selectedGoal2 = createSelectedGoal(gssQuery, g2, 0);
    PrioritizedElement selectedGoal3 = createSelectedGoal(gssQuery, g3, 0);
   
    createPriorizedDecomposition(gssQuery, d1, 0);
    createPriorizedDecomposition(gssQuery, d2, 0);
 
    new RemovePrioritizedElementCommand(gssQuery.getSelectedGoalsSet(), selectedGoal3).runWithoutUnicaseCommand();
View Full Code Here

   * simple test without subgoals
   */
  @Test
  public void testSimpleTestWithoutSubgoals() {
    Goal g1 = createGoal(gss, 1);
    PrioritizedElement sg1 =  createSelectedGoal(gssQuery, g1, 80);
   
    Goal g2 = createGoal(gss, 2);
    PrioritizedElement sg2 =  createSelectedGoal(gssQuery, g2, 10);
   
    Goal g3 = createGoal(gss, 3);
    PrioritizedElement sg3 =  createSelectedGoal(gssQuery, g3, 10);


   
    new UpdatePrioritizedElementPriorityCommand(gssQuery.getSelectedGoalsSet(), sg1, "60" ).runWithoutUnicaseCommand();
   

    assertEquals(3, gssQuery.getSelectedGoalsSet().getPrioritizedElements().size());
    assertEquals(0, gssQuery.getSelectedGoalsSet().getPriorizedDecompositionRelations().size());
    assertEquals("60", sg1.getGlobalPriority());

    assertEquals("10", sg2.getGlobalPriority());

    assertEquals("10", sg3.getGlobalPriority());
   
    assertEquals(true,gssQuery.getSelectedGoalsSet().isChanged() );

 
View Full Code Here

    Goal goal = createGoal(gss, 1);
    Goal subgoal = createGoal(gss, 2);
    Decomposition decomposition = createDecomposition(gss, subgoal, goal);
    PrioritizedDecomposition priorizedDecomposition = createPriorizedDecomposition(gssQuery, decomposition, 100);
   
    PrioritizedElement selectedGoal = createSelectedGoal(gssQuery, goal, 100);
    createSelectedGoal(gssQuery, subgoal, 100);

    executeRequiredPhases();
    assertEquals( selectedGoal, priorizedElementsCache.getPrioritizedElement(goal));
  }
View Full Code Here

    Goal goal = createGoal(gss, 1);
    Goal subgoal = createGoal(gss, 2);
    Decomposition decomposition = createDecomposition(gss, subgoal, goal);
    PrioritizedDecomposition priorizedDecomposition = createPriorizedDecomposition(gssQuery, decomposition, 100);
   
    PrioritizedElement selectedGoal = createSelectedGoal(gssQuery, goal, 100);
    createSelectedGoal(gssQuery, subgoal, 100);

    executeRequiredPhases();
    assertEquals(goal , priorizedElementsCache.getElement(selectedGoal));
  }
View Full Code Here

    Decomposition decomposition1 = createDecomposition(gss, subgoal1, goal1);
    Decomposition decomposition2 = createDecomposition(gss, subgoal2, goal1);
    PrioritizedDecomposition priorizedDecomposition1 = createPriorizedDecomposition(gssQuery, decomposition1, 50);
    PrioritizedDecomposition priorizedDecomposition2 = createPriorizedDecomposition(gssQuery, decomposition2, 50);
   
    PrioritizedElement selectedGoal = createSelectedGoal(gssQuery, goal1, 100);
    createSelectedGoal(gssQuery, subgoal1, 50);
    createSelectedGoal(gssQuery, subgoal2, 50);

    executeRequiredPhases();
   
View Full Code Here

    Decomposition decomposition1 = createDecomposition(gss, subgoal1, goal1);
    Decomposition decomposition2 = createDecomposition(gss, subgoal2, goal1);
    PrioritizedDecomposition priorizedDecomposition1 = createPriorizedDecomposition(gssQuery, decomposition1, 50);
    PrioritizedDecomposition priorizedDecomposition2 = createPriorizedDecomposition(gssQuery, decomposition2, 50);
   
    PrioritizedElement selectedGoal = createSelectedGoal(gssQuery, goal1, 100);
    createSelectedGoal(gssQuery, subgoal1, 50);
    createSelectedGoal(gssQuery, subgoal2, 50);

    executeRequiredPhases();
   
View Full Code Here

    Decomposition decomposition3 = createDecomposition(gss, subgoal3, goal2);
    Decomposition decomposition4 = createDecomposition(gss, subgoal4, goal2);
    PrioritizedDecomposition priorizedDecomposition3 = createPriorizedDecomposition(gssQuery, decomposition3, 50);
    PrioritizedDecomposition priorizedDecomposition4 = createPriorizedDecomposition(gssQuery, decomposition4, 50);
   
    PrioritizedElement selectedGoal1 = createSelectedGoal(gssQuery, goal1, 50);
    PrioritizedElement selectedGoal2 = createSelectedGoal(gssQuery, goal2, 50);
   
    Decomposition decomposition5 = createDecomposition(gss, subgoal5, subgoal3);
    Decomposition decomposition6 = createDecomposition(gss, subgoal6, subgoal3);
   
   
    PrioritizedDecomposition priorizedDecomposition5 = createPriorizedDecomposition(gssQuery, decomposition5, 40);
    PrioritizedDecomposition priorizedDecomposition6 = createPriorizedDecomposition(gssQuery, decomposition6, 60);
   
    createSelectedGoal(gssQuery, subgoal1, 25);
    createSelectedGoal(gssQuery, subgoal2, 25);
   

    createSelectedGoal(gssQuery, subgoal3, 25);
    createSelectedGoal(gssQuery, subgoal4, 25);
   
    createSelectedGoal(gssQuery, subgoal5, 10);
    createSelectedGoal(gssQuery, subgoal6, 15);
   

    executeRequiredPhases();
   
    priorizedElementsCache.setPriority(goal1, 80);
    priorizedElementsCache.setPriority(goal2, 20);

    assertEquals(80.0f , priorizedElementsCache.getPrioritizedElementPriority(goal1));
    assertEquals(20.0f , priorizedElementsCache.getPrioritizedElementPriority(goal2));
   
    assertEquals("50", selectedGoal1.getGlobalPriority()); //priority of elements in the emf workspace must be unchanged until flush() is called
    assertEquals("50", selectedGoal2.getGlobalPriority());
   
    assertEquals(new Integer(50) , priorizedElementsCache.getWeight(subgoal1, goal1));
    assertEquals(new Integer(50) , priorizedElementsCache.getWeight(subgoal2, goal1));
   
    assertEquals(40.0f , priorizedElementsCache.getPrioritizedElementPriority(subgoal1));
View Full Code Here

  @Test
  public void testFlush() {
    Goal goal1 = createGoal(gss, 1);
    Goal goal2 = createGoal(gss, 2);
   
    PrioritizedElement selectedGoal1 = createSelectedGoal(gssQuery, goal1, 50);
    PrioritizedElement selectedGoal2 = createSelectedGoal(gssQuery, goal2, 50);


    executeRequiredPhases();
   
    priorizedElementsCache.setPriority(goal1, 80);
    priorizedElementsCache.setPriority(goal2, 20);
    assertEquals( 80.0f, priorizedElementsCache.getPrioritizedElementPriority(goal1));
    assertEquals( 20.0f, priorizedElementsCache.getPrioritizedElementPriority(goal2));
   
    assertEquals( "50", selectedGoal1.getGlobalPriority()); //must be unchanged until flush is called
    assertEquals( "50", selectedGoal2.getGlobalPriority());

    /* due to the use of transactions to write the changes into the modelworkspace, this method could be test to runtime only
    priorizedElementsCache.flush();
    assertEquals( 80.0f, priorizedElementsCache.getPriorizedElementPriority(goal1));
    assertEquals( 20.0f, priorizedElementsCache.getPriorizedElementPriority(goal2));
View Full Code Here

TOP

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

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.