palmed.edit.text
Class Cache

java.lang.Object
  extended by palmed.edit.text.Cache
All Implemented Interfaces:
ICache, ISerializable

public final class Cache
extends java.lang.Object
implements ICache

This class implements a cache based on records.

Version:
$Revision$ $Date$
Author:
Mathieu Champlon

Constructor Summary
Cache(IRecordFactory factory, int threshold)
          Create a cache.
 
Method Summary
 void add(ICachable cachable)
          Add a component.
 void clear()
          Clear the cache.
 void delete()
          Delete the cache.
 java.util.Enumeration elements()
          Retrieve an enumeration on all added components.
 void marshall(java.io.OutputStream stream)
          Write to an output stream.
 void unmarshall(java.io.InputStream stream)
          Read from an input stream.
 void wake(ICachable cachable)
          Notify to wake a component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cache

public Cache(IRecordFactory factory,
             int threshold)
Create a cache.

Parameters:
factory - the record factory
threshold - the maximum number of elements in cache at a time
Method Detail

elements

public java.util.Enumeration elements()
Retrieve an enumeration on all added components.

Specified by:
elements in interface ICache
Returns:
an enumeration

add

public void add(ICachable cachable)
Add a component.

Specified by:
add in interface ICache
Parameters:
cachable - the component

wake

public void wake(ICachable cachable)
Notify to wake a component.

Specified by:
wake in interface ICache
Parameters:
cachable - the component

clear

public void clear()
Clear the cache.

Specified by:
clear in interface ICache

unmarshall

public void unmarshall(java.io.InputStream stream)
                throws java.io.IOException
Read from an input stream.

Specified by:
unmarshall in interface ISerializable
Parameters:
stream - the stream to read from
Throws:
java.io.IOException - an io exception occurs

marshall

public void marshall(java.io.OutputStream stream)
              throws java.io.IOException
Write to an output stream.

Specified by:
marshall in interface ISerializable
Parameters:
stream - the stream to write to
Throws:
java.io.IOException - an io exception occurs

delete

public void delete()
Delete the cache.

Specified by:
delete in interface ICache


Copyright © 2004-2006 PalmEd. All Rights Reserved.