Venice 0.7beta

org.mov.quote
Class EODQuoteBundleCache

java.lang.Object
  extended by org.mov.quote.EODQuoteBundleCache

public class EODQuoteBundleCache
extends java.lang.Object

This class is responsible for caching quote bundles. When a EODQuoteBundle is created it tries to load itself into memory by calling the load() method in this class. When this method is called, this class will make sure that all of its quotes are loaded in the EODQuoteCache. If not, it will try and load only the quotes not present in the quote cache.

When this class loads quotes into the quote cache, it will check to make sure the quote cache hasn't got too big. If it has, it will free up the quotes used only by the oldest quote caches.

Its possible that the oldest quote bundle is still in use, in which case when the quote bundle tries to access the cache it might not find its quote. If thats the case, it will call load() again to reload the quotes.

See Also:
EODQuote, EODQuoteBundle, EODQuoteCache, Symbol

Method Summary
 void expand(EODQuoteBundle quoteBundle, EODQuoteRange expandedQuoteRange)
          Expand the given quote bundle to include quotes from the new quote range.
static EODQuoteBundleCache getInstance()
          Create or return the singleton instance of the quote bundle cache.
 boolean isLoaded(EODQuoteBundle quoteBundle)
          Return whether the given quote bundle is loaded or not.
 void load(EODQuoteBundle quoteBundle)
          Make sure all the quotes needed by the quote bundle are in the quote cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static EODQuoteBundleCache getInstance()
Create or return the singleton instance of the quote bundle cache.

Returns:
singleton instance of this class

expand

public void expand(EODQuoteBundle quoteBundle,
                   EODQuoteRange expandedQuoteRange)
Expand the given quote bundle to include quotes from the new quote range. When this function is called, the quote bundle should still have its old quote range. It will be updated by this function.

Parameters:
quoteBundle - the quote bundle to expand
expandedQuoteRange - the quote bundles new quote range

load

public void load(EODQuoteBundle quoteBundle)
Make sure all the quotes needed by the quote bundle are in the quote cache.

Parameters:
quoteBundle - the quote bundle to load
See Also:
EODQuoteCache

isLoaded

public boolean isLoaded(EODQuoteBundle quoteBundle)
Return whether the given quote bundle is loaded or not.

Parameters:
quoteBundle - the quote bundle to check
Returns:
true if the quote bundle is loaded

Venice 0.7beta