analysis.lami: Implementation of LAMI plugins
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.lami.core / src / org / eclipse / tracecompass / internal / provisional / analysis / lami / core / module / LamiChartModel.java
1 /*******************************************************************************
2 * Copyright (c) 2015, 2016 EfficiOS Inc., Alexandre Montplaisir
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
9
10 package org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module;
11
12 import java.util.List;
13
14 import com.google.common.collect.ImmutableList;
15
16 /**
17 * UI Model of a LAMI chart. This object should contain all the information
18 * needed to create a chart in the GUI, independently of the actual chart
19 * implementation.
20 *
21 * @author Alexandre Montplaisir
22 */
23 public class LamiChartModel {
24
25 /**
26 * Supported types of charts
27 */
28 public enum ChartType {
29 /** Bar chart */
30 BAR_CHART("Bar"), //$NON-NLS-1$
31
32 /** XY scatter chart */
33 XY_SCATTER("Scatter"), //$NON-NLS-1$
34
35 /**
36 * Pie chart
37 * FIXME NYI
38 */
39 PIE_CHART("Pie"); //$NON-NLS-1$
40
41 private final String fText;
42
43 private ChartType(final String text) {
44 fText = text;
45 }
46
47 @Override
48 public String toString() {
49 return fText;
50 }
51 }
52
53 private final ChartType fType;
54 private final String fName;
55 private final List<String> fXSeriesColumns;
56 private final List<String> fYSeriesColumns;
57 private final boolean fXAxisIsLog;
58 private final boolean fYAxisIsLog;
59
60
61 /**
62 * Constructor
63 *
64 * @param type
65 * The type of chart
66 * @param name
67 * The name of the chart
68 * @param xSeriesColumn
69 * The title of column used for the X axis
70 * @param ySeriesColumns
71 * The titles of the columns used for the series
72 * @param xAxisIsLog
73 * If the X-axis is log scale or not
74 * @param yAxisIsLog
75 * If the Y-axis is log scale or not
76 */
77 public LamiChartModel(ChartType type, String name, List<String> xSeriesColumn, List<String> ySeriesColumns,
78 boolean xAxisIsLog, boolean yAxisIsLog) {
79 fType = type;
80 fName = name;
81 fXSeriesColumns = ImmutableList.copyOf(xSeriesColumn);
82 fYSeriesColumns = ImmutableList.copyOf(ySeriesColumns);
83 fXAxisIsLog = xAxisIsLog;
84 fYAxisIsLog = yAxisIsLog;
85 }
86
87 /**
88 * Get the chart type.
89 *
90 * @return The chart type
91 */
92 public ChartType getChartType() {
93 return fType;
94 }
95
96 /**
97 * Get the chart's name.
98 *
99 * @return The chart name
100 */
101 public String getName() {
102 return fName;
103 }
104
105 /**
106 * Get the names of the columns used for the X part of a series.
107 *
108 * @return The columns used for the X-axis
109 */
110 public List<String> getXSeriesColumns() {
111 return fXSeriesColumns;
112 }
113
114 /**
115 * Get the names of the columns used for the Y part of a series.
116 *
117 * @return The columns used for the series
118 */
119 public List<String> getYSeriesColumns() {
120 return fYSeriesColumns;
121 }
122
123 /**
124 * Return if the X-axis should use a log scale.
125 *
126 * @return If the X-axis is log scale
127 */
128 public boolean xAxisIsLog() {
129 return fXAxisIsLog;
130 }
131
132 /**
133 * Return if the Y-axis should use a log scale.
134 *
135 * @return If Y-axis is log scale
136 */
137 public boolean yAxisIsLog() {
138 return fYAxisIsLog;
139 }
140
141 }
This page took 0.035259 seconds and 5 git commands to generate.