Some Trick jobs are labeled "simobject.classPtr->Foo()" trick_dp barfs on the "->" string

Backporting fix that does not split string on '-' character if it is part of "->" string.

refs #51
This commit is contained in:
Alex Lin 2016-06-30 15:40:10 -05:00
parent c4ed577d87
commit 2784232457

View File

@ -194,6 +194,8 @@ public class TrickQPActionController {
* Helper method for adding specified new {@link ProductVar} variables to selected node(s) in the tree.
* If newVars has only one element, it's for single variable. If newVars has more than one variable,
* it's for array variable.
* @param newVars new variables
* @param selectedTreeNodes tree to add new variables
*/
public void handleAddVarToSelected(ProductVar[] newVars, ArrayList<DefaultMutableTreeNode> selectedTreeNodes) {
CommonTreeNode plotNode;
@ -349,16 +351,7 @@ public class TrickQPActionController {
for (int i = 0; i < selectedVars.length; i++) {
LogVar varFrom = (LogVar)selectedVars[i];
if (varFrom.getName().indexOf('-') != -1) {
// arrayed variable
/***
if (varFrom.getName().indexOf('-') < varFrom.getName().lastIndexOf('-')) {
JOptionPane.showMessageDialog(application.getMainFrame(),
"Too many ranged dimensions. \nPlease use Expand Var to get to one ranged dimension\n" +
"(or to a singular variable with no ranges).",
"Error", JOptionPane.WARNING_MESSAGE);
return;
}***/
if (varFrom.getName().matches("-(?!>)")) {
List<String> vars = get_components_from_array(varFrom.getName()); // expand variable
if ( (selectedTreeNodes!=null) && (selectedTreeNodes.size()>0)
&& (((CommonTreeNode)selectedTreeNodes.get(0)).getNodeType()!=CommonTreeNode.PLOTS_NODE) ) {
@ -589,7 +582,7 @@ public class TrickQPActionController {
public List<String> get_components_from_array(String arrayvar) {
// MAX_DIMENSIONS is how many ranges we can handle splitting in a variable
final int MAX_DIMENSIONS = 3;
String[] parts = arrayvar.split("-");
String[] parts = arrayvar.split("-(?!>)");
int numparts = parts.length;
if (numparts==1) {
// no range to split
@ -853,6 +846,7 @@ public class TrickQPActionController {
* TODO: Haven't added this mechanism to any other places as this is the
* only one is called by other application for now. Add other
* places if necessary.
* @param dirList list of directories
*/
public void handleAddRuns(final String[] dirList) {
@ -959,6 +953,7 @@ public class TrickQPActionController {
/**
* Invoked when new output is entered.
* @param newOutput not sure
*/
public void handleNewProgramOutput(String newOutput) {
addVarToOutput(new ProductMeasurement(newOutput), true);
@ -968,6 +963,8 @@ public class TrickQPActionController {
* Invoked when Subtract is selected.
*
* This function generates nodes for (var1 - var2)
* @param var1 var1
* @param var2 var2
*/
public void handleSubtractFunction(LogVar var1, LogVar var2) {
String units = null;
@ -1434,6 +1431,7 @@ public class TrickQPActionController {
* The valid range would be [0, total child count of this plot].
* @param isNew <code>true</code>, if the user object of the plot node does not
* have the curve user object in its curve list, <code>false</code> otherwise.
* @return curve node.
*/
public CommonTreeNode addCurveToPlot(CommonTreeNode plotNode, Object curve, int idx, boolean isNew) {
CommonTreeNode curveNode = null;
@ -1484,6 +1482,7 @@ public class TrickQPActionController {
* is created based on the specified curve object.
* @param isNew <code>true</code>, if the user object of the plot node does not
* have the curve user object in its curve list, <code>false</code> otherwise.
* @return curve node.
*/
public CommonTreeNode addCurveToPlot(CommonTreeNode plotNode, Object curve, boolean isNew) {
return addCurveToPlot(plotNode, curve, -1, isNew);
@ -1497,6 +1496,7 @@ public class TrickQPActionController {
* an instance of {@link ProductPlot}.
* @param isNew <code>true</code> if the plot user object needs adding to the
* plot list of the page user object, <code>false</code> otherwise.
* @return top plot node
*
*/
public CommonTreeNode addPlotToPage(CommonTreeNode pageNode, Object plot, boolean isNew) {
@ -1522,6 +1522,8 @@ public class TrickQPActionController {
/**
* Helper method for adding a new Page.
* @param page the page node
* @return top page node
*/
@SuppressWarnings("rawtypes")
public CommonTreeNode addPageToPlots(ProductPage page) {
@ -1553,7 +1555,6 @@ public class TrickQPActionController {
application.productTree.addNode(application.plotsNode, pageNode, true);
return pageNode;
}
/**
* Helper method for adding a new var to a table column.
*/
@ -1575,6 +1576,7 @@ public class TrickQPActionController {
* The valid range would be [0, total child count of this table].
* @param isNew <code>true</code> if the column user object needs adding to the
* column list of the table user object, <code>false</code> otherwise.
* @return top column node
*/
public CommonTreeNode addColumnToTable(CommonTreeNode tableNode, Object column, int idx, boolean isNew) {
CommonTreeNode columnNode = null;
@ -1608,6 +1610,7 @@ public class TrickQPActionController {
* an instance of {@link ProductColumn}.
* @param isNew <code>true</code> if the column user object needs adding to the
* column list of the table user object, <code>false</code> otherwise.
* @return top column node
*/
public CommonTreeNode addColumnToTable(CommonTreeNode tableNode, Object column, boolean isNew) {
return addColumnToTable(tableNode, column, -1, isNew);