public void intersection(FlowSet otherFlow, FlowSet destFlow) { if (sameType(otherFlow) && sameType(destFlow)) { ArraySparseSet other = (ArraySparseSet) otherFlow; ArraySparseSet dest = (ArraySparseSet) destFlow; ArraySparseSet workingSet; if (dest == other || dest == this) workingSet = new ArraySparseSet(); else { workingSet = dest; workingSet.clear(); } for (int i = 0; i < this.numElements; i++) { if (other.contains(this.elements[i])) workingSet.add(this.elements[i]); } if (workingSet != dest) workingSet.copy(dest); } else super.intersection(otherFlow, destFlow); }
public void intersection(FlowSet other) { intersection(other, this); }