⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 celllists.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
        excludeNewestVersions.setText("Exclude newest versions");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 14;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(0, 20, 4, 4);        getContentPane().add(excludeNewestVersions, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 15;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        getContentPane().add(jSeparator3, gridBagConstraints);        jLabel4.setText("Display ordering:");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 16;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        getContentPane().add(jLabel4, gridBagConstraints);        ordering.add(orderByName);        orderByName.setText("Order by name");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 17;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(4, 20, 0, 4);        getContentPane().add(orderByName, gridBagConstraints);        ordering.add(orderByDate);        orderByDate.setText("Order by modification date");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 19;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(0, 20, 0, 4);        getContentPane().add(orderByDate, gridBagConstraints);        ordering.add(orderByStructure);        orderByStructure.setText("Order by skeletal structure");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 20;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(0, 20, 4, 4);        getContentPane().add(orderByStructure, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 21;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        getContentPane().add(jSeparator4, gridBagConstraints);        jLabel5.setText("Destination:");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 22;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        getContentPane().add(jLabel5, gridBagConstraints);        destination.add(displayInMessages);        displayInMessages.setText("Display in messages window");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 23;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(4, 20, 0, 4);        getContentPane().add(displayInMessages, gridBagConstraints);        destination.add(saveToDisk);        saveToDisk.setText("Save to disk");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 24;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(0, 20, 4, 4);        getContentPane().add(saveToDisk, gridBagConstraints);        evaluateNumerically.setText("Evaluate Numbers when Sorting Names");        evaluateNumerically.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));        evaluateNumerically.setMargin(new java.awt.Insets(0, 0, 0, 0));        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 18;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(0, 40, 0, 4);        getContentPane().add(evaluateNumerically, gridBagConstraints);        pack();    }// </editor-fold>//GEN-END:initComponents	private void onlyThisViewActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_onlyThisViewActionPerformed	{//GEN-HEADEREND:event_onlyThisViewActionPerformed		boolean selected = onlyThisView.isSelected();		views.setEnabled(selected);	}//GEN-LAST:event_onlyThisViewActionPerformed	private void cancel(java.awt.event.ActionEvent evt)//GEN-FIRST:event_cancel	{//GEN-HEADEREND:event_cancel		closeDialog(null);	}//GEN-LAST:event_cancel	private void ok(java.awt.event.ActionEvent evt)//GEN-FIRST:event_ok	{//GEN-HEADEREND:event_ok		// get cell and port markers		Set<Cell> cellsSeen = new HashSet<Cell>();		// mark cells to be shown		if (allCells.isSelected())		{			// mark all cells for display			for(Iterator<Library> it = Library.getLibraries(); it.hasNext(); )			{				Library lib = it.next();				for(Iterator<Cell> cIt = lib.getCells(); cIt.hasNext(); )				{					Cell cell = cIt.next();					cellsSeen.add(cell);				}			}		} else		{			// mark no cells for display, filter according to request			if (onlyCellsUnderCurrent.isSelected())			{				// mark those that are under this				recursiveMark(curCell, cellsSeen);			} else if (onlyCellsUsedElsewhere.isSelected())			{				// mark those that are in use				for(Iterator<Library> it = Library.getLibraries(); it.hasNext(); )				{					Library lib = it.next();					for(Iterator<Cell> cIt = lib.getCells(); cIt.hasNext(); )					{						Cell cell = cIt.next();						Cell iconCell = cell.iconView();						if (iconCell == null) iconCell = cell;						if (cell.getInstancesOf().hasNext() || iconCell.getInstancesOf().hasNext())							cellsSeen.add(cell);					}				}			} else if (onlyCellsNotUsedElsewhere.isSelected())			{				// mark those that are not in use				for(Iterator<Library> it = Library.getLibraries(); it.hasNext(); )				{					Library lib = it.next();					for(Iterator<Cell> cIt = lib.getCells(); cIt.hasNext(); )					{						Cell cell = cIt.next();						Cell iconCell = cell.iconView();						if (iconCell != null)						{							// has icon: acceptable if the only instances are examples							if (cell.getInstancesOf().hasNext()) continue;							boolean found = false;							for(Iterator<NodeInst> nIt = iconCell.getInstancesOf(); nIt.hasNext(); )							{								NodeInst ni = nIt.next();								if (ni.isIconOfParent()) { found = true;   break; }							}							if (found) continue;						} else						{							// no icon: reject if this has instances							if (cell.isIcon())							{								// this is an icon: reject if instances are not examples								boolean found = false;								for(Iterator<NodeInst> nIt = cell.getInstancesOf(); nIt.hasNext(); )								{									NodeInst ni = nIt.next();									if (ni.isIconOfParent()) { found = true;   break; }								}								if (found) continue;							} else							{								if (cell.getInstancesOf().hasNext()) continue;							}						}						cellsSeen.add(cell);					}				}			} else			{				// mark placeholder cells				for(Iterator<Library> it = Library.getLibraries(); it.hasNext(); )				{					Library lib = it.next();					for(Iterator<Cell> cIt = lib.getCells(); cIt.hasNext(); )					{						Cell cell = cIt.next();						Variable var = cell.getVar("IO_true_library");						if (var != null) cellsSeen.add(cell);					}				}			}		}		// filter views		if (onlyThisView.isSelected())		{			String viewName = (String)views.getSelectedItem();			View v = View.findView(viewName);			if (v != null)			{				for(Iterator<Library> it = Library.getLibraries(); it.hasNext(); )				{					Library lib = it.next();					for(Iterator<Cell> cIt = lib.getCells(); cIt.hasNext(); )					{						Cell cell = cIt.next();						if (cell.getView() != v)						{							if (cell.isIcon())							{								if (alsoIconViews.isSelected()) continue;							}							cellsSeen.remove(cell);						}					}				}			}		}		// filter versions		if (excludeOlderVersions.isSelected())		{			for(Iterator<Library> it = Library.getLibraries(); it.hasNext(); )			{				Library lib = it.next();				for(Iterator<Cell> cIt = lib.getCells(); cIt.hasNext(); )				{					Cell cell = cIt.next();					if (cell.getNewestVersion() != cell) cellsSeen.remove(cell);				}			}		}		if (excludeNewestVersions.isSelected())		{			for(Iterator<Library> it = Library.getLibraries(); it.hasNext(); )			{				Library lib = it.next();				for(Iterator<Cell> cIt = lib.getCells(); cIt.hasNext(); )				{					Cell cell = cIt.next();					if (cell.getNewestVersion() == cell) cellsSeen.remove(cell);				}			}		}		// now make a list and sort it		List<Cell> cellList = new ArrayList<Cell>();		for(Iterator<Library> it = Library.getLibraries(); it.hasNext(); )		{			Library lib = it.next();			if (lib.isHidden()) continue;			for(Iterator<Cell> cIt = lib.getCells(); cIt.hasNext(); )			{				Cell cell = cIt.next();				if (cellsSeen.contains(cell)) cellList.add(cell);			}		}		if (cellList.size() == 0) System.out.println("No cells match this request"); else		{			if (orderByName.isSelected())			{				if (evaluateNumerically.isSelected())				{					Collections.sort(cellList);				} else				{					Collections.sort(cellList, new TextUtils.CellsByName());				}			} else if (orderByDate.isSelected())			{				Collections.sort(cellList, new TextUtils.CellsByDate());			} else if (orderByStructure.isSelected())			{				Collections.sort(cellList, new SortByCellStructure());			}			// finally show the results			if (saveToDisk.isSelected())			{				String trueName = OpenFile.chooseOutputFile(FileType.READABLEDUMP, null, "celllist.txt");				if (trueName == null) System.out.println("Cannot write cell listing"); else				{					FileOutputStream fileOutputStream = null;					try {						fileOutputStream = new FileOutputStream(trueName);					} catch (FileNotFoundException e) {}					BufferedOutputStream bufStrm = new BufferedOutputStream(fileOutputStream);					DataOutputStream dataOutputStream = new DataOutputStream(bufStrm);					try					{						DateFormat df = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);						String header = "List of cells created on " + df.format(new Date()) + "\n";						dataOutputStream.write(header.getBytes(), 0, header.length());						header = "Cell\tVersion\tCreation date\tRevision Date\tSize\tUsage\tLock\tInst-lock\tCell-lib\tDRC\tNCC\n";						dataOutputStream.write(header.getBytes(), 0, header.length());						for(Cell cell : cellList)						{							String line =  makeCellLine(cell, -1) + "\n";							dataOutputStream.write(line.getBytes(), 0, line.length());						}						dataOutputStream.close();						System.out.println("Wrote " + trueName);					} catch (IOException e)					{						System.out.println("Error closing " + trueName);					}				}			} else			{				int maxLen = 0;				for(Cell cell : cellList)				{					maxLen = Math.max(maxLen, cell.noLibDescribe().length());				}				maxLen = Math.max(maxLen+2, 7);				printHeaderLine(maxLen);				Library lib = null;				for(Cell cell : cellList)				{					if (cell.getLibrary() != lib)					{						lib = cell.getLibrary();						System.out.println("======== LIBRARY " + lib.getName() + ": ========");					}					System.out.println(makeCellLine(cell, maxLen));				}			}		}		closeDialog(null);	}//GEN-LAST:event_ok	/** Closes the dialog */	private void closeDialog(java.awt.event.WindowEvent evt)//GEN-FIRST:event_closeDialog	{		// remember settings		if (allCells.isSelected()) whichSwitch = 0; else		if (onlyCellsUsedElsewhere.isSelected()) whichSwitch = 1; else		if (onlyCellsNotUsedElsewhere.isSelected()) whichSwitch = 2; else		if (onlyCellsUnderCurrent.isSelected()) whichSwitch = 3; else		if (onlyPlaceholderCells.isSelected()) whichSwitch = 4;		onlyViewSwitch = onlyThisView.isSelected();		viewSwitch = View.findView((String)views.getSelectedItem());		alsoIconSwitch = alsoIconViews.isSelected();		excOldVersSwitch = excludeOlderVersions.isSelected();		excNewVersSwitch = excludeNewestVersions.isSelected();		evaluateNumbers = evaluateNumerically.isSelected();		if (orderByName.isSelected()) orderingSwitch = 0; else		if (orderByDate.isSelected()) orderingSwitch = 1; else		if (orderByStructure.isSelected()) orderingSwitch = 2;		if (displayInMessages.isSelected()) destinationSwitch = 0; else		if (saveToDisk.isSelected()) destinationSwitch = 1;		setVisible(false);		dispose();	}//GEN-LAST:event_closeDialog    // Variables declaration - do not modify//GEN-BEGIN:variables    private javax.swing.JRadioButton allCells;    private javax.swing.JCheckBox alsoIconViews;    private javax.swing.JButton cancel;    private javax.swing.ButtonGroup destination;    private javax.swing.JRadioButton displayInMessages;    private javax.swing.JCheckBox evaluateNumerically;    private javax.swing.JCheckBox excludeNewestVersions;    private javax.swing.JCheckBox excludeOlderVersions;    private javax.swing.JLabel jLabel1;    private javax.swing.JLabel jLabel2;    private javax.swing.JLabel jLabel3;    private javax.swing.JLabel jLabel4;    private javax.swing.JLabel jLabel5;    private javax.swing.JSeparator jSeparator1;    private javax.swing.JSeparator jSeparator2;    private javax.swing.JSeparator jSeparator3;    private javax.swing.JSeparator jSeparator4;    private javax.swing.JButton ok;    private javax.swing.JRadioButton onlyCellsNotUsedElsewhere;    private javax.swing.JRadioButton onlyCellsUnderCurrent;    private javax.swing.JRadioButton onlyCellsUsedElsewhere;    private javax.swing.JRadioButton onlyPlaceholderCells;    private javax.swing.JCheckBox onlyThisView;    private javax.swing.JRadioButton orderByDate;    private javax.swing.JRadioButton orderByName;    private javax.swing.JRadioButton orderByStructure;    private javax.swing.ButtonGroup ordering;    private javax.swing.JRadioButton saveToDisk;    private javax.swing.JComboBox views;    private javax.swing.ButtonGroup whichCells;    // End of variables declaration//GEN-END:variables}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -