📄 splitstatsdlg.java
字号:
getContentPane().add(preClustFld); preEcFld = new JTextField(); preEcFld.setMargin(defaultInsets); preEcFld.setHorizontalAlignment(SwingConstants.RIGHT); preEcFld.setEditable(false); preEcFld.setBounds(235, yPos, 105, 20); preEcFld.setBackground(Color.white); preEcFld.setFont(defaultFont); getContentPane().add(preEcFld); yPos += 25; optSplitLbl = new JLabel(); optSplitLbl.setText("Opt. Split:"); optSplitLbl.setBounds(leftMargin, yPos, 80, 20); getContentPane().add(optSplitLbl); optClustFld = new JTextField(); optClustFld.setMargin(defaultInsets); optClustFld.setHorizontalAlignment(SwingConstants.RIGHT); optClustFld.setEditable(false); optClustFld.setBounds(120, yPos, 105, 20); optClustFld.setBackground(Color.white); optClustFld.setFont(defaultFont); getContentPane().add(optClustFld); optEcFld = new JTextField(); optEcFld.setMargin(defaultInsets); optEcFld.setHorizontalAlignment(SwingConstants.RIGHT); optEcFld.setEditable(false); optEcFld.setBounds(235, yPos, 105, 20); optEcFld.setBackground(Color.white); optEcFld.setFont(defaultFont); getContentPane().add(optEcFld); yPos += 25; actualSplitLbl = new JLabel(); actualSplitLbl.setText("Actual Split:"); actualSplitLbl.setBounds(leftMargin, yPos, 95, 20); getContentPane().add(actualSplitLbl); actualClustFld = new JTextField(); actualClustFld.setMargin(defaultInsets); actualClustFld.setHorizontalAlignment(SwingConstants.RIGHT); actualClustFld.setEditable(false); actualClustFld.setBounds(120, yPos, 105, 20); actualClustFld.setBackground(Color.white); actualClustFld.setFont(defaultFont); getContentPane().add(actualClustFld); actualEcFld = new JTextField(); actualEcFld.setMargin(defaultInsets); actualEcFld.setHorizontalAlignment(SwingConstants.RIGHT); actualEcFld.setEditable(false); actualEcFld.setBounds(235, yPos, 105, 20); actualEcFld.setBackground(Color.white); actualEcFld.setFont(defaultFont); getContentPane().add(actualEcFld); yPos += 25; lossLbl = new JLabel(); lossLbl.setText("Loss:"); lossLbl.setBounds(leftMargin, yPos, 80, 20); getContentPane().add(lossLbl); excCovLossFld = new JTextField(); excCovLossFld.setMargin(defaultInsets); excCovLossFld.setHorizontalAlignment(SwingConstants.RIGHT); excCovLossFld.setEditable(false); excCovLossFld.setBounds(235, yPos, 105, 20); excCovLossFld.setBackground(Color.white); excCovLossFld.setFont(defaultFont); getContentPane().add(excCovLossFld); clustLossFld = new JTextField(); clustLossFld.setMargin(defaultInsets); clustLossFld.setHorizontalAlignment(SwingConstants.RIGHT); clustLossFld.setEditable(false); clustLossFld.setBounds(120, yPos, 105, 20); clustLossFld.setBackground(Color.white); clustLossFld.setFont(defaultFont); getContentPane().add(clustLossFld); yPos += 25; ohLbl = new JLabel(); ohLbl.setText("Overheads:"); ohLbl.setBounds(leftMargin, yPos, 70, 20); getContentPane().add(ohLbl); clustOhFld = new JTextField(); clustOhFld.setMargin(defaultInsets); clustOhFld.setHorizontalAlignment(SwingConstants.RIGHT); clustOhFld.setEditable(false); clustOhFld.setBounds(120, yPos, 105, 20); clustOhFld.setBackground(Color.white); clustOhFld.setFont(defaultFont); getContentPane().add(clustOhFld); excCovOhFld = new JTextField(); excCovOhFld.setMargin(defaultInsets); excCovOhFld.setHorizontalAlignment(SwingConstants.RIGHT); excCovOhFld.setEditable(false); excCovOhFld.setBounds(235, yPos, 105, 20); excCovOhFld.setBackground(Color.white); excCovOhFld.setFont(defaultFont); getContentPane().add(excCovOhFld); yPos += 25; successLbl = new JLabel(); successLbl.setText("Success [%]:"); successLbl.setBounds(leftMargin, yPos, 100, 20); getContentPane().add(successLbl); clustSuccessFld = new JTextField(); clustSuccessFld.setMargin(defaultInsets); clustSuccessFld.setHorizontalAlignment(SwingConstants.RIGHT); clustSuccessFld.setEditable(false); clustSuccessFld.setBounds(120, yPos, 105, 20); clustSuccessFld.setBackground(Color.white); clustSuccessFld.setFont(defaultFont); getContentPane().add(clustSuccessFld); excCovSuccessFld = new JTextField(); excCovSuccessFld.setMargin(defaultInsets); excCovSuccessFld.setHorizontalAlignment(SwingConstants.RIGHT); excCovSuccessFld.setEditable(false); excCovSuccessFld.setBounds(235, yPos, 105, 20); excCovSuccessFld.setBackground(Color.white); excCovSuccessFld.setFont(defaultFont); getContentPane().add(excCovSuccessFld); // quit button yPos += 35; JButton quitBtn = new JButton("Quit"); quitBtn.setFont(defaultFont); quitBtn.setBounds(125, yPos, 80, 30); quitBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { SplitStatsDlg.this.setVisible(false); } }); getContentPane().add(quitBtn); setBounds(0, 0, 400, yPos+90); setVisible(false); //getContentPane().setBounds(0, 0, 400, 600); //pack();}// ((double) ((int) x*1000)/1000): Java's way of printing 3 significant digitsprivate doubletruncate(double d, int digits){ double p = Math.pow(10.0, (double) digits); return ((double) ((int) (d * p))/p);}// ((double) ((int) x*1000)/1000): Java's way of printing 3 significant digitsprivate floattruncate(float d, int digits){ float p = (float) Math.pow(10.0, (double) digits); return ((float) ((int) (d * p))/p);}///////////////////////////////////////////////////////////////////////////////// setLeaf - updates display of currently selected leaf (incl. tree view)//// Description:// - extracts currently selected leaf number from dialog//// Exceptions: none/////////////////////////////////////////////////////////////////////////////////private voidsetLeaf(){ int leafNo = 0; // avg if (selectorGroup.getSelection().getActionCommand().equals("leaf")) { // we don't want the avg leafNo = splitLeaves[splitLeavesIdx]; } setLeaf(leafNo);}///////////////////////////////////////////////////////////////////////////////// setLeaf - updates display of query (incl. tree view)//// Description://// Exceptions: none/////////////////////////////////////////////////////////////////////////////////private voidsetLeaf(int leafNo){ boolean absValues = absGroup.getSelection().getActionCommand().equals("abs"); // true if the user wants to see absolute I/O numbers, not deltas boolean weighted = weightedGroup.getSelection().getActionCommand().equals("weighted"); // true if the user wants to see absolute I/O numbers, not deltas Libgist.getSplitStats(leafNo, weighted, splitStats); // load leafFld if (leafNo != 0) { // otherwise it's the total leafFld.setText(Integer.toString(leafNo)); } preClustFld.setText(Float.toString(truncate(splitStats.preIos, 2))); preEcFld.setText(Float.toString(truncate(splitStats.preExcCovLoss, 3))); if (absValues) { optClustFld.setText(Float.toString(truncate(splitStats.optIos, 3))); } else { optClustFld.setText(Float.toString(truncate(splitStats.optClusterDelta, 3))); } optEcFld.setText("0"); if (absValues) { actualClustFld.setText(Float.toString(truncate(splitStats.actualIos, 3))); } else { actualClustFld.setText(Float.toString(truncate(splitStats.actualClusterDelta, 3))); } if (absValues) { actualEcFld.setText(Float.toString(truncate(splitStats.actualExcCovLoss, 3))); } else { actualEcFld.setText(Float.toString(truncate(splitStats.excCovDelta, 3))); } clustLossFld.setText(Float.toString(truncate(splitStats.clusterLoss, 3))); excCovLossFld.setText(Float.toString(truncate(splitStats.excCovLoss, 3))); clustOhFld.setText(Float.toString(truncate(splitStats.clusterOh, 3))); excCovOhFld.setText(Float.toString(truncate(splitStats.excCovOh, 3))); clustSuccessFld.setText(Float.toString(truncate( splitStats.clusterSuccess * 100.0f, 3))); excCovSuccessFld.setText(Float.toString(truncate( splitStats.excCovSuccess * 100.0f, 3))); // display stats in treeview Libgist.getSplitNodeStats(statsTypeBox.getSelectedIndex(), absValues, weighted); treeView.showStats(Libgist.nodeCnt, Libgist.displayStats, (String) statsTypeBox.getSelectedItem());}// init dialog for user interaction:// set querySlider range to # of queriespublic voidinit(TreeView treeView){ this.treeView = treeView; // make splitLeaves big enough (we assume that the split stats // were computed on the currently opened tree) splitLeaves = new int[Libgist.getPageCount()]; Libgist.getSplitLeaves(splitLeaves); splitLeavesIdx = 0; leafFld.setText(Integer.toString(splitLeaves[splitLeavesIdx])); setLeaf(0);}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -