Input:
	private void build() {
		final BooksDatabase db = BooksDatabase.Instance();
		final FileInfoSet fileInfos = new FileInfoSet();
		final Map<Long,Book> savedBooksByFileId = db.loadBooks(fileInfos, true);
		final Map<Long,Book> savedBooksByBookId = new HashMap<Long,Book>();
		for (Book b : savedBooksByFileId.values()) {
			savedBooksByBookId.put(b.getId(), b);
		}
		for (long id : db.loadRecentBookIds()) {
			Book book = savedBooksByBookId.get(id);
			if (book == null) {
				book = Book.getById(id);
			}
			if (book != null) {
				new BookTree(getFirstLevelTree(ROOT_RECENT), book, true);
			}
		}
		for (long id : db.loadFavoritesIds()) {
			Book book = savedBooksByBookId.get(id);
			if (book == null) {
				book = Book.getById(id);
			}
			if (book != null) {
				getFirstLevelTree(ROOT_FAVORITES).getBookSubTree(book, true);
			}
		}
		fireModelChangedEvent();
		if (savedBooksByFileId.size() > 10) {
			final HashSet<String> letterSet = new HashSet<String>();
			for (Book book : savedBooksByFileId.values()) {
				final String letter = TitleTree.firstTitleLetter(book);
				if (letter != null) {
					letterSet.add(letter);
				}
			}
			myDoGroupTitlesByFirstLetter = savedBooksByFileId.values().size() > letterSet.size() * 5 / 4;
		}
		final Set<Book> orphanedBooks = new HashSet<Book>();
		for (Book book : savedBooksByFileId.values()) {
			synchronized (this) {
				if (book.File.exists()) {
					boolean doAdd = true;
					final ZLPhysicalFile file = book.File.getPhysicalFile();
					if (file == null) {
						continue;
					}
					if (!fileInfos.check(file, true)) {
						if (book.readMetaInfo()) {
							book.save();
						} else {
							doAdd = false;
						}
						file.setCached(false);
					}
					if (doAdd) {
						addBookToLibrary(book);
					}
				} else {
					myRootTree.removeBook(book);
					orphanedBooks.add(book);
				}
			}
			fireModelChangedEvent();
		}
		db.setExistingFlag(orphanedBooks, false);
		final Map<Long,Book> orphanedBooksByFileId = db.loadBooks(fileInfos, false);
		final Set<Book> newBooks = new HashSet<Book>();
		final List<ZLPhysicalFile> physicalFilesList = collectPhysicalFiles();
		for (ZLPhysicalFile file : physicalFilesList) {
			collectBooks(
				file, fileInfos,
				savedBooksByFileId, orphanedBooksByFileId,
				newBooks,
				!fileInfos.check(file, true)
			);
			file.setCached(false);
		}
		final ZLFile helpFile = getHelpFile();
		Book helpBook = savedBooksByFileId.get(fileInfos.getId(helpFile));
		if (helpBook == null) {
			helpBook = new Book(helpFile);
			helpBook.readMetaInfo();
		}
		addBookToLibrary(helpBook);
		fireModelChangedEvent();
		fileInfos.save();
		db.executeAsATransaction(new Runnable() {
			public void run() {
				for (Book book : newBooks) {
					book.save();
				}
			}
		});
		db.setExistingFlag(newBooks, true);
	}

Output:
	private void build() {
		final BooksDatabase db = BooksDatabase.Instance();
		final FileInfoSet fileInfos = new FileInfoSet();
		final Map<Long,Book> savedBooksByFileId = db.loadBooks(fileInfos, true);
		final Map<Long,Book> savedBooksByBookId = new HashMap<Long,Book>();
		for (Book b : savedBooksByFileId.values()) {
			savedBooksByBookId.put(b.getId(), b);
		}
		for (long id : db.loadRecentBookIds()) {
			Book book = savedBooksByBookId.get(id);
			if (book == null) {
				book = Book.getById(id);
				if (book != null && !book.File.exists()) {
					book = null;
				}
			}
			if (book != null) {
				new BookTree(getFirstLevelTree(ROOT_RECENT), book, true);
			}
		}
		for (long id : db.loadFavoritesIds()) {
			Book book = savedBooksByBookId.get(id);
			if (book == null) {
				book = Book.getById(id);
				if (book != null && !book.File.exists()) {
					book = null;
				}
			}
			if (book != null) {
				getFirstLevelTree(ROOT_FAVORITES).getBookSubTree(book, true);
			}
		}
		fireModelChangedEvent();
		if (savedBooksByFileId.size() > 10) {
			final HashSet<String> letterSet = new HashSet<String>();
			for (Book book : savedBooksByFileId.values()) {
				final String letter = TitleTree.firstTitleLetter(book);
				if (letter != null) {
					letterSet.add(letter);
				}
			}
			myDoGroupTitlesByFirstLetter = savedBooksByFileId.values().size() > letterSet.size() * 5 / 4;
		}
		final Set<Book> orphanedBooks = new HashSet<Book>();
		for (Book book : savedBooksByFileId.values()) {
			synchronized (this) {
				if (book.File.exists()) {
					boolean doAdd = true;
					final ZLPhysicalFile file = book.File.getPhysicalFile();
					if (file == null) {
						continue;
					}
					if (!fileInfos.check(file, true)) {
						if (book.readMetaInfo()) {
							book.save();
						} else {
							doAdd = false;
						}
						file.setCached(false);
					}
					if (doAdd) {
						addBookToLibrary(book);
					}
				} else {
					myRootTree.removeBook(book);
					orphanedBooks.add(book);
				}
			}
			fireModelChangedEvent();
		}
		db.setExistingFlag(orphanedBooks, false);
		final Map<Long,Book> orphanedBooksByFileId = db.loadBooks(fileInfos, false);
		final Set<Book> newBooks = new HashSet<Book>();
		final List<ZLPhysicalFile> physicalFilesList = collectPhysicalFiles();
		for (ZLPhysicalFile file : physicalFilesList) {
			collectBooks(
				file, fileInfos,
				savedBooksByFileId, orphanedBooksByFileId,
				newBooks,
				!fileInfos.check(file, true)
			);
			file.setCached(false);
		}
		final ZLFile helpFile = getHelpFile();
		Book helpBook = savedBooksByFileId.get(fileInfos.getId(helpFile));
		if (helpBook == null) {
			helpBook = new Book(helpFile);
			helpBook.readMetaInfo();
		}
		addBookToLibrary(helpBook);
		fireModelChangedEvent();
		fileInfos.save();
		db.executeAsATransaction(new Runnable() {
			public void run() {
				for (Book book : newBooks) {
					book.save();
				}
			}
		});
		db.setExistingFlag(newBooks, true);
	}


Input:
	public String encode() {
		if (name != null && value != null && !isFlagParameter) {
			if (GenericObject.isMySubclass(value.getClass())) {
				GenericObject gv = (GenericObject) value;
				return name + separator + quotes + gv.encode() + quotes;
			} else if (GenericObjectList.isMySubclass(value.getClass())) {
				GenericObjectList gvlist = (GenericObjectList) value;
				return name + separator + gvlist.encode();
			} else if ( value.toString().equals("")) {
				if (name.toString().equals(gov.nist.javax.sip.header.ParameterNames.OPAQUE))
					return name + separator + quotes + quotes;
				else
					return name;
			} else
				return name + separator + quotes + value.toString() + quotes;
		} else if (name == null && value != null) {
			if (GenericObject.isMySubclass(value.getClass())) {
				GenericObject gv = (GenericObject) value;
				return gv.encode();
			} else if (GenericObjectList.isMySubclass(value.getClass())) {
				GenericObjectList gvlist = (GenericObjectList) value;
				return gvlist.encode();
			}
			return quotes + value.toString() + quotes;
		} else if (name != null && (value == null || isFlagParameter)) {
			return name;
		} else
			return "";
	}

Output:
	public String encode() {
		if (name != null && value != null && !isFlagParameter) {
			if (GenericObject.isMySubclass(value.getClass())) {
				GenericObject gv = (GenericObject) value;
				return name + separator + quotes + gv.encode() + quotes;
			} else if (GenericObjectList.isMySubclass(value.getClass())) {
				GenericObjectList gvlist = (GenericObjectList) value;
				return name + separator + gvlist.encode();
			} else if ( value.toString().equals("")) {
				if ( this.isQuotedString ) {
					return name + separator + quotes + quotes;
				} else
					return name;
			} else
				return name + separator + quotes + value.toString() + quotes;
		} else if (name == null && value != null) {
			if (GenericObject.isMySubclass(value.getClass())) {
				GenericObject gv = (GenericObject) value;
				return gv.encode();
			} else if (GenericObjectList.isMySubclass(value.getClass())) {
				GenericObjectList gvlist = (GenericObjectList) value;
				return gvlist.encode();
			}
			return quotes + value.toString() + quotes;
		} else if (name != null && (value == null || isFlagParameter)) {
			return name;
		} else
			return "";
	}


Input:
	public QSync(File qsyncfile)
	{
		Document qsyncDoc =null;
		try
		{
			qsyncDoc = DocumentBuilderFactory.newInstance()
					.newDocumentBuilder()
					.parse(qsyncfile);
		}
		catch(ParserConfigurationException ex) { System.err.println("QSync: error creating XML configuration"); }
		catch(SAXException ex) { System.err.println("Error reading document ("+qsyncfile.getName()+"): "+ex.getMessage()); }
		catch(IOException ex) { System.err.println("IOException reading document ("+qsyncfile.getName()+")"); }
		if(qsyncDoc==null) System.exit(-1);
		mPwd = qsyncfile.getAbsoluteFile().getParentFile();
		try
		{
			NodeList includeExtList = qsyncDoc.getElementsByTagName("ClInclude");
			if(includeExtList.getLength() == 0) throw new XMLParseException("element <ClInclude> not found");
			if(includeExtList.getLength() >1) throw new XMLParseException("multiple <ClInclude> elements");
			Element includes = (Element) qsyncDoc.adoptNode(includeExtList.item(0));
			mIncludes = includes.getAttribute("ext");
			if(mIncludes.length()==0 || !mIncludes.matches("^[a-zA-Z0-9]*(,[a-zA-Z0-9]*)*$"))
				throw new XMLParseException("src attribute of <ClInclude> is not valid");
			NodeList compileExtList = qsyncDoc.getElementsByTagName("ClCompile");
			if(compileExtList.getLength() == 0) throw new XMLParseException("element <ClCompile> not found");
			if(compileExtList.getLength() >1) throw new XMLParseException("multiple <ClCompile> elements");
			Element compiles = (Element) qsyncDoc.adoptNode(compileExtList.item(0));
			mCompiles = compiles.getAttribute("ext");
			if(mCompiles.length()==0 || !mCompiles.matches("^[a-zA-Z0-9]*(,[a-zA-Z0-9]*)*$"))
				throw new XMLParseException("src attribute of <ClCompile> is not valid");
			mProjects = new ArrayList<QSyncVcxproj>();
			NodeList vcxprojList = qsyncDoc.getElementsByTagName("vcxproj");
			if(vcxprojList.getLength() == 0) throw new XMLParseException("no <vcxproj> elements found");
			for(int i=vcxprojList.getLength()-1; i>=0; --i)
			{
				Node projNode = vcxprojList.item(i);
				Element projElem = (Element) qsyncDoc.adoptNode(projNode);
				String projFile = projElem.getAttribute("proj");
				if(projFile.length()==0 || !projFile.matches(".*vcxproj$"))
					throw new XMLParseException("proj attribute of <vcxproj> is not valid (must be *.vcxproj)");
				projFile = Helpers.resolvePath(mPwd.getAbsolutePath(), projFile);
				QSyncVcxproj proj = new QSyncVcxproj(projFile, projFile + ".filters");
				NodeList importList = projNode.getChildNodes();
				if(importList.getLength() == 0) throw new XMLParseException("no <import> element defined for " + projFile);
				for(int j= importList.getLength()-1; j>=0; --j)
				{
					Node importNode = importList.item(j);
					if(!importNode.getNodeName().equals("import")) continue;
					String toFilter = importNode.getAttributes().getNamedItem("tofilter").getNodeValue();
					toFilter = Helpers.fixSlashes(toFilter);
					toFilter = Helpers.stripSlashes(toFilter);
					if(toFilter.length()==0 || !toFilter.matches("[a-zA-Z0-9 ]*(\\\\[a-zA-Z0-9 ]*)*"))
						throw new XMLParseException("tofilter attribute of <import> is not valid");
					QSyncImport imp = new QSyncImport(toFilter);
					NodeList importIncludesList = importNode.getChildNodes();
					if(importIncludesList.getLength()==0)
						throw new XMLParseException("<import> is empty (with tofilter="+toFilter+")");
					boolean src=false, inc=false;
					for(int n=importIncludesList.getLength()-1; n>=0; --n)
					{
						Node includeNode = importIncludesList.item(n);
						if(!includeNode.getNodeName().equals("include")
								   && !includeNode.getNodeName().equals("src")
								   && !includeNode.getNodeName().equals("misc"))
									continue;
						if(includeNode.getNodeName().equals("include"))
						{
							Node attrNode;
							if( (attrNode=includeNode.getAttributes().getNamedItem("accept"))!=null )
								imp.setRegexpInclude(attrNode.getNodeValue());
							if( (attrNode=includeNode.getAttributes().getNamedItem("exclude"))!=null )
								imp.setExcludeInc(attrNode.getNodeValue());
							if(inc) throw new XMLParseException("<import tofilter="+toFilter+"> has multiple <include> elements");
							if(includeNode.getFirstChild()==null) throw new XMLParseException("<include> element is empty.");
							inc = true;
							String includePath = includeNode.getFirstChild().getNodeValue();
							includePath = Helpers.resolvePath(mPwd.getAbsolutePath(), includePath);
							imp.setInclude(includePath);
						}
						else if(includeNode.getNodeName().equals("src"))
						{
							Node attrNode;
							if( (attrNode=includeNode.getAttributes().getNamedItem("regexp"))!=null)
								imp.setRegexpSrc(attrNode.getNodeValue());
							if( (attrNode=includeNode.getAttributes().getNamedItem("exclude"))!=null )
								imp.setExcludeSrc(attrNode.getNodeValue());
							if(src) throw new XMLParseException("<import tofilter="+toFilter+"> has multiple <src> elements");
							if(includeNode.getFirstChild()==null) throw new XMLParseException("<src> element is empty");
							src = true;
							String srcPath = includeNode.getFirstChild().getNodeValue();
							srcPath = Helpers.resolvePath(mPwd.getAbsolutePath(), srcPath);
							imp.setSrc(srcPath);
						}
						else if(includeNode.getNodeName().equals("misc"))
						{
							if(includeNode.getFirstChild()==null) throw new XMLParseException("<misc> element is empty");
							String miscPath = includeNode.getFirstChild().getNodeValue();
							miscPath = Helpers.resolvePath(mPwd.getAbsolutePath(), miscPath);
							imp.addMisc(miscPath);
						}
						else
						{
							throw new XMLParseException("<import tofilter="+toFilter+"> has invalid element: " + includeNode.getNodeName());
						}
					}
					proj.addImport(imp);
				}
				mProjects.add(proj);
			}
		}
		catch(XMLParseException ex) { System.err.println("XMLParseExcepiton: " + ex.getMessage()); System.exit(-1); }
	}

Output:
	public QSync(File qsyncfile)
	{
		Document qsyncDoc =null;
		try
		{
			qsyncDoc = DocumentBuilderFactory.newInstance()
					.newDocumentBuilder()
					.parse(qsyncfile);
		}
		catch(ParserConfigurationException ex) { System.err.println("QSync: error creating XML configuration"); }
		catch(SAXException ex) { System.err.println("Error reading document ("+qsyncfile.getName()+"): "+ex.getMessage()); }
		catch(IOException ex) { System.err.println("IOException reading document ("+qsyncfile.getName()+")"); }
		if(qsyncDoc==null) System.exit(-1);
		mPwd = qsyncfile.getAbsoluteFile().getParentFile();
		try
		{
			NodeList includeExtList = qsyncDoc.getElementsByTagName("ClInclude");
			if(includeExtList.getLength() == 0) throw new XMLParseException("element <ClInclude> not found");
			if(includeExtList.getLength() >1) throw new XMLParseException("multiple <ClInclude> elements");
			Element includes = (Element) qsyncDoc.adoptNode(includeExtList.item(0));
			mIncludes = includes.getAttribute("ext");
			if(mIncludes.length()==0 || !mIncludes.matches("^[a-zA-Z0-9]*(,[a-zA-Z0-9]*)*$"))
				throw new XMLParseException("src attribute of <ClInclude> is not valid");
			NodeList compileExtList = qsyncDoc.getElementsByTagName("ClCompile");
			if(compileExtList.getLength() == 0) throw new XMLParseException("element <ClCompile> not found");
			if(compileExtList.getLength() >1) throw new XMLParseException("multiple <ClCompile> elements");
			Element compiles = (Element) qsyncDoc.adoptNode(compileExtList.item(0));
			mCompiles = compiles.getAttribute("ext");
			if(mCompiles.length()==0 || !mCompiles.matches("^[a-zA-Z0-9]*(,[a-zA-Z0-9]*)*$"))
				throw new XMLParseException("src attribute of <ClCompile> is not valid");
			mProjects = new ArrayList<QSyncVcxproj>();
			NodeList vcxprojList = qsyncDoc.getElementsByTagName("vcxproj");
			if(vcxprojList.getLength() == 0) throw new XMLParseException("no <vcxproj> elements found");
			for(int i=vcxprojList.getLength()-1; i>=0; --i)
			{
				Node projNode = vcxprojList.item(i);
				Element projElem = (Element) qsyncDoc.adoptNode(projNode);
				String projFile = projElem.getAttribute("proj");
				if(projFile.length()==0 || !projFile.matches(".*vcxproj$"))
					throw new XMLParseException("proj attribute of <vcxproj> is not valid (must be *.vcxproj)");
				projFile = Helpers.resolvePath(mPwd.getAbsolutePath(), projFile);
				QSyncVcxproj proj = new QSyncVcxproj(projFile, projFile + ".filters");
				NodeList importList = projNode.getChildNodes();
				if(importList.getLength() == 0) throw new XMLParseException("no <import> element defined for " + projFile);
				for(int j= importList.getLength()-1; j>=0; --j)
				{
					Node importNode = importList.item(j);
					if(!importNode.getNodeName().equals("import")) continue;
					String toFilter = importNode.getAttributes().getNamedItem("tofilter").getNodeValue();
					toFilter = Helpers.fixSlashes(toFilter);
					toFilter = Helpers.stripSlashes(toFilter);
					if(toFilter.length()==0 || !toFilter.matches("[a-zA-Z0-9 ]*(\\\\[a-zA-Z0-9 ]*)*"))
						throw new XMLParseException("tofilter attribute of <import> is not valid");
					QSyncImport imp = new QSyncImport(toFilter);
					NodeList importIncludesList = importNode.getChildNodes();
					if(importIncludesList.getLength()==0)
						throw new XMLParseException("<import> is empty (with tofilter="+toFilter+")");
					boolean src=false, inc=false;
					for(int n=importIncludesList.getLength()-1; n>=0; --n)
					{
						Node includeNode = importIncludesList.item(n);
						if(!includeNode.getNodeName().equals("include")
								   && !includeNode.getNodeName().equals("src")
								   && !includeNode.getNodeName().equals("misc"))
									continue;
						if(includeNode.getNodeName().equals("include"))
						{
							Node attrNode;
							if( (attrNode=includeNode.getAttributes().getNamedItem("accept"))!=null )
								imp.setRegexpInclude(attrNode.getNodeValue());
							if( (attrNode=includeNode.getAttributes().getNamedItem("exclude"))!=null )
								imp.setExcludeInc(attrNode.getNodeValue());
							if(inc) throw new XMLParseException("<import tofilter="+toFilter+"> has multiple <include> elements");
							if(includeNode.getFirstChild()==null) throw new XMLParseException("<include> element is empty.");
							inc = true;
							String includePath = includeNode.getFirstChild().getNodeValue().trim();
							includePath = Helpers.resolvePath(mPwd.getAbsolutePath(), includePath);
							imp.setInclude(includePath);
						}
						else if(includeNode.getNodeName().equals("src"))
						{
							Node attrNode;
							if( (attrNode=includeNode.getAttributes().getNamedItem("regexp"))!=null)
								imp.setRegexpSrc(attrNode.getNodeValue());
							if( (attrNode=includeNode.getAttributes().getNamedItem("exclude"))!=null )
								imp.setExcludeSrc(attrNode.getNodeValue());
							if(src) throw new XMLParseException("<import tofilter="+toFilter+"> has multiple <src> elements");
							if(includeNode.getFirstChild()==null) throw new XMLParseException("<src> element is empty");
							src = true;
							String srcPath = includeNode.getFirstChild().getNodeValue().trim();
							srcPath = Helpers.resolvePath(mPwd.getAbsolutePath(), srcPath);
							imp.setSrc(srcPath);
						}
						else if(includeNode.getNodeName().equals("misc"))
						{
							if(includeNode.getFirstChild()==null) throw new XMLParseException("<misc> element is empty");
							String miscPath = includeNode.getFirstChild().getNodeValue();
							miscPath = Helpers.resolvePath(mPwd.getAbsolutePath(), miscPath);
							imp.addMisc(miscPath);
						}
						else
						{
							throw new XMLParseException("<import tofilter="+toFilter+"> has invalid element: " + includeNode.getNodeName());
						}
					}
					proj.addImport(imp);
				}
				mProjects.add(proj);
			}
		}
		catch(XMLParseException ex) { System.err.println("XMLParseExcepiton: " + ex.getMessage()); System.exit(-1); }
	}


Input:
	public List<IValidationItem> validate(String source, final URI path, final IValidationManager manager)
	{
		List<IValidationItem> items = new ArrayList<IValidationItem>();
		CompatVersion version = CompatVersion.RUBY1_8;
		IPath projectPath = null;
		IPath workingDir = null;
		if (path != null && "file".equals(path.getScheme()))
		{
			File file = new File(path);
			workingDir = Path.fromOSString(file.getParent());
		}
		if (workingDir != null)
		{
			IContainer container = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(workingDir);
			if (container != null)
			{
				IProject project = container.getProject();
				if (project != null)
				{
					projectPath = project.getLocation();
				}
			}
		}
		IPath ruby = RubyLaunchingPlugin.rubyExecutablePath(projectPath);
		String rubyVersion = ProcessUtil.outputForCommand(
				ruby == null ? "ruby" : ruby.toOSString(), workingDir, ShellExecutable.getEnvironment(), "-v");
		if (rubyVersion != null && rubyVersion.startsWith("ruby 1.9"))
		{
			version = CompatVersion.RUBY1_9;
		}
		ParserConfiguration config = new ParserConfiguration(1, version);
		RubyParser parser;
		if (version == CompatVersion.RUBY1_9)
		{
			ParserSupport19 support = new ParserSupport19();
			support.setConfiguration(config);
			parser = new Ruby19Parser(support);
		}
		else
		{
			ParserSupport support = new ParserSupport();
			support.setConfiguration(config);
			parser = new Ruby18Parser(support);
		}
		IRubyWarnings warnings = new IRubyWarnings()
		{
			public void warn(ID id, SourcePosition position, String message, Object... data)
			{
				int length = position.getEndOffset() - position.getStartOffset() + 1;
				manager.addWarning(message, position.getStartLine(), 0, length, path);
			}
			public void warn(ID id, String fileName, int lineNumber, String message, Object... data)
			{
				manager.addWarning(message, lineNumber, 0, 1, path);
			}
			public boolean isVerbose()
			{
				return true;
			}
			public void warn(ID id, String message, Object... data)
			{
				manager.addWarning(message, 1, 0, 1, path);
			}
			public void warning(ID id, String message, Object... data)
			{
				warn(id, message, data);
			}
			public void warning(ID id, SourcePosition position, String message, Object... data)
			{
				warn(id, position, message, data);
			}
			public void warning(ID id, String fileName, int lineNumber, String message, Object... data)
			{
				warn(id, fileName, lineNumber, message, data);
			}
		};
		parser.setWarnings(warnings);
		LexerSource lexerSource = LexerSource.getSource(path.getPath(), new StringReader(source), config);
		try
		{
			parser.parse(config, lexerSource);
		}
		catch (SyntaxException e)
		{
			int start = e.getPosition().getStartOffset();
			int end = e.getPosition().getEndOffset();
			int lineNumber = e.getPosition().getStartLine();
			int charLineOffset = 0;
			try
			{
				int lineOffset = new Document(source).getLineOffset(lineNumber - 1);
				charLineOffset = start - lineOffset;
			}
			catch (BadLocationException ble)
			{
			}
			manager.addError(e.getMessage(), lineNumber, charLineOffset, end - start + 1, path);
		}
		return items;
	}

Output:
	public List<IValidationItem> validate(String source, final URI path, final IValidationManager manager)
	{
		List<IValidationItem> items = new ArrayList<IValidationItem>();
		CompatVersion version = CompatVersion.RUBY1_8;
		IPath projectPath = null;
		IPath workingDir = null;
		if (path != null && "file".equals(path.getScheme()))
		{
			File file = new File(path);
			workingDir = Path.fromOSString(file.getParent());
		}
		if (workingDir != null)
		{
			IContainer container = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(workingDir);
			if (container != null)
			{
				IProject project = container.getProject();
				if (project != null)
				{
					projectPath = project.getLocation();
				}
			}
		}
		IPath ruby = RubyLaunchingPlugin.rubyExecutablePath(projectPath);
		String rubyVersion = ProcessUtil.outputForCommand(
				ruby == null ? "ruby" : ruby.toOSString(), workingDir, ShellExecutable.getEnvironment(), "-v");
		if (rubyVersion != null && rubyVersion.startsWith("ruby 1.9"))
		{
			version = CompatVersion.RUBY1_9;
		}
		ParserConfiguration config = new ParserConfiguration(1, version);
		RubyParser parser;
		if (version == CompatVersion.RUBY1_9)
		{
			ParserSupport19 support = new ParserSupport19();
			support.setConfiguration(config);
			parser = new Ruby19Parser(support);
		}
		else
		{
			ParserSupport support = new ParserSupport();
			support.setConfiguration(config);
			parser = new Ruby18Parser(support);
		}
		IRubyWarnings warnings = new IRubyWarnings()
		{
			public void warn(ID id, SourcePosition position, String message, Object... data)
			{
				int length = position.getEndOffset() - position.getStartOffset() + 1;
				manager.addWarning(message, position.getStartLine(), 0, length, path);
			}
			public void warn(ID id, String fileName, int lineNumber, String message, Object... data)
			{
				manager.addWarning(message, lineNumber, 0, 1, path);
			}
			public boolean isVerbose()
			{
				return true;
			}
			public void warn(ID id, String message, Object... data)
			{
				manager.addWarning(message, 1, 0, 1, path);
			}
			public void warning(ID id, String message, Object... data)
			{
				warn(id, message, data);
			}
			public void warning(ID id, SourcePosition position, String message, Object... data)
			{
				warn(id, position, message, data);
			}
			public void warning(ID id, String fileName, int lineNumber, String message, Object... data)
			{
				warn(id, fileName, lineNumber, message, data);
			}
		};
		parser.setWarnings(warnings);
		LexerSource lexerSource = LexerSource.getSource(path.getPath(), new StringReader(source), config);
		try
		{
			parser.parse(config, lexerSource);
		}
		catch (SyntaxException e)
		{
			int start = e.getPosition().getStartOffset();
			int end = e.getPosition().getEndOffset();
			int lineNumber = e.getPosition().getStartLine();
			int charLineOffset = 0;
			try
			{
				int lineOffset = new Document(source).getLineOffset(lineNumber - 1);
				charLineOffset = start - lineOffset;
			}
			catch (BadLocationException ble)
			{
			}
			items.add(manager.addError(e.getMessage(), lineNumber, charLineOffset, end - start + 1, path));
		}
		return items;
	}


Input:
  private void initMetadata(String xml) throws FormatException, IOException {
    LIFHandler handler = new LIFHandler();
    xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><LEICA>" + xml +
      "</LEICA>";
    for (int i=0; i<xml.length(); i++) {
      char c = xml.charAt(i);
      if (Character.isISOControl(c) || !Character.isDefined(c)) {
        xml = xml.replace(c, ' ');
      }
    }
    try {
      SAXParser parser = SAX_FACTORY.newSAXParser();
      parser.parse(new ByteArrayInputStream(xml.getBytes()), handler);
    }
    catch (ParserConfigurationException exc) {
      throw new FormatException(exc);
    }
    catch (SAXException exc) {
      throw new FormatException(exc);
    }
    Vector elements = new Vector();
    seriesNames = new Vector();
    status("Populating native metadata");
    StringTokenizer st = new StringTokenizer(xml, ">");
    while (st.hasMoreTokens()) {
      String token = st.nextToken();
      elements.add(token.substring(1));
    }
    String token = (String) elements.get(0);
    String key = token.substring(0, token.indexOf("\""));
    String value = token.substring(token.indexOf("\"") + 1, token.length()-1);
    addMeta(key, value);
    int ndx = 1;
    int numDatasets = 0;
    Vector widths = new Vector();
    Vector heights = new Vector();
    Vector zs = new Vector();
    Vector ts = new Vector();
    Vector channels = new Vector();
    Vector bps = new Vector();
    Vector extraDims = new Vector();
    String prefix = "";
    while (ndx < elements.size()) {
      token = (String) elements.get(ndx);
      if (token.startsWith("ScannerSettingRecord")) {
        if (token.indexOf("csScanMode") != -1) {
          int index = token.indexOf("Variant") + 7;
          String ordering = token.substring(index + 2,
            token.indexOf("\"", index + 3));
          ordering = ordering.toLowerCase();
          if (ordering.indexOf("x") == -1 || ordering.indexOf("y") == -1 ||
            ordering.indexOf("xy") == -1)
          {
            int xPos = ordering.indexOf("x");
            int yPos = ordering.indexOf("y");
            int zPos = ordering.indexOf("z");
            int tPos = ordering.indexOf("t");
            if (xPos < 0) xPos = 0;
            if (yPos < 0) yPos = 1;
            if (zPos < 0) zPos = 2;
            if (tPos < 0) tPos = 3;
            int x = ((Integer) widths.get(widths.size() - 1)).intValue();
            int y = ((Integer) heights.get(widths.size() - 1)).intValue();
            int z = ((Integer) zs.get(widths.size() - 1)).intValue();
            int t = ((Integer) ts.get(widths.size() - 1)).intValue();
            int[] dimensions = {x, y, z, t};
            x = dimensions[xPos];
            y = dimensions[yPos];
            z = dimensions[zPos];
            t = dimensions[tPos];
            widths.setElementAt(new Integer(x), widths.size() - 1);
            heights.setElementAt(new Integer(y), heights.size() - 1);
            zs.setElementAt(new Integer(z), zs.size() - 1);
            ts.setElementAt(new Integer(t), ts.size() - 1);
          }
        }
        else if (token.indexOf("dblVoxel") != -1) {
          int index = token.indexOf("Variant") + 7;
          String size = token.substring(index + 2,
            token.indexOf("\"", index + 3));
          float cal = Float.parseFloat(size) * 1000000;
          if (token.indexOf("X") != -1) xcal.add(new Float(cal));
          else if (token.indexOf("Y") != -1) ycal.add(new Float(cal));
          else if (token.indexOf("Z") != -1) zcal.add(new Float(cal));
        }
      }
      else if (token.startsWith("Element Name")) {
        seriesNames.add(token.substring(token.indexOf("=") + 2,
          token.length() - 1));
        numDatasets++;
        int numChannels = 0;
        int extras = 1;
        while (token.indexOf("/ImageDescription") == -1) {
          if (token.indexOf("=") != -1) {
            if (token.startsWith("Element Name")) {
              seriesNames.setElementAt(token.substring(token.indexOf("=") + 2,
                token.length() - 1), seriesNames.size() - 1);
              prefix = (String) seriesNames.get(seriesNames.size() - 1);
            }
            Hashtable tmp = new Hashtable();
            while (token.length() > 2) {
              key = token.substring(0, token.indexOf("\"") - 1);
              value = token.substring(token.indexOf("\"") + 1,
                token.indexOf("\"", token.indexOf("\"") + 1));
              token = token.substring(key.length() + value.length() + 3);
              key = key.trim();
              value = value.trim();
              tmp.put(key, value);
            }
            if (tmp.get("ChannelDescription DataType") != null) {
              numChannels++;
              if (numChannels == 1) {
                bps.add(new Integer((String) tmp.get("Resolution")));
                String sMin = (String) tmp.get("Min");
                String sMax = (String) tmp.get("Max");
                if (sMin != null && sMax != null) {
                  double min = Double.parseDouble(sMin);
                  double max = Double.parseDouble(sMax);
                  channelMins.add(new Integer((int) min));
                  channelMaxs.add(new Integer((int) max));
                }
              }
            }
            else if (tmp.get("DimensionDescription DimID") != null) {
              int w = Integer.parseInt((String) tmp.get("NumberOfElements"));
              int id = Integer.parseInt((String)
                tmp.get("DimensionDescription DimID"));
              switch (id) {
                case 1:
                  widths.add(new Integer(w));
                  break;
                case 2:
                  heights.add(new Integer(w));
                  break;
                case 3:
                  zs.add(new Integer(w));
                  break;
                case 4:
                  ts.add(new Integer(w));
                  break;
                default:
                  extras *= w;
              }
            }
          }
          ndx++;
          if (elements != null && ndx < elements.size()) {
            token = (String) elements.get(ndx);
          }
          else break;
        }
        extraDims.add(new Integer(extras));
        if (numChannels == 0) numChannels++;
        channels.add(new Integer(numChannels));
        if (widths.size() < numDatasets && heights.size() < numDatasets) {
          numDatasets--;
        }
        else {
          if (widths.size() < numDatasets) widths.add(new Integer(1));
          if (heights.size() < numDatasets) heights.add(new Integer(1));
          if (zs.size() < numDatasets) zs.add(new Integer(1));
          if (ts.size() < numDatasets) ts.add(new Integer(1));
          if (bps.size() < numDatasets) bps.add(new Integer(8));
        }
      }
      ndx++;
    }
    numDatasets = widths.size();
    bitsPerPixel = new int[numDatasets];
    extraDimensions = new int[numDatasets];
    status("Populating metadata");
    MetadataStore store = getMetadataStore();
    core = new CoreMetadata(numDatasets);
    Arrays.fill(core.orderCertain, true);
    validBits = new int[numDatasets][];
    for (int i=0; i<numDatasets; i++) {
      core.sizeX[i] = ((Integer) widths.get(i)).intValue();
      core.sizeY[i] = ((Integer) heights.get(i)).intValue();
      core.sizeZ[i] = ((Integer) zs.get(i)).intValue();
      core.sizeC[i] = ((Integer) channels.get(i)).intValue();
      core.sizeT[i] = ((Integer) ts.get(i)).intValue();
      core.currentOrder[i] =
        (core.sizeZ[i] > core.sizeT[i]) ? "XYCZT" : "XYCTZ";
      bitsPerPixel[i] = ((Integer) bps.get(i)).intValue();
      extraDimensions[i] = ((Integer) extraDims.get(i)).intValue();
      if (extraDimensions[i] > 1) {
        if (core.sizeZ[i] == 1) core.sizeZ[i] = extraDimensions[i];
        else core.sizeT[i] *= extraDimensions[i];
        extraDimensions[i] = 1;
      }
      core.littleEndian[i] = true;
      core.rgb[i] = core.sizeC[i] > 1 && core.sizeC[i] < 4;
      core.interleaved[i] = true;
      core.imageCount[i] = core.sizeZ[i] * core.sizeT[i];
      if (!core.rgb[i]) core.imageCount[i] *= core.sizeC[i];
      validBits[i] = new int[core.sizeC[i] != 2 ? core.sizeC[i] : 3];
      for (int j=0; j<validBits[i].length; j++) {
        validBits[i][j] = bitsPerPixel[i];
      }
      while (bitsPerPixel[i] % 8 != 0) bitsPerPixel[i]++;
      switch (bitsPerPixel[i]) {
        case 8:
          core.pixelType[i] = FormatTools.UINT8;
          break;
        case 16:
          core.pixelType[i] = FormatTools.UINT16;
          break;
        case 32:
          core.pixelType[i] = FormatTools.FLOAT;
          break;
      }
      Integer ii = new Integer(i);
      String seriesName = (String) seriesNames.get(i);
      if (seriesName == null || seriesName.trim().length() == 0) {
        seriesName = "Series " + (i + 1);
      }
      store.setImage(seriesName, null, null, ii);
      store.setPixels(
        new Integer(core.sizeX[i]),
        new Integer(core.sizeY[i]),
        new Integer(core.sizeZ[i]),
        new Integer(core.sizeC[i]),
        new Integer(core.sizeT[i]),
        new Integer(core.pixelType[i]),
        new Boolean(!core.littleEndian[i]),
        core.currentOrder[i],
        ii,
        null);
      Float xf = i < xcal.size() ? (Float) xcal.get(i) : null;
      Float yf = i < ycal.size() ? (Float) ycal.get(i) : null;
      Float zf = i < zcal.size() ? (Float) zcal.get(i) : null;
      store.setDimensions(xf, yf, zf, null, null, ii);
      for (int j=0; j<core.sizeC[i]; j++) {
        store.setLogicalChannel(j, null, null, null, null, null, null, ii);
      }
      String zoom = (String) getMeta(seriesName + " - dblZoom");
      store.setDisplayOptions(zoom == null ? null : new Float(zoom),
        new Boolean(core.sizeC[i] > 1), new Boolean(core.sizeC[i] > 1),
        new Boolean(core.sizeC[i] > 2), new Boolean(isRGB()), null,
        null, null, null, null, ii, null, null, null, null, null);
      Enumeration keys = metadata.keys();
      while (keys.hasMoreElements()) {
        String k = (String) keys.nextElement();
        boolean use = true;
        for (int j=0; j<seriesNames.size(); j++) {
          if (j != i && k.startsWith((String) seriesNames.get(i))) {
            use = false;
            break;
          }
        }
        if (use) core.seriesMetadata[i].put(k, metadata.get(k));
      }
    }
  }

Output:
  private void initMetadata(String xml) throws FormatException, IOException {
    LIFHandler handler = new LIFHandler();
    xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><LEICA>" + xml +
      "</LEICA>";
    for (int i=0; i<xml.length(); i++) {
      char c = xml.charAt(i);
      if (Character.isISOControl(c) || !Character.isDefined(c)) {
        xml = xml.replace(c, ' ');
      }
    }
    try {
      SAXParser parser = SAX_FACTORY.newSAXParser();
      parser.parse(new ByteArrayInputStream(xml.getBytes()), handler);
    }
    catch (ParserConfigurationException exc) {
      throw new FormatException(exc);
    }
    catch (SAXException exc) {
      throw new FormatException(exc);
    }
    Vector elements = new Vector();
    seriesNames = new Vector();
    status("Populating native metadata");
    StringTokenizer st = new StringTokenizer(xml, ">");
    while (st.hasMoreTokens()) {
      String token = st.nextToken();
      elements.add(token.substring(1));
    }
    String token = (String) elements.get(0);
    String key = token.substring(0, token.indexOf("\""));
    String value = token.substring(token.indexOf("\"") + 1, token.length()-1);
    addMeta(key, value);
    int ndx = 1;
    int numDatasets = 0;
    Vector widths = new Vector();
    Vector heights = new Vector();
    Vector zs = new Vector();
    Vector ts = new Vector();
    Vector channels = new Vector();
    Vector bps = new Vector();
    Vector extraDims = new Vector();
    String prefix = "";
    while (ndx < elements.size()) {
      token = (String) elements.get(ndx);
      if (token.startsWith("ScannerSettingRecord")) {
        if (token.indexOf("csScanMode") != -1) {
          int index = token.indexOf("Variant") + 7;
          String ordering = token.substring(index + 2,
            token.indexOf("\"", index + 3));
          ordering = ordering.toLowerCase();
          if (ordering.indexOf("x") == -1 || ordering.indexOf("y") == -1 ||
            ordering.indexOf("xy") == -1)
          {
            int xPos = ordering.indexOf("x");
            int yPos = ordering.indexOf("y");
            int zPos = ordering.indexOf("z");
            int tPos = ordering.indexOf("t");
            if (xPos < 0) xPos = 0;
            if (yPos < 0) yPos = 1;
            if (zPos < 0) zPos = 2;
            if (tPos < 0) tPos = 3;
            int x = ((Integer) widths.get(widths.size() - 1)).intValue();
            int y = ((Integer) heights.get(widths.size() - 1)).intValue();
            int z = ((Integer) zs.get(widths.size() - 1)).intValue();
            int t = ((Integer) ts.get(widths.size() - 1)).intValue();
            int[] dimensions = {x, y, z, t};
            x = dimensions[xPos];
            y = dimensions[yPos];
            z = dimensions[zPos];
            t = dimensions[tPos];
            widths.setElementAt(new Integer(x), widths.size() - 1);
            heights.setElementAt(new Integer(y), heights.size() - 1);
            zs.setElementAt(new Integer(z), zs.size() - 1);
            ts.setElementAt(new Integer(t), ts.size() - 1);
          }
        }
        else if (token.indexOf("dblVoxel") != -1) {
          int index = token.indexOf("Variant") + 7;
          String size = token.substring(index + 2,
            token.indexOf("\"", index + 3));
          float cal = Float.parseFloat(size) * 1000000;
          if (token.indexOf("X") != -1) xcal.add(new Float(cal));
          else if (token.indexOf("Y") != -1) ycal.add(new Float(cal));
          else if (token.indexOf("Z") != -1) zcal.add(new Float(cal));
        }
      }
      else if (token.startsWith("Element Name")) {
        seriesNames.add(token.substring(token.indexOf("=") + 2,
          token.length() - 1));
        numDatasets++;
        int numChannels = 0;
        int extras = 1;
        while (token.indexOf("/ImageDescription") == -1) {
          if (token.indexOf("=") != -1) {
            if (token.startsWith("Element Name")) {
              seriesNames.setElementAt(token.substring(token.indexOf("=") + 2,
                token.length() - 1), seriesNames.size() - 1);
              prefix = (String) seriesNames.get(seriesNames.size() - 1);
            }
            Hashtable tmp = new Hashtable();
            while (token.length() > 2) {
              key = token.substring(0, token.indexOf("\"") - 1);
              value = token.substring(token.indexOf("\"") + 1,
                token.indexOf("\"", token.indexOf("\"") + 1));
              token = token.substring(key.length() + value.length() + 3);
              key = key.trim();
              value = value.trim();
              tmp.put(key, value);
            }
            if (tmp.get("ChannelDescription DataType") != null) {
              numChannels++;
              if (numChannels == 1) {
                bps.add(new Integer((String) tmp.get("Resolution")));
                String sMin = (String) tmp.get("Min");
                String sMax = (String) tmp.get("Max");
                if (sMin != null && sMax != null) {
                  double min = Double.parseDouble(sMin);
                  double max = Double.parseDouble(sMax);
                  channelMins.add(new Integer((int) min));
                  channelMaxs.add(new Integer((int) max));
                }
              }
            }
            else if (tmp.get("DimensionDescription DimID") != null) {
              int w = Integer.parseInt((String) tmp.get("NumberOfElements"));
              int id = Integer.parseInt((String)
                tmp.get("DimensionDescription DimID"));
              switch (id) {
                case 1:
                  widths.add(new Integer(w));
                  break;
                case 2:
                  heights.add(new Integer(w));
                  break;
                case 3:
                  zs.add(new Integer(w));
                  break;
                case 4:
                  ts.add(new Integer(w));
                  break;
                default:
                  extras *= w;
              }
            }
          }
          ndx++;
          if (elements != null && ndx < elements.size()) {
            token = (String) elements.get(ndx);
          }
          else break;
        }
        extraDims.add(new Integer(extras));
        if (numChannels == 0) numChannels++;
        channels.add(new Integer(numChannels));
        if (widths.size() < numDatasets && heights.size() < numDatasets) {
          numDatasets--;
        }
        else {
          if (widths.size() < numDatasets) widths.add(new Integer(1));
          if (heights.size() < numDatasets) heights.add(new Integer(1));
          if (zs.size() < numDatasets) zs.add(new Integer(1));
          if (ts.size() < numDatasets) ts.add(new Integer(1));
          if (bps.size() < numDatasets) bps.add(new Integer(8));
        }
      }
      ndx++;
    }
    numDatasets = widths.size();
    bitsPerPixel = new int[numDatasets];
    extraDimensions = new int[numDatasets];
    status("Populating metadata");
    MetadataStore store = getMetadataStore();
    core = new CoreMetadata(numDatasets);
    Arrays.fill(core.orderCertain, true);
    validBits = new int[numDatasets][];
    for (int i=0; i<numDatasets; i++) {
      core.sizeX[i] = ((Integer) widths.get(i)).intValue();
      core.sizeY[i] = ((Integer) heights.get(i)).intValue();
      core.sizeZ[i] = ((Integer) zs.get(i)).intValue();
      core.sizeC[i] = ((Integer) channels.get(i)).intValue();
      core.sizeT[i] = ((Integer) ts.get(i)).intValue();
      core.currentOrder[i] =
        (core.sizeZ[i] > core.sizeT[i]) ? "XYCZT" : "XYCTZ";
      bitsPerPixel[i] = ((Integer) bps.get(i)).intValue();
      extraDimensions[i] = ((Integer) extraDims.get(i)).intValue();
      if (extraDimensions[i] > 1) {
        if (core.sizeZ[i] == 1) core.sizeZ[i] = extraDimensions[i];
        else core.sizeT[i] *= extraDimensions[i];
        extraDimensions[i] = 1;
      }
      core.littleEndian[i] = true;
      core.rgb[i] = core.sizeC[i] > 1 && core.sizeC[i] < 4;
      core.interleaved[i] = true;
      core.imageCount[i] = core.sizeZ[i] * core.sizeT[i];
      if (!core.rgb[i]) core.imageCount[i] *= core.sizeC[i];
      validBits[i] = new int[core.sizeC[i] != 2 ? core.sizeC[i] : 3];
      for (int j=0; j<validBits[i].length; j++) {
        validBits[i][j] = bitsPerPixel[i];
      }
      while (bitsPerPixel[i] % 8 != 0) bitsPerPixel[i]++;
      switch (bitsPerPixel[i]) {
        case 8:
          core.pixelType[i] = FormatTools.UINT8;
          break;
        case 16:
          core.pixelType[i] = FormatTools.UINT16;
          break;
        case 32:
          core.pixelType[i] = FormatTools.FLOAT;
          break;
      }
      Integer ii = new Integer(i);
      String seriesName = (String) seriesNames.get(i);
      if (seriesName == null || seriesName.trim().length() == 0) {
        seriesName = "Series " + (i + 1);
      }
      store.setImage(seriesName, null, null, ii);
      store.setPixels(
        new Integer(core.sizeX[i]),
        new Integer(core.sizeY[i]),
        new Integer(core.sizeZ[i]),
        new Integer(core.sizeC[i]),
        new Integer(core.sizeT[i]),
        new Integer(core.pixelType[i]),
        new Boolean(!core.littleEndian[i]),
        core.currentOrder[i],
        ii,
        null);
      Float xf = i < xcal.size() ? (Float) xcal.get(i) : null;
      Float yf = i < ycal.size() ? (Float) ycal.get(i) : null;
      Float zf = i < zcal.size() ? (Float) zcal.get(i) : null;
      store.setDimensions(xf, yf, zf, null, null, ii);
      for (int j=0; j<core.sizeC[i]; j++) {
        store.setLogicalChannel(j, null, null, null, null, null, null, ii);
      }
      String zoom = (String) getMeta(seriesName + " - dblZoom");
      store.setDisplayOptions(zoom == null ? null : new Float(zoom),
        new Boolean(core.sizeC[i] > 1), new Boolean(core.sizeC[i] > 1),
        new Boolean(core.sizeC[i] > 2), new Boolean(isRGB()), null,
        null, null, null, null, ii, null, null, null, null, null);
      Enumeration keys = metadata.keys();
      while (keys.hasMoreElements()) {
        String k = (String) keys.nextElement();
        boolean use = true;
        for (int j=0; j<seriesNames.size(); j++) {
          if (j != i && k.startsWith((String) seriesNames.get(j))) {
            use = false;
            break;
          }
        }
        if (use) core.seriesMetadata[i].put(k, metadata.get(k));
      }
    }
  }


Input:
    public String getMessage() {
        if (message != null)
            return message;
        String msg = (String) errorMessages.get(new Integer(id));
        if (msg == null)
            msg = "";
        if (arg != null) {
            msg = MessageFormat.format(msg, new Object[] { new String(arg) });
        }
        IASTNodeLocation [] locs = getNodeLocations();
        String file = null;
        int offset = 0;
        if( locs != null && locs.length > 0 ){
            file = ((IASTFileLocation) locs[0]).getFileName();
            offset = locs[0].getNodeOffset();
        } else {
            file = "";
            offset = 0;
        }
        Object[] args = new Object[] { msg, file, new Integer(offset) };
        message = ParserMessages.getFormattedString(AST_PROBLEM_PATTERN, args);
        return message;
    }

Output:
    public String getMessage() {
        if (message != null)
            return message;
        String msg = (String) errorMessages.get(new Integer(id));
        if (msg == null)
            msg = "";
        if (arg != null) {
            msg = MessageFormat.format(msg, new Object[] { new String(arg) });
        }
        IASTNodeLocation [] locs = getNodeLocations();
        String file = null;
        int offset = 0;
        if( locs != null && locs.length == 1 && locs[0] instanceof IASTFileLocation ){
            file = ((IASTFileLocation) locs[0]).getFileName();
            offset = locs[0].getNodeOffset();
        } else {
            IASTFileLocation f = getTranslationUnit().flattenLocationsToFile(locs);
            if( f == null )
            {
                file = "";
                offset = 0;
            }
            else
            {
                file = f.getFileName();
                offset = f.getNodeOffset();
            }
        }
        Object[] args = new Object[] { msg, file, new Integer(offset) };
        message = ParserMessages.getFormattedString(AST_PROBLEM_PATTERN, args);
        return message;
    }


Input:
	private void nextInts() {
		switch (operation) {
		case 0:
			operand1 = random.nextInt(99) + 1;
			operand2 = random.nextInt(99) + 1;
			result = operand1 + operand2;
			break;
		case 1:
			operand1 = random.nextInt(99) + 1;
			operand2 = random.nextInt(99) + 1;
			result = operand1 - operand2;
			break;
		case 2:
			operand1 = random.nextInt(8) + 2;
			operand2 = random.nextInt(8) + 2;
			result = operand1 * operand2;
			break;
		case 3:
			result = random.nextInt(8) + 2;
			operand2 = random.nextInt(8) + 2;
			operand1 = result * operand2;
			break;
		default:
			throw new IllegalArgumentException("This should not happen");
		}
	}

Output:
	private void nextInts() {
		switch (operation) {
		case 0:
			operand1 = random.nextInt(99) + 1;
			operand2 = random.nextInt(99) + 1;
			result = operand1 + operand2;
			break;
		case 1:
			operand1 = random.nextInt(99) + 1;
			operand2 = random.nextInt(99) + 1;
			result = operand1 - operand2;
			break;
		case 2:
			operand1 = random.nextInt(8) + 2;
			operand2 = random.nextInt(8) + 2;
			result = operand1 * operand2;
			break;
		case 3:
			result = random.nextInt(8) + 2;
			operand2 = random.nextInt(8) + 2;
			operand1 = result / operand2;
			break;
		default:
			throw new IllegalArgumentException("This should not happen");
		}
	}


Input:
    private String parseString(Source source)
    {
        if (source.next()!='"')
            throw new IllegalStateException();
        boolean escape=false;
        StringBuffer b=null;
        final char[] scratch=source.scratchBuffer();
        if (scratch!=null)
        {
            int i=0;
            while (source.hasNext())
            {
                if(i>=scratch.length)
                {
                    b=new StringBuffer(scratch.length*2);
                    b.append(scratch,0,i);
                    break;
                }
                char c=source.next();
                if (escape)
                {
                    escape=false;
                    switch (c)
                    {
                        case '"':
                            scratch[i++]='"';
                            break;
                        case '\\':
                            scratch[i++]='\\';
                            break;
                        case '/':
                            scratch[i++]='/';
                            break;
                        case 'b':
                            scratch[i++]='\b';
                            break;
                        case 'f':
                            scratch[i++]='\f';
                            break;
                        case 'n':
                            scratch[i++]='\n';
                            break;
                        case 'r':
                            scratch[i++]='\r';
                            break;
                        case 't':
                            scratch[i++]='\t';
                            break;
                        case 'u':
                            char uc=(char)((TypeUtil.convertHexDigit((byte)source.next())<<12)+
                                    (TypeUtil.convertHexDigit((byte)source.next())<<8)+
                                    (TypeUtil.convertHexDigit((byte)source.next())<<4)+
                                    (TypeUtil.convertHexDigit((byte)source.next())));
                            scratch[i++]=uc;
                            break;
                        default:
                            scratch[i++]=c;
                    }
                }
                else if (c=='\\')
                {
                    escape=true;
                    continue;
                }
                else if (c=='\"')
                {
                    return toString(scratch,0,i);
                }
                else
                    scratch[i++]=c;
            }
            if (b==null)
                return toString(scratch,0,i);
        }
        else
            b=new StringBuffer(getStringBufferSize());
        synchronized (b)
        {
            while (source.hasNext())
            {
                char c=source.next();
                if (escape)
                {
                    escape=false;
                    switch (c)
                    {
                        case 'n':
                            b.append('\n');
                            break;
                        case 'r':
                            b.append('\r');
                            break;
                        case 't':
                            b.append('\t');
                            break;
                        case 'f':
                            b.append('\f');
                            break;
                        case 'b':
                            b.append('\b');
                            break;
                        case 'u':
                            b.append((char)((TypeUtil.convertHexDigit((byte)source.next())<<24)+(TypeUtil.convertHexDigit((byte)source.next())<<16)
                                    +(TypeUtil.convertHexDigit((byte)source.next())<<8)+(TypeUtil.convertHexDigit((byte)source.next()))));
                            break;
                        default:
                            b.append(c);
                    }
                }
                else if (c=='\\')
                {
                    escape=true;
                    continue;
                }
                else if (c=='\"')
                    break;
                else
                    b.append(c);
            }
            return b.toString();
        }
    }

Output:
    private String parseString(Source source)
    {
        if (source.next()!='"')
            throw new IllegalStateException();
        boolean escape=false;
        StringBuffer b=null;
        final char[] scratch=source.scratchBuffer();
        if (scratch!=null)
        {
            int i=0;
            while (source.hasNext())
            {
                if(i>=scratch.length)
                {
                    b=new StringBuffer(scratch.length*2);
                    b.append(scratch,0,i);
                    break;
                }
                char c=source.next();
                if (escape)
                {
                    escape=false;
                    switch (c)
                    {
                        case '"':
                            scratch[i++]='"';
                            break;
                        case '\\':
                            scratch[i++]='\\';
                            break;
                        case '/':
                            scratch[i++]='/';
                            break;
                        case 'b':
                            scratch[i++]='\b';
                            break;
                        case 'f':
                            scratch[i++]='\f';
                            break;
                        case 'n':
                            scratch[i++]='\n';
                            break;
                        case 'r':
                            scratch[i++]='\r';
                            break;
                        case 't':
                            scratch[i++]='\t';
                            break;
                        case 'u':
                            char uc=(char)((TypeUtil.convertHexDigit((byte)source.next())<<12)+
                                    (TypeUtil.convertHexDigit((byte)source.next())<<8)+
                                    (TypeUtil.convertHexDigit((byte)source.next())<<4)+
                                    (TypeUtil.convertHexDigit((byte)source.next())));
                            scratch[i++]=uc;
                            break;
                        default:
                            scratch[i++]=c;
                    }
                }
                else if (c=='\\')
                {
                    escape=true;
                    continue;
                }
                else if (c=='\"')
                {
                    return toString(scratch,0,i);
                }
                else
                    scratch[i++]=c;
            }
            if (b==null)
                return toString(scratch,0,i);
        }
        else
            b=new StringBuffer(getStringBufferSize());
        synchronized (b)
        {
            while (source.hasNext())
            {
                char c=source.next();
                if (escape)
                {
                    escape=false;
                    switch (c)
                    {
                        case '"':
                            b.append('"');
                            break;
                        case '\\':
                            b.append('\\');
                            break;
                        case '/':
                            b.append('/');
                            break;
                        case 'b':
                            b.append('\b');
                            break;
                        case 'f':
                            b.append('\f');
                            break;
                        case 'n':
                            b.append('\n');
                            break;
                        case 'r':
                            b.append('\r');
                            break;
                        case 't':
                            b.append('\t');
                            break;
                        case 'u':
                            char uc=(char)((TypeUtil.convertHexDigit((byte)source.next())<<12)+
                                    (TypeUtil.convertHexDigit((byte)source.next())<<8)+
                                    (TypeUtil.convertHexDigit((byte)source.next())<<4)+
                                    (TypeUtil.convertHexDigit((byte)source.next())));
                            b.append(uc);
                            break;
                        default:
                            b.append(c);
                    }
                }
                else if (c=='\\')
                {
                    escape=true;
                    continue;
                }
                else if (c=='\"')
                    break;
                else
                    b.append(c);
            }
            return b.toString();
        }
    }


Input:
    public String getStudentId(final long id)
    {
        Cursor c = null;
        try
        {
            c = getDatabase().query(
                    Signature.TABLE_NAME,
                    new String[] { Signature.STUDENT_ID },
                    Signature._ID + "=?",
                    new String[] { Long.toString(id) },
                    null ,
                    null ,
                    null );
            if (c != null && c.moveToFirst())
            {
                return c.getString(0);
            }
            return null;
        }
        finally
        {
            if (c != null)
            {
                c.close();
            }
        }
    }

Output:
    public String getStudentId(final long id)
    {
        Cursor c = null;
        try
        {
            c = getDatabase().query(
                    Signature.TABLE_NAME,
                    new String[] { Signature.STUDENT_ID },
                    Signature._ID + "=?",
                    new String[] { Long.toString(id) },
                    null ,
                    null ,
                    null );
            if (c != null && c.moveToFirst())
            {
                return c.getString(0);
            }
            Log.e(TAG, "Failed to get student ID for " + id);
            return null;
        }
        finally
        {
            if (c != null)
            {
                c.close();
            }
        }
    }


Input:
	public static Test suite() {
		TestSuite suite = new TestSuite(AllTests.class.getName());
		suite.addTest(Bug_126104.suite());
		suite.addTest(Bug_127562.suite());
		suite.addTest(Bug_25457.suite());
		suite.addTest(Bug_26294.suite());
		suite.addTest(Bug_27271.suite());
		suite.addTest(Bug_28981.suite());
		suite.addTest(Bug_29116.suite());
		suite.addTest(Bug_29671.suite());
		suite.addTest(Bug_29851.suite());
		suite.addTest(Bug_32076.suite());
		suite.addTest(Bug_44106.suite());
		suite.addTest(Bug_6708.suite());
		suite.addTest(Bug_98740.suite());
		suite.addTest(IFileTest.suite());
		suite.addTest(IFolderTest.suite());
		suite.addTest(IProjectTest.suite());
		suite.addTest(IResourceTest.suite());
		suite.addTest(IWorkspaceTest.suite());
		suite.addTest(LocalStoreRegressionTests.suite());
		suite.addTest(NLTest.suite());
		suite.addTest(PR_1GEAB3C_Test.suite());
		suite.addTest(PR_1GH2B0N_Test.suite());
		suite.addTest(PR_1GHOM0N_Test.suite());
		return suite;
	}

Output:
	public static Test suite() {
		TestSuite suite = new TestSuite(AllTests.class.getName());
		suite.addTest(Bug_126104.suite());
		suite.addTest(Bug_127562.suite());
		suite.addTest(Bug_132510.suite());
		suite.addTest(Bug_25457.suite());
		suite.addTest(Bug_26294.suite());
		suite.addTest(Bug_27271.suite());
		suite.addTest(Bug_28981.suite());
		suite.addTest(Bug_29116.suite());
		suite.addTest(Bug_29671.suite());
		suite.addTest(Bug_29851.suite());
		suite.addTest(Bug_32076.suite());
		suite.addTest(Bug_44106.suite());
		suite.addTest(Bug_6708.suite());
		suite.addTest(Bug_98740.suite());
		suite.addTest(IFileTest.suite());
		suite.addTest(IFolderTest.suite());
		suite.addTest(IProjectTest.suite());
		suite.addTest(IResourceTest.suite());
		suite.addTest(IWorkspaceTest.suite());
		suite.addTest(LocalStoreRegressionTests.suite());
		suite.addTest(NLTest.suite());
		suite.addTest(PR_1GEAB3C_Test.suite());
		suite.addTest(PR_1GH2B0N_Test.suite());
		suite.addTest(PR_1GHOM0N_Test.suite());
		return suite;
	}


Input:
    public String getHoverHelpAt(IParseController parseController, ISourceViewer srcViewer, int offset)
    {
        IPrsStream ps= parseController.getParser().getParseStream();
        IToken token= ps.getTokenAtCharacter(offset);
        if (token == null) return null;
        Object ast = parseController.getCurrentAst();
        if (ast == null) return null;
        IASTNodeLocator nodeLocator= parseController.getNodeLocator();
        Object node = nodeLocator.findNode(ast, offset);
        if (node == null)
            return null;
        if (node instanceof IASTNodeToken
        		|| node instanceof ASTNodeToken)
        {
        	int tokenKind = ((IASTNodeToken) node).getLeftIToken().getKind();
        	switch (tokenKind) {
        	case PrefspecsLexer.TK_TABS:
        		return("In this section list each of the four tabs:  'default', 'configuration', 'instance', and 'project',	" +
        				"and, for eack, indicate whether it is 'in' or 'out' of the preference page and assign tab-wide attributes, " +
        				"'iseditable' and/or 'isremovable', as appropriate");
        	case PrefspecsLexer.TK_FIELDS:
        		return("In this section list the fields that will appear on the generated preferences page (each field will appear" +
        				"on each included tab).  To list a field, give its type and name, and optionally set any properties specific " +
        				"to that field (applicable properties depend on field type).  The name of each field should be unique.");
        	case PrefspecsLexer.TK_CUSTOM:
        		return("In this section provide property values that apply to specific fields on specific tabs.  " +
        				"Designate fields by 'tab-name' 'field-name'; " +
        				"applicable properties depend on field type.  " +
        				"Field names should have been introduced in the 'fields' section.  " +
        				"Specific fields (specific tab-field combinations) may appear multiple times " +
        				"with any subset of applicable properties (later assignments override earlier ones).");
        	case PrefspecsLexer.TK_CONDITIONALS:
        		return("In this section list fields of any type whose enabled state depends on the state of another field of boolean type." +
        				"E.g., 'nameOfDependentField with nameOfBooleanField' or 'nameOfDependentField against nameOfBooleanField'");
        	case PrefspecsLexer.TK_DEFAULT:
        		return("Designates the 'default' level preferences tab");
        	case PrefspecsLexer.TK_CONFIGURATION:
        		return("Designates the 'configuration' level preferences tab");
        	case PrefspecsLexer.TK_INSTANCE:
        		return("Designates the 'instance' level preferences tab");
        	case PrefspecsLexer.TK_PROJECT:
        		return("Designates the 'project' level preferences tab");
        	case PrefspecsLexer.TK_BOOLEAN:
        		return("Designates the 'boolean' (checkbox) field type");
        	case PrefspecsLexer.TK_COMBO:
        		return("Designates the 'combo' (combo box) field type");
        	case PrefspecsLexer.TK_DIRLIST:
        		return("Designates the 'dirlist' (directory list) field type");
        	case PrefspecsLexer.TK_FILE:
        		return("Designates the 'file' (file name) field type");
        	case PrefspecsLexer.TK_INT:
        		return("Designates the 'int' field type");
        	case PrefspecsLexer.TK_RADIO:
        		return("Designates the 'radio' (radio buttons) field type");
        	case PrefspecsLexer.TK_STRING:
        		return("Designates the 'string' field type");
        	case PrefspecsLexer.TK_EMPTYALLOWED:
        		return("'emptyallowed' indicates whether the field has, and is allowed to take on, " +
        				"an 'empty' value; this attribute takes a boolean value; if 'true' then a value " +
           				"of the field type must be provided (to serve as the 'empty' value); " +
        				"if 'false', then no other argument is needed");
        	case PrefspecsLexer.TK_HASSPECIAL:
        		return("'hasspecial' requires a value of the type of the field that " +
        				"will serve as a distinguished value; omit if no such value");
        	case PrefspecsLexer.TK_ISEDITABLE:
        		return("'iseditable' takes a boolean value:  'true' indicates that the field " +
        				"can be edited (normal case); false indicates that it cannot (field is 'read only')");
        	case PrefspecsLexer.TK_ISREMOVABLE:
        		return("'isremovable' takes a boolean value:  'true' indicates that the value " +
        				"can be removed from this field an inherited from a higher level; " +
        				"'false' means that the field must always have a local value (not inherited");
        	case PrefspecsLexer.TK_RANGE:
        		return("'range' sets a range for numeric field types in the form 'lowVal .. highVal'");
        	case PrefspecsLexer.TK_AGAINST:
        		return("'against' means that the preceding field (of any type) is enabled if and only if " +
        				"the following field (of boolean type) is set to 'false'");
        	case PrefspecsLexer.TK_WITH:
        		return("'with' means that the preceding field (of any type) is enabled if and only if " +
        				"the following field (of boolean type) is set to 'true'");
        	case PrefspecsLexer.TK_STRING_LITERAL:
        		return("String literal");
        	case PrefspecsLexer.TK_IDENTIFIER:
        		int tokenNumber = ((IASTNodeToken) node).getLeftIToken().getTokenIndex();
        		if (tokenNumber == 2)
        			return "Preference-page identifier";
        		else
        			return "Preference-field identifier";
        	case PrefspecsLexer.TK_SINGLE_LINE_COMMENT:
        		return "Comment (no effect on pagegeneration)";
           	case PrefspecsLexer.TK_IN:
        		return("'in' means that the associated tab will be included in the generated preferences page");
        	case PrefspecsLexer.TK_OUT:
           		return("'out' means that the associated tab will not be included in the generated preferences page");
           	case PrefspecsLexer.TK_TRUE:
        		return("The opposite of false.");
        	case PrefspecsLexer.TK_FALSE:
           		return("The opposite of true.");
        	case PrefspecsLexer.TK_PAGE:
        		return "This designates the beginning of a preference-page specification";
        	case PrefspecsLexer.TK_LEFTBRACE:
        	case PrefspecsLexer.TK_RIGHTBRACE:
        		ASTNode grandParentNode = (ASTNode) ((ASTNode)node).getParent().getParent();
        		if (grandParentNode == null) {
        			if (tokenKind == PrefspecsLexer.TK_LEFTBRACE)
        				return "This is the beginning of the body of the specification";
        			else
        				return "This is the end of the body of the specification";
        		}
        		String parentTypeName = grandParentNode.getClass().getName();
        		if (parentTypeName.endsWith("tabSpecs")) {
        			return("Specify tab properties within braces; these properties by default apply to " +
        					"all fields in the tab.  There are two optional properties:  " +
        					"'iseditable' (boolean) indicates whether fields in the tab are editable; " +
        					"'isremovable' (boolean) indicates whether values stored in fields on the tab " +
        					"can be removed (triggering inheritance).  When both are used 'iseditable' " +
        					"must appear first.  Each should be followed by a ';'.");
        		} else if (parentTypeName.endsWith("fieldSpecs")) {
        			ASTNode specNode = getFieldSpecNode((ASTNode) node);
        			if (specNode != null) {
        				if (specNode.getClass().toString().endsWith("booleanFieldSpec")) {
            				return("Specify attributes for a boolean field:  three optional, semicolon-separated attributes, " +
            						"in this order, if used:  'iseditable' (boolean), 'hasspecial' (boolean), 'isremovable' (boolean).");
        				} else if (specNode.getClass().toString().endsWith("comboFieldSpec")) {
            				return("Specify attributes for a combo-box field:  four optional, semicolon-separated attributes, " +
            						"in this order, if used:  'iseditable' (boolean), 'hasspecial' (string), " +
            						"'emptyallowed' (boolean--plus a string if 'true'), and 'isremovable' (boolean).");
        				} else if (specNode.getClass().toString().endsWith("dirListFieldSpec")) {
            				return("Specify attributes for a directory-list field:   four optional, semicolon-separated attributes, " +
            						"in this order, if used:  'iseditable' (boolean), 'hasspecial' (string), " +
            						"'emptyallowed' (boolean--plus a string if 'true'), and 'isremovable' (boolean).");
        				} else if (specNode.getClass().toString().endsWith("fileFieldSpec")) {
            				return("Specify attributes for a file-name field:   four optional, semicolon-separated attributes, " +
            						"in this order, if used:  'iseditable' (boolean), 'hasspecial' (string), " +
    								"'emptyallowed' (boolean--plus a string if 'true'), and 'isremovable' (boolean).");
        				} else if (specNode.getClass().toString().endsWith("intFieldSpec")) {
            				return("Specify attributes for an integer field:   four optional, semicolon-separated attributes, " +
            						"in this order, if used:  'iseditable' (boolean), 'range' (lowval .. highval), " +
            						"'hasspecial' (int), and 'isremovable' (boolean).");
        				} else if (specNode.getClass().toString().endsWith("radioFieldSpec")) {
            				return("Specify attributes for a radio-button field:   three optional, semicolon-separated attributes, " +
            						"in this order, if used:  'iseditable' (boolean), 'hasspecial' (int), " +
									"and 'isremovable' (boolean).");
        				} else if (specNode.getClass().toString().endsWith("stringFieldSpec")) {
            				return("Specify attributes for a string	field:   four optional, semicolon-separated attributes, " +
            						"in this order, if used:  'iseditable' (boolean), 'hasspecial' (string), " +
    								"'emptyallowed' (boolean--plus a string if 'true'), and 'isremovable' (boolean).");
        				}
        				return("Unrecognized field-spec type; no hover help available");
        			} else {
        				return("No field spec found; no hover help possible");
        			}
        		} else {
        			return("This is some kind of crazy AST node!");
        		}
        	default:
		        ASTNode def = null;
		        if (def != null)
		            return getSubstring(parseController, def.getLeftIToken().getStartOffset(), def.getRightIToken().getEndOffset());
		        else
		        	return "Abandon hope";
        	}
        }
        return getSubstring(parseController, token);
    }

Output:
    public String getHoverHelpAt(IParseController parseController, ISourceViewer srcViewer, int offset)
    {
        IPrsStream ps= parseController.getParser().getParseStream();
        IToken token= ps.getTokenAtCharacter(offset);
        if (token == null) return null;
        Object ast = parseController.getCurrentAst();
        if (ast == null) return null;
        IASTNodeLocator nodeLocator= parseController.getNodeLocator();
        Object node = nodeLocator.findNode(ast, offset);
        if (node == null)
            return null;
        if (node instanceof IASTNodeToken
        		|| node instanceof ASTNodeToken)
        {
        	int tokenKind = ((IASTNodeToken) node).getLeftIToken().getKind();
        	switch (tokenKind) {
        	case PrefspecsLexer.TK_TABS:
        		return("In this section list each of the four tabs:  'default', 'configuration', 'instance', and 'project',	" +
        				"and, for eack, indicate whether it is 'in' or 'out' of the preference page and assign tab-wide attributes, " +
        				"'iseditable' and/or 'isremovable', as appropriate");
        	case PrefspecsLexer.TK_FIELDS:
        		return("In this section list the fields that will appear on the generated preferences page (each field will appear" +
        				"on each included tab).  To list a field, give its type and name, and optionally set any properties specific " +
        				"to that field (applicable properties depend on field type).  The name of each field should be unique.");
        	case PrefspecsLexer.TK_CUSTOM:
        		return("In this section provide property values that apply to specific fields on specific tabs.  " +
        				"Designate fields by 'tab-name' 'field-name'; " +
        				"applicable properties depend on field type.  " +
        				"Field names should have been introduced in the 'fields' section.  " +
        				"Specific fields (specific tab-field combinations) may appear multiple times " +
        				"with any subset of applicable properties (later assignments override earlier ones).");
        	case PrefspecsLexer.TK_CONDITIONALS:
        		return("In this section list fields of any type whose enabled state depends on the state of another field of boolean type." +
        				"E.g., 'nameOfDependentField with nameOfBooleanField' or 'nameOfDependentField against nameOfBooleanField'");
        	case PrefspecsLexer.TK_DEFAULT:
        		return("Designates the 'default' level preferences tab");
        	case PrefspecsLexer.TK_CONFIGURATION:
        		return("Designates the 'configuration' level preferences tab");
        	case PrefspecsLexer.TK_INSTANCE:
        		return("Designates the 'instance' level preferences tab");
        	case PrefspecsLexer.TK_PROJECT:
        		return("Designates the 'project' level preferences tab");
        	case PrefspecsLexer.TK_BOOLEAN:
        		return("Designates the 'boolean' (checkbox) field type");
        	case PrefspecsLexer.TK_COMBO:
        		return("Designates the 'combo' (combo box) field type");
        	case PrefspecsLexer.TK_DIRLIST:
        		return("Designates the 'dirlist' (directory list) field type");
        	case PrefspecsLexer.TK_FILE:
        		return("Designates the 'file' (file name) field type");
        	case PrefspecsLexer.TK_INT:
        		return("Designates the 'int' field type");
        	case PrefspecsLexer.TK_RADIO:
        		return("Designates the 'radio' (radio buttons) field type");
        	case PrefspecsLexer.TK_STRING:
        		return("Designates the 'string' field type");
        	case PrefspecsLexer.TK_EMPTYALLOWED:
        		return("'emptyallowed' indicates whether the field has, and is allowed to take on, " +
        				"an 'empty' value; this attribute takes a boolean value; if 'true' then a value " +
           				"of the field type must be provided (to serve as the 'empty' value); " +
        				"if 'false', then no other argument is needed");
        	case PrefspecsLexer.TK_HASSPECIAL:
        		return("'hasspecial' requires a value of the type of the field that " +
        				"will serve as a distinguished value; omit if no such value");
        	case PrefspecsLexer.TK_ISEDITABLE:
        		return("'iseditable' takes a boolean value:  'true' indicates that the field " +
        				"can be edited (normal case); false indicates that it cannot (field is 'read only')");
        	case PrefspecsLexer.TK_ISREMOVABLE:
        		return("'isremovable' takes a boolean value:  'true' indicates that the value " +
        				"can be removed from this field an inherited from a higher level; " +
        				"'false' means that the field must always have a local value (not inherited");
        	case PrefspecsLexer.TK_RANGE:
        		return("'range' sets a range for numeric field types in the form 'lowVal .. highVal'");
        	case PrefspecsLexer.TK_AGAINST:
        		return("'against' means that the preceding field (of any type) is enabled if and only if " +
        				"the following field (of boolean type) is set to 'false'");
        	case PrefspecsLexer.TK_WITH:
        		return("'with' means that the preceding field (of any type) is enabled if and only if " +
        				"the following field (of boolean type) is set to 'true'");
        	case PrefspecsLexer.TK_STRING_LITERAL:
        		return("String literal");
        	case PrefspecsLexer.TK_IDENTIFIER:
        		int tokenNumber = ((IASTNodeToken) node).getLeftIToken().getTokenIndex();
        		if (tokenNumber == 2)
        			return "Preference-page identifier";
        		else
        			return "Preference-field identifier";
        	case PrefspecsLexer.TK_SINGLE_LINE_COMMENT:
        		return "Comment (no effect on pagegeneration)";
           	case PrefspecsLexer.TK_IN:
        		return("'in' means that the associated tab will be included in the generated preferences page");
        	case PrefspecsLexer.TK_OUT:
           		return("'out' means that the associated tab will not be included in the generated preferences page");
           	case PrefspecsLexer.TK_TRUE:
        		return("The opposite of false.");
        	case PrefspecsLexer.TK_FALSE:
           		return("The opposite of true.");
        	case PrefspecsLexer.TK_PAGE:
        		return "This designates the beginning of a preference-page specification";
        	case PrefspecsLexer.TK_LEFTBRACE:
        	case PrefspecsLexer.TK_RIGHTBRACE:
        		ASTNode grandParentNode = (ASTNode) ((ASTNode)node).getParent().getParent();
        		if (grandParentNode == null) {
        			if (tokenKind == PrefspecsLexer.TK_LEFTBRACE)
        				return "This is the beginning of the body of the specification";
        			else
        				return "This is the end of the body of the specification";
        		}
        		String parentTypeName = grandParentNode.getClass().getName();
        		if (parentTypeName.endsWith("tabSpecs")) {
        			return("Specify tab properties within braces; these properties by default apply to " +
        					"all fields in the tab.  There are two optional properties:  " +
        					"'iseditable' (boolean) indicates whether fields in the tab are editable; " +
        					"'isremovable' (boolean) indicates whether values stored in fields on the tab " +
        					"can be removed (triggering inheritance).  When both are used 'iseditable' " +
        					"must appear first.  Each should be followed by a ';'.");
        		} else if (parentTypeName.endsWith("fieldSpecs")) {
        			ASTNode specNode = getFieldSpecNode((ASTNode) node);
        			if (specNode != null) {
        				if (specNode.getClass().toString().endsWith("booleanFieldSpec")) {
            				return("Specify attributes for a boolean field:  three optional, semicolon-separated attributes, " +
            						"in this order, if used:  'iseditable' (boolean), 'hasspecial' (boolean), 'isremovable' (boolean).");
        				} else if (specNode.getClass().toString().endsWith("comboFieldSpec")) {
            				return("Specify attributes for a combo-box field:  four optional, semicolon-separated attributes, " +
            						"in this order, if used:  'iseditable' (boolean), 'hasspecial' (string), " +
            						"'emptyallowed' (boolean--plus a string if 'true'), and 'isremovable' (boolean).");
        				} else if (specNode.getClass().toString().endsWith("dirListFieldSpec")) {
            				return("Specify attributes for a directory-list field:   four optional, semicolon-separated attributes, " +
            						"in this order, if used:  'iseditable' (boolean), 'hasspecial' (string), " +
            						"'emptyallowed' (boolean--plus a string if 'true'), and 'isremovable' (boolean).");
        				} else if (specNode.getClass().toString().endsWith("fileFieldSpec")) {
            				return("Specify attributes for a file-name field:   four optional, semicolon-separated attributes, " +
            						"in this order, if used:  'iseditable' (boolean), 'hasspecial' (string), " +
    								"'emptyallowed' (boolean--plus a string if 'true'), and 'isremovable' (boolean).");
        				} else if (specNode.getClass().toString().endsWith("intFieldSpec")) {
            				return("Specify attributes for an integer field:   four optional, semicolon-separated attributes, " +
            						"in this order, if used:  'iseditable' (boolean), 'range' (lowval .. highval), " +
            						"'hasspecial' (int), and 'isremovable' (boolean).");
        				} else if (specNode.getClass().toString().endsWith("radioFieldSpec")) {
            				return("Specify attributes for a radio-button field:   three optional, semicolon-separated attributes, " +
            						"in this order, if used:  'iseditable' (boolean), 'hasspecial' (int), " +
									"and 'isremovable' (boolean).");
        				} else if (specNode.getClass().toString().endsWith("stringFieldSpec")) {
            				return("Specify attributes for a string	field:   four optional, semicolon-separated attributes, " +
            						"in this order, if used:  'iseditable' (boolean), 'hasspecial' (string), " +
    								"'emptyallowed' (boolean--plus a string if 'true'), and 'isremovable' (boolean).");
        				}
        				return("Unrecognized field-spec type; no hover help available");
        			} else {
        				return("No field spec found; no hover help possible");
        			}
        		} else {
        			return null;
        		}
        	default:
		        ASTNode def = null;
		        if (def != null)
		            return getSubstring(parseController, def.getLeftIToken().getStartOffset(), def.getRightIToken().getEndOffset());
		        else
		        	return "No help available";
        	}
        }
        return getSubstring(parseController, token);
    }


Input:
    public void test_handle_implies_call_to_authenticationSchemeHandler_when_authentication_succeed() throws Exception {
        MockRequestAdapter request = new MockRequestAdapter(new MockRequest());
        MockResponseAdapter response = new MockResponseAdapter(new MockResponse());
        AuthenticationSchemeHandler<MockRequestAdapter, MockResponseAdapter> authenticationSchemeHandler = mock(AuthenticationSchemeHandler.class);
        Collection<Class<? extends Callback>> callbackClasses = Lists.newArrayList();
        callbackClasses.add(NameCallback.class);
        when(authenticationSchemeHandler.getCallbackTypes()).thenReturn(callbackClasses);
        Collection<AuthenticationSchemeHandler<MockRequestAdapter, MockResponseAdapter>> authenticationSchemeHandlers = new ArrayList<AuthenticationSchemeHandler<MockRequestAdapter, MockResponseAdapter>>();
        authenticationSchemeHandlers.add(authenticationSchemeHandler);
        MockCallbackHandler mockCallbackHandler = new MockCallbackHandler(new MockRequestAdapter(new MockRequest()), new MockResponseAdapter(new MockResponse()), authenticationSchemeHandlers
        );
        List<Callback> callbackList = new ArrayList<Callback>();
        NameCallback nameCallback = new NameCallback(DUMMY_PROMPT);
        callbackList.add(nameCallback);
        Callback[] callbacks = callbackList.toArray(new Callback[callbackList.size()]);
        mockCallbackHandler.handle(callbacks);
        Subject subject = new Subject();
        mockCallbackHandler.authenticationSucceed(subject);
        verify(authenticationSchemeHandler).authenticationSucceed(subject, request, response);
    }

Output:
    public void test_handle_implies_call_to_authenticationSchemeHandler_when_authentication_succeed() throws Exception {
        MockRequestAdapter request = new MockRequestAdapter(new MockRequest());
        MockResponseAdapter response = new MockResponseAdapter(new MockResponse());
        AuthenticationSchemeHandler<MockRequestAdapter, MockResponseAdapter> authenticationSchemeHandler = mock(AuthenticationSchemeHandler.class);
        Collection<Class<? extends Callback>> callbackClasses = Lists.newArrayList();
        callbackClasses.add(NameCallback.class);
        when(authenticationSchemeHandler.getCallbackTypes()).thenReturn(callbackClasses);
        Collection<AuthenticationSchemeHandler<MockRequestAdapter, MockResponseAdapter>> authenticationSchemeHandlers = new ArrayList<AuthenticationSchemeHandler<MockRequestAdapter, MockResponseAdapter>>();
        authenticationSchemeHandlers.add(authenticationSchemeHandler);
        MockCallbackHandler mockCallbackHandler = new MockCallbackHandler(request, response, authenticationSchemeHandlers
        );
        List<Callback> callbackList = new ArrayList<Callback>();
        NameCallback nameCallback = new NameCallback(DUMMY_PROMPT);
        callbackList.add(nameCallback);
        Callback[] callbacks = callbackList.toArray(new Callback[callbackList.size()]);
        mockCallbackHandler.handle(callbacks);
        Subject subject = new Subject();
        mockCallbackHandler.authenticationSucceed(subject);
        verify(authenticationSchemeHandler).authenticationSucceed(subject, request, response);
    }


Input:
	public void populate(Chunk chunk, Random random) {
		noise.setSeed((int) chunk.getWorld().getSeed());
		int x = chunk.getX() * 16;
		int y = chunk.getY() * 16;
		int z = chunk.getZ() * 16;
		Point pt = new Point(chunk.getWorld(), x + random.nextInt(16), y + random.nextInt(16), z + random.nextInt(16));
		for (int dx = x; dx < x + 16; dx++) {
			for (int dz = z; dz < z + 16; dz++) {
				for (int dy = y; dy < y + 16; dy++) {
					if (Math.sqrt(Math.pow(dx - pt.getX(), 2) + Math.pow(dy - pt.getY(), 2) + Math.pow(dz - pt.getZ(), 2)) > 6) {
						continue;
					}
					if (noise.GetValue(dx / 5.0 + 0.005, dy / 5.0 + 0.005, dz / 5.0 + 0.005) > 0 && chunk.getBlockMaterial(dx, dy, dz) == VanillaMaterials.STONE) {
						chunk.getBlock(dx, dy, dz).setMaterial(VanillaMaterials.AIR).update(true);
					}
				}
			}
		}
	}

Output:
	public void populate(Chunk chunk, Random random) {
		noise.setSeed((int) chunk.getWorld().getSeed());
		int x = chunk.getX() * 16;
		int y = chunk.getY() * 16;
		int z = chunk.getZ() * 16;
		Point pt = new Point(chunk.getWorld(), x + random.nextInt(16), y + random.nextInt(16), z + random.nextInt(16));
		for (int dx = x; dx < x + 16; dx++) {
			for (int dz = z; dz < z + 16; dz++) {
				for (int dy = y; dy < y + 16; dy++) {
					if (Math.sqrt(Math.pow(dx - pt.getX(), 2) + Math.pow(dy - pt.getY(), 2) + Math.pow(dz - pt.getZ(), 2)) > 6) {
						continue;
					}
					if (noise.GetValue(dx / 5.0 + 0.005, dy / 5.0 + 0.005, dz / 5.0 + 0.005) > 0 && chunk.getBlockMaterial(dx, dy, dz) == VanillaMaterials.STONE) {
					}
				}
			}
		}
	}


Input:
    public int getKeyIndexAndNearbyCodes(int x, int y, final int[] allCodes) {
        final List<Key> keys = getKeys();
        final int touchX = getTouchX(x);
        final int touchY = getTouchY(y);
        initializeNearbyKeys();
        int primaryIndex = NOT_A_KEY;
        for (final int index : mKeyboard.getNearestKeys(touchX, touchY)) {
            final Key key = keys.get(index);
            final boolean isInside = mKeyboard.isInside(key, touchX, touchY);
            final int distance = key.squaredDistanceToEdge(touchX, touchY);
            if (isInside || (mProximityCorrectOn && distance < mProximityThresholdSquare)) {
                final int insertedPosition = sortNearbyKeys(index, distance);
                if (insertedPosition == 0 && isInside)
                    primaryIndex = index;
            }
        }
        if (allCodes != null && allCodes.length > 0) {
            getNearbyKeyCodes(allCodes);
            if (DEBUG) {
                Log.d(TAG, "x=" + x + " y=" + y
                        + " primary="
                        + (primaryIndex == NOT_A_KEY ? "none" : keys.get(primaryIndex).mCode)
                        + " codes=" + Arrays.toString(allCodes));
            }
        }
        return primaryIndex;
    }

Output:
    public int getKeyIndexAndNearbyCodes(int x, int y, final int[] allCodes) {
        final List<Key> keys = getKeys();
        final int touchX = getTouchX(x);
        final int touchY = getTouchY(y);
        initializeNearbyKeys();
        int primaryIndex = NOT_A_KEY;
        for (final int index : mKeyboard.getNearestKeys(touchX, touchY)) {
            final Key key = keys.get(index);
            final boolean isInside = mKeyboard.isInside(key, touchX, touchY);
            final int distance = key.squaredDistanceToEdge(touchX, touchY);
            if (isInside || (mProximityCorrectOn && distance < mProximityThresholdSquare)) {
                final int insertedPosition = sortNearbyKeys(index, distance);
                if (insertedPosition == 0)
                    primaryIndex = index;
            }
        }
        if (allCodes != null && allCodes.length > 0) {
            getNearbyKeyCodes(allCodes);
            if (DEBUG) {
                Log.d(TAG, "x=" + x + " y=" + y
                        + " primary="
                        + (primaryIndex == NOT_A_KEY ? "none" : keys.get(primaryIndex).mCode)
                        + " codes=" + Arrays.toString(allCodes));
            }
        }
        return primaryIndex;
    }


Input:
	final public void run( final String args )
	{
		if ( IJ.versionLessThan( "1.41n" ) ) return;
		final ImagePlus imp = WindowManager.getCurrentImage();
		if ( imp == null )  { System.err.println( "There are no images open" ); return; }
		GenericDialog gd = new GenericDialog( "Generate optic flow" );
		gd.addNumericField( "sigma :", sigma, 2, 6, "px" );
		gd.addNumericField( "maximal_distance :", maxDistance, 0, 6, "px" );
		gd.addCheckbox( "show_color_map", showColors );
		gd.showDialog();
		if (gd.wasCanceled()) return;
		sigma = ( float )gd.getNextNumber();
		maxDistance = ( byte )gd.getNextNumber();
		showColors = gd.getNextBoolean();
		if ( showColors )
		{
			ColorProcessor ipColor = new ColorProcessor( imp.getWidth(), imp.getHeight() );
			colorCircle( ipColor );
			ImagePlus impColor = new ImagePlus( "Color", ipColor );
			impColor.show();
		}
		ImageStack seq = imp.getStack();
		ImageStack seqOpticFlow = new ImageStack( seq.getWidth(), seq.getHeight() );
		FloatProcessor ip1;
		FloatProcessor ip2 = ( FloatProcessor )seq.getProcessor( 1 ).convertToFloat();
		ImagePlus impOpticFlow = null;
		for ( int i = 1; i < seq.getSize(); ++i )
		{
			ip1 = ip2;
			ip2 = ( FloatProcessor )seq.getProcessor( i + 1 ).convertToFloat();
			IJ.log( "Processing slice " + i );
			seqOpticFlow.addSlice( "" + i, createOpticFlow( ip1, ip2 ) );
			if ( seqOpticFlow.getSize() == 1 )
			{
				impOpticFlow = new ImagePlus( imp.getTitle() + " optic flow", seqOpticFlow );
				impOpticFlow.show();
			}
			else
				impOpticFlow.setStack( null, seqOpticFlow );
			IJ.showProgress( i, seq.getSize() );
			impOpticFlow.setSlice( i );
			imp.setSlice( i + 1 );
		}
	}

Output:
	final public void run( final String args )
	{
		if ( IJ.versionLessThan( "1.41n" ) ) return;
		final ImagePlus imp = WindowManager.getCurrentImage();
		if ( imp == null )  { IJ.error( "There are no images open" ); return; }
		GenericDialog gd = new GenericDialog( "Generate optic flow" );
		gd.addNumericField( "sigma :", sigma, 2, 6, "px" );
		gd.addNumericField( "maximal_distance :", maxDistance, 0, 6, "px" );
		gd.addCheckbox( "show_color_map", showColors );
		gd.showDialog();
		if (gd.wasCanceled()) return;
		sigma = ( float )gd.getNextNumber();
		maxDistance = ( byte )gd.getNextNumber();
		showColors = gd.getNextBoolean();
		if ( showColors )
		{
			ColorProcessor ipColor = new ColorProcessor( imp.getWidth(), imp.getHeight() );
			colorCircle( ipColor );
			ImagePlus impColor = new ImagePlus( "Color", ipColor );
			impColor.show();
		}
		ImageStack seq = imp.getStack();
		ImageStack seqOpticFlow = new ImageStack( seq.getWidth(), seq.getHeight() );
		FloatProcessor ip1;
		FloatProcessor ip2 = ( FloatProcessor )seq.getProcessor( 1 ).convertToFloat();
		ImagePlus impOpticFlow = null;
		for ( int i = 1; i < seq.getSize(); ++i )
		{
			ip1 = ip2;
			ip2 = ( FloatProcessor )seq.getProcessor( i + 1 ).convertToFloat();
			IJ.log( "Processing slice " + i );
			seqOpticFlow.addSlice( "" + i, createOpticFlow( ip1, ip2 ) );
			if ( seqOpticFlow.getSize() == 1 )
			{
				impOpticFlow = new ImagePlus( imp.getTitle() + " optic flow", seqOpticFlow );
				impOpticFlow.show();
			}
			else
				impOpticFlow.setStack( null, seqOpticFlow );
			IJ.showProgress( i, seq.getSize() );
			impOpticFlow.setSlice( i );
			imp.setSlice( i + 1 );
		}
	}


Input:
	public void setContent(String content)
	{
		this.content= content.replaceAll("[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\ud800-\\udfff\\uffff\\ufffe]", "");
		if (this.content == null) this.content = "";
	}

Output:
	public void setContent(String content)
	{
		if (this.content == null) this.content = "";
		this.content= content.replaceAll("[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\ud800-\\udfff\\uffff\\ufffe]", "");
	}


Input:
    public void performAction() {
	FLyrVect lyr = null;
	MapControl mapCtrl = view.getMapControl();
	try {
	    mapCtrl.getMapContext().beginAtomicEvent();
	    lyr = wizard.createLayer(mapCtrl.getProjection());
	} catch (Exception e) {
	    NotificationManager.showMessageError(e.getLocalizedMessage(), e);
	    return;
	}
	if (lyr == null) {
	    return;
	}
	lyr.setVisible(true);
	mapCtrl.getMapContext().getLayers().addLayer(lyr);
	mapCtrl.getMapContext().endAtomicEvent();
	lyr.addLayerListener(CADExtension.getEditionManager());
	lyr.setActive(true);
	try {
	    lyr.setEditing(true);
	    VectorialEditableAdapter vea = (VectorialEditableAdapter) lyr
		    .getSource();
	    vea.getRules().clear();
	    if (vea.getShapeType() == FShape.POLYGON) {
		IRule rulePol = new RulePolygon();
		vea.getRules().add(rulePol);
	    }
	    StartEditing.startCommandsApplicable(view, lyr);
	    vea.getCommandRecord().addCommandListener(mapCtrl);
	    view.showConsole();
	    oldAction.performAction();
	} catch (ReadDriverException e) {
	    NotificationManager.addError(e);
	} catch (StartEditionLayerException e) {
	    NotificationManager.addError(e);
	}
    }

Output:
    public void performAction() {
	FLyrVect lyr = null;
	MapControl mapCtrl = view.getMapControl();
	try {
	    mapCtrl.getMapContext().beginAtomicEvent();
	    lyr = wizard.createLayer(mapCtrl.getProjection());
	} catch (Exception e) {
	    Throwable cause = e.getCause();
	    if (cause != null) {
		NotificationManager.showMessageError(
			cause.getLocalizedMessage(), e);
	    } else {
		NotificationManager
			.showMessageError(e.getLocalizedMessage(), e);
	    }
	    return;
	}
	if (lyr == null) {
	    return;
	}
	lyr.setVisible(true);
	mapCtrl.getMapContext().getLayers().addLayer(lyr);
	mapCtrl.getMapContext().endAtomicEvent();
	lyr.addLayerListener(CADExtension.getEditionManager());
	lyr.setActive(true);
	try {
	    lyr.setEditing(true);
	    VectorialEditableAdapter vea = (VectorialEditableAdapter) lyr
		    .getSource();
	    vea.getRules().clear();
	    if (vea.getShapeType() == FShape.POLYGON) {
		IRule rulePol = new RulePolygon();
		vea.getRules().add(rulePol);
	    }
	    StartEditing.startCommandsApplicable(view, lyr);
	    vea.getCommandRecord().addCommandListener(mapCtrl);
	    view.showConsole();
	    oldAction.performAction();
	} catch (ReadDriverException e) {
	    NotificationManager.addError(e);
	} catch (StartEditionLayerException e) {
	    NotificationManager.addError(e);
	}
    }