boolean isDisjoint(TypeDeclaration td){
  if (this instanceof UnionType) {
    return false;
  }
  if (this instanceof ClassOrInterface && td instanceof ClassOrInterface && equals(td)) {
    return false;
  }
  if (this instanceof TypeParameter && td instanceof TypeParameter && equals(td)) {
    return false;
  }
  List<Type> sts=getSatisfiedTypes();
  for (int i=0, s=sts.size(); i < s; i++) {
    Type st=sts.get(i);
    if (isDisjoint(td,st)) {
      return true;
    }
  }
  Type et=getExtendedType();
  if (et != null) {
    if (isDisjoint(td,et)) {
      return true;
    }
  }
  return false;
}

boolean isDisjoint ( TypeDeclaration td ) { if ( this instanceof UnionType ) { return false ; } if ( this instanceof ClassOrInterface && td instanceof ClassOrInterface && equals ( td ) ) { return false ; } if ( this instanceof TypeParameter && td instanceof TypeParameter && equals ( td ) ) { return false ; } List < Type > sts = getSatisfiedTypes ( ) ; for ( int i = 0 , s = sts . size ( ) ; i < s ; i ++ ) { Type st = sts . get ( i ) ; if ( isDisjoint ( td , st ) ) { return true ; } } Type et = getExtendedType ( ) ; if ( et != null ) { if ( isDisjoint ( td , et ) ) { return true ; } } return false ; }
implement the rule that foo & bar = = nothing if there exists some enumerated type baz with baz of foo | bar
