Package org.deckfour.xes.model.buffered
Class XFastEventList
- java.lang.Object
-
- org.deckfour.xes.model.buffered.XFastEventList
-
- All Implemented Interfaces:
java.lang.Cloneable
public class XFastEventList extends java.lang.Object implements java.lang.CloneableImplements a fast list of events stored in disk buffers, by using the means of the NikeFS2 virtual file system for event logs. Frees main memory for other tasks, while guaranteeing quick sequential and random access to event log data.- Author:
- Christian W. Guenther (christian@deckfour.org)
-
-
Field Summary
Fields Modifier and Type Field Description protected XAttributeMapSerializerattributeMapSerializerAttribute map serializer.protected XSequentialEventBufferbufferSequential event buffer used for raw buffered storage.protected java.util.BitSetholeFlagsIndicates the positions in the list which are no longer valid, i.e.static intOVERFLOW_LIMITMaximal number of buffered edit operations on the list, before it is consolidated to the disk buffer.protected XEvent[]overflowEntriesArray of additional overflow entries.protected int[]overflowIndicesArray of list indices for additional overflow entries.protected intoverflowSizeCurrent, actual size of the overflow data structures.protected intsizeSize of the list.
-
Constructor Summary
Constructors Constructor Description XFastEventList(XAttributeMapSerializer attributeMapSerializer)Creates a new fast event list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intappend(XEvent event)Appends the given event to the end of this fast event list.voidcleanup()Cleans up this fast event list after use, frees all associated resources.java.lang.Objectclone()Creates a clone of this list.booleanconsolidate()Consolidates this fast event list.protected voidfinalize()XEventget(int index)Retrieves an event at a specific index in the list.voidinsert(XEvent event, int index)Inserts an event at a given index into the list.intinsertOrdered(XEvent event)Inserts the given event at its logical position in the list.booleanisTainted()Checks whether this list needs consolidation, i.e.XEventremove(int index)Removes the event at the given index from this list.XEventreplace(XEvent event, int index)Replaces the event at the given index with another event.intsize()Returns the size of this event list.
-
-
-
Field Detail
-
OVERFLOW_LIMIT
public static int OVERFLOW_LIMIT
Maximal number of buffered edit operations on the list, before it is consolidated to the disk buffer.
-
size
protected int size
Size of the list.
-
buffer
protected XSequentialEventBuffer buffer
Sequential event buffer used for raw buffered storage.
-
attributeMapSerializer
protected XAttributeMapSerializer attributeMapSerializer
Attribute map serializer.
-
holeFlags
protected java.util.BitSet holeFlags
Indicates the positions in the list which are no longer valid, i.e. need to be skipped.
-
overflowIndices
protected int[] overflowIndices
Array of list indices for additional overflow entries.
-
overflowEntries
protected XEvent[] overflowEntries
Array of additional overflow entries.
-
overflowSize
protected int overflowSize
Current, actual size of the overflow data structures.
-
-
Constructor Detail
-
XFastEventList
public XFastEventList(XAttributeMapSerializer attributeMapSerializer) throws java.io.IOException
Creates a new fast event list.- Parameters:
attributeMapSerializer- The attribute map serializer to be used.- Throws:
java.io.IOException
-
-
Method Detail
-
append
public int append(XEvent event) throws java.io.IOException
Appends the given event to the end of this fast event list.- Parameters:
event- Event to be added.- Returns:
- Index of the added event.
- Throws:
java.io.IOException
-
cleanup
public void cleanup() throws java.io.IOExceptionCleans up this fast event list after use, frees all associated resources.- Throws:
java.io.IOException
-
consolidate
public boolean consolidate() throws java.io.IOExceptionConsolidates this fast event list. Consolidation implies, that all overflow and skipping data structures are freed, and the buffered representation is brought completely in-line with the virtual current contents of the list. The actual consolidation will be skipped, if no need for it is detected by the algorithm.- Returns:
- Whether consolidation has been performed.
- Throws:
java.io.IOException
-
get
public XEvent get(int index) throws java.lang.IndexOutOfBoundsException, java.io.IOException
Retrieves an event at a specific index in the list.- Parameters:
index- Index of the required event in the list.- Returns:
- The requested event.
- Throws:
java.lang.IndexOutOfBoundsExceptionjava.io.IOException
-
insert
public void insert(XEvent event, int index) throws java.lang.IndexOutOfBoundsException, java.io.IOException
Inserts an event at a given index into the list.- Parameters:
event- The event to be inserted.index- Requested index of the inserted event.- Throws:
java.lang.IndexOutOfBoundsExceptionjava.io.IOException
-
insertOrdered
public int insertOrdered(XEvent event) throws java.io.IOException
Inserts the given event at its logical position in the list. The logical position is determined from timestamp information, if available. Otherwise, the event is appended to the end of the list.- Parameters:
event- Event to be inserted.- Returns:
- Position of the event after insertion.
- Throws:
java.io.IOException
-
isTainted
public boolean isTainted()
Checks whether this list needs consolidation, i.e. whether the overflow and skipping structures have any content.- Returns:
- Whether this list is tainted.
-
remove
public XEvent remove(int index) throws java.lang.IndexOutOfBoundsException, java.io.IOException
Removes the event at the given index from this list.- Parameters:
index- Index of the event to be removed.- Returns:
- The removed event.
- Throws:
java.lang.IndexOutOfBoundsExceptionjava.io.IOException
-
replace
public XEvent replace(XEvent event, int index) throws java.lang.IndexOutOfBoundsException, java.io.IOException
Replaces the event at the given index with another event.- Parameters:
event- Event to be inserted at the given position.index- Position to replace event at.- Returns:
- The removed event, which has been replaced.
- Throws:
java.lang.IndexOutOfBoundsExceptionjava.io.IOException
-
size
public int size()
Returns the size of this event list.- Returns:
- The number of currently contained events.
-
clone
public java.lang.Object clone()
Creates a clone of this list.- Overrides:
clonein classjava.lang.Object
-
finalize
protected void finalize() throws java.lang.Throwable- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
-