package lawOfDemeter.classform;
import java.util.*;

/**
 * @authors David H. Lorenz and Pengcheng Wu
 * @version 0.4, 12/19/02
 */


abstract aspect Pertype extends
  ClassSupplier {
  abstract pointcut Pertype();  
  before(): Pertype() {
    targets.put(thisJoinPointStaticPart.
      getSignature().getDeclaringType(), 
      getSuppliers(thisEnclosingJoinPointStaticPart,
        thisJoinPointStaticPart));
  }

  protected static boolean contains(Class thisType,
    Class targetType) {
    if(targets.containsKey(thisType)) {
      List alloweds = (List)targets.get(thisType);
      Iterator it=alloweds.iterator();
      while(it.hasNext()) {
        if(targetType==it.next()) 
          return true; 
      }
    }
    return Perscope.contains(targetType);
  }
  private static HashMap targets = new
    HashMap();
}

