您的当前位置:首页正文

资源分配和管理的银行家算法 银行家算法实验报告

2024-08-16 来源:汇智旅游网


《操作系统》实验报告

年级、专业、班级 实验题目 实验时间 2013.05.14 实验成绩 姓名 资源分配和管理的银行家算法 实验地点 实验性质 主教0416 □验证性 □设计性 □综合性 教师评价: □算法/实验过程正确; □源程序/实验内容提交 □程序结构/实验步骤合理; □实验结果正确; □语法、语义正确; □报告规范; 其他: 评价教师签名: 一、实验目的 学习分配和管理资源的银行家算法,了解死锁避免方法。 二、实验项目内容 编写程序实现教材6.3.2节的银行家算法 程序功能: 1. 程序随机生成进程数量(>10)、资源种类(>3)、每类资源总数量(>3)、进程的申请资源的数量(>0)、已分配资源的数量、可用资源数量等; 2. 输出每一个进程的资源分配情况; 3. 输出每一步的资源分配情况和进程执行序列(安全序列)。 4. 指出每一次资源分配后系统是否处于安全状态。 报告创建时间:2013.05.16

三、实验过程或算法(源程序) 3.1算法思路: 先对用户提出的请求进行合法性检查,即检查请求是否大于需要的,是否大于可利用的。若请求合法,则进行预分配,对分配后的状态调用安全性算法进行检查。若安全,则分配;若不安全,则拒绝申请,恢复到原来的状态,拒绝申请。 3.2银行家算法步骤 (1)如果Request[i]<=Need,则转向步骤(2);否则,认为出错,因为它所需要的资源数已超过它所宣布的最大值。 (2)如果Request[i]<=Available,则转向步骤(3);否则,表示系统中尚无足够的资源,进程必须等待。 (3)系统试探把要求的资源分配给进程Pi,并修改下面数据结构中的数值: Available=Available-Request[i]; Allocation=Allocation+Request; Need=Need-Request; (4)系统执行安全性算法,检查此次资源分配后,系统是否处于安全状态。 3.3安全性算法步骤 (1)设置工作向量 ①工作向量Work。它表示系统可提供进程继续运行所需要的各类资源数目,执行安全算法开始时,Work=Available; ②定义判断一个进程是否执行完毕的方法:boolean isFinished()。 (2)从进程集合中找到一个能满足下述条件的进程: 报告创建时间:2013.05.16

①process.isFinished()返回值为true. ②Need<=Work 如找到,执行步骤(3);否则,执行步骤(4)。 (3)当进程P获得资源后,可顺利执行,直至完成,并释放出分配给它的资源,故应执行: Work=Work+Allocation; Allocation += Need; 转向步骤(2)。 (4)如果所有进程的均执行完毕即isAllFinished()返回值为true,则表示系统处于安全状态;否则,系统处于不安全状态。 3.4数据结构: 3.4. 1主要用到的数据结构: (1) 保存进程最大资源需求量的矩阵: int[] _maxNeed (2) 保存进程已分配资源量的矩阵: int[] _allocated (3) 保存进程标识符的字符串:String _id (4) 保存系统中各资源总数的矩阵:int[] _totalResource (5) 表示申请资源的进程队列:ArrayList _processes (6) 表示系统资源种类数的整数:int _resourceClassCount (7) 存储执行信息:StringBuffer _executeInfo 3.4. 2程序模块: 代表进程的类:Process.java 代表银行家算法的类:BankerAlgorithm.java 报告创建时间:2013.05.16

算法的主界面:BankerUI.java 3.4. 3各模块间的调用关系: BankerUI是程序执行的主界面,输入系统资源种类数之后,其通过程序随机生成进程数量(>10)、资源种类(>3)、每类资源总数量(>3)、进程的申请资源的数量(>0)、已分配资源的数量、可用资源数量等。其中所用针对系统进程和资源的操作均需要调用类BankerAlgorithm的方法。 3.5主要函数的核心代码: 1. 进行初始化输入的函数 2. 打印输出的函数 3. 利用安全性算法进行检测的函数 4. 进行资源分配的函数 5. 利用行家算法进行判定的函数 注:具体代码请见附录—源程序清单。 程序流程图: 1、系统主要过程流程图: 报告创建时间:2013.05.16

2、进程请求资源序列图 报告创建时间:2013.05.16

3、安全性算法序列图 四、实验结果及分析和(或)源程序调试过程 4.1 主界面: 报告创建时间:2013.05.16

4.2点击“随机生成”按钮,随机生成进程数量(>10)、资源种类(>3)、每类资源总数量(>3)、进程的申请资源的数量(>0)、已分配资源的数量、可用资源数量,并向系统中添加进程,显示进程的资源分配情况。 报告创建时间:2013.05.16

4.3点击“分配资源”按钮,检查系统是否安全,如果当前系统安全,则输出安全队列,并给第一个安全进程分配资源。 若安全: 若不安全,则“执行结果”提示框会提示: 报告创建时间:2013.05.16

4.4点击“执行进程”按钮,执行已经分配资源的进程,并将其从队列中移除。 4.5点击“分配资源”按钮,重新检测当前系统的安全,如果当前系统安全,则输出安全队列,并给第一个安全进程分配资源。 报告创建时间:2013.05.16

4.6 此后重复4、5步,直至系统中的进程执行完毕: 4.7 系统中此时已没有等待执行的进程,若再点击“分配资源”按钮,则“执行结果”提示框中会提示: 报告创建时间:2013.05.16

4.8 如果需要再进行模拟,则点击“重新生成”按钮,会重新生成进程,再重复前7步即可。 4.9 如果模拟结束,可点击“退出”按钮,即可退出系统。 模拟结束。 报告创建时间:2013.05.16

五、心得体会 通过本次实验,我们对银行家算法有了更深的了解,理解了操作系统关于进程调度的一些方法,并通过编程实现了该算法。也进一步提高了我们的编程能力,从中学会了很多。 附录:源程序清单 1.主界面类BankerUI.java public class BankerUI extends JFrame implements ActionListener { private static final long serialVersionUID = -8004544916653049326L; private JPanel panel; private JButton model; private JButton alloc; private JButton next; private JButton exit; private JTextField processNum; // center private JEditorPane resourcesInfo; private JEditorPane processesInfo; // 用html格式显示进程需要资源个数. private JTextArea result; private JSplitPane splitCenter; private JPanel east; private int resourceClassesCount;// 表示资源的个数 private BankerAlgorithm banker; //private Process pro; private int Pronum = 0; private int Sournum = 0; static int[] available = null;// 可利用的资源 static int[][] max = null;// 最大的需求矩阵 static int[][] allocation = null;// 分配矩阵 static int[][] need = null;// 需求矩阵 static int[] totalSour = null; static int[] Max = null; static int[] Allocation = null; public BankerUI() { super(\"银行家算法\"); try { 报告创建时间:2013.05.16

UIManager .setLookAndFeel(\"com.sun.java.swing.plaf.windows.WindowsLookAndFeel\"); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } setBounds(100, 100, 800, 600); panel = new JPanel(new BorderLayout()); // center resourcesInfo = new JEditorPane(\"text/html\", \"\"); resourcesInfo.setEditable(false); processesInfo = new JEditorPane(\"text/html\", \"\"); // 以html格式显示进程信息. processesInfo.setEditable(false); JSplitPane splitInfo = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitInfo.add(new JScrollPane(resourcesInfo), JSplitPane.TOP); splitInfo.add(new JScrollPane(processesInfo), JSplitPane.BOTTOM); splitInfo.setBorder(BorderFactory.createTitledBorder(\"系统信息\")); splitInfo.setOneTouchExpandable(true); result = new JTextArea(5, 30); result.setEditable(false); result.setWrapStyleWord(true); // 按单词换行,即所有单词都不会打断. result.setLineWrap(true); // 换行. JScrollPane textScroll = new JScrollPane(result); textScroll.setBorder(BorderFactory.createTitledBorder(\"执行结果\")); splitCenter = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitCenter.setResizeWeight(1.0); splitCenter.add(splitInfo, JSplitPane.TOP); splitCenter.add(textScroll, JSplitPane.BOTTOM); splitCenter.setOneTouchExpandable(true); // 点击一下就可以扩展分割开来的控件. panel.add(splitCenter, BorderLayout.CENTER); panel.setSize(800, 700); // east east = new JPanel(); //east.setSize(60, 100); model = new JButton(\"随机生成\"); model.setSize(50, 20); model.setLocation(10, 10); model.addActionListener(this); alloc = new JButton(\"分配资源\"); alloc.addActionListener(this); next = new JButton(\"执行进程\"); 报告创建时间:2013.05.16

} next.addActionListener(this); exit = new JButton(\"退出\"); exit.addActionListener(this); JLabel label = new JLabel(\"当前进程个数:\"); label.setSize(50,20); label.setLocation(10, 60); processNum = new JTextField(); processNum.setSize(50, 20); processNum.setLocation(10,90); processNum.setEditable(false); processNum.setFont(new Font(\"宋体\", Font.BOLD, 20)); processNum.setForeground(Color.RED); processNum.setHorizontalAlignment(JTextField.CENTER); east.setLayout(new GridLayout(10,1,10,10)); east.setSize(80, 100); east.add(label); east.add(processNum); east.add(model); east.add(alloc); east.add(next); east.add(exit); panel.add(east, BorderLayout.EAST); setEastButtonEnabled(false); //this.getContentPane().add(new JScrollPane(panel)); this.getContentPane().add(panel); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); public void setEastButtonEnabled(boolean b) { // east alloc.setEnabled(b); next.setEnabled(b); } public BankerAlgorithm getBanker() { return banker; } // 一个数组小于另一个数组,两个数组大小相等. public boolean aLowerB(int[] a, int[] b) { for (int i = 0; i < a.length; i++) { if (a[i] > b[i]) return false; } return true; } // 在resourceInfoz中显示系统资源的信息. private void updateTotalResourcesInfo() { StringBuffer html = new StringBuffer(100); html.append(\"\"); html.append(\"

bgcolor=\\\"#C0C0C0\\\" bordercolor=\\\"#000000\\\">\\n\"); StringBuffer resourceNames = new StringBuffer(\"\"); StringBuffer resourceCounts = new StringBuffer(\"\"); //int[] totalResource = banker.getTotalResource(); for (int i = 0; i < Sournum; i++) { resourceNames.append(\"\"); resourceCounts.append(\"\"); } resourceNames.append(\"\"); resourceCounts.append(\"\"); html.append(resourceNames); html.append(resourceCounts); html.append(\"
资源名
资源个数\"); resourceNames.append(\"R\" + String.valueOf(i)); resourceNames.append(\"\"); resourceCounts.append(String.valueOf(totalSour[i])); resourceCounts.append(\"
\\n\\n\"); resourcesInfo.setText(html.toString()); } private void updateProcessInfo() { StringBuffer content = new StringBuffer(\"\\n\"); content.append(\"\\n\"); content.append(\"\\n\"); content.append(\"\"); content.append(\"\"); content.append(\"\"); StringBuffer processNames = new StringBuffer(40); for (int i = 0; i < Sournum; i++) { processNames.append(\"\"); } content.append(processNames); // Max content.append(processNames); // Allocated content.append(processNames); // Need content.append(processNames); // Avilable content.append(\"\"); ArrayList processes = banker.getProcesses(); //System.out.println(\"pppp\"+processes.size()); for (int i = 0; i < processes.size(); i++) { Process p = processes.get(i); 报告创建时间:2013.05.16

content.append(\"

\" + p.makeHtml()); if (i == 0) { int[] avilable = banker.getAvilable(); for (int j = 0; j < avilable.length; j++) content.append(\"\"); } if (i == 1) content.append(\"\"); content.append(\"\"); } content.append(\"
资源情况MaxAllocatedNeedAvilable
进程名R\" + i + \"
\" + avilable[j] + \"
\\n\"); content.append(\"\\n\"); content.append(\"\"); processesInfo.setText(content.toString()); processNum.setText(\"\"+Pronum); } @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == model) { RandomMake(); banker = new BankerAlgorithm(totalSour,Sournum, new ArrayList()); for (int i = 0; i < Pronum; i++) { Max = new int[Sournum]; Allocation = new int[Sournum]; for (int j = 0; j < Sournum; j++) { Max[j] = max[i][j]; Allocation[j] = allocation[i][j]; } Process pro = new Process(String.valueOf(i),Max,Allocation,Sournum); if (banker.addProcess(pro)) { result.setText(result.getText() + \"成功添加进程: \" + banker.getExecuteInfo()); } else { result.setText(result.getText() + \"添加进程失败: \" + banker.getExecuteInfo()); return; } //updateProcessInfo(); } updateTotalResourcesInfo(); // 更新系统资源信息. updateProcessInfo(); // 更新系统进程资源信息. alloc.setEnabled(true); next.setEnabled(false); model.setText(\"重新生成\"); } if (e.getSource() == alloc) { String[] names = banker.getProcessNames(); 报告创建时间:2013.05.16

if (names.length == 0) { result.setText(result.getText() + \"当前系统中没有进程,无法分配资源!\\n\"); next.setEnabled(false); return; } if (banker.isSecured()) { String id = banker.AllocationResourse(); result.setText(result.getText() + \"进程P\"+id+\"资源分配成功!\\n\" +\"当前系统是安全的.\\n安全序列: \" + banker.getExecuteInfo()); updateProcessInfo(); // 更新系统进程资源信息. next.setEnabled(true); } else { result.setText(result.getText() +\"资源分配失败!\\n\"+ \"当前系统是不安全的.\\n详细信息如下: \" + banker.getExecuteInfo()); next.setEnabled(false); } return; } if (e.getSource() == next) { String pid = banker.ExecuteProcess(); if(Pronum > 0){ Pronum--; updateProcessInfo(); result.append(\"进程P\"+pid+\"执行完毕!\\n\"); } else{ JOptionPane.showMessageDialog(this, \"系统中所有进程已执行完毕!\", \"提示:\", JOptionPane.ERROR_MESSAGE); next.setEnabled(false); } next.setEnabled(false); } if (e.getSource() == exit) { if (JOptionPane.showConfirmDialog(this, \"退出系统?\", \"确定退出\", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) System.exit(0); return; } } public void RandomMake(){ Random rnd = new Random(); Pronum = rnd.nextInt(10)+10; Sournum = rnd.nextInt(5)+3; available = new int[Sournum]; max = new int[Pronum][Sournum]; allocation = new int[Pronum][Sournum]; 报告创建时间:2013.05.16

need = new int[Pronum][Sournum]; for (int i = 0; i < Sournum; i++) { available[i] = rnd.nextInt(5) + 3; } for (int i = 0; i < Pronum; i++) { for (int j = 0; j < Sournum; j++) { allocation[i][j] = rnd.nextInt(5);// 分配矩阵获得随机数 } } for (int i = 0; i < Pronum; i++) { for (int j = 0; j < Sournum; j++) { do { max[i][j] = rnd.nextInt(10);// 最大的需求矩阵获得随机数,且要比分配矩阵相同位置的数大 } while (max[i][j] < allocation[i][j]); } } need = new int[Pronum][Sournum]; for (int i = 0; i < Pronum; i++) { for (int j = 0; j < Sournum; j++) { need[i][j] = max[i][j] - allocation[i][j]; } } totalSour = new int[Sournum]; for (int i = 0; i < Sournum; i++) { totalSour[i]=available[i]; } for (int i = 0; i < Pronum; i++) { for (int j = 0; j < Sournum; j++) { totalSour[j]+= allocation[i][j]; } } } public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { BankerUI banker = new BankerUI(); banker.setVisible(true); } } 2.银行家算法实现类 BankerAlgorithm.java public class BankerAlgorithm { // 表示系统中资源种类数 //private int[] saveProcess; private int savePNum = 0; private final int _resourceClassesCount; 报告创建时间:2013.05.16

private final int[] _totalResource; private ArrayList _processes = new ArrayList(); private ArrayList saveProcesses = new ArrayList(); private StringBuffer _executeInfo = new StringBuffer(50); public BankerAlgorithm(int[] totalResource, int resourceClassesCount, ArrayList processes) { _resourceClassesCount = resourceClassesCount; _totalResource = totalResource; _processes = processes; } private ArrayList newProcesses() { ArrayList pList = new ArrayList(); for (Process p : _processes) { pList.add(p.newProcess()); } return pList; } public int[] getAvilable() { int[] avilable = new int[_resourceClassesCount]; for (int i = 0; i < _resourceClassesCount; ++i) { avilable[i] = _totalResource[i] - getResourceAllocated(i); } return avilable; } // index代表某个资源的索引,结果为某个资源的已分配量. private int getResourceAllocated(int index) { int totalAllocated = 0; for (Process p : _processes) { int[] allocated = p.getAllocated(); totalAllocated += allocated[index]; } return totalAllocated; } public boolean addProcess(Process p) { if (isUniqueProcessId(p.getId())) { _executeInfo.append(p.getId() + \"=\" + p.toString()); return _processes.add(p); } else { _executeInfo.append(p.getId() + \"与已有进程重名.\"); return false; } } public void removeProcess(String processId) { removeProcess(getProcessById(_processes, processId)); } public void removeProcess(Process p) { _processes.remove(p); //_executeInfo.append(p.getId()); } String id; public String ExecuteProcess(){ if(savePNum < saveProcesses.size()){ Process p = saveProcesses.get(savePNum); id = p.getId(); removeProcess(id); 报告创建时间:2013.05.16

savePNum ++; } else{ _executeInfo.append(\"警告:所有进程已执行完毕!\"); } return id; //saveProcesses.remove(p); } String idd; public String AllocationResourse(){ if(savePNum < saveProcesses.size()){ Process p = saveProcesses.get(savePNum); idd = p.getId(); int[] pmax = p.getMaxNeed(); p.setAllocated(pmax); saveProcesses.set(savePNum, p); int no = 0; for (Process pp : _processes) { if(idd == pp.getId()){ _processes.set(no, p); } no++; } } return idd; } public String getExecuteInfo() { // 若存在安全序列,则要删除最后一个\"->\". int startIndex = _executeInfo.lastIndexOf(\"->\"); if (startIndex != -1) { _executeInfo.delete(startIndex, startIndex + 2); } _executeInfo.append(\"\\n\\n\"); String info = _executeInfo.toString(); _executeInfo.delete(0, _executeInfo.length()); return info; } public ArrayList getProcesses() { return _processes; } public String[] getProcessNames() { String[] names = new String[_processes.size()]; for (int i = 0; i < _processes.size(); i++) names[i] = _processes.get(i).getId(); return names; } // 判断当前系统是否安全 public boolean isSecured() { return isSecured(newProcesses(), getAvilable()); } private boolean isSecured(ArrayList pList, int[] avilable) { if (!isAllMaxNeedLowerTotalResource(pList)) return false; 报告创建时间:2013.05.16

while (!isAllFinished(pList)) { Process p = searchProcessLowerAvilable(pList, avilable); if (p != null) { int[] need = p.getNeed(); p.allocate(need); // System.out.println(p.getId()); _executeInfo.append(\"P\" + p.getId() + \"->\"); saveProcesses.add(p); sub(avilable, need); add(avilable, p.getAllocated()); } else { _executeInfo.append(\"系统中剩余进程的资源需求量均大于系统资源可用量.\"); return false; } } return true; } private Process getProcessById(ArrayList pList, String id) { for (Process p : pList) { if (p.equals(id)) return p; } return null; } private boolean isAllFinished(ArrayList pList) { for (Process p : pList) { if (!p.isFinished()) return false; } return true; } public boolean isAllMaxNeedLowerTotalResource(ArrayList processes) { for (Process p : processes) { if (!p.isMaxNeedLowerTotalResource(_totalResource, _executeInfo)) return false; } return true; } public boolean isAllAllocatedLowerMax() { for (Process p : _processes) if (!p.isAllocatedLowerMax()) { _executeInfo .append(\"进程\" + p.getId() + \"的已分配资源数大于其所需要的最大资源量.\\n\"); return false; } return true; } public boolean isAllAllocatedLowerTotalResource() { for (int i = 0; i < _resourceClassesCount; i++) if (_totalResource[i] < getResourceAllocated(i)) { _executeInfo.append(\"资源R\" + i + \"的已分配总量大于系统中该资源报告创建时间:2013.05.16

的最大数目.\\n\"); return false; } return true; } private Process searchProcessLowerAvilable(ArrayList pList, int[] avilable) { for (Process p : pList) { if (p.isNeedLowerAvilable(avilable) && !p.isFinished()) return p; } return null; } public boolean isUniqueProcessId(String processId) { String[] names = getProcessNames(); for (String id : names) { if (id.equals(processId)) { return false; } } return true; } // a用来保存a+b之和 private void add(int[] a, int[] b) { for (int i = 0; i < a.length; ++i) { a[i] += b[i]; } } // a用来保存a-b之和 private void sub(int[] a, int[] b) { for (int i = 0; i < a.length; ++i) { a[i] -= b[i]; } } public void print() { for (Process p : _processes) { System.out.println(p.toString()); } System.out.println(); } } 3.进程实现类 Process.java public class Process { // 表示系统中资源种类数 private final int _resourceClassesCount; private String _id; private int[] _maxNeed; private int[] _allocated; public Process(String id, int[] maxNeed, int[] allocated, int resourceClassesCount) { 报告创建时间:2013.05.16

_resourceClassesCount = resourceClassesCount; _id = id; _maxNeed = maxNeed; _allocated = allocated; } public String getId() { return _id; } public void setId(String id) { _id = id; } public int[] getMaxNeed() { return _maxNeed; } public void setMaxNeed(int[] maxNeed) { _maxNeed = maxNeed; } public int[] getAllocated() { return _allocated; } public void setAllocated(int[] allocated) { _allocated = allocated; } public int[] getNeed() { int[] need = new int[_resourceClassesCount]; for (int i = 0; i < _resourceClassesCount; ++i) need[i] = _maxNeed[i] - _allocated[i]; return need; } public Process newProcess() { return new Process(this._id, Arrays.copyOf(_maxNeed, _resourceClassesCount), Arrays.copyOf(_allocated, _resourceClassesCount), _resourceClassesCount); } public boolean equals(String id) { return _id.equals(id); } public boolean isFinished() { for (int i = 0; i < _resourceClassesCount; ++i) if (_maxNeed[i] != _allocated[i]) return false; return true; } public boolean isNeedLowerAvilable(int[] avilable) { int[] need = getNeed(); for (int i = 0; i < avilable.length; ++i) { if (need[i] > avilable[i]) return false; } return true; } public boolean isAllocatedLowerMax() { for (int i = 0; i < _resourceClassesCount; ++i) { if (_allocated[i] > _maxNeed[i]) return false; } return true; 报告创建时间:2013.05.16

} public void allocate(int[] resource) { for (int i = 0; i < resource.length; ++i) _allocated[i] += resource[i]; } public boolean isMaxNeedLowerTotalResource(int[] totalResource, StringBuffer executeInfo) { for (int i = 0; i < totalResource.length; ++i) { if (_maxNeed[i] > totalResource[i]) { executeInfo.append(\"进程\" + _id + \"的最大资源需求量大于系统资源量.\"); return false; } } return true; } public boolean isLowerMaxNeed(int[] resource, StringBuffer executeInfo) { for (int i = 0; i < resource.length; ++i) { if ((_allocated[i] + resource[i]) > _maxNeed[i]) { executeInfo.append(\"进程\" + _id + \"的资源请求量大于其最大资源需求量.\"); return false; } } return true; } private String printArray(int[] array) { StringBuffer buffer = new StringBuffer(20); buffer.append(\"[\"); for (int i = 0; i < array.length; i++) { buffer.append(String.valueOf(array[i]) + \); } buffer.deleteCharAt(buffer.length() - 1); buffer.append(\"]\"); return buffer.toString(); } public String toString() { StringBuffer print = new StringBuffer(50); print.append(\"{ processName=\"); print.append(\"P\"+_id); print.append(\); print.append(printArray(_maxNeed)); print.append(\); print.append(printArray(_allocated)); print.append(\); print.append(printArray(getNeed())); print.append(\); return print.toString(); } // 用html格式显示. public String makeHtml() { StringBuffer tableRow = new StringBuffer(50); tableRow.append(\"\" +\"P\"+ _id + \"\"); StringBuffer maxNeed = new StringBuffer(_maxNeed.length * 3); StringBuffer allocated = new StringBuffer(_maxNeed.length * 3); 报告创建时间:2013.05.16

} } StringBuffer need = new StringBuffer(_maxNeed.length * 3); int[] needed = getNeed(); for (int i = 0; i < _maxNeed.length; i++) { maxNeed.append(\"\" + String.valueOf(_maxNeed[i]) + \"\"); allocated.append(\"\" + String.valueOf(_allocated[i]) + \"\"); need.append(\"\" + String.valueOf(needed[i]) + \"\"); } tableRow.append(maxNeed); tableRow.append(allocated); tableRow.append(need); return tableRow.toString();

报告创建时间:2013.05.16

因篇幅问题不能全部显示,请点此查看更多更全内容