Package soot.util
Interface Chain<E>
-
- Type Parameters:
E- element type
- All Superinterfaces:
Collection<E>,Iterable<E>,Serializable
- All Known Implementing Classes:
EmptyChain,HashChain,IterableSet,PatchingChain,PegChain,SPatchingChain,UnitPatchingChain,UnmodifiableIterableSet
public interface Chain<E> extends Collection<E>, Serializable
Augmented data type guaranteeing O(1) insertion and removal from a set of ordered, unique elements.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddFirst(E u)Adds the given object at the beginning of the Chain.voidaddLast(E u)Adds the given object at the end of the Chain.booleanfollows(E someObject, E someReferenceObject)Returns true if objectsomeObjectfollows objectsomeReferenceObjectin the Chain, i.e.Collection<E>getElementsUnsorted()Gets all elements in the chain.EgetFirst()Returns the first object in this Chain.EgetLast()Returns the last object in this Chain.longgetModificationCount()Returns the number of times this chain has been modified.EgetPredOf(E point)Returns the object immediately precedingpoint.EgetSuccOf(E point)Returns the object immediately followingpoint.voidinsertAfter(E toInsert, E point)InsertstoInsertin the Chain afterpoint.voidinsertAfter(Collection<? extends E> toInsert, E point)InsertstoInsertin the Chain afterpoint.voidinsertAfter(List<E> toInsert, E point)InsertstoInsertin the Chain afterpoint.voidinsertAfter(Chain<E> toInsert, E point)InsertstoInsertin the Chain afterpoint.voidinsertBefore(E toInsert, E point)InsertstoInsertin the Chain beforepoint.voidinsertBefore(Collection<? extends E> toInsert, E point)InsertstoInsertin the Chain beforepoint.voidinsertBefore(List<E> toInsert, E point)InsertstoInsertin the Chain beforepoint.voidinsertBefore(Chain<E> toInsert, E point)InsertstoInsertin the Chain beforepoint.Iterator<E>iterator()Returns an iterator over this Chain.Iterator<E>iterator(E u)Returns an iterator over this Chain, starting at the given object.Iterator<E>iterator(E head, E tail)Returns an iterator over this Chain, starting at head and reaching tail (inclusive).booleanremove(Object u)Removes the given object from this Chain.voidremoveFirst()Removes the first object contained in this Chain.voidremoveLast()Removes the last object contained in this Chain.intsize()Returns the size of this Chain.Iterator<E>snapshotIterator()Returns an iterator over a copy of this chain.voidswapWith(E out, E in)Replacesoutin the Chain byin.-
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
-
-
-
Method Detail
-
insertBefore
void insertBefore(Chain<E> toInsert, E point)
InsertstoInsertin the Chain beforepoint.
-
insertAfter
void insertAfter(Chain<E> toInsert, E point)
InsertstoInsertin the Chain afterpoint.
-
insertBefore
void insertBefore(List<E> toInsert, E point)
InsertstoInsertin the Chain beforepoint.
-
insertBefore
void insertBefore(Collection<? extends E> toInsert, E point)
InsertstoInsertin the Chain beforepoint.
-
insertAfter
void insertAfter(Collection<? extends E> toInsert, E point)
InsertstoInsertin the Chain afterpoint.
-
remove
boolean remove(Object u)
Removes the given object from this Chain. Parameter has to be of typeObjectto be compatible with theCollectioninterface.- Specified by:
removein interfaceCollection<E>
-
addFirst
void addFirst(E u)
Adds the given object at the beginning of the Chain.
-
addLast
void addLast(E u)
Adds the given object at the end of the Chain.
-
removeFirst
void removeFirst()
Removes the first object contained in this Chain.
-
removeLast
void removeLast()
Removes the last object contained in this Chain.
-
follows
boolean follows(E someObject, E someReferenceObject)
Returns true if objectsomeObjectfollows objectsomeReferenceObjectin the Chain, i.e. someReferenceObject comes first and then someObject.
-
getFirst
E getFirst()
Returns the first object in this Chain.
-
getLast
E getLast()
Returns the last object in this Chain.
-
snapshotIterator
Iterator<E> snapshotIterator()
Returns an iterator over a copy of this chain. This avoids ConcurrentModificationExceptions from being thrown if the underlying Chain is modified during iteration. Do not use this to remove elements which have not yet been iterated over!
-
iterator
Iterator<E> iterator(E u)
Returns an iterator over this Chain, starting at the given object.
-
iterator
Iterator<E> iterator(E head, E tail)
Returns an iterator over this Chain, starting at head and reaching tail (inclusive).
-
size
int size()
Returns the size of this Chain.- Specified by:
sizein interfaceCollection<E>
-
getModificationCount
long getModificationCount()
Returns the number of times this chain has been modified.
-
getElementsUnsorted
Collection<E> getElementsUnsorted()
Gets all elements in the chain. There is no guarantee on sorting. On the other hand, the collection returned by this method is thread-safe. You can iterate over it even in the case of concurrent modifications to the underlying chain.- Returns:
- All elements in the chain in an unsorted collection
-
-