-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPerformanceComparisionPanel.java
More file actions
138 lines (120 loc) · 4.09 KB
/
Copy pathPerformanceComparisionPanel.java
File metadata and controls
138 lines (120 loc) · 4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
package quest;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import javax.swing.*;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.axis.LogAxis;
import org.jfree.chart.axis.NumberTickUnit;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.renderer.category.BarRenderer;
import org.jfree.chart.renderer.category.StackedBarRenderer;
import org.jfree.chart.renderer.category.StandardBarPainter;
import org.jfree.data.category.DefaultCategoryDataset;
public class PerformanceComparisionPanel
{
JPanel mainPanel;
double executionTime[];
boolean isExecutionTimeSet[];
PerformanceComparisionPanel(AllObjects allObjects)
{
allObjects.setExecutionResultPanelObj(this);
mainPanel = new JPanel();
executionTime = new double[4];
isExecutionTimeSet = new boolean[4];
}
void setNativeOptimizerExecTime(double time, AllObjects allObjects)
{
executionTime[0] = time;
isExecutionTimeSet[0] = true;
int i;
for(i=0;i<4;i++)
if(!isExecutionTimeSet[i])
break;
if(i==4)
{
MainFrame mainFrameObj = allObjects.getMainFrameObj();
mainFrameObj.allTabs.setEnabledAt(QUESTConstants.RESULT_PANE, true);
}
}
void setOptimalPlanExecutionTime(double time, AllObjects allObjects)
{
executionTime[1] = time;
isExecutionTimeSet[1] = true;
int i;
for(i=0;i<4;i++)
if(!isExecutionTimeSet[i])
break;
if(i==4)
{
MainFrame mainFrameObj = allObjects.getMainFrameObj();
mainFrameObj.allTabs.setEnabledAt(QUESTConstants.RESULT_PANE, true);
}
}
void setBasicBouquetTime(double time, AllObjects allObjects)
{
executionTime[2] = time;
isExecutionTimeSet[2] = true;
int i;
for(i=0;i<4;i++)
if(!isExecutionTimeSet[i])
break;
if(i==4)
{
MainFrame mainFrameObj = allObjects.getMainFrameObj();
mainFrameObj.allTabs.setEnabledAt(QUESTConstants.RESULT_PANE, true);
}
}
void setOptimisedBouquetTime(double time, AllObjects allObjects)
{
executionTime[3] = time;
isExecutionTimeSet[3] = true;
int i;
for(i=0;i<4;i++)
if(!isExecutionTimeSet[i])
break;
if(i==4)
{
MainFrame mainFrameObj = allObjects.getMainFrameObj();
mainFrameObj.allTabs.setEnabledAt(QUESTConstants.RESULT_PANE, true);
}
}
void showResultBarGraph()
{
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.setValue(executionTime[0]/executionTime[1], "PGSubOpt", "PostgreSQL Optimizer");
dataset.setValue(executionTime[2]/executionTime[1], "BouSubOpt", "Basic Bouquet");
dataset.setValue(executionTime[3]/executionTime[1], "OptSubOpt", "Optimized Bouquet");
JFreeChart chart = ChartFactory.createStackedBarChart
("Sub-optimality (log scale)","Method of Execution", "Sub-optimality", dataset,
PlotOrientation.VERTICAL, false,true, false);
CategoryPlot plot = chart.getCategoryPlot();
plot.setRangeGridlinePaint(Color.WHITE);
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setMaximumBarWidth(0.1);
renderer.setBarPainter(new StandardBarPainter());
renderer.setSeriesPaint(0, Color.RED);
renderer.setSeriesPaint(1, Color.BLUE);
renderer.setSeriesPaint(2, Color.GREEN);
CategoryAxis domain = plot.getDomainAxis();
domain.setTickLabelFont(new Font("SansSerif", Font.BOLD, QUESTConstants.AXIS_TICK_FONT_SIZE));
domain.setLabelFont(new Font("SansSerif", Font.BOLD, QUESTConstants.AXIS_LABEL_FONT_SIZE));
LogAxis range = new LogAxis("Sub-optimality");
range.setBase(2);
range.setTickUnit(new NumberTickUnit(1));
range.setRange(1, 32);
range.setTickLabelFont(new Font("SansSerif", Font.PLAIN, QUESTConstants.AXIS_TICK_FONT_SIZE));
range.setLabelFont(new Font("SansSerif", Font.BOLD, QUESTConstants.AXIS_LABEL_FONT_SIZE));
plot.setRangeAxis(range);
StackedBarRenderer r = (StackedBarRenderer) plot.getRenderer();
r.setBase(0.001);
ChartPanel cPanel = new ChartPanel(chart);
cPanel.setPreferredSize(new Dimension(750, 500));
mainPanel.add(cPanel);
mainPanel.setBackground(Color.WHITE);
}
}