in src/main/java/org/apache/neethi/util/PolicyIntersector.java [185:205]
public Policy intersect(Policy p1, Policy p2, boolean allowDups) {
Policy compatible = new Policy(p1.getPolicyRegistry(), p1.getNamespace());
ExactlyOne eo = new ExactlyOne(compatible);
if (!compatiblePolicies(p1, p2)) {
return compatible;
}
Iterator<List<Assertion>> i1 = p1.getAlternatives();
while (i1.hasNext()) {
List<Assertion> alt1 = i1.next();
Iterator<List<Assertion>> i2 = p2.getAlternatives();
while (i2.hasNext()) {
List<Assertion> alt2 = i2.next();
All all = createCompatibleAlternatives(alt1, alt2, !allowDups);
if (all != null) {
eo.addPolicyComponent(all);
}
}
}
return compatible;
}