Ejemplo n.º 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;
 }
Ejemplo n.º 2
0
 /*
 ****************************************************************************
 * Constructor()
 ****************************************************************************
 */
 /**
  *
  */
 internal CacheResult(CacheNode oNode, int nNumFound)
 {
     moLastCacheNode = oNode;
     mnNumFound = nNumFound;
 }
Ejemplo n.º 3
0
 /*
 ****************************************************************************
 * Constructor()
 ****************************************************************************
 */
 /**
  * Creates a Cache structure with the specified maximum size
  */
 Cache(int nSize)
 {
     moRootNode = new CacheNode(this);
     mnMaxSize = nSize;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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();
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 8
0
    /*
    ****************************************************************************
    * Constructor()
    ****************************************************************************
    */ /**
    *
    */
    CacheResult(CacheNode oNode, int nNumFound)
    {
        moLastCacheNode = oNode;
        mnNumFound = nNumFound;

    } // Constructor()
Ejemplo n.º 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()
Ejemplo n.º 10
0
    /*
    ****************************************************************************
    * Constructor()
    ****************************************************************************
    */ /**
    * Creates a Cache structure with the specified maximum size
    */
    Cache(int nSize)
    {
        moRootNode = new CacheNode(this);
        mnMaxSize = nSize;

    } // Constructor()
Ejemplo n.º 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()