=-1;j++)
time_lru[j]++;
}
this.rate=1-(float)npageNum/320;
dataStrings[blockNum][3]=this.rate+"";
}
publicintgetBlockNum(){
returnblockNum;
}
publicvoidsetBlockNum(intblockNum){
this.blockNum=blockNum;
}
publicString[][]getDataStrings(){
returndataStrings;
}
publicvoidsetDataStrings(String[][]dataStrings){
this.dataStrings=dataStrings;
}
}
2.界面类
packageMemoryManagement;
importorg.eclipse.swt.widgets.Display;
importorg.eclipse.swt.widgets.MessageBox;
importorg.eclipse.swt.widgets.Shell;
importorg.eclipse.swt.widgets.Menu;
importorg.eclipse.swt.widgets.TableItem;
importorg.eclipse.swt.SWT;
importorg.eclipse.swt.widgets.MenuItem;
importorg.eclipse.swt.widgets.Table;
importorg.eclipse.swt.widgets.TableColumn;
importorg.eclipse.swt.events.SelectionAdapter;
importorg.eclipse.swt.events.SelectionEvent;
publicclassManageSWT{
protectedShellshell;
privateTabletable;
/**
*Launchtheapplication.
*@paramargs
*/
publicstaticvoidmain(String[]args){
try{
ManageSWTwindow=newManageSWT();
window.open();
}catch(Exceptione){
e.printStackTrace();
}
}
/**
*Openthewindow.
*/
publicvoidopen(){
Displaydisplay=Display.getDefault();
createContents();
shell.open();
shell.layout();
while(!
shell.isDisposed()){
if(!
display.readAndDispatch()){
display.sleep();
}
}
}
/**
*Createcontentsofthewindow.
*/
protectedvoidcreateContents(){
shell=newShell();
shell.setSize(450,300);
shell.setText("\u5B58\u50A8\u7BA1\u7406");
Menumenu=newMenu(shell,SWT.BAR);
shell.setMenuBar(menu);
MenuItemmenuItem=newMenuItem(menu,SWT.NONE);
menuItem.addSelectionListener(newSelectionAdapter(){
@Override
publicvoidwidgetSelected(SelectionEvente){
analysis();
}
});
menuItem.setText("\u547D\u4E2D\u7387\u5206\u6790");
MenuItemmenuItem_2=newMenuItem(menu,SWT.NONE);
menuItem_2.addSelectionListener(newSelectionAdapter(){
@Override
publicvoidwidgetSelected(SelectionEvente){
shell.dispose();
}
});
menuItem_2.setText("\u9000\u51FA");
MenuItemmenuItem_1=newMenuItem(menu,SWT.NONE);
menuItem_1.addSelectionListener(newSelectionAdapter(){
@Override
publicvoidwidgetSelected(SelectionEvente){
MessageBoxmessageBox=newMessageBox(shell,SWT.ICON_INFORMATION);
messageBox.setText("关于");
messageBox.setMessage("存储管理\n作者:
章进兴\n0941901228");
messageBox.open();
}
});
menuItem_1.setText("\u5173\u4E8E");
table=newTable(shell,SWT.BORDER|SWT.FULL_SELECTION);
table.setBounds(0,0,434,242);
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableColumntblclmnNewColumn=newTableColumn(table,SWT.NONE);
tblclmnNewColumn.setWidth(90);
tblclmnNewColumn.setText("\u7269\u7406\u5757\u6570");
TableColumntblclmnNewColumn_1=newTableColumn(table,SWT.CENTER);
tblclmnNewColumn_1.setWidth(100);
tblclmnNewColumn_1.setText("\u5148\u8FDB\u5148\u51FA\u7684\u7B97\u6CD5");
TableColumntblclmnNewColumn_2=newTableColumn(table,SWT.CENTER);
tblclmnNewColumn_2.setWidth(110);
tblclmnNewColumn_2.setText("\u6700\u8FD1\u6700\u5C11\u4F7F\u7528\u7B97\u6CD5");
TableColumntblclmnLfu=newTableColumn(table,SWT.CENTER);
tblclmnLfu.setWidth(110);
tblclmnLfu.setText("\u6700\u5C11\u8BBF\u95EE\u9875\u9762\u7B97\u6CD5");
}
publicvoidanalysis(){
table.removeAll();
MemoryManage_OperationmOperation=newMemoryManage_Operation();
mOperation.setProduceAddstream();
String[][]tempStrings=