⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 memcache.java

📁 一宗队列算法
💻 JAVA
📖 第 1 页 / 共 2 页
字号:

   /**
   @roseuid 41870B000251
   */
   public boolean InserNewChart(ObjChart newChart)
   {
     NowChart = thefirstchart;
     while(NowChart.NextChart!=null)
     {
       NowChart = NowChart.NextChart;
     }
     NowChart.NextChart = newChart;
     return true;
   }

   /**
   @roseuid 4189858D034B
   */
   public ObjChart SearchChartByName(String sourcefiename)
   {
     NowChart = thefirstchart;
     while(NowChart!=null)
     {
       if((NowChart.GetName()).equals(sourcefiename))
       {
         return NowChart;
       }
       else
       {
         NowChart = NowChart.NextChart;
       }
     }
     return NowChart;
   }

   /**
   @roseuid 418EC35B03D8
   */
   public boolean InsertNewVector(int data, String head, String tail, String sourcename)
   {
     while(!lock)
     {
     }
     if(lock)
     {
       Close();
       ChartEdge NewVector = new ChartEdge();
       NewVector.SetData(data);
       NewVector.Sethead(head);
       NewVector.Settail(tail);
       NowChart = SearchChartByName(sourcename);//先找到对应的转换图
       ChartFirstVex NowVex = NowChart.theFirstVex;
       //再找到向量的起点和终点
       ChartFirstVex headVex,tailVex;
       headVex = null;
       tailVex = null;
       while(NowVex!=null)
       {
         if((NowVex.GetData()).equals(head))
         {
           headVex = NowVex;
         }
         else if((NowVex.GetData()).equals(tail))
         {
           tailVex = NowVex;
         }
         NowVex = NowVex.nextvex;
       }
       if((headVex!=null)&&(tailVex!=null))
       {
         //起点链表
         ChartEdge NowEdage = headVex.firstin;
         if(NowEdage!=null)
         {
           while(NowEdage.Rlink1!=null)
           {
             NowEdage = NowEdage.Rlink1;
           }
           NowEdage.Rlink1 = NewVector;
         }
         else
         {
           headVex.firstin = NewVector;
         }
         //终点链表
         NowEdage = tailVex.firstout;
         if(NowEdage!=null)
         {
           while(NowEdage.Rlink2!=null)
           {
             NowEdage = NowEdage.Rlink2;
           }
           NowEdage.Rlink2 = NewVector;
         }
         else
         {
           tailVex.firstout = NewVector;
         }
         Open();
         return true;
       }
       else
       {
         Open();
         return false;
       }
     }
     return false;
   }

   /**
   @roseuid 418ECAAC0157
   */
   public boolean InsertNewVex(ChartFirstVex aVex)
   {

     return true;
   }

   /**
   @roseuid 418ECB5D0222
   */
   public boolean InsertNewVex(ChartFirstVex aVex, String sourcename)
   {
     if(thefirstchart==null)//在转换图链表中插入新的转换图节点
       {
         thefirstchart = new ObjChart(sourcename);
         thefirstchart.theFirstVex = new ChartFirstVex();//第一个顶点代表原始对象
         thefirstchart.theFirstVex.SetData(sourcename);
         thefirstchart.InsertNewVex(aVex);
         //thefirstchart.theFirstVex.nextvex = aVex;

       }
       else
       {
         NowChart = SearchChartByName(sourcename);
           if(NowChart!=null)//如果存在该对象的转换图节点
           {
             /*ChartFirstVex NowVex = NowChart.theFirstVex;
             while(NowVex.nextvex!=null)
             {
               NowVex = NowVex.nextvex;
             }
             NowVex.nextvex = aVex;*/
             NowChart.InsertNewVex(aVex);
           }
           else//不存在该对象的转换图节点
           {
             ObjChart Newchart = new ObjChart(sourcename);
             Newchart.theFirstVex = new ChartFirstVex();//第一个顶点代表原始对象
             Newchart.theFirstVex.SetData(sourcename);
             //Newchart.theFirstVex.nextvex = aVex;
             Newchart.InsertNewVex(aVex);
             InserNewChart(Newchart);
           }
       }
       return true;
   }

   /**
   @roseuid 418ED8F402EE
   */
   public boolean InsertNewVector(int data, String head, String tail)
   {
     return true;
   }

   /**
   @roseuid 419869310148
   */
   private void AddCacheSize(int addsize)
   {
     CacheSize = CacheSize+addsize;
   }

   /**
   @roseuid 419869750232
   */
   private void SubCacheSize(int subsize)
   {
     CacheSize = CacheSize-subsize;
     if(CacheSize<0)
     {
       CacheSize = 0;
     }
   }

   /**
   @roseuid 419869DB00FA
   */
   public int GetCacheSize()
   {
     return CacheSize;
   }

   /**
   @roseuid 41997F8A032C
   */
   public WebObj GetMinGPFObj()
   {
     NowObj = FirstObj;
     WebObj headObj = FirstObj;
     WebObj MinGPFObj = NowObj;
     if(headObj!=null)
     {
       while(headObj!=null)
       {
         while(NowObj!=null)
         {
           if(MinGPFObj.GetGPF()>NowObj.GetGPF())
           {
             MinGPFObj = NowObj;
           }
           NowObj = NowObj.NextObjEdition;
         }
         headObj = headObj.NextObj;
         NowObj = headObj;
       }
       return MinGPFObj;
     }
     else
     {
       return null;
     }
   }

   /**
   @roseuid 4199C4ED0177
   */
   public WebObj GetTheFirstObj()
   {
     return FirstObj;
   }

   /**
   @roseuid 41CA47500271
   */
   public WebObj GetCachedObj(String SourceFileName, String CachedFileName)
   {
     NowObj = FirstObj;
     while(NowObj!=null)
     {
       if((NowObj.GetSourceFileName()).equals(SourceFileName))
       {
         WebObj CachedObj = NowObj;
         while(CachedObj!=null)
         {
           if(CachedObj.GetCachedFileName().equals(CachedFileName))
           {
             return CachedObj;
           }
           CachedObj = CachedObj.NextObjEdition;
         }
         return null;
       }
       NowObj = NowObj.NextObj;
     }
     return null;
   }

   /**
   @roseuid 41CA610B038A
   */
   public static MemCache Instance()
   {
     if(theCacheInstance == null)
     {
       theCacheInstance = new MemCache();
     }
     return theCacheInstance;
   }

   /**
   @roseuid 41CA622E0186
   */
   public boolean IsLocked()
   {
     return lock;
   }

   /**
   @roseuid 41CA62DE0203
   */
   private boolean Open()
   {
     lock = true;
     return lock;
   }

   /**
   @roseuid 41CA6386009C
   */
   private boolean Close()
   {
     lock = false;
     return lock;
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -