private HeldLockSet() { this(Empty.<GuardedByExpression>set()); }
public PCollection<E> minus(Object e) { return Empty.<E>vector().plusAll(this).minus(e); }
public void testBehavesLikePSet() { PSet<Integer> s = Empty.set(); POrderedSet<Integer> os = Empty.orderedSet(); Random r = new Random(); for (int i = 0; i < 100000; i++) { int v = r.nextInt(1000); if (r.nextFloat() < 0.8) { s = s.plus(v); os = os.plus(v); } else { s = s.minus(v); os = os.minus(v); } } assertEquals(s, os); } }
public void testPlus() { POrderedSet<Integer> s = Empty.orderedSet(); s = s.plus(3).plus(2).plus(1).plus(1).plus(2).plus(3).plus(4); int vals[] = new int[] { 3, 2, 1, 4 }; assertEquals(vals.length, s.size()); Iterator<Integer> it = s.iterator(); for (int i = 0; i < vals.length; i++) { assertEquals(vals[i], s.get(i).intValue()); assertEquals(vals[i], it.next().intValue()); } }
public PCollection<E> minusAll(Collection<?> list) { return Empty.<E>vector().plusAll(this).minusAll(list); }
public void testPlusMinus() { POrderedSet<Integer> s = Empty.orderedSet(); s = s.plus(3).plus(2).plus(1).minus(1).plus(2).plus(3).minus(17) .plus(5).plus(1).plus(4); int vals[] = new int[] { 3, 2, 5, 1, 4 }; assertEquals(vals.length, s.size()); Iterator<Integer> it = s.iterator(); for (int i = 0; i < vals.length; i++) { assertEquals(vals[i], s.get(i).intValue()); assertEquals(vals[i], it.next().intValue()); } }
public PCollection<E> minus(Object e) { return Empty.<E>vector().plusAll(this).minus(e); }
private HeldLockSet() { this(Empty.<GuardedByExpression>set()); }
public PCollection<E> minusAll(Collection<?> list) { return Empty.<E>vector().plusAll(this).minusAll(list); }
public AmortizedPQueue<E> minus() { if (size() == 0) { return this; } int fsize = front.size(); if (fsize == 0) { //If there's nothing on front, dump back onto front //(as stacks, this goes in reverse like we want) //and take one off. return new AmortizedPQueue<E>(Empty.<E>stack().plusAll(back), Empty.<E>stack()).minus(); } else if (fsize == 1) { //If there's one element on front, dump back onto front, //but now we've already removed the head. return new AmortizedPQueue<E>(Empty.<E>stack().plusAll(back), Empty.<E>stack()); } else { //If there's more than one on front, we pop one off. return new AmortizedPQueue<E>(front.minus(0), back); } }
public PCollection<E> minusAll(Collection<?> list) { return Empty.<E>vector().plusAll(this).minusAll(list); }
public AmortizedPQueue<E> minus() { if (size() == 0) { return this; } int fsize = front.size(); if (fsize == 0) { //If there's nothing on front, dump back onto front //(as stacks, this goes in reverse like we want) //and take one off. return new AmortizedPQueue<E>(Empty.<E>stack().plusAll(back), Empty.<E>stack()).minus(); } else if (fsize == 1) { //If there's one element on front, dump back onto front, //but now we've already removed the head. return new AmortizedPQueue<E>(Empty.<E>stack().plusAll(back), Empty.<E>stack()); } else { //If there's more than one on front, we pop one off. return new AmortizedPQueue<E>(front.minus(0), back); } }
public PCollection<E> minus(Object e) { return Empty.<E>vector().plusAll(this).minus(e); }
public PCollection<E> minus(Object e) { return Empty.<E>vector().plusAll(this).minus(e); }
public PCollection<E> minusAll(Collection<?> list) { return Empty.<E>vector().plusAll(this).minusAll(list); }
public AmortizedPQueue<E> minus() { if (size() == 0) { return this; } int fsize = front.size(); if (fsize == 0) { //If there's nothing on front, dump back onto front //(as stacks, this goes in reverse like we want) //and take one off. return new AmortizedPQueue<E>(Empty.<E>stack().plusAll(back), Empty.<E>stack()).minus(); } else if (fsize == 1) { //If there's one element on front, dump back onto front, //but now we've already removed the head. return new AmortizedPQueue<E>(Empty.<E>stack().plusAll(back), Empty.<E>stack()); } else { //If there's more than one on front, we pop one off. return new AmortizedPQueue<E>(front.minus(0), back); } }