/* **************************************************************************** * detach() **************************************************************************** */ /** * Detaches this CacheNode from the queue. Synchronized externally. */ private void detach() { // remove yourself from the current spot in the list moPrev.moNext = moNext; moNext.moPrev = moPrev; moNext = null; moPrev = null; }
/* **************************************************************************** * Constructor() **************************************************************************** */ /** * */ internal CacheResult(CacheNode oNode, int nNumFound) { moLastCacheNode = oNode; mnNumFound = nNumFound; }
/* **************************************************************************** * Constructor() **************************************************************************** */ /** * Creates a Cache structure with the specified maximum size */ Cache(int nSize) { moRootNode = new CacheNode(this); mnMaxSize = nSize; }
/* **************************************************************************** * addToFront() **************************************************************************** */ /** * Places this CacheNode in the front of the queue. Synchronized externally. */ private void addToFront() { // insert the new node right after the root node moPrev = moCache.moRootNode; moNext = moCache.moRootNode.moNext; moCache.moRootNode.moNext = this; moNext.moPrev = this; }
/* **************************************************************************** * Constructor() **************************************************************************** */ /** * This is used to add a new CacheNode to the cache */ CacheNode(CacheNode oParent, string sSubsegment) { // we need to keep track of these for the removeSelf method moParent = oParent; msSubsegment = sSubsegment; moCache = oParent.moCache; moCache.increment(); addToFront(); }
/* **************************************************************************** * mkdir() **************************************************************************** */ /** * Creates a CacheNode under this CacheNode for the specified subsegment */ internal CacheNode mkdir(string sSubSegment) { CacheNode oNode = find(sSubSegment); if (oNode == null) { oNode = new CacheNode(this, sSubSegment); moCacheHash[sSubSegment] = oNode; } return oNode; }
Hashtable moCacheHash = new Hashtable(); // this was a synchronized object in java #endregion Fields #region Constructors /* **************************************************************************** * Constructor() **************************************************************************** */ /** * This constructor is used only for the root node, makes a circular * doubly linked list */ internal CacheNode(Cache oCache) { moCache = oCache; moNext = this; moPrev = this; }
/* **************************************************************************** * Constructor() **************************************************************************** */ /** * */ CacheResult(CacheNode oNode, int nNumFound) { moLastCacheNode = oNode; mnNumFound = nNumFound; } // Constructor()
} // mkdir() /* **************************************************************************** * mkdir() **************************************************************************** */ /** * Creates a CacheNode under this CacheNode for the specified subsegment */ CacheNode mkdir(String sSubSegment) { CacheNode oNode = find(sSubSegment); if (oNode == null) { oNode = new CacheNode(this, sSubSegment); moCacheHash.put(sSubSegment, oNode); } return oNode; } // mkdir()
/* **************************************************************************** * Constructor() **************************************************************************** */ /** * Creates a Cache structure with the specified maximum size */ Cache(int nSize) { moRootNode = new CacheNode(this); mnMaxSize = nSize; } // Constructor()
/* **************************************************************************** * Constructor() **************************************************************************** */ /** * This constructor is used only for the root node, makes a circular * doubly linked list */ CacheNode(Cache oCache) { moCache = oCache; moNext = this; moPrev = this; } // Constructor()