Package org.hibernate.engine.spi
Class ExecutableList<E extends ComparableExecutable>
- java.lang.Object
-
- org.hibernate.engine.spi.ExecutableList<E>
-
- All Implemented Interfaces:
Externalizable
,Serializable
,Iterable<E>
public class ExecutableList<E extends ComparableExecutable> extends Object implements Serializable, Iterable<E>, Externalizable
A list ofexecuteble actions
. Responsible for sorting the executables, and calculating the affected query spaces.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ExecutableList.Sorter<ComparableExecutable>
Provides a sorting interface forExecutableList
.
-
Field Summary
Fields Modifier and Type Field Description static int
INIT_QUEUE_LIST_SIZE
-
Constructor Summary
Constructors Constructor Description ExecutableList()
Creates a new instance with the default settings.ExecutableList(boolean requiresSorting)
ExecutableList(int initialCapacity)
Creates a new instance with the given initial capacity.ExecutableList(int initialCapacity, boolean requiresSorting)
ExecutableList(int initialCapacity, ExecutableList.Sorter<E> sorter)
Creates a new instance with the given initial capacity andExecutableList.Sorter
.ExecutableList(ExecutableList.Sorter<E> sorter)
Creates a new instance using the givenExecutableList.Sorter
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(E executable)
Add anExecutable
to this list.void
afterDeserialize(EventSource session)
Allow theExecutable
s to reassociate themselves with the session after deserialization.void
clear()
Clears the list of executions.E
get(int index)
Set<Serializable>
getQuerySpaces()
Lazily constructs the querySpaces affected by the actions in the list.boolean
isEmpty()
Iterator<E>
iterator()
Returns an iterator for the list.void
readExternal(ObjectInput in)
Read this object state back in from the given stream as part of the deserialization process.ComparableExecutable
remove(int index)
Removes the entry at position index in the list.void
removeLastN(int n)
Removes the last n entries from the list.int
size()
void
sort()
Sorts the list using the natural ordering or using theExecutableList.Sorter
if it's not null.String
toString()
void
writeExternal(ObjectOutput oos)
Write this list out to the given stream as part of serialization-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
INIT_QUEUE_LIST_SIZE
public static final int INIT_QUEUE_LIST_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ExecutableList
public ExecutableList()
Creates a new instance with the default settings.
-
ExecutableList
public ExecutableList(int initialCapacity)
Creates a new instance with the given initial capacity.- Parameters:
initialCapacity
- The initial capacity for instantiating the internal List
-
ExecutableList
public ExecutableList(boolean requiresSorting)
-
ExecutableList
public ExecutableList(int initialCapacity, boolean requiresSorting)
-
ExecutableList
public ExecutableList(ExecutableList.Sorter<E> sorter)
Creates a new instance using the givenExecutableList.Sorter
.- Parameters:
sorter
- The Sorter to use; may benull
-
ExecutableList
public ExecutableList(int initialCapacity, ExecutableList.Sorter<E> sorter)
Creates a new instance with the given initial capacity andExecutableList.Sorter
.- Parameters:
initialCapacity
- The initial capacity for instantiating the internal Listsorter
- The Sorter to use; may benull
-
-
Method Detail
-
getQuerySpaces
public Set<Serializable> getQuerySpaces()
Lazily constructs the querySpaces affected by the actions in the list.- Returns:
- the querySpaces affected by the actions in this list
-
isEmpty
public boolean isEmpty()
- Returns:
- true if the list is empty.
-
remove
public ComparableExecutable remove(int index)
Removes the entry at position index in the list.- Parameters:
index
- The index of the element to remove- Returns:
- the entry that was removed
-
clear
public void clear()
Clears the list of executions.
-
removeLastN
public void removeLastN(int n)
Removes the last n entries from the list.- Parameters:
n
- The number of elements to remove.
-
add
public boolean add(E executable)
Add anExecutable
to this list.- Parameters:
executable
- the executable to add to the list- Returns:
- true if the object was added to the list
-
sort
public void sort()
Sorts the list using the natural ordering or using theExecutableList.Sorter
if it's not null.
-
size
public int size()
- Returns:
- the current size of the list
-
get
public E get(int index)
- Parameters:
index
- The index of the element to retrieve- Returns:
- The element at specified index
-
iterator
public Iterator<E> iterator()
Returns an iterator for the list. Wraps the list just in case something tries to modify it.- Specified by:
iterator
in interfaceIterable<E extends ComparableExecutable>
- Returns:
- an unmodifiable iterator
-
writeExternal
public void writeExternal(ObjectOutput oos) throws IOException
Write this list out to the given stream as part of serialization- Specified by:
writeExternal
in interfaceExternalizable
- Parameters:
oos
- The stream to which to serialize our state- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
Read this object state back in from the given stream as part of the deserialization process.- Specified by:
readExternal
in interfaceExternalizable
- Parameters:
in
- The stream from which to read our serial state- Throws:
IOException
ClassNotFoundException
-
afterDeserialize
public void afterDeserialize(EventSource session)
Allow theExecutable
s to reassociate themselves with the session after deserialization.- Parameters:
session
- The session with which to associate theExecutable
s
-
-