Example #1
0
  /** Return a Vector of all critics that can be applied to the
   * design material subclass, including inherited critics. */
  public static Vector criticsForClass(Class clazz) {
    Vector critics = (Vector) _cachedCritics.get(clazz);
    if (critics != null) return critics;
    Class origClazz = clazz;
    critics = new Vector();
    while (clazz != null) {
      Vector specificCritics = criticsForSpecificClass(clazz);
      Enumeration cur = specificCritics.elements();
      while (cur.hasMoreElements())
	critics.addElement(cur.nextElement());
      clazz = clazz.getSuperclass();
    }
    _cachedCritics.put(origClazz, critics);
    return critics;
  }
Example #2
0
  //@ 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();
    }
    //}
  }