public static Kam intersection(Kam kam1, Kam kam2) throws InvalidArgument {

        if (!kam1.getKamInfo().equals(kam2.getKamInfo())) {
            throw new InvalidArgument(
                    "Kam1 and Kam2 must reference the same kam in the KamStore");
        }
        List<KamEdge> kamEdges = new ArrayList<KamEdge>();

        // Check for edges in Kam1 that are also in Kam2
        for (KamEdge kamEdge : kam1.getEdges()) {
            if (kam2.contains(kamEdge)) {
                kamEdges.add(kamEdge);
            }
        }

        // Create a new Kam with the difference set from both Kams
        Kam newKam = newInstance(kam1);
        newKam.union(kamEdges);
        return newKam;

    }
public static Kam intersection ( Kam kam1 , Kam kam2 ) throws InvalidArgument { if ( ! kam1 . getKamInfo ( ) . equals ( kam2 . getKamInfo ( ) ) ) { throw new InvalidArgument ( "Kam1 and Kam2 must reference the same kam in the KamStore" ) ; } List < KamEdge > kamEdges = new ArrayList < KamEdge > ( ) ; for ( KamEdge kamEdge : kam1 . getEdges ( ) ) { if ( kam2 . contains ( kamEdge ) ) { kamEdges . add ( kamEdge ) ; } } Kam newKam = newInstance ( kam1 ) ; newKam . union ( kamEdges ) ; return newKam ; }
@param kam1
@param kam2
@return
@throws InvalidArgument