?? calculaterect.java
字號(hào):
package com.ysu.cwy;
public class CalculateRect {
private MemoryInit memoryInit; //內(nèi)存初始化對(duì)象
private int y; //上一此所畫矩形的y坐標(biāo)
private int hightInit; //整個(gè)圖形的高度
//構(gòu)造函數(shù)
public CalculateRect(MemoryInit memoryInit,int hightInit) {
super();
this.memoryInit = memoryInit;
y=20;
this.hightInit=hightInit;
}//end method CalculateRect
/**
* @function 計(jì)算表示某個(gè)內(nèi)存塊的矩形的坐標(biāo)
* @param memoryBlock 需要計(jì)算的內(nèi)存快
* @return 返回矩形坐標(biāo)
*/
public Rect calculateRect(MemoryBlock memoryBlock){
Rect rect=null;
int highth=getHight(memoryBlock);
rect=new Rect(y,highth);
y+=(highth+1);
return rect;
}//end method calculateRect
/**
* @function 計(jì)算表示某個(gè)內(nèi)存塊的矩形的高度
* @param memoryBlock 需要計(jì)算的內(nèi)存快
* @return 返回高度
*/
public int getHight(MemoryBlock memoryBlock){
int blockSize=memoryBlock.getBlockSize();
int hight=(int)((float)blockSize*hightInit/(float)memoryInit.getMemorySize());
return hight;
}//end method getHight
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -