org.processmining.framework.log.rfb
Class AuditTrailEntriesProxy

java.lang.Object
  extended by org.processmining.framework.log.rfb.AuditTrailEntriesProxy
All Implemented Interfaces:
java.lang.Cloneable, AuditTrailEntries

public class AuditTrailEntriesProxy
extends java.lang.Object
implements AuditTrailEntries

This class implements a lightweight proxy, which transparently maps the legacy AuditTrailEntries interface to the actual AuditTrailEntryList interface.

Author:
Christian W. Guenther (christian at deckfour dot com)

Field Summary
protected  AuditTrailEntryList ates
          The proxied container
protected  boolean canRemove
          Flag to ensure at most one removal per invocation of next().
protected  int position
          Memory index for iterator functionality
 
Constructor Summary
AuditTrailEntriesProxy(AuditTrailEntryList ateList, int startPosition)
          Creates a new proxy instance, backed by the provided audit trail entry list and with its iterator set to the specified position in the list.
 
Method Summary
 void add(AuditTrailEntry ate)
          Adds an audit trail entry to the end of the list.
 void add(AuditTrailEntry ate, int pos)
          Adds an audit trail entry to the given position in the list.
 java.lang.Object clone()
          Makes a deep copy of this object.
 AuditTrailEntries cloneIteratorOnly()
          Makes a shallow copy of this object.
 AuditTrailEntry first()
          Gets the first element out of the list of audit trail entries.
 AuditTrailEntry getEntry(int n)
          Retrieves an audit trail entry based on the given position in the list.
 boolean hasNext()
          Iterator-style access method.
 AuditTrailEntry last()
          Gets the last element out of the list of audit trail entries.
 AuditTrailEntry next()
          Iterator-style access method.
 void remove()
          Iterator-style access method.
 void reset()
          Iterator-style access method.
 int size()
          Determines the number of audit trail entries stored in the list.
 java.util.ArrayList toArrayList()
          Returns the list of audit trail entries.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.processmining.framework.log.AuditTrailEntries
toString
 

Field Detail

ates

protected AuditTrailEntryList ates
The proxied container


position

protected int position
Memory index for iterator functionality


canRemove

protected boolean canRemove
Flag to ensure at most one removal per invocation of next().

Constructor Detail

AuditTrailEntriesProxy

public AuditTrailEntriesProxy(AuditTrailEntryList ateList,
                              int startPosition)
Creates a new proxy instance, backed by the provided audit trail entry list and with its iterator set to the specified position in the list.

Parameters:
ateList -
startPosition -
Method Detail

add

public void add(AuditTrailEntry ate)
Description copied from interface: AuditTrailEntries
Adds an audit trail entry to the end of the list.

Specified by:
add in interface AuditTrailEntries
Parameters:
ate - the entry to add

add

public void add(AuditTrailEntry ate,
                int pos)
Description copied from interface: AuditTrailEntries
Adds an audit trail entry to the given position in the list.

Specified by:
add in interface AuditTrailEntries
Parameters:
ate - the entry to add
pos - the position of the entry

cloneIteratorOnly

public AuditTrailEntries cloneIteratorOnly()
Description copied from interface: AuditTrailEntries
Makes a shallow copy of this object. This means that the contained list of AuditTrailEntry elements will be not cloned. However, the iterator is duplicated in its current positon.

Specified by:
cloneIteratorOnly in interface AuditTrailEntries
Returns:
the cloned object

first

public AuditTrailEntry first()
Description copied from interface: AuditTrailEntries
Gets the first element out of the list of audit trail entries.

Specified by:
first in interface AuditTrailEntries
Returns:
the first AuditTrailEntry from the list

getEntry

public AuditTrailEntry getEntry(int n)
Description copied from interface: AuditTrailEntries
Retrieves an audit trail entry based on the given position in the list.

Specified by:
getEntry in interface AuditTrailEntries
Parameters:
n - the index position in the list (starting with 0)
Returns:
the AuditTrailEntry stored at the given position

hasNext

public boolean hasNext()
Description copied from interface: AuditTrailEntries
Iterator-style access method.

Determines whether there is another audit trail entry left. (This relates to the built-in iterator walking through the elements.)

Specified by:
hasNext in interface AuditTrailEntries
Returns:
true if there is at least one audit trail entry left, false otherwise.
See Also:
next

last

public AuditTrailEntry last()
Description copied from interface: AuditTrailEntries
Gets the last element out of the list of audit trail entries.

Specified by:
last in interface AuditTrailEntries
Returns:
the last AuditTrailEntry from the list

next

public AuditTrailEntry next()
Description copied from interface: AuditTrailEntries
Iterator-style access method.

Retrieves the next audit trail entry from the list. (This relates to the built-in iterator walking through the elements and implies moving it one poksition further.) Before calling this method one should call hasNext in order to determine whether there is onother element left.

Specified by:
next in interface AuditTrailEntries
Returns:
the next AuditTrailEntry from the list

remove

public void remove()
Description copied from interface: AuditTrailEntries
Iterator-style access method.

Remove the entry that was returned by the last call to next().

Specified by:
remove in interface AuditTrailEntries

reset

public void reset()
Description copied from interface: AuditTrailEntries
Iterator-style access method.

Resets the built-in iterator to the first element of the list.

Specified by:
reset in interface AuditTrailEntries

size

public int size()
Description copied from interface: AuditTrailEntries
Determines the number of audit trail entries stored in the list.

Specified by:
size in interface AuditTrailEntries
Returns:
the number of audit trail entries

toArrayList

public java.util.ArrayList toArrayList()
Description copied from interface: AuditTrailEntries
Returns the list of audit trail entries.

WARNING: The usage contract for this interface determines, that any changes that you make for the returned array list will not be persistent to both this instance and the potentially wrapped higher-level classes! Use dedicated modification methods for this purpose!

Specified by:
toArrayList in interface AuditTrailEntries
Returns:
the list of audit trail entries as an ArrayList

clone

public java.lang.Object clone()
Description copied from interface: AuditTrailEntries
Makes a deep copy of this object. This means that both the contained list of AuditTrailEntry elements and the iterator in its current positon will be duplicated. Overrides clone.

Specified by:
clone in interface AuditTrailEntries
Overrides:
clone in class java.lang.Object
Returns:
the cloned object