Esempio n. 1
0
 public void removeFromCache(NodeSub nodeSub, long l)
 {
     try
     {
         if (spaceLeft == 0)
         {
             NodeSub nodeSub_1 = nodeSubList.popTail();
             nodeSub_1.unlink();
             nodeSub_1.unlinkSub();
             if (nodeSub_1 == emptyNodeSub)
             {
                 NodeSub nodeSub_2 = nodeSubList.popTail();
                 nodeSub_2.unlink();
                 nodeSub_2.unlinkSub();
             }
         }
         else
         {
             spaceLeft--;
         }
         nodeCache.removeFromCache(nodeSub, l);
         nodeSubList.insertHead(nodeSub);
         return;
     }
     catch (Exception runtimeexception)
     {
         signlink.reporterror("47547, " + nodeSub + ", " + l + ", " + (byte)2 + ", " + runtimeexception.Message);
     }
     throw new Exception();
 }
Esempio n. 2
0
 public MRUNodes(int i)
 {
     emptyNodeSub = new NodeSub();
     nodeSubList  = new NodeSubList();
     initialCount = i;
     spaceLeft    = i;
     nodeCache    = new NodeCache();
 }
Esempio n. 3
0
        public NodeSub insertFromCache(long l)
        {
            NodeSub nodeSub = (NodeSub)nodeCache.findNodeByID(l);

            if (nodeSub != null)
            {
                nodeSubList.insertHead(nodeSub);
            }
            return(nodeSub);
        }
Esempio n. 4
0
        public int getNodeCount()
        {
            int i = 0;

            for (NodeSub nodeSub = head.prevNodeSub; nodeSub != head; nodeSub = nodeSub.prevNodeSub)
            {
                i++;
            }

            return(i);
        }
Esempio n. 5
0
 public void insertHead(NodeSub nodeSub)
 {
     if (nodeSub.nextNodeSub != null)
     {
         nodeSub.unlinkSub();
     }
     nodeSub.nextNodeSub             = head.nextNodeSub;
     nodeSub.prevNodeSub             = head;
     nodeSub.nextNodeSub.prevNodeSub = nodeSub;
     nodeSub.prevNodeSub.nextNodeSub = nodeSub;
 }
Esempio n. 6
0
        public NodeSub popTail()
        {
            NodeSub nodeSub = head.prevNodeSub;

            if (nodeSub == head)
            {
                return(null);
            }
            else
            {
                nodeSub.unlinkSub();
                return(nodeSub);
            }
        }
Esempio n. 7
0
        public NodeSub reverseGetNext()
        {
            NodeSub nodeSub = current;

            if (nodeSub == head)
            {
                current = null;
                return(null);
            }
            else
            {
                current = nodeSub.prevNodeSub;
                return(nodeSub);
            }
        }
Esempio n. 8
0
 public void unlinkAll()
 {
     do
     {
         NodeSub nodeSub = nodeSubList.popTail();
         if (nodeSub != null)
         {
             nodeSub.unlink();
             nodeSub.unlinkSub();
         }
         else
         {
             spaceLeft = initialCount;
             return;
         }
     } while (true);
 }
Esempio n. 9
0
 public NodeSubList()
 {
     head             = new NodeSub();
     head.prevNodeSub = head;
     head.nextNodeSub = head;
 }