private void findLeftmost(RedBlackTree<T> node) { while (node.left != EMPTY) { path = path.cons(node); node = node.left; } this.next = node; }
private void findLeftmost(RedBlackTreeNode<K,V> node) { while (node.left != EMPTY) { path = path.cons(node); node = node.left; } this.next = node; }
public final Cons<E> reverseInto(Cons<E> tail) { Cons<E> result = tail; Cons<E> iter = this; while (iter != EMPTY) { result = result.cons(iter.first); iter = iter.rest; } return result; }
public void registerNewObject(Object obj) { newObjects = newObjects.cons(obj); }
public void registerNewObject(Object obj) { newObjects = newObjects.cons(obj); }
private void findStart(RedBlackTree<T> node, RedBlackTree<T> target) { while (node != target) { path = path.cons(node); int cmp = target.elem.compareTo(node.elem); if (cmp < 0) { node = node.left; } else { node = node.right; } } this.next = node; }
public static void addListener(TxQueueListener listener) { while (true) { Cons<TxQueueListener> old = listeners.get(); if (listeners.compareAndSet(old, old.cons(listener))) { return; } } }
protected static void returnToPool(VBox[] array) { pool.set(pool.get().cons(array)); }
public FunctionalSet<E> addUnique(E obj) { return makeFunctionalSet(size + 1, elems.cons(obj)); }
private static Cons<Method> computePredicatesForClass(Class objClass) { if (objClass != null) { Cons<Method> predicates = computePredicatesForClass(objClass.getSuperclass()); for (Method m : objClass.getDeclaredMethods()) { if (m.isAnnotationPresent(ConsistencyPredicate.class)) { m.setAccessible(true); predicates = predicates.cons(m); } } return predicates; } else { return Cons.empty(); } }
private static Cons<Method> computePredicatesForClass(Class objClass) { if (objClass != null) { Cons<Method> predicates = computePredicatesForClass(objClass.getSuperclass()); for (Method m : objClass.getDeclaredMethods()) { if (m.isAnnotationPresent(ConsistencyPredicate.class) || m.isAnnotationPresent(jvstm.cps.ConsistencyPredicate.class)) { m.setAccessible(true); predicates = predicates.cons(m); } } return predicates; } else { return Cons.empty(); } }
protected Cons<GarbageCollectable> writeBackLoop(int newTxNumber, int min, int max, VBox[] vboxes, Object[] values) { Cons<GarbageCollectable> newBodies = Cons.empty(); for (int i = max - 1; i >= min; i--) { VBox vbox = vboxes[i]; Object newValue = values[i]; VBoxBody newBody = vbox.commit((newValue == ReadWriteTransaction.NULL_VALUE) ? null : newValue, newTxNumber); newBodies = newBodies.cons(newBody); } return newBodies; }
protected <T> void addToReadSet(VBox<T> vbox) { VBox[] readset = null; if (next < 0) { readset = borrowFromPool(); next = readset.length - 1; bodiesRead = bodiesRead.cons(readset); } else { readset = bodiesRead.first(); } readset[next--] = vbox; }
private Cons<GarbageCollectable> doWriteback(int newTxNumber) { GarbageCollectable newLogNode = array.commit(newTxNumber, writesToCommit, logEntryIndexes); return Cons.<GarbageCollectable> empty().cons(newLogNode); } }
@Override public <T> T getArrayValue(VArrayEntry<T> entry) { T value = getLocalArrayValue(entry); if (value == null) { value = entry.getValue(number); arraysRead = arraysRead.cons(entry); } return (value == NULL_VALUE) ? null : value; }
@Override protected Cons<GarbageCollectable> writeBackLoop(int newTxNumber, int min, int max, jvstm.VBox[] vboxes, Object[] values) { Object newValue = VBox.notLoadedValue(); Cons<GarbageCollectable> newBodies = Cons.empty(); for (int i = max - 1; i >= min; i--) { jvstm.VBox vbox = vboxes[i]; logger.debug("Will commit to vbox {} version {} with value {}", ((VBox) vbox).getId(), newTxNumber, newValue); VBoxBody newBody = vbox.commit(newValue, newTxNumber); newBodies = newBodies.cons(newBody); } return newBodies; }
protected Iterator<DependenceRecord> getDependenceRecordsToRecheck() { Cons<Iterator<DependenceRecord>> iteratorsList = Cons.empty(); for (VBox box : boxesWritten.keySet()) { Depended dep = DependedVBoxes.getDependedForBoxIfExists(box); if (dep != null) { iteratorsList = iteratorsList.cons(dep.getDependenceRecords().iterator()); } } return new ChainedIterator<DependenceRecord>(iteratorsList.iterator()); }
@Override public boolean justRemove(E2 obj) { TransactionSupport.logAttrChange(listHolder, attributeName); elementsToRemove.put(elementsToRemove.get().cons(obj)); elementsToAdd.put(elementsToAdd.get().removeAll(obj)); // HACK!!! This is to be fixed upon migration to RelationAwareSet // I wouldn't like to force a load of the list to be able to return the correct boolean value return true; }
@Override public boolean justAdd(E2 obj) { TransactionSupport.logAttrChange(listHolder, attributeName); elementsToAdd.put(elementsToAdd.get().cons(obj)); elementsToRemove.put(elementsToRemove.get().removeAll(obj)); // HACK!!! This is to be fixed upon migration to RelationAwareSet // I wouldn't like to force a load of the list to be able to return the correct boolean value return true; }