Пример #1
0
 /*
 ****************************************************************************
 * 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;
 }
Пример #2
0
 /*
 ****************************************************************************
 * Constructor()
 ****************************************************************************
 */
 /**
  *
  */
 internal CacheResult(CacheNode oNode, int nNumFound)
 {
     moLastCacheNode = oNode;
     mnNumFound = nNumFound;
 }
Пример #3
0
 /*
 ****************************************************************************
 * Constructor()
 ****************************************************************************
 */
 /**
  * Creates a Cache structure with the specified maximum size
  */
 Cache(int nSize)
 {
     moRootNode = new CacheNode(this);
     mnMaxSize = nSize;
 }
Пример #4
0
 /*
 ****************************************************************************
 * 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;
 }
Пример #5
0
        /*
        ****************************************************************************
        * 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();
        }
Пример #6
0
        /*
        ****************************************************************************
        * 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;
        }
Пример #7
0
        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;
        }
Пример #8
0
    /*
    ****************************************************************************
    * Constructor()
    ****************************************************************************
    */ /**
    *
    */
    CacheResult(CacheNode oNode, int nNumFound)
    {
        moLastCacheNode = oNode;
        mnNumFound = nNumFound;

    } // Constructor()
Пример #9
0
    } // 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()
Пример #10
0
    /*
    ****************************************************************************
    * Constructor()
    ****************************************************************************
    */ /**
    * Creates a Cache structure with the specified maximum size
    */
    Cache(int nSize)
    {
        moRootNode = new CacheNode(this);
        mnMaxSize = nSize;

    } // Constructor()
Пример #11
0
    /*
    ****************************************************************************
    * 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()