public static ISet Union(ISet x, object y) { ISet set = SetHelpers.MakeSet(x, x); IEnumerator ie = PythonOps.GetEnumerator(y); while (ie.MoveNext()) { set.PrivAdd(ie.Current); } return(set); }
public ISet __rsub__(ISet s) { SetCollection set = s as SetCollection; if (set != null) { return(set.Difference(this)); } return(SetHelpers.MakeSet(this, s.PrivDifference(this))); }
public FrozenSetCollection copy() { // Python behavior: If we're a non-derived frozen set, we return ourselves. // If we're a derived frozen set we make a new set of our type that contains our // contents. if (this.GetType() == typeof(FrozenSetCollection)) { return(this); } FrozenSetCollection set = (FrozenSetCollection)SetHelpers.MakeSet(this, this); return(set); }
public ISet OperatorReverseSubtract(ISet s) { FrozenSetCollection fs = s as FrozenSetCollection; if (fs != null) { return(fs.Difference(this)); } ISet set = SetHelpers.MakeSet(this, s.PrivDifference(this)); set.PrivFreeze(); return(set); }
public ISet __rxor__(ISet s) { if (s.GetLength() < GetLength()) { return(SymmetricDifference(s)); } SetCollection set = s as SetCollection; if (set != null) { return(set.SymmetricDifference(this)); } return(SetHelpers.MakeSet(this, s.PrivSymmetricDifference(this))); }
public static ISet Difference(ISet x, object y) { ISet res = SetHelpers.MakeSet(x, x); IEnumerator ie = PythonOps.GetEnumerator(y); while (ie.MoveNext()) { if (res.__contains__(ie.Current)) { res.PrivRemove(ie.Current); } } return(res); }
public static ISet Intersection(ISet x, object y) { ISet res = SetHelpers.MakeSet(x); IEnumerator ie = PythonOps.GetEnumerator(y); while (ie.MoveNext()) { if (x.__contains__(ie.Current)) { res.PrivAdd(ie.Current); } } return(res); }
public ISet __ror__(ISet s) { if (s.GetLength() < GetLength()) { return(Union(s)); } SetCollection set = s as SetCollection; if (set != null) { return(set.Union(this)); } return(SetHelpers.MakeSet(this, s.PrivUnion(this))); }
public static ISet Intersection(ISet x, object y) { ISet res = SetHelpers.MakeSet(x); IEnumerator ie = Ops.GetEnumerator(y); while (ie.MoveNext()) { if (x.Contains(ie.Current) == Ops.TRUE) { res.PrivAdd(ie.Current); } } res.PrivFreeze(); return(res); }
public ISet OperatorReverseXor(ISet s) { if (s.GetLength() < GetLength()) { return(SymmetricDifference(s)); } FrozenSetCollection fs = s as FrozenSetCollection; if (fs != null) { return(fs.SymmetricDifference(this)); } ISet set = SetHelpers.MakeSet(this, s.PrivSymmetricDifference(this)); set.PrivFreeze(); return(set); }
public object OperatorReverseOr(ISet s) { if (s.GetLength() < GetLength()) { return(Union(s)); } FrozenSetCollection fs = s as FrozenSetCollection; if (fs != null) { return(fs.Union(this)); } ISet set = SetHelpers.MakeSet(this, s.PrivUnion(this)); set.PrivFreeze(); return(set); }
public static ISet Difference(ISet x, object y) { ISet res = SetHelpers.MakeSet(x, x) as ISet; Debug.Assert(res != null); IEnumerator ie = Ops.GetEnumerator(y); while (ie.MoveNext()) { if (res.Contains(ie.Current) == Ops.TRUE) { res.PrivRemove(ie.Current); } } res.PrivFreeze(); return(res); }
public static ISet SymmetricDifference(ISet x, object y) { SetCollection otherSet = new SetCollection(PythonOps.GetEnumerator(y)); //make a set to deal w/ dups in the enumerator ISet res = SetHelpers.MakeSet(x, x) as ISet; Debug.Assert(res != null); foreach (object o in otherSet) { if (res.__contains__(o)) { res.PrivRemove(o); } else { res.PrivAdd(o); } } return(res); }
public ISet difference() { return(SetHelpers.MakeSet(this, this)); }
public ISet intersection() { return(SetHelpers.MakeSet(this, this)); }
public ISet union() { return(SetHelpers.MakeSet(this, this)); }