예제 #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();
 }
예제 #2
0
 public MRUNodes(int i)
 {
     emptyNodeSub = new NodeSub();
     nodeSubList  = new NodeSubList();
     initialCount = i;
     spaceLeft    = i;
     nodeCache    = new NodeCache();
 }
예제 #3
0
        public NodeSub insertFromCache(long l)
        {
            NodeSub nodeSub = (NodeSub)nodeCache.findNodeByID(l);

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

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

            return(i);
        }
예제 #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;
 }
예제 #6
0
        public NodeSub popTail()
        {
            NodeSub nodeSub = head.prevNodeSub;

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

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