예제 #1
0
파일: Agency.java 프로젝트: cflewis/argouml
  public static void applyCritics(Object dm, Designer d, Vector
				  critics, long reasonCode) {
    int size = critics.size();
//     if (_hot) System.out.println("----------");
//     if (_hot) System.out.println("HOT: " +
// 				 Long.toBinaryString(reasonCode) +
// 				 " " +  dm);
    for (int i = 0; i < size; i++) {
      Critic c = (Critic) critics.elementAt(i);
      if (c.isActive() && c.matchReason(reasonCode)) {
// 	if (_hot) System.out.println("hot: " +
// 				     Long.toBinaryString(c.getTriggerMask()) +
// 				     " " + c.getClass().getName());
	try {
	  //_numCriticsApplied++;
	  c.critique(dm, d);
	}
	catch (Exception ex) {
	  System.out.println("Exception raised in critique");
	  System.out.println(c.toString());
	  System.out.println(dm.toString());
	  ex.printStackTrace();
	  System.out.println("----------");
	}
      }
    }
  }
예제 #2
0
파일: Agency.java 프로젝트: cflewis/argouml
  //@ should loop over simpler vector of critics, not CompoundCritics
  public void determineActiveCritics(Designer d) {
    //     Enumeration clazzEnum = getCriticRegistry().keys();
    //     while (clazzEnum.hasMoreElements()) {
    //       Class clazz = (Class) (clazzEnum.nextElement());
    Enumeration criticEnum = _critics.elements();
    while (criticEnum.hasMoreElements()) {
      Critic c = (Critic)(criticEnum.nextElement());
      if (_controlMech.isRelevant(c, d)) {
	//System.out.println("Activated: " + c.toString());
	//Dbg.log("debugActivation","Activated: " + c.toString());
	c.beActive();
      }
      else {
	//System.out.println("Deactivated: " + c.toString());
	//Dbg.log("debugActivation","Deactivated: " + c.toString());
	c.beInactive();
      }
	Thread.yield();
    }
    //}
  }