/** * Returns the intersection between this mapping and that. * * @param that The mapping to be intersected to this mapping. * @return The intersection bewteen this and that. */ public Alignment getIntersection(Alignment that) { HashSet<Correspondence> thisCSet = this.getCorrespondencesAsSet(); HashSet<Correspondence> thatCSet = that.getCorrespondencesAsSet(); thisCSet.retainAll(thatCSet); return (new Alignment(thisCSet)); }
/** * Returns the union of this mapping and that. * * @param that The mapping to be unioned with this mapping. * @return The union of this and that. */ public Alignment getUnion(Alignment that) { HashSet<Correspondence> thisCSet = this.getCorrespondencesAsSet(); HashSet<Correspondence> thatCSet = that.getCorrespondencesAsSet(); thisCSet.addAll(thatCSet); return (new Alignment(thisCSet)); }
/** * Returns the set difference between this mapping and that mapping. * * @param that The mapping to be compared to this mapping. * @return The set difference this without that. */ public Alignment getDifference(Alignment that) { HashSet<Correspondence> thisCSet = this.getCorrespondencesAsSet(); HashSet<Correspondence> thatCSet = that.getCorrespondencesAsSet(); thisCSet.removeAll(thatCSet); return (new Alignment(thisCSet)); }