📄 comparisonspane.java
字号:
* Get the Export Assertions table for comparison number compNdx * @param compNdx comparison index * @return Export Assertions table wrapped into a JScrollPane */ private JScrollPane getExportAssertionPane(int compNdx) { if (compNdx < 0 || compNdx >= exportAssertionsPanes.length) return null; if (exportAssertionsPanes[compNdx] == null) { ExportAssertionTable table = new ExportAssertionTable(mismatches[compNdx]); exportAssertionsPanes[compNdx] = new JScrollPane(table); exportAssertionsPanes[compNdx].setBackground(Color.WHITE); } return exportAssertionsPanes[compNdx]; } /** * Get the Export/Global Network Conflict table for comparison number compNdx * @param compNdx comparison index * @return Export/Global Network Conflict table wrapped into a JScrollPane */ private JScrollPane getExportNetConflictPane(int compNdx) { if (compNdx < 0 || compNdx >= exportNetConflictPanes.length) return null; if (exportNetConflictPanes[compNdx] == null) { ExportConflictTable table = new ExportConflictTable.NetworkTable(mismatches[compNdx]); exportNetConflictPanes[compNdx] = new JScrollPane(table); exportNetConflictPanes[compNdx].setBackground(Color.WHITE); } return exportNetConflictPanes[compNdx]; } /** * Get the Export/Global Characteristics Conflict table for comparison number compNdx * @param compNdx comparison index * @return Export/Global Characteristics Conflict table wrapped into a JScrollPane */ private JScrollPane getExportChrConflictPane(int compNdx) { if (compNdx < 0 || compNdx >= exportChrConflictPanes.length) return null; if (exportChrConflictPanes[compNdx] == null) { ExportConflictTable table = new ExportConflictTable.CharacteristicsTable(mismatches[compNdx]); exportChrConflictPanes[compNdx] = new JScrollPane(table); exportChrConflictPanes[compNdx].setBackground(Color.WHITE); } return exportChrConflictPanes[compNdx]; } /** * Get the Unrecognized Parts table for comparison number compNdx * @param compNdx comparison index * @return Unrecognized Parts table wrapped into a JScrollPane */ private JScrollPane getUnrecognizedPartsPane(int compNdx) { if (compNdx < 0 || compNdx >= unrecognizedPartsPanes.length) return null; if (unrecognizedPartsPanes[compNdx] == null) { UnrecognizedPartTable table = new UnrecognizedPartTable(mismatches[compNdx]); unrecognizedPartsPanes[compNdx] = new JScrollPane(table); unrecognizedPartsPanes[compNdx].setBackground(Color.WHITE); } return unrecognizedPartsPanes[compNdx]; } /** * Get the Sizes table for comparison number compNdx * @param compNdx comparison index * @return Sizes table wrapped into a JScrollPane */ private JPanel getSizesPane(int compNdx) { if (compNdx < 0 || compNdx >= sizesPanes.length) return null; if (sizesPanes[compNdx] == null) sizesPanes[compNdx] = new SizeMismatchPane(mismatches[compNdx]); return sizesPanes[compNdx]; } /** * Notify Comparisons Pane that the tree selection has changed. The supplied * TreeNode was either added (added is true) or removed (added is false) * from the current selection * @param node a TreeNode whose state has changed * @param added true if the node was added, false otherwise */ public void treeSelectionChanged(TreeNode node, boolean added) { if (node == null) return; int type = node.type; if (type == TreeNode.TITLE) return; if (type == TreeNode.PARTLEAF || type == TreeNode.WIRELEAF) { node = node.getParent(); type = node.type; } if (!added) { // if node is removed from selection if (type == TreeNode.PART || type == TreeNode.WIRE) curEqRecNodes.remove(node); else curExlusiveNodes.remove(node); } else { // if node is added to selection if (type == TreeNode.PART || type == TreeNode.WIRE) curEqRecNodes.add(node); else curExlusiveNodes.add(node); } } /** * Update right pane. Content of the pane depends on the current tree selection * and should be updated every time the selection changes. */ public void updateRightPane() { int divPos = getDividerLocation(); if (curExlusiveNodes.size() > 0) { // if an exclusive node is selected // get the first node (it is selected for the longest time) TreeNode exNode = curExlusiveNodes.firstElement(); int exType = exNode.type; switch (exType) { case TreeNode.COMP_TITLE: dispOnRight = COMP_SUMMARY; displayComparisonSummary(exNode.compNdx); break; case TreeNode.EXPORTS: dispOnRight = EXPORTS; setRightComponent(getExportsPane(exNode.compNdx)); break; case TreeNode.SIZES: dispOnRight = SIZES; setRightComponent(getSizesPane(exNode.compNdx)); break; case TreeNode.EXPORT_ASSERTS: dispOnRight = EXPORT_ASSERTS; setRightComponent(getExportAssertionPane(exNode.compNdx)); break; case TreeNode.EXPORT_NET_CONF: dispOnRight = EXPORT_NET_CONF; setRightComponent(getExportNetConflictPane(exNode.compNdx)); break; case TreeNode.EXPORT_CHR_CONF: dispOnRight = EXPORT_CHR_CONF; setRightComponent(getExportChrConflictPane(exNode.compNdx)); break; case TreeNode.UNRECOG_PART: dispOnRight = UNRECOG_PART; setRightComponent(getUnrecognizedPartsPane(exNode.compNdx)); break; } setDividerLocation(divPos); // restore divider position return; } else if (curEqRecNodes.size() == 0) { // if no equiv. class is selected resetRightPane(); // display an empty right pane return; } // the right pane will display one or more equiv. classes dispOnRight = PARTS_WIRES; // get equiv. classes to be displayed curEqRecNodesToDisplay.clear(); int i = 0; for (Iterator<TreeNode> it=curEqRecNodes.iterator(); it.hasNext() && i<MAX_CONCUR_EQ_RECS;) { TreeNode eqRecNode = it.next(); if (curEqRecNodesToDisplay.contains(eqRecNode)) continue; // skip if already displayed curEqRecNodesToDisplay.add(eqRecNode); i++; } // get a pane with proper number of rows EquivClassSplitPane rightSplPane = rightSplPanes[curEqRecNodesToDisplay.size()-1]; i = 0; // fill pane with data row by row for (Iterator<TreeNode> it=curEqRecNodesToDisplay.iterator(); it.hasNext(); i++) { TreeNode eqRecNode = it.next(); String partitionTitle = eqRecNode.getParent().getShortName() + " : " + eqRecNode.getShortName(); rightSplPane.setPartitionTitle(i, partitionTitle); List<NetObjReport>[] mism = new ArrayList[2]; EquivRecReport eqRec = mismEqRecs[eqRecNode.compNdx][eqRecNode.eclass]; mism[0] = eqRec.getNotMatchedNetObjs().get(0); mism[1] = eqRec.getNotMatchedNetObjs().get(1); mismNetObjs[eqRecNode.compNdx][eqRecNode.eclass] = mism; List<NetObjReport>[] matched = new ArrayList[2]; matched[0] = eqRec.getMatchedNetObjs().get(0); matched[1] = eqRec.getMatchedNetObjs().get(1); matchedNetObjs[eqRecNode.compNdx][eqRecNode.eclass] = matched;// if (mismatches[eqRecNode.compNdx].isHashFailuresPrinted())// fillHashPartitionResults(eqRecNode, rightSplPane, i);// else fillLocalPartitionResults(eqRecNode, rightSplPane, i); } setRightComponent(rightSplPane); setDividerLocation(divPos); rightSplPane.updateLayout(); } /** * Fill the provided split cell with parts or wires from compared cells that * belong to the local partitioning equivalence class identified by * the provided tree node. * @param node tree node * @param pane split pane * @param row row in the split pane (>1 rows if >1 node selected) */ private void fillLocalPartitionResults(TreeNode node, EquivClassSplitPane pane, int row) { int swap = 0; if (mismatches[node.compNdx].isSwapCells()) swap = 1; List<NetObjReport>[] matched = matchedNetObjs[node.compNdx][node.eclass]; List<NetObjReport>[] mism = mismNetObjs[node.compNdx][node.eclass]; String href = "<a style=\"text-decoration: none\" href=\""; StringBuffer html = new StringBuffer(256); for (int cell=0; cell<2; cell++) { int ndx = (cell + swap)%2; StringBuffer curCellText = pane.getCellPlainTextBuffer(row,ndx); curCellText.setLength(0); html.setLength(0); // fonts: Courier, Dialog, Helvetica, TimesRoman, Serif html.append("<html><FONT SIZE=3><FONT FACE=\"Helvetica, TimesRoman\">"); // mismatched netobjects (printed in red) if (mism[ndx].size() > 0) { html.append("<font COLOR=\"red\">"); for (int k=0; k<mism[ndx].size() && k<ComparisonsTree.MAX_LIST_ELEMENTS; k++) { String descr = cleanNetObjectName( (mism[ndx].get(k)).instanceDescription()); html.append(href + (row*100000 + ndx*10000 + k) +"\">"+ descr + "</a>"); curCellText.append(descr); html.append("<br>"); curCellText.append(LSEP); } html.append("</font>"); } // if this cell has fewer mismatches than the other one // and matches are going to printed in this cell, then add empty lines int sizeDiff = mism[(ndx+1)%2].size() - mism[ndx].size(); if (matched[ndx].size() > 0) while (sizeDiff-- > 0) { html.append("<br>"); curCellText.append(LSEP); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -