private TIntHashSet getIntersection(TIntHashSet contextA, TIntHashSet contextB) { TIntHashSet is = new TIntHashSet(); for (int a : contextA.toArray()) { if (contextB.contains(a) || contextB.contains(DataAccess.expandTerm(a))) { is.add(a); } } return is; }
private TIntHashSet getUnion(TIntHashSet contextA, TIntHashSet contextB) { TIntHashSet union = new TIntHashSet(); for (int a : contextB.toArray()) { union.add(a); } for (int a : contextA.toArray()) { if (!union.contains(a) && !union.contains(DataAccess.expandTerm(a))) { union.add(a); } } return union; }