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

📄 checkoutjob.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
					propagated = false;					for(Iterator<Library> it = Library.getLibraries(); it.hasNext(); )					{						Library oLib = it.next();						for(Iterator<Cell> cIt = oLib.getCells(); cIt.hasNext(); )						{							Cell cell = cIt.next();							MutableInteger val = cellsMarked.get(cell);							if (val.intValue() == 1)							{								propagated = true;								val.setValue(2);								for(Iterator<NodeInst> nIt = cell.getNodes(); nIt.hasNext(); )								{									NodeInst ni = nIt.next();									if (!ni.isCellInstance()) continue;									MutableInteger subVal = cellsMarked.get(ni.getProto());									if (subVal.intValue() == 0) subVal.setValue(1);								}							}						}					}				}				miNewVers.setValue(0);				total = 0;				for(Iterator<Library> it = Library.getLibraries(); it.hasNext(); )				{					Library oLib = it.next();					for(Iterator<Cell> cIt = oLib.getCells(); cIt.hasNext(); )					{						Cell cell = cIt.next();						MutableInteger val = cellsMarked.get(cell);						if (val.intValue() == 0) continue;						String owner = Project.getCellOwner(cell);						if (owner.length() == 0) continue;						if (!owner.equals(Project.getCurrentUserName()))						{							val.setValue(3);							total++;						}					}				}				if (total != 0)				{					System.out.println("*** Warning: the following cells are below this in the hierarchy");					System.out.println("*** and are checked out to others.  This may cause problems");					for(Iterator<Library> it = Library.getLibraries(); it.hasNext(); )					{						Library oLib = it.next();						for(Iterator<Cell> cIt = oLib.getCells(); cIt.hasNext(); )						{							Cell cell = cIt.next();							MutableInteger val = cellsMarked.get(cell);							if (val.intValue() != 3) continue;							String owner = Project.getCellOwner(cell);							System.out.println("    " + cell + " is checked out to " + owner);						}					}				}			}		}    }//	/**//	 * This class checks out cells from Project Management to allow changes that have been made.//	 *///	static class AutoCheckoutJob extends Job//	{//		private List<Cell> cellsThatChanged;//		private ProjectDB pdb;//		private DisplayedCells displayedCells;////		AutoCheckoutJob(List<Cell> cellsThatChanged)//		{//			super("Check out locked cells to allow changes", Project.getProjectTool(), Job.Type.CHANGE, null, null, Job.Priority.USER);//			this.cellsThatChanged = cellsThatChanged;//			pdb = Project.projectDB;////			// save the current window configuration//			displayedCells = new DisplayedCells();//			displayedCells.setCellsToBeChanged(cellsThatChanged);//			startJob();//		}////		public boolean doIt() throws JobException//		{//			// make a set of project libraries that are affected//			Set<ProjectLibrary> projectLibs = new HashSet<ProjectLibrary>();//			for(Cell oldVers : cellsThatChanged)//			{//				Library lib = oldVers.getLibrary();//				ProjectLibrary pl = pdb.findProjectLibrary(lib);//				projectLibs.add(pl);//			}////			// lock access to the project files (throws JobException on error)//			ProjectLibrary.lockManyProjectFiles(projectLibs);////			// check out the cell//			try//			{//				preCheckOutCells(pdb, cellsThatChanged);//			} catch (JobException e)//			{//				ProjectLibrary.releaseManyProjectFiles(projectLibs);//				throw e;//			}////			// prevent tools (including this one) from seeing the changes//			Project.setChangeStatus(true);////			// make new version//			for(Cell oldVers : cellsThatChanged)//			{//				// change version information (throws JobException on error)//				Cell newVers = bumpVersion(oldVers);		// CHANGES DATABASE//				if (newVers != null)//				{//					// update records for the changed cells//		        	bumpRecordVersions(pdb, oldVers, newVers);////		        	// record that cells changed so that displays get updated//		        	displayedCells.swap(oldVers, newVers);//				}//			}////			Project.setChangeStatus(false);////			ProjectLibrary.releaseManyProjectFiles(projectLibs);////			fieldVariableChanged("pdb");//			fieldVariableChanged("displayedCells");//			return true;//		}////		public void terminateIt(Throwable je)//        {//	    	// take the new version of the project database from the server//	    	Project.projectDB = pdb;////	    	// redisplay windows to show current versions//	    	displayedCells.updateWindows();////			// update explorer tree//			WindowFrame.wantToRedoLibraryTree();//        }//	}	/**	 * Method to "bump" the version of a Cell by duplicating it.	 * The cell then has a new version number.  The new Cell replaces	 * the old Cell, and the old one is deleted.	 * @param oldVers the old Cell.	 * @return the new Cell (null on error).	 */	private static Cell bumpVersion(Cell oldVers)		throws JobException	{		Library lib = oldVers.getLibrary();		Cell newVers = Cell.copyNodeProto(oldVers, lib, oldVers.getName(), true);		if (newVers == null)			throw new JobException("Error making new version of cell " + oldVers.describe(false));		// replace former usage with new version		if (Project.useNewestVersion(oldVers, newVers))		// CHANGES DATABASE			throw new JobException("Error replacing instances of cell " + oldVers.describe(false));		Project.markLocked(newVers, false);		// CHANGES DATABASE		lib.setChanged();		return newVers;	}	/**	 * Method to update the project databases to account for cell replacements.	 * @param newCells a map from old cells to new cells.	 */	private static void bumpRecordVersions(ProjectDB pdb, Cell oldVers, Cell newVers)	{		// find the old ProjectCell		ProjectLibrary pl = pdb.findProjectLibrary(oldVers.getLibrary());		ProjectCell oldPC = pl.findProjectCell(oldVers);		// make the new ProjectCell		ProjectCell newPC = new ProjectCell(newVers, pl);		newPC.setLibType(oldPC.getLibType());		newPC.setComment("CHECKED OUT");		newPC.setOwner(Project.getCurrentUserName());		pl.linkProjectCellToCell(oldPC, null);		pl.linkProjectCellToCell(newPC, newVers);	}	/**	 * Method to check out a list of Cells.	 * @param cellsToCheckOut the List of Cells to check out.	 * Throws JobException on error.	 */	private static void preCheckOutCells(ProjectDB pdb, List<Cell> cellsToCheckOut)		throws JobException	{		// examine each cell being checked out		for(Cell oldVers : cellsToCheckOut)		{			// see if there is a newer version of a cell			ProjectLibrary pl = pdb.findProjectLibrary(oldVers.getLibrary());			ProjectCell newestProjectCell = null;			for(Iterator<ProjectCell> it = pl.getProjectCells(); it.hasNext(); )			{				ProjectCell pc = it.next();				if (pc.getCellName().equals(oldVers.getName()) && pc.getView() == oldVers.getView())				{					if (pc.getVersion() > oldVers.getVersion())					{						if (newestProjectCell == null || newestProjectCell.getVersion() < pc.getVersion())							newestProjectCell = pc;					}				}			}			if (newestProjectCell != null)			{				if (newestProjectCell.getOwner().length() == 0)				{					throw new JobException(						"A more recent version of cell " + oldVers.describe(false) + " is in the repository.  Do an update first.");				}				if (newestProjectCell.getOwner().equals(Project.getCurrentUserName()))				{					throw new JobException(						"You already checked-out cell " + oldVers.describe(false) + ", but the changes are not in the current library.  Do an update first.");				}				throw new JobException(					"Cannot check-out cell " + oldVers.describe(false) + ".  It is checked-out to '" + newestProjectCell.getOwner() + "'");			}			// find this cell in the project file			ProjectCell pc = pl.findProjectCell(oldVers);			if (pc == null)			{				throw new JobException(					"Cell " + oldVers.describe(false) + " is not in the project.  You must add it to the project before being able to check it out and in.");			}			// see if it is available			if (pc.getOwner().length() != 0)			{				if (pc.getOwner().equals(Project.getCurrentUserName()))				{					Project.markLocked(oldVers, false);		// CHANGES DATABASE					throw new JobException(						"Cell " + oldVers.describe(false) + " is already checked out to you.");				}				throw new JobException(					"Cannot check cell " + oldVers.describe(false) + " out because it is already checked out to '" + pc.getOwner() + "'");			}			// make sure we have the latest version			if (pc.getVersion() > oldVers.getVersion())			{				throw new JobException(					"Cannot check out cell " + oldVers.describe(false) +					" because you don't have the latest version (yours is " + oldVers.getVersion() + ", project has " +					pc.getVersion() + ").  Do an 'update' first");			}		}	}}

⌨️ 快捷键说明

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