public class HashChain<E> extends AbstractCollection<E> implements Chain<E>
Constructor and Description |
---|
HashChain()
Constructs an empty HashChain.
|
HashChain(Chain<E> src)
Constructs a HashChain filled with the contents of the src Chain.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(E item)
Adds the given object to this HashChain.
|
void |
addFirst(E item)
Adds the given object at the beginning of the Chain.
|
void |
addLast(E item)
Adds the given object at the end of the Chain.
|
void |
clear()
Erases the contents of the current HashChain.
|
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
boolean |
follows(E someObject,
E someReferenceObject)
Returns true if object
someObject follows object someReferenceObject in the Chain. |
Collection<E> |
getElementsUnsorted()
Gets all elements in the chain.
|
E |
getFirst()
Returns the first object in this Chain.
|
E |
getLast()
Returns the last object in this Chain.
|
long |
getModificationCount()
Returns the number of times this chain has been modified.
|
E |
getPredOf(E point)
Returns the object immediately preceding
point . |
E |
getSuccOf(E point)
Returns the object immediately following
point . |
void |
insertAfter(Chain<E> toInsert,
E point)
Inserts
toInsert in the Chain after point . |
void |
insertAfter(Collection<? extends E> toInsert,
E point) |
void |
insertAfter(E toInsert,
E point)
Inserts
toInsert in the Chain after point . |
void |
insertAfter(List<E> toInsert,
E point)
Inserts
toInsert in the Chain after point . |
void |
insertBefore(Chain<E> toInsert,
E point)
Inserts
toInsert in the Chain before point . |
void |
insertBefore(Collection<? extends E> toInsert,
E point) |
void |
insertBefore(E toInsert,
E point)
Inserts
toInsert in the Chain before point . |
void |
insertBefore(List<E> toInsert,
E point)
Inserts
toInsert in the Chain before point . |
void |
insertOnEdge(Chain<E> toInsert,
E point_src,
E point_tgt)
Inserts instrumentation in a manner such that the resulting control flow
graph (CFG) of the program will contain
toInsert on an edge
that is defined by point_source and point_target . |
void |
insertOnEdge(Collection<? extends E> toInsert,
E point_src,
E point_tgt)
Inserts instrumentation in a manner such that the resulting control flow
graph (CFG) of the program will contain
toInsert on an edge
that is defined by point_source and point_target . |
void |
insertOnEdge(E toInsert,
E point_src,
E point_tgt)
Inserts instrumentation in a manner such that the resulting control flow
graph (CFG) of the program will contain
toInsert on an edge
that is defined by point_source and point_target . |
void |
insertOnEdge(List<E> toInsert,
E point_src,
E point_tgt)
Inserts instrumentation in a manner such that the resulting control flow
graph (CFG) of the program will contain
toInsert on an edge
that is defined by point_source and point_target . |
Iterator<E> |
iterator()
Returns an iterator over this Chain.
|
Iterator<E> |
iterator(E item)
Returns an iterator over this Chain, starting at the given object.
|
Iterator<E> |
iterator(E head,
E tail)
Returns an iterator ranging from
head to tail ,
inclusive. |
static <T> HashChain<T> |
listToHashChain(List<T> list) |
boolean |
remove(Object item)
Removes the given object from this Chain.
|
void |
removeFirst()
Removes the first object contained in this Chain.
|
void |
removeLast()
Removes the last object contained in this Chain.
|
int |
size()
Returns the size of this Chain.
|
Iterator<E> |
snapshotIterator()
Returns an iterator over a copy of this chain.
|
Iterator<E> |
snapshotIterator(E item) |
void |
swapWith(E out,
E in)
Replaces
out in the Chain by in . |
static <E> List<E> |
toList(Chain<E> c)
Deprecated.
you can use
new ArrayList instead |
String |
toString()
Returns a textual representation of the contents of this Chain.
|
addAll, isEmpty, removeAll, retainAll, toArray, toArray
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray
public void clear()
clear
in interface Collection<E>
clear
in class AbstractCollection<E>
public void swapWith(E out, E in)
Chain
out
in the Chain by in
.public boolean add(E item)
add
in interface Collection<E>
add
in class AbstractCollection<E>
public Collection<E> getElementsUnsorted()
getElementsUnsorted
in interface Chain<E>
@Deprecated public static <E> List<E> toList(Chain<E> c)
new ArrayList(c)
insteadpublic boolean follows(E someObject, E someReferenceObject)
Chain
someObject
follows object someReferenceObject
in the Chain.public boolean contains(Object o)
contains
in interface Collection<E>
contains
in class AbstractCollection<E>
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<E>
containsAll
in class AbstractCollection<E>
public void insertAfter(E toInsert, E point)
Chain
toInsert
in the Chain after point
.insertAfter
in interface Chain<E>
public void insertAfter(Collection<? extends E> toInsert, E point)
public void insertAfter(List<E> toInsert, E point)
Chain
toInsert
in the Chain after point
.insertAfter
in interface Chain<E>
public void insertAfter(Chain<E> toInsert, E point)
Chain
toInsert
in the Chain after point
.
(It would probably be better to make Chain implement List)insertAfter
in interface Chain<E>
public void insertBefore(E toInsert, E point)
Chain
toInsert
in the Chain before point
.insertBefore
in interface Chain<E>
public void insertBefore(Collection<? extends E> toInsert, E point)
public void insertBefore(List<E> toInsert, E point)
Chain
toInsert
in the Chain before point
.insertBefore
in interface Chain<E>
public void insertBefore(Chain<E> toInsert, E point)
Chain
toInsert
in the Chain before point
.
(It would probably be better to make Chain implement List)insertBefore
in interface Chain<E>
public void insertOnEdge(E toInsert, E point_src, E point_tgt)
toInsert
on an edge
that is defined by point_source
and point_target
.insertOnEdge
in interface Chain<E>
toInsert
- the instrumentation to be added in the Chainpoint_src
- the source point of an edge in CFGpoint_tgt
- the target point of an edgepublic void insertOnEdge(Collection<? extends E> toInsert, E point_src, E point_tgt)
toInsert
on an edge
that is defined by point_source
and point_target
.toInsert
- instrumentation to be added in the Chainpoint_src
- the source point of an edge in CFGpoint_tgt
- the target point of an edgepublic void insertOnEdge(List<E> toInsert, E point_src, E point_tgt)
toInsert
on an edge
that is defined by point_source
and point_target
.insertOnEdge
in interface Chain<E>
toInsert
- instrumentation to be added in the Chainpoint_src
- the source point of an edge in CFGpoint_tgt
- the target point of an edgepublic void insertOnEdge(Chain<E> toInsert, E point_src, E point_tgt)
toInsert
on an edge
that is defined by point_source
and point_target
.insertOnEdge
in interface Chain<E>
toInsert
- instrumentation to be added in the Chainpoint_src
- the source point of an edge in CFGpoint_tgt
- the target point of an edgepublic boolean remove(Object item)
Chain
Object
to be compatible
with the Collection
interface.remove
in interface Collection<E>
remove
in interface Chain<E>
remove
in class AbstractCollection<E>
public void addFirst(E item)
Chain
public void addLast(E item)
Chain
public void removeFirst()
Chain
removeFirst
in interface Chain<E>
public void removeLast()
Chain
removeLast
in interface Chain<E>
public E getFirst()
Chain
public E getLast()
Chain
public E getSuccOf(E point) throws NoSuchElementException
Chain
point
.getSuccOf
in interface Chain<E>
NoSuchElementException
public E getPredOf(E point) throws NoSuchElementException
Chain
point
.getPredOf
in interface Chain<E>
NoSuchElementException
public Iterator<E> snapshotIterator()
Chain
snapshotIterator
in interface Chain<E>
public Iterator<E> iterator()
Chain
public Iterator<E> iterator(E item)
Chain
public Iterator<E> iterator(E head, E tail)
Returns an iterator ranging from head
to tail
,
inclusive.
If tail
is the element immediately preceding
head
in this HashChain
, the returned iterator
will iterate 0 times (a special case to allow the specification of an
empty range of elements). Otherwise if tail
is not one of
the elements following head
, the returned iterator will
iterate past the end of the HashChain
, provoking a
NoSuchElementException
.
iterator
in interface Chain<E>
NoSuchElementException
- if head
is not an element of the chain.public int size()
Chain
size
in interface Collection<E>
size
in interface Chain<E>
size
in class AbstractCollection<E>
public String toString()
toString
in class AbstractCollection<E>
public long getModificationCount()
getModificationCount
in interface Chain<E>