public OrderedSet <T> reverse() { var result = new OrderedSet <T>(this); result.Reverse(); return(result); }
public OrderedSet <T> union(Collection <T> other) { var result = new OrderedSet <T>(this); result.Union(other); return(result); }
public OrderedSet <T> including(T element) { var copy = new OrderedSet <T>(this); copy.add(element); return(copy); }
public OrderedSet <T> excluding(T element) { var copy = new OrderedSet <T>(this); copy.remove(element); return(copy); }
public OrderedSet <T> insertAt(int index, T item) { var result = new OrderedSet <T>(this); result.Insert(index, item); return(result); }
public virtual OrderedSet <T> asOrderedSet() { var set = new OrderedSet <T>(); foreach (T element in this) { set.add(element); } return(set); }
public OrderedSet <T> minus(Set <T> other) { var result = new OrderedSet <T>(this); foreach (T element in other) { result.remove(element); } return(result); }
/// <summary> /// http://download.eclipse.org/ocl/doc/6.0.0/ocl.pdf /// The OrderedSet of elements, consisting of all elements of self, followed by objects. /// </summary> public OrderedSet <T> appendAll(Collection <T> collection) { var result = new OrderedSet <T>(this); foreach (T item in collection) { result.Add(item); } return(result); }
/// <summary> /// http://download.eclipse.org/ocl/doc/6.0.0/ocl.pdf /// The OrderedSet consisting of objects, followed by all elements in self. /// /// OrderedSet{1,2,3}->prependAll(OrderedSet{2,3}) Results 2, 3, 1 /// </summary> public OrderedSet <T> prependAll(Collection <T> collection) { var result = new OrderedSet <T>(collection); foreach (T item in this) { result.add(item); } return(result); }
public OrderedSet <T> select(Func <T, bool> lambda) { var filter = this.Where(lambda); var result = new OrderedSet <T>(); foreach (T element in filter) { result.add(element); } return(result); }
/// <summary> /// http://download.eclipse.org/ocl/doc/6.0.0/ocl.pdf /// The OrderedSet containing all elements of self and objects. /// </summary> public OrderedSet <T> includingAll(Collection <T> collection) { var result = new OrderedSet <T>(this); foreach (T item in collection) { result.add(item); } return(result); }
public virtual OrderedSet <T> prepend(T item) { var result = new OrderedSet <T>(); result.add(item); foreach (T i in this) { result.add(i); } return(result); }
public virtual OrderedSet <T> append(T item) { var copy = new OrderedSet <T>(this); if (this.Contains(item)) { copy.remove(item); } copy.add(item); return(copy); }
public virtual OrderedSet <T> intersection(Set <T> other) { var result = new OrderedSet <T>(); foreach (T item in this) { if (other.Contains(item)) { result.add(item); } } return(result); }
//http://download.eclipse.org/ocl/doc/6.0.0/ocl.pdf public OrderedSet <T> excludingAll(Collection <T> collection) { var result = new OrderedSet <T>(); foreach (T item in this) { if (!collection.Contains(item)) { result.add(item); } } return(result); }
public OrderedSet <T2> collect <T2>(Func <T, T2> lambda) { var result = new OrderedSet <T2>(); foreach (T element in this) { var item = lambda(element); if (item != null) { result.add(item); } } return(result); }
public OrderedSet <T2> selectByType <T2>() { var thisCollection = this; var result = new OrderedSet <T2>(); foreach (T item in thisCollection) { var itemType = item.GetType(); if (itemType == typeof(T2)) { result.Add((T2)Convert.ChangeType(item, typeof(T2))); } } return(result); }
public OrderedSet <T> reject(Func <T, bool> lambda) { var remove = this.Where(lambda); var result = new OrderedSet <T>(); foreach (T element in this) { if (!remove.Contains(element)) { result.add(element); } } return(result); }
public OrderedSet <T2> collect <T2>(Func <T, Collection <T2> > lambda) { var result = new OrderedSet <T2>(); foreach (T element in this) { var e = lambda(element); foreach (T2 ee in e) { result.add(ee); } } return(result); }
public OrderedSet <T> union(OrderedSet <T> other) { var union = new OrderedSet <T>(); foreach (T element in this) { union.add(element); } foreach (T element in other) { union.add(element); } return(union); }
public OrderedSet <T2> flatten <T2>() { var result = new OrderedSet <T2>(); foreach (object element in this) { if (element is OrderedSet <T2> ) { var subcollection = (OrderedSet <T2>)element; foreach (T2 e in subcollection.flatten <T2>().asSet()) { result.add(e); } } else if (element is T2) { var e = (T2)element; result.add(e); } } return(result); }