_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q5500
XtextLinker.clearReference
train
@Override protected void clearReference(EObject obj, EReference ref) { super.clearReference(obj, ref); if (obj.eIsSet(ref) && ref.getEType().equals(XtextPackage.Literals.TYPE_REF)) { INode node = NodeModelUtils.getNode((EObject) obj.eGet(ref)); if (node == null) obj.eUnset(ref); } if (obj.eIsSet(ref)...
java
{ "resource": "" }
q5501
OutdatedStateManager.newCancelIndicator
train
public CancelIndicator newCancelIndicator(final ResourceSet rs) { CancelIndicator _xifexpression = null; if ((rs instanceof XtextResourceSet)) { final boolean cancelationAllowed = (this.cancelationAllowed.get()).booleanValue(); final int current = ((XtextResourceSet)rs).getModificationStamp(); ...
java
{ "resource": "" }
q5502
IdeContentProposalCreator.createProposal
train
public ContentAssistEntry createProposal(final String proposal, final ContentAssistContext context) { return this.createProposal(proposal, context.getPrefix(), context, ContentAssistEntry.KIND_UNKNOWN, null); }
java
{ "resource": "" }
q5503
IdeContentProposalCreator.createSnippet
train
public ContentAssistEntry createSnippet(final String proposal, final String label, final ContentAssistContext context) { final Procedure1<ContentAssistEntry> _function = (ContentAssistEntry it) -> { it.setLabel(label); }; return this.createProposal(proposal, context.getPrefix(), context, ContentAssist...
java
{ "resource": "" }
q5504
IdeContentProposalCreator.createProposal
train
public ContentAssistEntry createProposal(final String proposal, final ContentAssistContext context, final Procedure1<? super ContentAssistEntry> init) { return this.createProposal(proposal, context.getPrefix(), context, ContentAssistEntry.KIND_UNKNOWN, init); }
java
{ "resource": "" }
q5505
IdeContentProposalCreator.createProposal
train
public ContentAssistEntry createProposal(final String proposal, final String prefix, final ContentAssistContext context, final String kind, final Procedure1<? super ContentAssistEntry> init) { boolean _isValidProposal = this.isValidProposal(proposal, prefix, context); if (_isValidProposal) { final Content...
java
{ "resource": "" }
q5506
UriExtensions.toDecodedString
train
public String toDecodedString(final java.net.URI uri) { final String scheme = uri.getScheme(); final String part = uri.getSchemeSpecificPart(); if ((scheme == null)) { return part; } return ((scheme + ":") + part); }
java
{ "resource": "" }
q5507
UriExtensions.withEmptyAuthority
train
public URI withEmptyAuthority(final URI uri) { URI _xifexpression = null; if ((uri.isFile() && (uri.authority() == null))) { _xifexpression = URI.createHierarchicalURI(uri.scheme(), "", uri.device(), uri.segments(), uri.query(), uri.fragment()); } else { _xifexpression = uri; } return _x...
java
{ "resource": "" }
q5508
RequiredRuleNameComputer.getRequiredRuleNames
train
public String[][] getRequiredRuleNames(Param param) { if (isFiltered(param)) { return EMPTY_ARRAY; } AbstractElement elementToParse = param.elementToParse; String ruleName = param.ruleName; if (ruleName == null) { return getRequiredRuleNames(param, elementToParse); } return getAdjustedRequiredRuleNa...
java
{ "resource": "" }
q5509
RequiredRuleNameComputer.isFiltered
train
protected boolean isFiltered(Param param) { AbstractElement elementToParse = param.elementToParse; while (elementToParse != null) { if (isFiltered(elementToParse, param)) { return true; } elementToParse = getEnclosingSingleElementGroup(elementToParse); } return false; }
java
{ "resource": "" }
q5510
RequiredRuleNameComputer.getEnclosingSingleElementGroup
train
protected AbstractElement getEnclosingSingleElementGroup(AbstractElement elementToParse) { EObject container = elementToParse.eContainer(); if (container instanceof Group) { if (((Group) container).getElements().size() == 1) { return (AbstractElement) container; } } return null; }
java
{ "resource": "" }
q5511
RequiredRuleNameComputer.isFiltered
train
protected boolean isFiltered(AbstractElement canddiate, Param param) { if (canddiate instanceof Group) { Group group = (Group) canddiate; if (group.getGuardCondition() != null) { Set<Parameter> context = param.getAssignedParametes(); ConditionEvaluator evaluator = new ConditionEvaluator(context); if...
java
{ "resource": "" }
q5512
CodeGenUtil2.isJavaLangType
train
public static boolean isJavaLangType(String s) { return getJavaDefaultTypes().contains(s) && Character.isUpperCase(s.charAt(0)); }
java
{ "resource": "" }
q5513
ContentAssistContext.copy
train
public ContentAssistContext.Builder copy() { Builder result = builderProvider.get(); result.copyFrom(this); return result; }
java
{ "resource": "" }
q5514
ContentAssistContext.getFirstSetGrammarElements
train
public ImmutableList<AbstractElement> getFirstSetGrammarElements() { if (firstSetGrammarElements == null) { firstSetGrammarElements = ImmutableList.copyOf(mutableFirstSetGrammarElements); } return firstSetGrammarElements; }
java
{ "resource": "" }
q5515
ContentAssistContext.getReplaceContextLength
train
public int getReplaceContextLength() { if (replaceContextLength == null) { int replacementOffset = getReplaceRegion().getOffset(); ITextRegion currentRegion = getCurrentNode().getTextRegion(); int replaceContextLength = currentRegion.getLength() - (replacementOffset - currentRegion.getOffset()); this.repl...
java
{ "resource": "" }
q5516
NodeModelStreamer.getFormattedDatatypeValue
train
protected String getFormattedDatatypeValue(ICompositeNode node, AbstractRule rule, String text) throws ValueConverterException { Object value = valueConverter.toValue(text, rule.getName(), node); text = valueConverter.toString(value, rule.getName()); return text; }
java
{ "resource": "" }
q5517
LexerSpecialStateTransitionSplitter.splitSpecialStateSwitch
train
public String splitSpecialStateSwitch(String specialStateTransition){ Matcher transformedSpecialStateMatcher = TRANSORMED_SPECIAL_STATE_TRANSITION_METHOD.matcher(specialStateTransition); if( !transformedSpecialStateMatcher.find() ){ return specialStateTransition; } String specialStateSwitch = transfor...
java
{ "resource": "" }
q5518
PluginXmlAccess.merge
train
public boolean merge(final PluginXmlAccess other) { boolean _xblockexpression = false; { String _path = this.getPath(); String _path_1 = other.getPath(); boolean _notEquals = (!Objects.equal(_path, _path_1)); if (_notEquals) { String _path_2 = this.getPath(); String _plus...
java
{ "resource": "" }
q5519
DefaultDocumentHighlightService.getTargetURIs
train
protected Iterable<URI> getTargetURIs(final EObject primaryTarget) { final TargetURIs result = targetURIsProvider.get(); uriCollector.add(primaryTarget, result); return result; }
java
{ "resource": "" }
q5520
NameBasedFilter.setRegularExpression
train
public void setRegularExpression(String regularExpression) { if (regularExpression != null) this.regularExpression = Pattern.compile(regularExpression); else this.regularExpression = null; }
java
{ "resource": "" }
q5521
AbstractGenericResourceSupport.registerServices
train
public void registerServices(boolean force) { Injector injector = Guice.createInjector(getGuiceModule()); injector.injectMembers(this); registerInRegistry(force); }
java
{ "resource": "" }
q5522
ResourceDescriptionsData.register
train
public void register(Delta delta) { final IResourceDescription newDesc = delta.getNew(); if (newDesc == null) { removeDescription(delta.getUri()); } else { addDescription(delta.getUri(), newDesc); } }
java
{ "resource": "" }
q5523
AbstractTraceForURIProvider.getGeneratedLocation
train
protected AbsoluteURI getGeneratedLocation(PersistedTrace trace) { AbsoluteURI path = trace.getPath(); String fileName = traceFileNameProvider.getJavaFromTrace(path.getURI().toString()); return new AbsoluteURI(fileName); }
java
{ "resource": "" }
q5524
Scopes.scopeFor
train
public static <T extends EObject> IScope scopeFor(Iterable<? extends T> elements, final Function<T, QualifiedName> nameComputation, IScope outer) { return new SimpleScope(outer,scopedElementsFor(elements, nameComputation)); }
java
{ "resource": "" }
q5525
PolymorphicDispatcher.compare
train
protected int compare(MethodDesc o1, MethodDesc o2) { final Class<?>[] paramTypes1 = o1.getParameterTypes(); final Class<?>[] paramTypes2 = o2.getParameterTypes(); // sort by parameter types from left to right for (int i = 0; i < paramTypes1.length; i++) { final Class<?> class1 = paramTypes1[i]; final Cl...
java
{ "resource": "" }
q5526
ResourceStorageWritable.writeEntries
train
protected void writeEntries(final StorageAwareResource resource, final ZipOutputStream zipOut) throws IOException { final BufferedOutputStream bufferedOutput = new BufferedOutputStream(zipOut); ZipEntry _zipEntry = new ZipEntry("emf-contents"); zipOut.putNextEntry(_zipEntry); try { this.writeConte...
java
{ "resource": "" }
q5527
IndentationAwareCompletionPrefixProvider.getInputToParse
train
@Override public String getInputToParse(String completeInput, int offset, int completionOffset) { int fixedOffset = getOffsetIncludingWhitespace(completeInput, offset, Math.min(completeInput.length(), completionOffset)); return super.getInputToParse(completeInput, fixedOffset, completionOffset); }
java
{ "resource": "" }
q5528
GrammarResource.doLinking
train
@Override protected void doLinking() { IParseResult parseResult = getParseResult(); if (parseResult == null || parseResult.getRootASTElement() == null) return; XtextLinker castedLinker = (XtextLinker) getLinker(); castedLinker.discardGeneratedPackages(parseResult.getRootASTElement()); }
java
{ "resource": "" }
q5529
SourceLevelURIsAdapter.setSourceLevelUrisWithoutCopy
train
public static void setSourceLevelUrisWithoutCopy(final ResourceSet resourceSet, final Set<URI> uris) { final SourceLevelURIsAdapter adapter = SourceLevelURIsAdapter.findOrCreateAdapter(resourceSet); adapter.sourceLevelURIs = uris; }
java
{ "resource": "" }
q5530
XtextGeneratorLanguage.setFileExtensions
train
public void setFileExtensions(final String fileExtensions) { this.fileExtensions = IterableExtensions.<String>toList(((Iterable<String>)Conversions.doWrapArray(fileExtensions.trim().split("\\s*,\\s*")))); }
java
{ "resource": "" }
q5531
NodeModelUtils.compactDump
train
public static String compactDump(INode node, boolean showHidden) { StringBuilder result = new StringBuilder(); try { compactDump(node, showHidden, "", result); } catch (IOException e) { return e.getMessage(); } return result.toString(); }
java
{ "resource": "" }
q5532
NodeModelUtils.getTokenText
train
public static String getTokenText(INode node) { if (node instanceof ILeafNode) return ((ILeafNode) node).getText(); else { StringBuilder builder = new StringBuilder(Math.max(node.getTotalLength(), 1)); boolean hiddenSeen = false; for (ILeafNode leaf : node.getLeafNodes()) { if (!leaf.isHidden()) { ...
java
{ "resource": "" }
q5533
SemanticHighlightingRegistry.getAllScopes
train
public List<List<String>> getAllScopes() { this.checkInitialized(); final ImmutableList.Builder<List<String>> builder = ImmutableList.<List<String>>builder(); final Consumer<Integer> _function = (Integer it) -> { List<String> _get = this.scopes.get(it); StringConcatenation _builder = new StringC...
java
{ "resource": "" }
q5534
MergeableManifest2.addRequiredBundles
train
public void addRequiredBundles(Set<String> requiredBundles) { addRequiredBundles(requiredBundles.toArray(new String[requiredBundles.size()])); }
java
{ "resource": "" }
q5535
MergeableManifest2.addRequiredBundles
train
public void addRequiredBundles(String... requiredBundles) { String oldBundles = mainAttributes.get(REQUIRE_BUNDLE); if (oldBundles == null) oldBundles = ""; BundleList oldResultList = BundleList.fromInput(oldBundles, newline); BundleList resultList = BundleList.fromInput(oldBundles, newline); for (String b...
java
{ "resource": "" }
q5536
MergeableManifest2.addImportedPackages
train
public void addImportedPackages(Set<String> importedPackages) { addImportedPackages(importedPackages.toArray(new String[importedPackages.size()])); }
java
{ "resource": "" }
q5537
MergeableManifest2.addImportedPackages
train
public void addImportedPackages(String... importedPackages) { String oldBundles = mainAttributes.get(IMPORT_PACKAGE); if (oldBundles == null) oldBundles = ""; BundleList oldResultList = BundleList.fromInput(oldBundles, newline); BundleList resultList = BundleList.fromInput(oldBundles, newline); for (String...
java
{ "resource": "" }
q5538
MergeableManifest2.addExportedPackages
train
public void addExportedPackages(Set<String> exportedPackages) { addExportedPackages(exportedPackages.toArray(new String[exportedPackages.size()])); }
java
{ "resource": "" }
q5539
MergeableManifest2.addExportedPackages
train
public void addExportedPackages(String... exportedPackages) { String oldBundles = mainAttributes.get(EXPORT_PACKAGE); if (oldBundles == null) oldBundles = ""; BundleList oldResultList = BundleList.fromInput(oldBundles, newline); BundleList resultList = BundleList.fromInput(oldBundles, newline); for (String...
java
{ "resource": "" }
q5540
MergeableManifest2.setBREE
train
public void setBREE(String bree) { String old = mainAttributes.get(BUNDLE_REQUIREDEXECUTIONENVIRONMENT); if (!bree.equals(old)) { this.mainAttributes.put(BUNDLE_REQUIREDEXECUTIONENVIRONMENT, bree); this.modified = true; this.bree = bree; } }
java
{ "resource": "" }
q5541
MergeableManifest2.setBundleActivator
train
public void setBundleActivator(String bundleActivator) { String old = mainAttributes.get(BUNDLE_ACTIVATOR); if (!bundleActivator.equals(old)) { this.mainAttributes.put(BUNDLE_ACTIVATOR, bundleActivator); this.modified = true; this.bundleActivator = bundleActivator; } }
java
{ "resource": "" }
q5542
MergeableManifest2.make512Safe
train
public static String make512Safe(StringBuffer input, String newline) { StringBuilder result = new StringBuilder(); String content = input.toString(); String rest = content; while (!rest.isEmpty()) { if (rest.contains("\n")) { String line = rest.substring(0, rest.indexOf("\n")); rest = rest.substring(...
java
{ "resource": "" }
q5543
AbstractFormatter2._format
train
protected void _format(EObject obj, IFormattableDocument document) { for (EObject child : obj.eContents()) document.format(child); }
java
{ "resource": "" }
q5544
AbstractReadWriteAcces.process
train
public <Result> Result process(IUnitOfWork<Result, State> work) { releaseReadLock(); acquireWriteLock(); try { if (log.isTraceEnabled()) log.trace("process - " + Thread.currentThread().getName()); return modify(work); } finally { if (log.isTraceEnabled()) log.trace("Downgrading from write lock ...
java
{ "resource": "" }
q5545
AbstractInternalAntlrParser.forceCreateModelElementAndSet
train
protected EObject forceCreateModelElementAndSet(Action action, EObject value) { EObject result = semanticModelBuilder.create(action.getType().getClassifier()); semanticModelBuilder.set(result, action.getFeature(), value, null /* ParserRule */, currentNode); insertCompositeNode(action); associateNode...
java
{ "resource": "" }
q5546
AntlrCodeQualityHelper.stripUnnecessaryComments
train
public String stripUnnecessaryComments(String javaContent, AntlrOptions options) { if (!options.isOptimizeCodeQuality()) { return javaContent; } javaContent = stripMachineDependentPaths(javaContent); if (options.isStripAllComments()) { javaContent = stripAllComments(javaContent); } return javaContent;...
java
{ "resource": "" }
q5547
ContentAssistContextFactory.getPrefix
train
public String getPrefix(INode prefixNode) { if (prefixNode instanceof ILeafNode) { if (((ILeafNode) prefixNode).isHidden() && prefixNode.getGrammarElement() != null) return ""; return getNodeTextUpToCompletionOffset(prefixNode); } StringBuilder result = new StringBuilder(prefixNode.getTotalLength()); ...
java
{ "resource": "" }
q5548
UriExtensions.toUriString
train
public String toUriString(final java.net.URI uri) { return this.toUriString(URI.createURI(uri.normalize().toString())); }
java
{ "resource": "" }
q5549
SimpleCache.hasCachedValue
train
public boolean hasCachedValue(Key key) { try { readLock.lock(); return content.containsKey(key); } finally { readLock.unlock(); } }
java
{ "resource": "" }
q5550
ResourceStorageLoadable.loadEntries
train
protected void loadEntries(final StorageAwareResource resource, final ZipInputStream zipIn) throws IOException { zipIn.getNextEntry(); BufferedInputStream _bufferedInputStream = new BufferedInputStream(zipIn); this.readContents(resource, _bufferedInputStream); zipIn.getNextEntry(); BufferedInputStre...
java
{ "resource": "" }
q5551
AbstractTraceRegion.leafIterator
train
public final Iterator<AbstractTraceRegion> leafIterator() { if (nestedRegions == null) return Collections.<AbstractTraceRegion> singleton(this).iterator(); return new LeafIterator(this); }
java
{ "resource": "" }
q5552
TracingSugar.generateTracedFile
train
public void generateTracedFile(final IFileSystemAccess2 fsa, final String path, final EObject rootTrace, final StringConcatenationClient code) { final CompositeGeneratorNode node = this.trace(rootTrace, code); this.generateTracedFile(fsa, path, node); }
java
{ "resource": "" }
q5553
TracingSugar.generateTracedFile
train
public void generateTracedFile(final IFileSystemAccess2 fsa, final String path, final CompositeGeneratorNode rootNode) { final GeneratorNodeProcessor.Result result = this.processor.process(rootNode); fsa.generateFile(path, result); }
java
{ "resource": "" }
q5554
OperationCanceledManager.propagateAsErrorIfCancelException
train
public void propagateAsErrorIfCancelException(final Throwable t) { if ((t instanceof OperationCanceledError)) { throw ((OperationCanceledError)t); } final RuntimeException opCanceledException = this.getPlatformOperationCanceledException(t); if ((opCanceledException != null)) { throw new Oper...
java
{ "resource": "" }
q5555
OperationCanceledManager.propagateIfCancelException
train
public void propagateIfCancelException(final Throwable t) { final RuntimeException cancelException = this.getPlatformOperationCanceledException(t); if ((cancelException != null)) { throw cancelException; } }
java
{ "resource": "" }
q5556
LazyURIEncoder.decode
train
public Triple<EObject, EReference, INode> decode(Resource res, String uriFragment) { if (isUseIndexFragment(res)) { return getLazyProxyInformation(res, uriFragment); } List<String> split = Strings.split(uriFragment, SEP); EObject source = resolveShortFragment(res, split.get(1)); EReference ref = fromShortE...
java
{ "resource": "" }
q5557
OnChangeEvictingCache.get
train
@Override public <T> T get(Object key, Resource resource, Provider<T> provider) { if(resource == null) { return provider.get(); } CacheAdapter adapter = getOrCreate(resource); T element = adapter.<T>internalGet(key); if (element==null) { element = provider.get(); cacheMiss(adapter); adapter.set(k...
java
{ "resource": "" }
q5558
OnChangeEvictingCache.execWithoutCacheClear
train
public <Result, Param extends Resource> Result execWithoutCacheClear(Param resource, IUnitOfWork<Result, Param> transaction) throws WrappedException { CacheAdapter cacheAdapter = getOrCreate(resource); try { cacheAdapter.ignoreNotifications(); return transaction.exec(resource); } catch (RuntimeException e) ...
java
{ "resource": "" }
q5559
OnChangeEvictingCache.execWithTemporaryCaching
train
public <Result, Param extends Resource> Result execWithTemporaryCaching(Param resource, IUnitOfWork<Result, Param> transaction) throws WrappedException { CacheAdapter cacheAdapter = getOrCreate(resource); IgnoreValuesMemento memento = cacheAdapter.ignoreNewValues(); try { return transaction.exec(resource); }...
java
{ "resource": "" }
q5560
LazyLinkingResource.resolveLazyCrossReferences
train
public void resolveLazyCrossReferences(final CancelIndicator mon) { final CancelIndicator monitor = mon == null ? CancelIndicator.NullImpl : mon; TreeIterator<Object> iterator = EcoreUtil.getAllContents(this, true); while (iterator.hasNext()) { operationCanceledManager.checkCanceled(monitor); InternalEObjec...
java
{ "resource": "" }
q5561
DescriptionUtils.collectOutgoingReferences
train
public Set<URI> collectOutgoingReferences(IResourceDescription description) { URI resourceURI = description.getURI(); Set<URI> result = null; for(IReferenceDescription reference: description.getReferenceDescriptions()) { URI targetResource = reference.getTargetEObjectUri().trimFragment(); if (!resourceURI.e...
java
{ "resource": "" }
q5562
TailWriter.write
train
@Override public void write(final char[] cbuf, final int off, final int len) throws IOException { int offset = off; int length = len; while (suppressLineCount > 0 && length > 0) { length = -1; for (int i = 0; i < len && suppressLineCount > 0; i++) { if (cbuf[off + i] == '\n') { offset = off + i + ...
java
{ "resource": "" }
q5563
DefaultTaskFinder.setEndTag
train
@Inject(optional = true) protected Pattern setEndTag(@Named(AbstractMultiLineCommentProvider.END_TAG) final String endTag) { return this.endTagPattern = Pattern.compile((endTag + "\\z")); }
java
{ "resource": "" }
q5564
GeneratorNodeExtensions.indent
train
public CompositeGeneratorNode indent(final CompositeGeneratorNode parent, final String indentString) { final IndentNode indent = new IndentNode(indentString); List<IGeneratorNode> _children = parent.getChildren(); _children.add(indent); return indent; }
java
{ "resource": "" }
q5565
GeneratorNodeExtensions.appendNewLineIfNotEmpty
train
public CompositeGeneratorNode appendNewLineIfNotEmpty(final CompositeGeneratorNode parent) { List<IGeneratorNode> _children = parent.getChildren(); String _lineDelimiter = this.wsConfig.getLineDelimiter(); NewLineNode _newLineNode = new NewLineNode(_lineDelimiter, true); _children.add(_newLineNode); ...
java
{ "resource": "" }
q5566
GeneratorNodeExtensions.appendTemplate
train
public CompositeGeneratorNode appendTemplate(final CompositeGeneratorNode parent, final StringConcatenationClient templateString) { final TemplateNode proc = new TemplateNode(templateString, this); List<IGeneratorNode> _children = parent.getChildren(); _children.add(proc); return parent; }
java
{ "resource": "" }
q5567
AbstractIndentationTokenSource.doSplitTokenImpl
train
protected void doSplitTokenImpl(Token token, ITokenAcceptor result) { String text = token.getText(); int indentation = computeIndentation(text); if (indentation == -1 || indentation == currentIndentation) { // no change of indentation level detected simply process the token result.accept(token); } else if...
java
{ "resource": "" }
q5568
ResourceStorageFacade.getOrCreateResourceStorageLoadable
train
@Override public ResourceStorageLoadable getOrCreateResourceStorageLoadable(final StorageAwareResource resource) { try { final ResourceStorageProviderAdapter stateProvider = IterableExtensions.<ResourceStorageProviderAdapter>head(Iterables.<ResourceStorageProviderAdapter>filter(resource.getResourceSet().eAd...
java
{ "resource": "" }
q5569
CompletionPrefixProvider.getLastCompleteNodeByOffset
train
public INode getLastCompleteNodeByOffset(INode node, int offsetPosition, int completionOffset) { return internalGetLastCompleteNodeByOffset(node.getRootNode(), offsetPosition); }
java
{ "resource": "" }
q5570
MergeableManifest.addRequiredBundles
train
public void addRequiredBundles(Set<String> bundles) { // TODO manage transitive dependencies // don't require self Set<String> bundlesToMerge; String bundleName = (String) getMainAttributes().get(BUNDLE_SYMBOLIC_NAME); if (bundleName != null) { int idx = bundleName.indexOf(';'); if (idx >= 0) { bund...
java
{ "resource": "" }
q5571
MergeableManifest.addExportedPackages
train
public void addExportedPackages(Set<String> packages) { String s = (String) getMainAttributes().get(EXPORT_PACKAGE); Wrapper<Boolean> modified = Wrapper.wrap(this.modified); String result = mergeIntoCommaSeparatedList(s, packages, modified, lineDelimiter); this.modified = modified.get(); getMainAttributes().p...
java
{ "resource": "" }
q5572
IdeContentProposalProvider.createProposals
train
public void createProposals(final Collection<ContentAssistContext> contexts, final IIdeContentProposalAcceptor acceptor) { Iterable<ContentAssistContext> _filteredContexts = this.getFilteredContexts(contexts); for (final ContentAssistContext context : _filteredContexts) { ImmutableList<AbstractElement> _f...
java
{ "resource": "" }
q5573
JavaStringConverter.convertFromJavaString
train
public String convertFromJavaString(String string, boolean useUnicode) { int firstEscapeSequence = string.indexOf('\\'); if (firstEscapeSequence == -1) { return string; } int length = string.length(); StringBuilder result = new StringBuilder(length); appendRegion(string, 0, firstEscapeSequence, result); ...
java
{ "resource": "" }
q5574
JavaStringConverter.convertToJavaString
train
public String convertToJavaString(String input, boolean useUnicode) { int length = input.length(); StringBuilder result = new StringBuilder(length + 4); for (int i = 0; i < length; i++) { escapeAndAppendTo(input.charAt(i), useUnicode, result); } return result.toString(); }
java
{ "resource": "" }
q5575
DownloadAction.performDownload
train
private void performDownload(HttpResponse response, File destFile) throws IOException { HttpEntity entity = response.getEntity(); if (entity == null) { return; } //get content length long contentLength = entity.getContentLength(); if (cont...
java
{ "resource": "" }
q5576
DownloadAction.stream
train
private void stream(InputStream is, File destFile) throws IOException { try { startProgress(); OutputStream os = new FileOutputStream(destFile); boolean finished = false; try { byte[] buf = new byte[1024 * 10]; int read...
java
{ "resource": "" }
q5577
DownloadAction.getCachedETag
train
private String getCachedETag(HttpHost host, String file) { Map<String, Object> cachedETags = readCachedETags(); @SuppressWarnings("unchecked") Map<String, Object> hostMap = (Map<String, Object>)cachedETags.get(host.toURI()); if (hostMap == null) { return null...
java
{ "resource": "" }
q5578
DownloadAction.makeDestFile
train
private File makeDestFile(URL src) { if (dest == null) { throw new IllegalArgumentException("Please provide a download destination"); } File destFile = dest; if (destFile.isDirectory()) { //guess name from URL String name = src.toString(); ...
java
{ "resource": "" }
q5579
DownloadAction.addAuthentication
train
private void addAuthentication(HttpHost host, Credentials credentials, AuthScheme authScheme, HttpClientContext context) { AuthCache authCache = context.getAuthCache(); if (authCache == null) { authCache = new BasicAuthCache(); context.setAuthCache(authCache); ...
java
{ "resource": "" }
q5580
DownloadAction.toLengthText
train
private String toLengthText(long bytes) { if (bytes < 1024) { return bytes + " B"; } else if (bytes < 1024 * 1024) { return (bytes / 1024) + " KB"; } else if (bytes < 1024 * 1024 * 1024) { return String.format("%.2f MB", bytes / (1024.0 * 1024.0)); } e...
java
{ "resource": "" }
q5581
CachingHttpClientFactory.close
train
public void close() throws IOException { for (CloseableHttpClient c : cachedClients.values()) { c.close(); } cachedClients.clear(); }
java
{ "resource": "" }
q5582
Provider.getCurrentProvider
train
public static Provider getCurrentProvider(boolean useSwingEventQueue) { Provider provider; if (Platform.isX11()) { provider = new X11Provider(); } else if (Platform.isWindows()) { provider = new WindowsProvider(); } else if (Platform.isMac()) { provide...
java
{ "resource": "" }
q5583
Provider.fireEvent
train
protected void fireEvent(HotKey hotKey) { HotKeyEvent event = new HotKeyEvent(hotKey); if (useSwingEventQueue) { SwingUtilities.invokeLater(event); } else { if (eventQueue == null) { eventQueue = Executors.newSingleThreadExecutor(); } ...
java
{ "resource": "" }
q5584
GroovyContext.newInstance
train
public Object newInstance(String resource) { try { String name = resource.startsWith("/") ? resource : "/" + resource; File file = new File(this.getClass().getResource(name).toURI()); return newInstance(classLoader.parseClass(new GroovyCodeSource(file), true)); } catc...
java
{ "resource": "" }
q5585
GuiceStepsFactory.addTypes
train
private void addTypes(Injector injector, List<Class<?>> types) { for (Binding<?> binding : injector.getBindings().values()) { Key<?> key = binding.getKey(); Type type = key.getTypeLiteral().getType(); if (hasAnnotatedMethods(type)) { types.add(((Class<?>)type)...
java
{ "resource": "" }
q5586
StoryMapper.map
train
public void map(Story story, MetaFilter metaFilter) { if (metaFilter.allow(story.getMeta())) { boolean allowed = false; for (Scenario scenario : story.getScenarios()) { // scenario also inherits meta from story Meta inherited = scenario.getMeta().inheritFr...
java
{ "resource": "" }
q5587
MetaFilter.createMetaMatcher
train
protected MetaMatcher createMetaMatcher(String filterAsString, Map<String, MetaMatcher> metaMatchers) { for ( String key : metaMatchers.keySet() ){ if ( filterAsString.startsWith(key)){ return metaMatchers.get(key); } } if (filterAsString.startsWith(GROOVY)) { return new...
java
{ "resource": "" }
q5588
CodeLocations.codeLocationFromClass
train
public static URL codeLocationFromClass(Class<?> codeLocationClass) { String pathOfClass = codeLocationClass.getName().replace(".", "/") + ".class"; URL classResource = codeLocationClass.getClassLoader().getResource(pathOfClass); String codeLocationPath = removeEnd(getPathFromURL(classResource),...
java
{ "resource": "" }
q5589
CodeLocations.codeLocationFromPath
train
public static URL codeLocationFromPath(String filePath) { try { return new File(filePath).toURI().toURL(); } catch (Exception e) { throw new InvalidCodeLocation(filePath); } }
java
{ "resource": "" }
q5590
CodeLocations.codeLocationFromURL
train
public static URL codeLocationFromURL(String url) { try { return new URL(url); } catch (Exception e) { throw new InvalidCodeLocation(url); } }
java
{ "resource": "" }
q5591
StoryRunner.run
train
public void run(Configuration configuration, List<CandidateSteps> candidateSteps, Story story) throws Throwable { run(configuration, candidateSteps, story, MetaFilter.EMPTY); }
java
{ "resource": "" }
q5592
StoryRunner.run
train
public void run(Configuration configuration, List<CandidateSteps> candidateSteps, Story story, MetaFilter filter) throws Throwable { run(configuration, candidateSteps, story, filter, null); }
java
{ "resource": "" }
q5593
StoryRunner.run
train
public void run(Configuration configuration, List<CandidateSteps> candidateSteps, Story story, MetaFilter filter, State beforeStories) throws Throwable { run(configuration, new ProvidedStepsFactory(candidateSteps), story, filter, beforeStories); }
java
{ "resource": "" }
q5594
StoryRunner.run
train
public void run(Configuration configuration, InjectableStepsFactory stepsFactory, Story story, MetaFilter filter, State beforeStories) throws Throwable { RunContext context = new RunContext(configuration, stepsFactory, story.getPath(), filter); if (beforeStories != null) { contex...
java
{ "resource": "" }
q5595
StoryRunner.storyOfPath
train
public Story storyOfPath(Configuration configuration, String storyPath) { String storyAsText = configuration.storyLoader().loadStoryAsText(storyPath); return configuration.storyParser().parseStory(storyAsText, storyPath); }
java
{ "resource": "" }
q5596
StoryRunner.storyOfText
train
public Story storyOfText(Configuration configuration, String storyAsText, String storyId) { return configuration.storyParser().parseStory(storyAsText, storyId); }
java
{ "resource": "" }
q5597
ScalaContext.newInstance
train
public Object newInstance(String className) { try { return classLoader.loadClass(className).newInstance(); } catch (Exception e) { throw new ScalaInstanceNotFound(className); } }
java
{ "resource": "" }
q5598
ChainedRow.values
train
@Override public Map<String, String> values() { Map<String, String> values = new LinkedHashMap<>(); for (Row each : delegates) { for (Entry<String, String> entry : each.values().entrySet()) { String name = entry.getKey(); if (!values.containsKey(name)) { ...
java
{ "resource": "" }
q5599
StepFinder.stepsInstances
train
public List<Object> stepsInstances(List<CandidateSteps> candidateSteps) { List<Object> instances = new ArrayList<>(); for (CandidateSteps steps : candidateSteps) { if (steps instanceof Steps) { instances.add(((Steps) steps).instance()); } } return ...
java
{ "resource": "" }