krati.core.array.entry
Class AbstractEntry<T extends EntryValue>

java.lang.Object
  extended by krati.core.array.entry.AbstractEntry<T>
All Implemented Interfaces:
Comparable<Entry<T>>, Entry<T>
Direct Known Subclasses:
PreFillEntry, SimpleEntry

public abstract class AbstractEntry<T extends EntryValue>
extends Object
implements Entry<T>

Entry. Transactional Redo Entry.

Author:
jwu

Field Summary
protected  int _entryCapacity
           
protected  int _entryId
           
protected  long _maxScn
           
protected  long _minScn
           
protected  EntryValueFactory<T> _valFactory
           
 
Fields inherited from interface krati.core.array.entry.Entry
STORAGE_VERSION
 
Constructor Summary
protected AbstractEntry(int entryId, EntryValueFactory<T> valFactory, int initialCapacity)
          Create a new entry to hold updates to an array.
 
Method Summary
 int capacity()
           
 void clear()
          Clears this Entry.
 int compareTo(Entry<T> e)
          Compares this Entry to another Entry for sorting purposes.
 File getFile()
          Gets the Entry file.
 int getId()
           
 long getMaxScn()
          Get the maximum SCN of updates maintained by this Entry.
 long getMinScn()
          Get the minimum SCN of updates maintained by this Entry.
 int getServiceId()
          Gets the service Id of this Entry.
 EntryValueFactory<T> getValueFactory()
           
 boolean isEmpty()
           
 boolean isFull()
           
 void load(File file)
          Loads an entry from a given file.
protected abstract  void loadDataSection(DataReader in, int cnt)
           
protected  void maintainScn(long scn)
           
 void save(File file)
          Saves to a file.
protected abstract  void saveDataSection(DataWriter out)
           
 void setServiceId(int serviceId)
          Sets the service Id of this Entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface krati.core.array.entry.Entry
add, getValueList, size
 

Field Detail

_minScn

protected long _minScn

_maxScn

protected long _maxScn

_entryId

protected final int _entryId

_valFactory

protected final EntryValueFactory<T extends EntryValue> _valFactory

_entryCapacity

protected int _entryCapacity
Constructor Detail

AbstractEntry

protected AbstractEntry(int entryId,
                        EntryValueFactory<T> valFactory,
                        int initialCapacity)
Create a new entry to hold updates to an array.

Parameters:
entryId - The Id of this Entry.
valFactory - The factory for manufacturing EntryValue(s).
initialCapacity - The initial number of values this entry can hold.
Method Detail

getId

public final int getId()
Specified by:
getId in interface Entry<T extends EntryValue>
Returns:
the Id of this Entry.

getServiceId

public final int getServiceId()
Description copied from interface: Entry
Gets the service Id of this Entry.

Specified by:
getServiceId in interface Entry<T extends EntryValue>
Returns:
the service Id of this Entry.

setServiceId

public final void setServiceId(int serviceId)
Description copied from interface: Entry
Sets the service Id of this Entry.

Specified by:
setServiceId in interface Entry<T extends EntryValue>

getFile

public File getFile()
Gets the Entry file.

Specified by:
getFile in interface Entry<T extends EntryValue>
Returns:
this Entry's file.

getMinScn

public final long getMinScn()
Get the minimum SCN of updates maintained by this Entry.

Specified by:
getMinScn in interface Entry<T extends EntryValue>
Returns:
the minimum SCN of updates maintained by this Entry.

getMaxScn

public final long getMaxScn()
Get the maximum SCN of updates maintained by this Entry.

Specified by:
getMaxScn in interface Entry<T extends EntryValue>
Returns:
the maximum SCN of updates maintained by this Entry.

getValueFactory

public final EntryValueFactory<T> getValueFactory()
Specified by:
getValueFactory in interface Entry<T extends EntryValue>
Returns:
the EntryValue factory.

capacity

public final int capacity()
Specified by:
capacity in interface Entry<T extends EntryValue>
Returns:
the capacity of this Entry.

isFull

public final boolean isFull()
Specified by:
isFull in interface Entry<T extends EntryValue>
Returns:
true if this Entry if filled up. Otherwise, false

isEmpty

public final boolean isEmpty()
Specified by:
isEmpty in interface Entry<T extends EntryValue>
Returns:
true if this Entry if empty. Otherwise, false

clear

public void clear()
Description copied from interface: Entry
Clears this Entry.

Specified by:
clear in interface Entry<T extends EntryValue>

compareTo

public int compareTo(Entry<T> e)
Description copied from interface: Entry
Compares this Entry to another Entry for sorting purposes.

Specified by:
compareTo in interface Comparable<Entry<T extends EntryValue>>
Specified by:
compareTo in interface Entry<T extends EntryValue>

save

public final void save(File file)
                throws IOException
Saves to a file.

Specified by:
save in interface Entry<T extends EntryValue>
Parameters:
file -
Throws:
IOException

load

public void load(File file)
          throws IOException
Loads an entry from a given file.

Specified by:
load in interface Entry<T extends EntryValue>
Parameters:
file -
Throws:
IOException

saveDataSection

protected abstract void saveDataSection(DataWriter out)
                                 throws IOException
Throws:
IOException

loadDataSection

protected abstract void loadDataSection(DataReader in,
                                        int cnt)
                                 throws IOException
Throws:
IOException

maintainScn

protected final void maintainScn(long scn)


Copyright © 2011. All Rights Reserved.