method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
list | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
list | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public void removeCSSNavigableDocumentListener
(CSSNavigableDocumentListener l) {
EventListener[] listeners
= (EventListener[]) cssNavigableDocumentListeners.get(l);
if (listeners == null) {
return;
}
XBLEventSupport es = (XBLEventSupport) initializeEventSupport();
es.removeImplementationEventListenerNS
(XMLConstants.XML_EVENTS_NAMESPACE_URI,
"DOMNodeInserted",
listeners[0], false);
es.removeImplementationEventListenerNS
(XMLConstants.XML_EVENTS_NAMESPACE_URI,
"DOMNodeRemoved",
listeners[1], false);
es.removeImplementationEventListenerNS
(XMLConstants.XML_EVENTS_NAMESPACE_URI,
"DOMSubtreeModified",
listeners[2], false);
es.removeImplementationEventListenerNS
(XMLConstants.XML_EVENTS_NAMESPACE_URI,
"DOMCharacterDataModified",
listeners[3], false);
es.removeImplementationEventListenerNS
(XMLConstants.XML_EVENTS_NAMESPACE_URI,
"DOMAttrModified",
listeners[4], false);
cssNavigableDocumentListeners.remove(l);
} | void function (CSSNavigableDocumentListener l) { EventListener[] listeners = (EventListener[]) cssNavigableDocumentListeners.get(l); if (listeners == null) { return; } XBLEventSupport es = (XBLEventSupport) initializeEventSupport(); es.removeImplementationEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, STR, listeners[0], false); es.removeImplementationEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, STR, listeners[1], false); es.removeImplementationEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, STR, listeners[2], false); es.removeImplementationEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, STR, listeners[3], false); es.removeImplementationEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, STR, listeners[4], false); cssNavigableDocumentListeners.remove(l); } | /**
* Removes an event listener for mutations on the
* CSSNavigableDocument tree.
*/ | Removes an event listener for mutations on the CSSNavigableDocument tree | removeCSSNavigableDocumentListener | {
"repo_name": "apache/batik",
"path": "batik-anim/src/main/java/org/apache/batik/anim/dom/SVG12OMDocument.java",
"license": "apache-2.0",
"size": 5332
} | [
"org.apache.batik.constants.XMLConstants",
"org.apache.batik.css.engine.CSSNavigableDocumentListener",
"org.w3c.dom.events.EventListener"
]
| import org.apache.batik.constants.XMLConstants; import org.apache.batik.css.engine.CSSNavigableDocumentListener; import org.w3c.dom.events.EventListener; | import org.apache.batik.constants.*; import org.apache.batik.css.engine.*; import org.w3c.dom.events.*; | [
"org.apache.batik",
"org.w3c.dom"
]
| org.apache.batik; org.w3c.dom; | 1,298,535 |
public synchronized void checkAccess(LicenseCheckerCallback callback) {
// If we have a valid recent LICENSED response, we can skip asking
// Market.
if (mPolicy.allowAccess()) {
Log.i(TAG, "Using cached license response");
callback.allow(Policy.LICENSED);
} else {
LicenseValidator validator = new LicenseValidator(mPolicy, new NullDeviceLimiter(),
callback, generateNonce(), mPackageName, mVersionCode);
if (mService == null) {
Log.i(TAG, "Binding to licensing service.");
try {
boolean bindResult = mContext
.bindService(
new Intent(
new String(
Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U="))
),
this, // ServiceConnection.
Context.BIND_AUTO_CREATE
);
if (bindResult) {
mPendingChecks.offer(validator);
} else {
Log.e(TAG, "Could not bind to service.");
handleServiceConnectionError(validator);
}
} catch (SecurityException e) {
callback.applicationError(LicenseCheckerCallback.ERROR_MISSING_PERMISSION);
} catch (Base64DecoderException e) {
e.printStackTrace();
}
} else {
mPendingChecks.offer(validator);
runChecks();
}
}
} | synchronized void function(LicenseCheckerCallback callback) { if (mPolicy.allowAccess()) { Log.i(TAG, STR); callback.allow(Policy.LICENSED); } else { LicenseValidator validator = new LicenseValidator(mPolicy, new NullDeviceLimiter(), callback, generateNonce(), mPackageName, mVersionCode); if (mService == null) { Log.i(TAG, STR); try { boolean bindResult = mContext .bindService( new Intent( new String( Base64.decode(STR)) ), this, Context.BIND_AUTO_CREATE ); if (bindResult) { mPendingChecks.offer(validator); } else { Log.e(TAG, STR); handleServiceConnectionError(validator); } } catch (SecurityException e) { callback.applicationError(LicenseCheckerCallback.ERROR_MISSING_PERMISSION); } catch (Base64DecoderException e) { e.printStackTrace(); } } else { mPendingChecks.offer(validator); runChecks(); } } } | /**
* Checks if the user should have access to the app. Binds the service if necessary.
* <p/>
* NOTE: This call uses a trivially obfuscated string (base64-encoded). For best security,
* we recommend obfuscating the string that is passed into bindService using another method
* of your own devising.
* <p/>
* source string: "com.android.vending.licensing.ILicensingService"
* <p/>
*
* @param callback
*/ | Checks if the user should have access to the app. Binds the service if necessary. we recommend obfuscating the string that is passed into bindService using another method of your own devising. source string: "com.android.vending.licensing.ILicensingService" | checkAccess | {
"repo_name": "lvillani/droidkit",
"path": "src/main/java/com/google/android/vending/licensing/LicenseChecker.java",
"license": "apache-2.0",
"size": 14166
} | [
"android.content.Context",
"android.content.Intent",
"android.util.Log",
"com.google.android.vending.licensing.util.Base64",
"com.google.android.vending.licensing.util.Base64DecoderException"
]
| import android.content.Context; import android.content.Intent; import android.util.Log; import com.google.android.vending.licensing.util.Base64; import com.google.android.vending.licensing.util.Base64DecoderException; | import android.content.*; import android.util.*; import com.google.android.vending.licensing.util.*; | [
"android.content",
"android.util",
"com.google.android"
]
| android.content; android.util; com.google.android; | 2,903,467 |
public float getExplosionResistance(Entity exploder)
{
return this.blockResistance / 5.0F;
} | float function(Entity exploder) { return this.blockResistance / 5.0F; } | /**
* Returns how much this block can resist explosions from the passed in entity.
*/ | Returns how much this block can resist explosions from the passed in entity | getExplosionResistance | {
"repo_name": "TorchPowered/Thallium",
"path": "src/main/java/net/minecraft/block/Block.java",
"license": "mit",
"size": 66867
} | [
"net.minecraft.entity.Entity"
]
| import net.minecraft.entity.Entity; | import net.minecraft.entity.*; | [
"net.minecraft.entity"
]
| net.minecraft.entity; | 340,402 |
@DoesServiceRequest
public final void download(final OutputStream outStream) throws StorageException {
this.download(outStream, null , null , null );
} | final void function(final OutputStream outStream) throws StorageException { this.download(outStream, null , null , null ); } | /**
* Downloads the contents of a blob to a stream.
*
* @param outStream
* An <code>{@link OutputStream}</code> object that represents the target stream.
* @throws StorageException
* If a storage service error occurred.
*/ | Downloads the contents of a blob to a stream | download | {
"repo_name": "esummers-msft/azure-storage-java",
"path": "microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudBlob.java",
"license": "apache-2.0",
"size": 133882
} | [
"com.microsoft.azure.storage.StorageException",
"java.io.OutputStream"
]
| import com.microsoft.azure.storage.StorageException; import java.io.OutputStream; | import com.microsoft.azure.storage.*; import java.io.*; | [
"com.microsoft.azure",
"java.io"
]
| com.microsoft.azure; java.io; | 1,260,176 |
public String getBizContent() {
return this.bizContent;
}
private String terminalType;
private String terminalInfo;
private String prodCode;
private String notifyUrl;
private String returnUrl;
private boolean needEncrypt=false;
private AlipayObject bizModel=null; | String function() { return this.bizContent; } private String terminalType; private String terminalInfo; private String prodCode; private String notifyUrl; private String returnUrl; private boolean needEncrypt=false; private AlipayObject bizModel=null; | /**
* <p>Getter for the field <code>bizContent</code>.</p>
*
* @return a {@link java.lang.String} object.
*/ | Getter for the field <code>bizContent</code> | getBizContent | {
"repo_name": "NotFound403/WePay",
"path": "src/main/java/cn/felord/wepay/ali/sdk/api/request/AlipayOpenPublicMessageCustomSendRequest.java",
"license": "apache-2.0",
"size": 4818
} | [
"cn.felord.wepay.ali.sdk.api.AlipayObject"
]
| import cn.felord.wepay.ali.sdk.api.AlipayObject; | import cn.felord.wepay.ali.sdk.api.*; | [
"cn.felord.wepay"
]
| cn.felord.wepay; | 941,006 |
protected Entry<String, String> keyValue(String key, Object value) {
@SuppressWarnings("unchecked") //Commons Collections does not support Generics
final Entry<String, String> entry
= (value == null) ? new DefaultMapEntry(key, "") : new DefaultMapEntry(key, value.toString());
return entry;
} | Entry<String, String> function(String key, Object value) { @SuppressWarnings(STR) final Entry<String, String> entry = (value == null) ? new DefaultMapEntry(key, "") : new DefaultMapEntry(key, value.toString()); return entry; } | /**
* Convenience method for creating a <code>{@link SimpleEntry}</code> out of a key/value pair
*
* @param key
* @param value
* @return SimpleImmutableEntry
*/ | Convenience method for creating a <code><code>SimpleEntry</code></code> out of a key/value pair | keyValue | {
"repo_name": "blackcathacker/kc.preclean",
"path": "coeus-code/src/main/java/org/kuali/coeus/sys/framework/rule/KcTransactionalDocumentRuleBase.java",
"license": "apache-2.0",
"size": 10582
} | [
"java.util.Map",
"org.apache.commons.collections4.keyvalue.DefaultMapEntry"
]
| import java.util.Map; import org.apache.commons.collections4.keyvalue.DefaultMapEntry; | import java.util.*; import org.apache.commons.collections4.keyvalue.*; | [
"java.util",
"org.apache.commons"
]
| java.util; org.apache.commons; | 512,201 |
public boolean position(GlyphSequence gs, String script, String language, int fontSize, GlyphTable.UseSpec[] usa, int[] widths, int[][] adjustments, ScriptContextTester sct) {
assert usa != null;
boolean adjusted = false;
for (GlyphTable.UseSpec us : usa) {
if (us.position(gs, script, language, fontSize, widths, adjustments, sct)) {
adjusted = true;
}
}
return adjusted;
} | boolean function(GlyphSequence gs, String script, String language, int fontSize, GlyphTable.UseSpec[] usa, int[] widths, int[][] adjustments, ScriptContextTester sct) { assert usa != null; boolean adjusted = false; for (GlyphTable.UseSpec us : usa) { if (us.position(gs, script, language, fontSize, widths, adjustments, sct)) { adjusted = true; } } return adjusted; } | /**
* Perform positioning processing using a specific set of ordered glyph table use specifications.
* @param gs an input glyph sequence
* @param script a script identifier
* @param language a language identifier
* @param fontSize size in device units
* @param usa an ordered array of glyph table use specs
* @param widths array of default advancements for each glyph in font
* @param adjustments accumulated adjustments array (sequence) of 4-tuples of placement [PX,PY] and advance [AX,AY] adjustments, in that order,
* with one 4-tuple for each element of glyph sequence
* @param sct a script specific context tester (or null)
* @return true if some adjustment is not zero; otherwise, false
*/ | Perform positioning processing using a specific set of ordered glyph table use specifications | position | {
"repo_name": "chunlinyao/fop",
"path": "fop-core/src/main/java/org/apache/fop/complexscripts/scripts/ScriptProcessor.java",
"license": "apache-2.0",
"size": 12823
} | [
"org.apache.fop.complexscripts.fonts.GlyphTable",
"org.apache.fop.complexscripts.util.GlyphSequence",
"org.apache.fop.complexscripts.util.ScriptContextTester"
]
| import org.apache.fop.complexscripts.fonts.GlyphTable; import org.apache.fop.complexscripts.util.GlyphSequence; import org.apache.fop.complexscripts.util.ScriptContextTester; | import org.apache.fop.complexscripts.fonts.*; import org.apache.fop.complexscripts.util.*; | [
"org.apache.fop"
]
| org.apache.fop; | 1,823,105 |
@Nullable
private static File findExecutable(Label target, List<File> outputs) {
if (outputs.size() == 1) {
return outputs.get(0);
}
String name = PathUtil.getFileName(target.targetName().toString());
for (File file : outputs) {
if (file.getName().equals(name)) {
return file;
}
}
return null;
} | static File function(Label target, List<File> outputs) { if (outputs.size() == 1) { return outputs.get(0); } String name = PathUtil.getFileName(target.targetName().toString()); for (File file : outputs) { if (file.getName().equals(name)) { return file; } } return null; } | /**
* Basic heuristic for choosing between multiple output files. Currently just looks for a filename
* matching the target name.
*/ | Basic heuristic for choosing between multiple output files. Currently just looks for a filename matching the target name | findExecutable | {
"repo_name": "brendandouglas/intellij",
"path": "clwb/src/com/google/idea/blaze/clwb/run/BlazeCidrRunConfigurationRunner.java",
"license": "apache-2.0",
"size": 5620
} | [
"com.google.idea.blaze.base.model.primitives.Label",
"com.intellij.util.PathUtil",
"java.io.File",
"java.util.List"
]
| import com.google.idea.blaze.base.model.primitives.Label; import com.intellij.util.PathUtil; import java.io.File; import java.util.List; | import com.google.idea.blaze.base.model.primitives.*; import com.intellij.util.*; import java.io.*; import java.util.*; | [
"com.google.idea",
"com.intellij.util",
"java.io",
"java.util"
]
| com.google.idea; com.intellij.util; java.io; java.util; | 1,781,384 |
public List<Build> getBuilds() {
return getBuilds(new BuildCriteria());
} | List<Build> function() { return getBuilds(new BuildCriteria()); } | /**
* Gets all builds.
*
* @return the list of all builds.
*/ | Gets all builds | getBuilds | {
"repo_name": "lorislab/tower",
"path": "tower-store/src/main/java/org/lorislab/tower/store/ejb/BuildService.java",
"license": "apache-2.0",
"size": 5349
} | [
"java.util.List",
"org.lorislab.tower.store.criteria.BuildCriteria",
"org.lorislab.tower.store.model.Build"
]
| import java.util.List; import org.lorislab.tower.store.criteria.BuildCriteria; import org.lorislab.tower.store.model.Build; | import java.util.*; import org.lorislab.tower.store.criteria.*; import org.lorislab.tower.store.model.*; | [
"java.util",
"org.lorislab.tower"
]
| java.util; org.lorislab.tower; | 44,687 |
public void orderBefore(NodeState src, NodeState dest)
throws ItemStateException {
NodeState parent = (NodeState) getItemState(src.getParentId());
ArrayList list = new ArrayList(parent.getChildNodeEntries());
int srcIndex = -1, destIndex = -1;
for (int i = 0; i < list.size(); i++) {
ChildNodeEntry cne = (ChildNodeEntry) list.get(i);
if (cne.getId().equals(src.getId())) {
srcIndex = i;
} else if (dest != null && cne.getId().equals(dest.getId())) {
destIndex = i;
}
}
if (destIndex == -1) {
list.add(list.remove(srcIndex));
} else {
if (srcIndex < destIndex) {
list.add(destIndex, list.get(srcIndex));
list.remove(srcIndex);
} else {
list.add(destIndex, list.remove(srcIndex));
}
}
parent.setChildNodeEntries(list);
} | void function(NodeState src, NodeState dest) throws ItemStateException { NodeState parent = (NodeState) getItemState(src.getParentId()); ArrayList list = new ArrayList(parent.getChildNodeEntries()); int srcIndex = -1, destIndex = -1; for (int i = 0; i < list.size(); i++) { ChildNodeEntry cne = (ChildNodeEntry) list.get(i); if (cne.getId().equals(src.getId())) { srcIndex = i; } else if (dest != null && cne.getId().equals(dest.getId())) { destIndex = i; } } if (destIndex == -1) { list.add(list.remove(srcIndex)); } else { if (srcIndex < destIndex) { list.add(destIndex, list.get(srcIndex)); list.remove(srcIndex); } else { list.add(destIndex, list.remove(srcIndex)); } } parent.setChildNodeEntries(list); } | /**
* Order a child node before another node.
*
* @param src src node
* @param dest destination node, may be <code>null</code>
* @throws ItemStateException if getting the parent node fails
*/ | Order a child node before another node | orderBefore | {
"repo_name": "sdmcraft/jackrabbit",
"path": "jackrabbit-core/src/test/java/org/apache/jackrabbit/core/CachingHierarchyManagerTest.java",
"license": "apache-2.0",
"size": 21352
} | [
"java.util.ArrayList",
"org.apache.jackrabbit.core.state.ChildNodeEntry",
"org.apache.jackrabbit.core.state.ItemStateException",
"org.apache.jackrabbit.core.state.NodeState"
]
| import java.util.ArrayList; import org.apache.jackrabbit.core.state.ChildNodeEntry; import org.apache.jackrabbit.core.state.ItemStateException; import org.apache.jackrabbit.core.state.NodeState; | import java.util.*; import org.apache.jackrabbit.core.state.*; | [
"java.util",
"org.apache.jackrabbit"
]
| java.util; org.apache.jackrabbit; | 2,420,616 |
private static List<Viewable> findTextPart(Multipart multipart, boolean directChild)
throws MessagingException {
List<Viewable> viewables = new ArrayList<Viewable>();
for (Part part : multipart.getBodyParts()) {
Body body = part.getBody();
if (body instanceof Multipart) {
Multipart innerMultipart = (Multipart) body;
List<Viewable> textViewables = findTextPart(innerMultipart, false);
if (!textViewables.isEmpty()) {
viewables.addAll(textViewables);
if (directChild) {
break;
}
}
} else if (isPartTextualBody(part) && part.getMimeType().equalsIgnoreCase("text/plain")) {
Text text = new Text(part);
viewables.add(text);
if (directChild) {
break;
}
}
}
return viewables;
} | static List<Viewable> function(Multipart multipart, boolean directChild) throws MessagingException { List<Viewable> viewables = new ArrayList<Viewable>(); for (Part part : multipart.getBodyParts()) { Body body = part.getBody(); if (body instanceof Multipart) { Multipart innerMultipart = (Multipart) body; List<Viewable> textViewables = findTextPart(innerMultipart, false); if (!textViewables.isEmpty()) { viewables.addAll(textViewables); if (directChild) { break; } } } else if (isPartTextualBody(part) && part.getMimeType().equalsIgnoreCase(STR)) { Text text = new Text(part); viewables.add(text); if (directChild) { break; } } } return viewables; } | /**
* Search the children of a {@link Multipart} for {@code text/plain} parts.
*
* @param multipart The {@code Multipart} to search through.
* @param directChild If {@code true}, this method will return after the first {@code text/plain} was
* found.
*
* @return A list of {@link Text} viewables.
*
* @throws MessagingException
* In case of an error.
*/ | Search the children of a <code>Multipart</code> for text/plain parts | findTextPart | {
"repo_name": "Valodim/k-9",
"path": "k9mail-library/src/main/java/com/fsck/k9/mail/internet/MessageExtractor.java",
"license": "bsd-3-clause",
"size": 18563
} | [
"com.fsck.k9.mail.Body",
"com.fsck.k9.mail.MessagingException",
"com.fsck.k9.mail.Multipart",
"com.fsck.k9.mail.Part",
"com.fsck.k9.mail.internet.Viewable",
"java.util.ArrayList",
"java.util.List"
]
| import com.fsck.k9.mail.Body; import com.fsck.k9.mail.MessagingException; import com.fsck.k9.mail.Multipart; import com.fsck.k9.mail.Part; import com.fsck.k9.mail.internet.Viewable; import java.util.ArrayList; import java.util.List; | import com.fsck.k9.mail.*; import com.fsck.k9.mail.internet.*; import java.util.*; | [
"com.fsck.k9",
"java.util"
]
| com.fsck.k9; java.util; | 1,501,141 |
@Override
protected void onComponentTag(final ComponentTag tag)
{
checkComponentTag(tag, "input");
checkComponentTagAttribute(tag, "type", "checkbox");
final String value = getValue();
if (value != null)
{
try
{
if (Strings.isTrue(value))
{
tag.put("checked", "checked");
}
else
{
// In case the attribute was added at design time
tag.remove("checked");
}
}
catch (StringValueConversionException e)
{
throw new WicketRuntimeException("Invalid boolean value \"" + value + "\"", e);
}
}
// Should a roundtrip be made (have onSelectionChanged called) when the
// checkbox is clicked?
if (wantOnSelectionChangedNotifications())
{
CharSequence url = urlFor(IOnChangeListener.INTERFACE);
Form<?> form = findParent(Form.class);
if (form != null)
{
RequestContext rc = RequestContext.get();
if (rc.isPortletRequest())
{
// restore url back to real wicket path as its going to be interpreted by the
// form itself
url = ((PortletRequestContext)rc).getLastEncodedPath();
}
tag.put("onclick", form.getJsForInterfaceUrl(url));
}
else
{
// TODO: following doesn't work with portlets, should be posted to a dynamic hidden
// form
// with an ActionURL or something
// NOTE: do not encode the url as that would give invalid
// JavaScript
tag.put("onclick", "window.location.href='" + url +
(url.toString().indexOf('?') > -1 ? "&" : "?") + getInputName() +
"=' + this.checked;");
}
}
super.onComponentTag(tag);
} | void function(final ComponentTag tag) { checkComponentTag(tag, "input"); checkComponentTagAttribute(tag, "type", STR); final String value = getValue(); if (value != null) { try { if (Strings.isTrue(value)) { tag.put(STR, STR); } else { tag.remove(STR); } } catch (StringValueConversionException e) { throw new WicketRuntimeException(STRSTR\STRonclickSTRonclickSTRwindow.location.href='STR&STR?STR=' + this.checked;"); } } super.onComponentTag(tag); } | /**
* Processes the component tag.
*
* @param tag
* Tag to modify
* @see org.apache.wicket.Component#onComponentTag(ComponentTag)
*/ | Processes the component tag | onComponentTag | {
"repo_name": "astubbs/wicket.get-portals2",
"path": "wicket/src/main/java/org/apache/wicket/markup/html/form/CheckBox.java",
"license": "apache-2.0",
"size": 6167
} | [
"org.apache.wicket.WicketRuntimeException",
"org.apache.wicket.markup.ComponentTag",
"org.apache.wicket.util.string.StringValueConversionException",
"org.apache.wicket.util.string.Strings"
]
| import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.util.string.StringValueConversionException; import org.apache.wicket.util.string.Strings; | import org.apache.wicket.*; import org.apache.wicket.markup.*; import org.apache.wicket.util.string.*; | [
"org.apache.wicket"
]
| org.apache.wicket; | 223,465 |
public static void register(OperationRegistry registry,
String protocolName,
RemoteRIF rrif) {
registry = (registry != null) ? registry :
JAI.getDefaultInstance().getOperationRegistry();
registry.registerFactory(MODE_NAME, protocolName, null, rrif);
} | static void function(OperationRegistry registry, String protocolName, RemoteRIF rrif) { registry = (registry != null) ? registry : JAI.getDefaultInstance().getOperationRegistry(); registry.registerFactory(MODE_NAME, protocolName, null, rrif); } | /**
* Registers the given <code>RemoteRIF</code> with the given
* <code>OperationRegistry</code> under the given protocolName.
*
* @param registry The <code>OperationRegistry</code> to register
* the <code>RemoteRIF</code> with. If this is
* <code>null</code>, then <code>
* JAI.getDefaultInstance().getOperationRegistry()</code>
* will be used.
* @param protocolName The protocolName to register the
* <code>RemoteRIF</code> under.
* @param rrif The <code>RemoteRIF</code> to register.
*
* @throws IllegalArgumentException if protocolName is null.
* @throws IllegalArgumentException if rrif is null.
* @throws IllegalArgumentException if there is no
* <code>RemoteDescriptor</code> registered against the
* given protocolName.
*/ | Registers the given <code>RemoteRIF</code> with the given <code>OperationRegistry</code> under the given protocolName | register | {
"repo_name": "MarinnaCole/LightZone",
"path": "lightcrafts/extsrc/com/lightcrafts/mediax/jai/registry/RemoteRIFRegistry.java",
"license": "bsd-3-clause",
"size": 7245
} | [
"com.lightcrafts.mediax.jai.JAI",
"com.lightcrafts.mediax.jai.OperationRegistry",
"com.lightcrafts.mediax.jai.remote.RemoteRIF"
]
| import com.lightcrafts.mediax.jai.JAI; import com.lightcrafts.mediax.jai.OperationRegistry; import com.lightcrafts.mediax.jai.remote.RemoteRIF; | import com.lightcrafts.mediax.jai.*; import com.lightcrafts.mediax.jai.remote.*; | [
"com.lightcrafts.mediax"
]
| com.lightcrafts.mediax; | 1,444,150 |
public LinkedList<Diff> diff_main(String text1, String text2) {
return diff_main(text1, text2, true);
} | LinkedList<Diff> function(String text1, String text2) { return diff_main(text1, text2, true); } | /**
* Find the differences between two texts.
* Run a faster slightly less optimal diff
* This method allows the 'checklines' of diff_main() to be optional.
* Most of the time checklines is wanted, so default to true.
* @param text1 Old string to be diffed.
* @param text2 New string to be diffed.
* @return Linked List of Diff objects.
*/ | Find the differences between two texts. Run a faster slightly less optimal diff This method allows the 'checklines' of diff_main() to be optional. Most of the time checklines is wanted, so default to true | diff_main | {
"repo_name": "visik7/webfilesys",
"path": "src/main/webapp/WEB-INF/source/name/fraser/neil/plaintext/diff_match_patch.java",
"license": "gpl-3.0",
"size": 84995
} | [
"java.util.LinkedList"
]
| import java.util.LinkedList; | import java.util.*; | [
"java.util"
]
| java.util; | 224,629 |
private void initialize(int port,String msisdn,String text,int order,String pin,String custom) throws Exception
{
//set parameters
this.uri = Uri.PAY_PORT_CHARGE;
this.httpMethod = HttpMethod.POST;
this.contentType = ContentType.RAW;
this.setPort(port);
this.setMsisdn(msisdn);
this.setText(text);
this.setOrder(order);
this.setPin(pin);
this.setCustom(custom);
}
| void function(int port,String msisdn,String text,int order,String pin,String custom) throws Exception { this.uri = Uri.PAY_PORT_CHARGE; this.httpMethod = HttpMethod.POST; this.contentType = ContentType.RAW; this.setPort(port); this.setMsisdn(msisdn); this.setText(text); this.setOrder(order); this.setPin(pin); this.setCustom(custom); } | /**
* Initialize the request
*
* @param port The port number
* @param msisdn The msisdn
* @param text The message text
* @param order The order ID
* @param pin The pin
* @param custom The custom ID
* @throws Exception If parameters are not valid
*/ | Initialize the request | initialize | {
"repo_name": "geodrop/geodrop-sdk-java",
"path": "src/com/geodrop/DropPay/PortChargeOnDemandPurchases.java",
"license": "apache-2.0",
"size": 5520
} | [
"com.geodrop.ContentType",
"com.geodrop.HttpMethod",
"com.geodrop.Uri"
]
| import com.geodrop.ContentType; import com.geodrop.HttpMethod; import com.geodrop.Uri; | import com.geodrop.*; | [
"com.geodrop"
]
| com.geodrop; | 1,122,101 |
public void removeCollaborators(GHUser... users) throws IOException {
removeCollaborators(asList(users));
} | void function(GHUser... users) throws IOException { removeCollaborators(asList(users)); } | /**
* Remove collaborators.
*
* @param users
* the users
* @throws IOException
* the io exception
*/ | Remove collaborators | removeCollaborators | {
"repo_name": "kohsuke/github-api",
"path": "src/main/java/org/kohsuke/github/GHRepository.java",
"license": "mit",
"size": 103118
} | [
"java.io.IOException"
]
| import java.io.IOException; | import java.io.*; | [
"java.io"
]
| java.io; | 2,288,984 |
@Deployment(resources = {
SIMPLE_SUBPROCESS,
NESTED_CALL_ACTIVITY,
CALL_ACTIVITY_PROCESS
})
public void testCancellationMultilevelProcessInstanceInCallActivity() {
// given
runtimeService.startProcessInstanceByKey("nestedCallActivity");
// one task in the subprocess should be active after starting the process instance
TaskQuery taskQuery = taskService.createTaskQuery();
Task taskBeforeSubProcess = taskQuery.singleResult();
// Completing the task continues the process which leads to calling the subprocess
taskService.complete(taskBeforeSubProcess.getId());
Task taskInSubProcess = taskQuery.singleResult();
// Completing the task continues the sub process which leads to calling the deeper subprocess
taskService.complete(taskInSubProcess.getId());
Task taskInNestedSubProcess = taskQuery.singleResult();
List<ProcessInstance> instanceList = runtimeService.createProcessInstanceQuery().list();
assertNotNull(instanceList);
assertEquals(3, instanceList.size());
ActivityInstance tree = runtimeService.getActivityInstance(taskInNestedSubProcess.getProcessInstanceId());
// when
runtimeService
.createProcessInstanceModification(taskInNestedSubProcess.getProcessInstanceId())
.cancelActivityInstance(getInstanceIdForActivity(tree, "task"))
.execute();
// then
// How many process Instances
instanceList = runtimeService.createProcessInstanceQuery().list();
assertNotNull(instanceList);
assertEquals(0, instanceList.size());
} | @Deployment(resources = { SIMPLE_SUBPROCESS, NESTED_CALL_ACTIVITY, CALL_ACTIVITY_PROCESS }) void function() { runtimeService.startProcessInstanceByKey(STR); TaskQuery taskQuery = taskService.createTaskQuery(); Task taskBeforeSubProcess = taskQuery.singleResult(); taskService.complete(taskBeforeSubProcess.getId()); Task taskInSubProcess = taskQuery.singleResult(); taskService.complete(taskInSubProcess.getId()); Task taskInNestedSubProcess = taskQuery.singleResult(); List<ProcessInstance> instanceList = runtimeService.createProcessInstanceQuery().list(); assertNotNull(instanceList); assertEquals(3, instanceList.size()); ActivityInstance tree = runtimeService.getActivityInstance(taskInNestedSubProcess.getProcessInstanceId()); runtimeService .createProcessInstanceModification(taskInNestedSubProcess.getProcessInstanceId()) .cancelActivityInstance(getInstanceIdForActivity(tree, "task")) .execute(); instanceList = runtimeService.createProcessInstanceQuery().list(); assertNotNull(instanceList); assertEquals(0, instanceList.size()); } | /**
* Test case for checking deletion of process instances in nested call activity subprocesses
*
* Checking that nested call activities will propagate upward over multiple nested levels
*
*/ | Test case for checking deletion of process instances in nested call activity subprocesses Checking that nested call activities will propagate upward over multiple nested levels | testCancellationMultilevelProcessInstanceInCallActivity | {
"repo_name": "subhrajyotim/camunda-bpm-platform",
"path": "engine/src/test/java/org/camunda/bpm/engine/test/api/runtime/ProcessInstanceModificationCancellationTest.java",
"license": "apache-2.0",
"size": 68120
} | [
"java.util.List",
"org.camunda.bpm.engine.runtime.ActivityInstance",
"org.camunda.bpm.engine.runtime.ProcessInstance",
"org.camunda.bpm.engine.task.Task",
"org.camunda.bpm.engine.task.TaskQuery",
"org.camunda.bpm.engine.test.Deployment"
]
| import java.util.List; import org.camunda.bpm.engine.runtime.ActivityInstance; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.camunda.bpm.engine.task.Task; import org.camunda.bpm.engine.task.TaskQuery; import org.camunda.bpm.engine.test.Deployment; | import java.util.*; import org.camunda.bpm.engine.runtime.*; import org.camunda.bpm.engine.task.*; import org.camunda.bpm.engine.test.*; | [
"java.util",
"org.camunda.bpm"
]
| java.util; org.camunda.bpm; | 1,180,326 |
public static FlatField resample(final FlatField f, final int[] res,
final boolean[] range, final float[] min, final float[] max)
throws VisADException, RemoteException
{
// TODO: rewrite VisBio resampling logic to work on raw images
// rework VisBio to avoid any reference to "range components"
// instead, multiple range components should always become multiple channels
final GriddedSet set = (GriddedSet) f.getDomainSet();
final float[][] samples = f.getFloats(false);
final FunctionType function = (FunctionType) f.getType();
final MathType frange = function.getRange();
final RealType[] rt =
frange instanceof RealTupleType ? ((RealTupleType) frange)
.getRealComponents() : new RealType[] { (RealType) frange };
// count number of range components to keep
int keep = 0;
if (range != null) {
for (int i = 0; i < range.length; i++) {
if (range[i]) keep++;
}
}
// strip out unwanted range components
FlatField ff;
if (range == null || keep == range.length) ff = f;
else {
final float[][] samps = new float[keep][];
final RealType[] reals = new RealType[keep];
int count = 0;
for (int i = 0; i < range.length; i++) {
if (range[i]) {
samps[count] = samples[i];
reals[count] = rt[i];
count++;
}
}
final MathType funcRange =
count == 1 ? (MathType) reals[0] : (MathType) new RealTupleType(reals);
final FunctionType func =
new FunctionType(function.getDomain(), funcRange);
ff = new FlatField(func, set);
ff.setSamples(samps, false);
}
// determine whether original resolution matches desired resolution
final int[] len = set.getLengths();
boolean same = true;
final float[] lo = set.getLow();
final float[] hi = set.getHi();
final double[] nlo = new double[len.length];
final double[] nhi = new double[len.length];
for (int i = 0; i < len.length; i++) {
if (res != null && len[i] != res[i]) same = false;
nlo[i] = lo[i];
nhi[i] = hi[i];
}
if (!same) {
// resample field to proper resolution
ff =
(FlatField) ff.resample((Set) LinearNDSet.create(set.getType(), nlo,
nhi, res, set.getCoordinateSystem(), set.getSetUnits(), set
.getSetErrors()), Data.WEIGHTED_AVERAGE, Data.NO_ERRORS);
}
// determine whether original low and high values match desired ones
boolean canUseInteger = true;
same = true;
for (int i = 0; i < len.length; i++) {
if (min != null) {
if (nlo[i] != min[i]) same = false;
if (min[i] != 0) canUseInteger = false;
nlo[i] = min[i];
}
if (max != null) {
if (nhi[i] != max[i]) same = false;
if (min[i] != res[i] - 1) canUseInteger = false;
nhi[i] = max[i];
}
}
if (canUseInteger || !same) {
// adjust field set appropriately
final FunctionType ffType = (FunctionType) ff.getType();
final Set ffSet =
canUseInteger ? (Set) IntegerNDSet.create(ffType.getDomain(), res)
: (Set) LinearNDSet.create(ffType.getDomain(), nlo, nhi, res);
final float[][] ffSamples = ff.getFloats(false);
ff = new FlatField(ffType, ffSet);
ff.setSamples(ffSamples);
}
return ff;
} | static FlatField function(final FlatField f, final int[] res, final boolean[] range, final float[] min, final float[] max) throws VisADException, RemoteException { final GriddedSet set = (GriddedSet) f.getDomainSet(); final float[][] samples = f.getFloats(false); final FunctionType function = (FunctionType) f.getType(); final MathType frange = function.getRange(); final RealType[] rt = frange instanceof RealTupleType ? ((RealTupleType) frange) .getRealComponents() : new RealType[] { (RealType) frange }; int keep = 0; if (range != null) { for (int i = 0; i < range.length; i++) { if (range[i]) keep++; } } FlatField ff; if (range == null keep == range.length) ff = f; else { final float[][] samps = new float[keep][]; final RealType[] reals = new RealType[keep]; int count = 0; for (int i = 0; i < range.length; i++) { if (range[i]) { samps[count] = samples[i]; reals[count] = rt[i]; count++; } } final MathType funcRange = count == 1 ? (MathType) reals[0] : (MathType) new RealTupleType(reals); final FunctionType func = new FunctionType(function.getDomain(), funcRange); ff = new FlatField(func, set); ff.setSamples(samps, false); } final int[] len = set.getLengths(); boolean same = true; final float[] lo = set.getLow(); final float[] hi = set.getHi(); final double[] nlo = new double[len.length]; final double[] nhi = new double[len.length]; for (int i = 0; i < len.length; i++) { if (res != null && len[i] != res[i]) same = false; nlo[i] = lo[i]; nhi[i] = hi[i]; } if (!same) { ff = (FlatField) ff.resample((Set) LinearNDSet.create(set.getType(), nlo, nhi, res, set.getCoordinateSystem(), set.getSetUnits(), set .getSetErrors()), Data.WEIGHTED_AVERAGE, Data.NO_ERRORS); } boolean canUseInteger = true; same = true; for (int i = 0; i < len.length; i++) { if (min != null) { if (nlo[i] != min[i]) same = false; if (min[i] != 0) canUseInteger = false; nlo[i] = min[i]; } if (max != null) { if (nhi[i] != max[i]) same = false; if (min[i] != res[i] - 1) canUseInteger = false; nhi[i] = max[i]; } } if (canUseInteger !same) { final FunctionType ffType = (FunctionType) ff.getType(); final Set ffSet = canUseInteger ? (Set) IntegerNDSet.create(ffType.getDomain(), res) : (Set) LinearNDSet.create(ffType.getDomain(), nlo, nhi, res); final float[][] ffSamples = ff.getFloats(false); ff = new FlatField(ffType, ffSet); ff.setSamples(ffSamples); } return ff; } | /**
* Resamples the given FlatField to the specified resolution, keeping only the
* flagged range components (or null to keep them all), and using the given
* minimum and maximum domain set values.
*/ | Resamples the given FlatField to the specified resolution, keeping only the flagged range components (or null to keep them all), and using the given minimum and maximum domain set values | resample | {
"repo_name": "uw-loci/visbio",
"path": "src/main/java/loci/visbio/util/DataUtil.java",
"license": "gpl-2.0",
"size": 14999
} | [
"java.rmi.RemoteException"
]
| import java.rmi.RemoteException; | import java.rmi.*; | [
"java.rmi"
]
| java.rmi; | 2,543,131 |
@Test(expected = IllegalArgumentException.class)
public void cleanTitle_emptyOrWhitespaces4() {
OutlineHelper.cleanTitle("\t");
} | @Test(expected = IllegalArgumentException.class) void function() { OutlineHelper.cleanTitle("\t"); } | /**
* Test for {@link OutlineHelper#cleanTitle(String)}.
*/ | Test for <code>OutlineHelper#cleanTitle(String)</code> | cleanTitle_emptyOrWhitespaces4 | {
"repo_name": "dzavodnikov/PdfMetaModifier",
"path": "src/test/java/org/pdfmetamodifier/OutlineHelperTest.java",
"license": "apache-2.0",
"size": 6595
} | [
"org.junit.Test"
]
| import org.junit.Test; | import org.junit.*; | [
"org.junit"
]
| org.junit; | 295,271 |
private List<Element> getElementsByScheme(Element parent, GoAble g) {
ArrayList<Element> retList = new ArrayList<Element>();
NodeList matchingTags = parent.getElementsByTagName(g.getXmlObject());
for (int a = 0; a < matchingTags.getLength(); a++) {
Element el = (Element) matchingTags.item(a);
if (g instanceof Value) {
List<Field> fields = ((Value) g).getFields();
Iterator<Field> i = fields.iterator();
boolean fail = false;
while (i.hasNext()) {
Field current = i.next();
String att = current.getName();
if (!el.hasAttribute(att)
|| current.hasMustBe()
&& !current.getMust_be().equals(
el.getAttribute(att))) {
fail = true;
}
}
if (!fail) {
retList.add(el);
}
} else {
retList.add(el);
}
}
return retList;
} | List<Element> function(Element parent, GoAble g) { ArrayList<Element> retList = new ArrayList<Element>(); NodeList matchingTags = parent.getElementsByTagName(g.getXmlObject()); for (int a = 0; a < matchingTags.getLength(); a++) { Element el = (Element) matchingTags.item(a); if (g instanceof Value) { List<Field> fields = ((Value) g).getFields(); Iterator<Field> i = fields.iterator(); boolean fail = false; while (i.hasNext()) { Field current = i.next(); String att = current.getName(); if (!el.hasAttribute(att) current.hasMustBe() && !current.getMust_be().equals( el.getAttribute(att))) { fail = true; } } if (!fail) { retList.add(el); } } else { retList.add(el); } } return retList; } | /**
* Returns all XML objects from the parent matching the given schema. Please
* note that this is not "depth-aware" for later editing reasons. See
* documentation for further details.
*
* @param parent
* @param g
* @return
*/ | Returns all XML objects from the parent matching the given schema. Please note that this is not "depth-aware" for later editing reasons. See documentation for further details | getElementsByScheme | {
"repo_name": "patrickbr/ferryleaks",
"path": "src/com/algebraweb/editor/server/logicalplan/xmlplanloader/planparser/PlanParser.java",
"license": "gpl-2.0",
"size": 12116
} | [
"com.algebraweb.editor.shared.scheme.Field",
"com.algebraweb.editor.shared.scheme.GoAble",
"com.algebraweb.editor.shared.scheme.Value",
"java.util.ArrayList",
"java.util.Iterator",
"java.util.List",
"org.w3c.dom.Element",
"org.w3c.dom.NodeList"
]
| import com.algebraweb.editor.shared.scheme.Field; import com.algebraweb.editor.shared.scheme.GoAble; import com.algebraweb.editor.shared.scheme.Value; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.w3c.dom.Element; import org.w3c.dom.NodeList; | import com.algebraweb.editor.shared.scheme.*; import java.util.*; import org.w3c.dom.*; | [
"com.algebraweb.editor",
"java.util",
"org.w3c.dom"
]
| com.algebraweb.editor; java.util; org.w3c.dom; | 1,645,218 |
public static Set<Path> getXdocsConfigFilePaths(Set<Path> files) {
final Set<Path> xdocs = new HashSet<>();
for (Path entry : files) {
final String fileName = entry.getFileName().toString();
if (fileName.startsWith("config_")) {
xdocs.add(entry);
}
}
return xdocs;
} | static Set<Path> function(Set<Path> files) { final Set<Path> xdocs = new HashSet<>(); for (Path entry : files) { final String fileName = entry.getFileName().toString(); if (fileName.startsWith(STR)) { xdocs.add(entry); } } return xdocs; } | /**
* Gets xdocs documentation file paths.
* @param files list of all xdoc files
* @return a list of xdocs config file paths.
*/ | Gets xdocs documentation file paths | getXdocsConfigFilePaths | {
"repo_name": "HubSpot/checkstyle",
"path": "src/test/java/com/puppycrawl/tools/checkstyle/internal/XDocUtil.java",
"license": "lgpl-2.1",
"size": 5716
} | [
"java.nio.file.Path",
"java.util.HashSet",
"java.util.Set"
]
| import java.nio.file.Path; import java.util.HashSet; import java.util.Set; | import java.nio.file.*; import java.util.*; | [
"java.nio",
"java.util"
]
| java.nio; java.util; | 724,555 |
public ArrowBuf buffer(int size, BufferManager manager); | ArrowBuf function(int size, BufferManager manager); | /**
* Allocate a new or reused buffer of the provided size. Note that the buffer may technically
* be larger than the
* requested size for rounding purposes. However, the buffer's capacity will be set to the
* configured size.
*
* @param size The size in bytes.
* @param manager A buffer manager to manage reallocation.
* @return a new ArrowBuf, or null if the request can't be satisfied
* @throws OutOfMemoryException if buffer cannot be allocated
*/ | Allocate a new or reused buffer of the provided size. Note that the buffer may technically be larger than the requested size for rounding purposes. However, the buffer's capacity will be set to the configured size | buffer | {
"repo_name": "NonVolatileComputing/arrow",
"path": "java/memory/src/main/java/org/apache/arrow/memory/BufferAllocator.java",
"license": "apache-2.0",
"size": 5657
} | [
"io.netty.buffer.ArrowBuf"
]
| import io.netty.buffer.ArrowBuf; | import io.netty.buffer.*; | [
"io.netty.buffer"
]
| io.netty.buffer; | 373,892 |
public Boolean getBoolean( String name ) throws BirtException; | Boolean function( String name ) throws BirtException; | /**
* Returns the value of a bound column as the Boolean data type.
* Currently it is only a dummy implementation.
*
* @param name of bound column
* @return value of bound column
* @throws BirtException
*/ | Returns the value of a bound column as the Boolean data type. Currently it is only a dummy implementation | getBoolean | {
"repo_name": "rrimmana/birt-1",
"path": "data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/api/IResultIterator.java",
"license": "epl-1.0",
"size": 9481
} | [
"org.eclipse.birt.core.exception.BirtException"
]
| import org.eclipse.birt.core.exception.BirtException; | import org.eclipse.birt.core.exception.*; | [
"org.eclipse.birt"
]
| org.eclipse.birt; | 1,662,323 |
public void registerMenuItem(int nameRes, int drawableRes, int itemId, EaseChatExtendMenuItemClickListener listener) {
registerMenuItem(context.getString(nameRes), drawableRes, itemId, listener);
}
private class ItemAdapter extends ArrayAdapter<ChatMenuItemModel>{
private Context context;
public ItemAdapter(Context context, List<ChatMenuItemModel> objects) {
super(context, 1, objects);
this.context = context;
} | void function(int nameRes, int drawableRes, int itemId, EaseChatExtendMenuItemClickListener listener) { registerMenuItem(context.getString(nameRes), drawableRes, itemId, listener); } private class ItemAdapter extends ArrayAdapter<ChatMenuItemModel>{ private Context context; public ItemAdapter(Context context, List<ChatMenuItemModel> objects) { super(context, 1, objects); this.context = context; } | /**
* register menu item
*
* @param nameRes
* resource id of item name
* @param drawableRes
* background of item
* @param itemId
* id
* @param listener
* on click event of item
*/ | register menu item | registerMenuItem | {
"repo_name": "simonOrganization/safe",
"path": "easeui/src/com/hyphenate/easeui/widget/EaseChatExtendMenu.java",
"license": "apache-2.0",
"size": 5441
} | [
"android.content.Context",
"android.widget.ArrayAdapter",
"java.util.List"
]
| import android.content.Context; import android.widget.ArrayAdapter; import java.util.List; | import android.content.*; import android.widget.*; import java.util.*; | [
"android.content",
"android.widget",
"java.util"
]
| android.content; android.widget; java.util; | 1,593,557 |
private void run() throws Exception {
DevelopmentProvider tp = new DevelopmentProvider();
// build the application/topology
Topology t = tp.newTopology("mqttSampleSubscriber");
// System.setProperty("javax.net.debug", "ssl"); // or "all"; "help" for full list
// Create the MQTT broker connector
MqttConfig mqttConfig = createMqttConfig();
MqttStreams mqtt = new MqttStreams(t, () -> mqttConfig);
// Subscribe to the topic and create a stream of messages
TStream<String> msgs = mqtt.subscribe(topic, 0);
// Process the received msgs - just print them out
msgs.sink(tuple -> System.out.println(
String.format("[%s] received: %s", Util.simpleTS(), tuple)));
// run the application / topology
System.out.println("Console URL for the job: "
+ tp.getServices().getService(HttpServer.class).getConsoleUrl());
tp.submit(t);
} | void function() throws Exception { DevelopmentProvider tp = new DevelopmentProvider(); Topology t = tp.newTopology(STR); MqttConfig mqttConfig = createMqttConfig(); MqttStreams mqtt = new MqttStreams(t, () -> mqttConfig); TStream<String> msgs = mqtt.subscribe(topic, 0); msgs.sink(tuple -> System.out.println( String.format(STR, Util.simpleTS(), tuple))); System.out.println(STR + tp.getServices().getService(HttpServer.class).getConsoleUrl()); tp.submit(t); } | /**
* Create a topology for the subscriber application and run it.
*/ | Create a topology for the subscriber application and run it | run | {
"repo_name": "dlaboss/incubator-quarks",
"path": "samples/connectors/src/main/java/org/apache/edgent/samples/connectors/mqtt/SimpleSubscriberApp.java",
"license": "apache-2.0",
"size": 3274
} | [
"org.apache.edgent.connectors.mqtt.MqttConfig",
"org.apache.edgent.connectors.mqtt.MqttStreams",
"org.apache.edgent.console.server.HttpServer",
"org.apache.edgent.providers.development.DevelopmentProvider",
"org.apache.edgent.samples.connectors.Util",
"org.apache.edgent.topology.TStream",
"org.apache.edgent.topology.Topology"
]
| import org.apache.edgent.connectors.mqtt.MqttConfig; import org.apache.edgent.connectors.mqtt.MqttStreams; import org.apache.edgent.console.server.HttpServer; import org.apache.edgent.providers.development.DevelopmentProvider; import org.apache.edgent.samples.connectors.Util; import org.apache.edgent.topology.TStream; import org.apache.edgent.topology.Topology; | import org.apache.edgent.connectors.mqtt.*; import org.apache.edgent.console.server.*; import org.apache.edgent.providers.development.*; import org.apache.edgent.samples.connectors.*; import org.apache.edgent.topology.*; | [
"org.apache.edgent"
]
| org.apache.edgent; | 178,328 |
private void checkSignificanceLevel(final double alpha)
throws IllegalArgumentException {
if ((alpha <= 0) || (alpha > 0.5)) {
throw MathRuntimeException.createIllegalArgumentException(
"out of bounds significance level {0}, must be between {1} and {2}",
alpha, 0.0, 0.5);
}
} | void function(final double alpha) throws IllegalArgumentException { if ((alpha <= 0) (alpha > 0.5)) { throw MathRuntimeException.createIllegalArgumentException( STR, alpha, 0.0, 0.5); } } | /** Check significance level.
* @param alpha significance level
* @exception IllegalArgumentException if significance level is out of bounds
*/ | Check significance level | checkSignificanceLevel | {
"repo_name": "SpoonLabs/astor",
"path": "examples/math_85/src/java/org/apache/commons/math/stat/inference/TTestImpl.java",
"license": "gpl-2.0",
"size": 46925
} | [
"org.apache.commons.math.MathRuntimeException"
]
| import org.apache.commons.math.MathRuntimeException; | import org.apache.commons.math.*; | [
"org.apache.commons"
]
| org.apache.commons; | 325,849 |
public static Map<String, ? extends CacheConfig> fromJSON(Reader reader) throws IOException {
return new CacheConfigSupport().fromJSON(reader);
} | static Map<String, ? extends CacheConfig> function(Reader reader) throws IOException { return new CacheConfigSupport().fromJSON(reader); } | /**
* Read config objects stored in JSON format from <code>Reader</code>
*
* @param reader of config
* @return config
* @throws IOException error
*/ | Read config objects stored in JSON format from <code>Reader</code> | fromJSON | {
"repo_name": "zhoffice/redisson",
"path": "redisson/src/main/java/org/redisson/spring/cache/CacheConfig.java",
"license": "apache-2.0",
"size": 6974
} | [
"java.io.IOException",
"java.io.Reader",
"java.util.Map"
]
| import java.io.IOException; import java.io.Reader; import java.util.Map; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
]
| java.io; java.util; | 58,008 |
public static Test suite()
{
ActiveTestSuite suite = new ActiveTestSuite(); | static Test function() { ActiveTestSuite suite = new ActiveTestSuite(); | /**
* A unit test suite for JUnit
* <p>
* @return The test suite
*/ | A unit test suite for JUnit | suite | {
"repo_name": "mohanaraosv/commons-jcs",
"path": "commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java",
"license": "apache-2.0",
"size": 5362
} | [
"junit.extensions.ActiveTestSuite",
"junit.framework.Test"
]
| import junit.extensions.ActiveTestSuite; import junit.framework.Test; | import junit.extensions.*; import junit.framework.*; | [
"junit.extensions",
"junit.framework"
]
| junit.extensions; junit.framework; | 1,466,236 |
public static MozuClient<com.mozu.api.contracts.productadmin.ProductExtra> updateExtraClient(com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductExtra productExtra, String productCode, String attributeFQN) throws Exception
{
return updateExtraClient(dataViewMode, productExtra, productCode, attributeFQN, null);
}
| static MozuClient<com.mozu.api.contracts.productadmin.ProductExtra> function(com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductExtra productExtra, String productCode, String attributeFQN) throws Exception { return updateExtraClient(dataViewMode, productExtra, productCode, attributeFQN, null); } | /**
* Updates the configuration of an extra attribute for the product specified in the request.
* <p><pre><code>
* MozuClient<com.mozu.api.contracts.productadmin.ProductExtra> mozuClient=UpdateExtraClient(dataViewMode, productExtra, productCode, attributeFQN);
* client.setBaseAddress(url);
* client.executeRequest();
* ProductExtra productExtra = client.Result();
* </code></pre></p>
* @param attributeFQN The fully qualified name of the attribute, which is a user defined attribute identifier.
* @param productCode Merchant-created code that uniquely identifies the product such as a SKU or item number. Once created, the product code is read-only.
* @param productExtra Properties of an extra attribute to defined for a product that is associated with a product type that uses the extra. Setting up extras for a product enables shopper-entered information, such as initials for a monogram.
* @return Mozu.Api.MozuClient <com.mozu.api.contracts.productadmin.ProductExtra>
* @see com.mozu.api.contracts.productadmin.ProductExtra
* @see com.mozu.api.contracts.productadmin.ProductExtra
*/ | Updates the configuration of an extra attribute for the product specified in the request. <code><code> MozuClient mozuClient=UpdateExtraClient(dataViewMode, productExtra, productCode, attributeFQN); client.setBaseAddress(url); client.executeRequest(); ProductExtra productExtra = client.Result(); </code></code> | updateExtraClient | {
"repo_name": "johngatti/mozu-java",
"path": "mozu-java-core/src/main/java/com/mozu/api/clients/commerce/catalog/admin/products/ProductExtraClient.java",
"license": "mit",
"size": 31133
} | [
"com.mozu.api.DataViewMode",
"com.mozu.api.MozuClient"
]
| import com.mozu.api.DataViewMode; import com.mozu.api.MozuClient; | import com.mozu.api.*; | [
"com.mozu.api"
]
| com.mozu.api; | 39,251 |
public static List<Integer> getFieldTypes(ParameterMetaData metadata) throws SQLException {
List<Integer> fieldTypes = new LinkedList<Integer>();
for (int i = 1; i <= metadata.getParameterCount(); i++) {
fieldTypes.add(new Integer(metadata.getParameterType(i)));
}
return fieldTypes;
} | static List<Integer> function(ParameterMetaData metadata) throws SQLException { List<Integer> fieldTypes = new LinkedList<Integer>(); for (int i = 1; i <= metadata.getParameterCount(); i++) { fieldTypes.add(new Integer(metadata.getParameterType(i))); } return fieldTypes; } | /**
* Gets the fieldTypes attribute of the SQLUtil class
*
* @param metadata Description of the Parameter
* @return The fieldTypes value
* @exception SQLException Description of the Exception
*/ | Gets the fieldTypes attribute of the SQLUtil class | getFieldTypes | {
"repo_name": "CloverETL/CloverETL-Engine",
"path": "cloveretl.connection/src/org/jetel/connection/jdbc/SQLUtil.java",
"license": "lgpl-2.1",
"size": 35457
} | [
"java.sql.ParameterMetaData",
"java.sql.SQLException",
"java.util.LinkedList",
"java.util.List"
]
| import java.sql.ParameterMetaData; import java.sql.SQLException; import java.util.LinkedList; import java.util.List; | import java.sql.*; import java.util.*; | [
"java.sql",
"java.util"
]
| java.sql; java.util; | 1,686,793 |
protected void createDynamicPolicyProviderNPE(String msg)
throws TestException {
try {
DynamicPolicyProvider policy = new DynamicPolicyProvider(null);
throw new TestException(Util.fail(msg, msg, NPE));
} catch (NullPointerException npe) {
logger.log(Level.FINE, Util.pass(msg, npe));
} catch (TestException qae) {
throw qae;
} catch (Exception e) {
throw new TestException(Util.fail(msg, e, NPE));
}
} | void function(String msg) throws TestException { try { DynamicPolicyProvider policy = new DynamicPolicyProvider(null); throw new TestException(Util.fail(msg, msg, NPE)); } catch (NullPointerException npe) { logger.log(Level.FINE, Util.pass(msg, npe)); } catch (TestException qae) { throw qae; } catch (Exception e) { throw new TestException(Util.fail(msg, e, NPE)); } } | /**
* Try to create DynamicPolicyProvider passing null as base policy class.
* Expect NullPointerException. If no exception or another
* exception is thrown then test failed.
*
* @throws TestException if failed
*
*/ | Try to create DynamicPolicyProvider passing null as base policy class. Expect NullPointerException. If no exception or another exception is thrown then test failed | createDynamicPolicyProviderNPE | {
"repo_name": "trasukg/river-qa-2.2",
"path": "qa/src/com/sun/jini/test/spec/policyprovider/dynamicPolicyProvider/DynamicPolicyProviderTestBase.java",
"license": "apache-2.0",
"size": 24155
} | [
"com.sun.jini.qa.harness.TestException",
"com.sun.jini.test.spec.policyprovider.util.Util",
"java.util.logging.Level",
"net.jini.security.policy.DynamicPolicyProvider"
]
| import com.sun.jini.qa.harness.TestException; import com.sun.jini.test.spec.policyprovider.util.Util; import java.util.logging.Level; import net.jini.security.policy.DynamicPolicyProvider; | import com.sun.jini.qa.harness.*; import com.sun.jini.test.spec.policyprovider.util.*; import java.util.logging.*; import net.jini.security.policy.*; | [
"com.sun.jini",
"java.util",
"net.jini.security"
]
| com.sun.jini; java.util; net.jini.security; | 2,316,975 |
public interface OnDismissListener {
void onDismiss();
}
public static class OneTimeHintViewBuilder {
private Context mContext;
public OneTimeHintViewBuilder(Context context) {
this.mContext = context;
} | interface OnDismissListener { void function(); } public static class OneTimeHintViewBuilder { private Context mContext; public OneTimeHintViewBuilder(Context context) { this.mContext = context; } | /**
* Method that will be called when this hint view is dismissed.
*/ | Method that will be called when this hint view is dismissed | onDismiss | {
"repo_name": "joaocsousa/OneTimeHintView",
"path": "library/src/main/java/com/tinycoolthings/onetimehintview/OneTimeHintView.java",
"license": "apache-2.0",
"size": 19799
} | [
"android.content.Context"
]
| import android.content.Context; | import android.content.*; | [
"android.content"
]
| android.content; | 2,302,062 |
@Test
public void testGetWorksheetAutoshapes() {
System.out.println("GetWorksheetAutoshapes");
String name = "test_cells.xlsx";
String sheetName = "Sheet1";
String storage = "";
String folder = "";
try {
AutoShapesResponse result = cellsApi.GetWorksheetAutoshapes(name, sheetName, storage, folder);
} catch (ApiException apiException) {
System.out.println("exp:" + apiException.getMessage());
assertNull(apiException);
}
} | void function() { System.out.println(STR); String name = STR; String sheetName = STR; String storage = STRSTRexp:" + apiException.getMessage()); assertNull(apiException); } } | /**
* Test of GetWorksheetAutoshapes method, of class CellsApi.
*/ | Test of GetWorksheetAutoshapes method, of class CellsApi | testGetWorksheetAutoshapes | {
"repo_name": "aspose-cells/Aspose.Cells-for-Cloud",
"path": "SDKs/Aspose.Cells-Cloud-SDK-for-Android/Aspose.Cells-Cloud-SDK-Android/src/test/java/com/aspose/cells/api/CellsApiTest.java",
"license": "mit",
"size": 91749
} | [
"org.junit.Assert"
]
| import org.junit.Assert; | import org.junit.*; | [
"org.junit"
]
| org.junit; | 239,828 |
public Set<String> getAlternativeStationNames(){
return this.alternativeNamesForStation;
} | Set<String> function(){ return this.alternativeNamesForStation; } | /**
* Internal Method used to associate a station with it's alternative names (which also lead to the same station)
* @return the list of already discovered alternative names for this station
*/ | Internal Method used to associate a station with it's alternative names (which also lead to the same station) | getAlternativeStationNames | {
"repo_name": "Timmeey/OeffiWatch",
"path": "oeffiwatch/src/main/java/de/timmeey/oeffiwatch/station/impl/StationImpl.java",
"license": "mit",
"size": 12024
} | [
"java.util.Set"
]
| import java.util.Set; | import java.util.*; | [
"java.util"
]
| java.util; | 1,048,165 |
public CountDownLatch createDocumentListAsync(com.mozu.api.contracts.content.DocumentList list, AsyncCallback<com.mozu.api.contracts.content.DocumentList> callback) throws Exception
{
return createDocumentListAsync( list, null, callback);
} | CountDownLatch function(com.mozu.api.contracts.content.DocumentList list, AsyncCallback<com.mozu.api.contracts.content.DocumentList> callback) throws Exception { return createDocumentListAsync( list, null, callback); } | /**
* Creates a new documentList
* <p><pre><code>
* DocumentList documentlist = new DocumentList();
* CountDownLatch latch = documentlist.createDocumentList( list, callback );
* latch.await() * </code></pre></p>
* @param callback callback handler for asynchronous operations
* @param list The list of document types and related properties that define content used by the content management system (CMS).
* @return com.mozu.api.contracts.content.DocumentList
* @see com.mozu.api.contracts.content.DocumentList
* @see com.mozu.api.contracts.content.DocumentList
*/ | Creates a new documentList <code><code> DocumentList documentlist = new DocumentList(); CountDownLatch latch = documentlist.createDocumentList( list, callback ); latch.await() * </code></code> | createDocumentListAsync | {
"repo_name": "lakshmi-nair/mozu-java",
"path": "mozu-javaasync-core/src/main/java/com/mozu/api/resources/content/DocumentListResource.java",
"license": "mit",
"size": 16866
} | [
"com.mozu.api.AsyncCallback",
"java.util.concurrent.CountDownLatch"
]
| import com.mozu.api.AsyncCallback; import java.util.concurrent.CountDownLatch; | import com.mozu.api.*; import java.util.concurrent.*; | [
"com.mozu.api",
"java.util"
]
| com.mozu.api; java.util; | 1,599,261 |
void removeProperty(String namespace, String property) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException; | void removeProperty(String namespace, String property) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException; | /**
* Removes a property from a namespace. Note that it may take a few seconds to propagate the change everywhere.
*
* @param namespace
* the name of the namespace
* @param property
* the name of a per-table property
* @throws AccumuloException
* if a general error occurs
* @throws AccumuloSecurityException
* if the user does not have permission
* @throws NamespaceNotFoundException
* if the specified namespace doesn't exist
* @since 1.6.0
*/ | Removes a property from a namespace. Note that it may take a few seconds to propagate the change everywhere | removeProperty | {
"repo_name": "joshelser/accumulo",
"path": "core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperations.java",
"license": "apache-2.0",
"size": 14835
} | [
"org.apache.accumulo.core.client.AccumuloException",
"org.apache.accumulo.core.client.AccumuloSecurityException",
"org.apache.accumulo.core.client.NamespaceNotFoundException"
]
| import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.NamespaceNotFoundException; | import org.apache.accumulo.core.client.*; | [
"org.apache.accumulo"
]
| org.apache.accumulo; | 2,562,284 |
public static boolean createQuota(ZooKeeper zk, String path,
long bytes, int numNodes)
throws KeeperException, IOException, InterruptedException
{
// check if the path exists. We cannot create
// quota for a path that already exists in zookeeper
// for now.
Stat initStat = zk.exists(path, false);
if (initStat == null) {
throw new IllegalArgumentException(path + " does not exist.");
}
// now check if their is already existing
// parent or child that has quota
String quotaPath = Quotas.quotaZookeeper;
// check for more than 2 children --
// if zookeeper_stats and zookeeper_qutoas
// are not the children then this path
// is an ancestor of some path that
// already has quota
String realPath = Quotas.quotaZookeeper + path;
try {
List<String> children = zk.getChildren(realPath, false);
for (String child: children) {
if (!child.startsWith("zookeeper_")) {
throw new IllegalArgumentException(path + " has child " +
child + " which has a quota");
}
}
} catch(KeeperException.NoNodeException ne) {
// this is fine
}
//check for any parent that has been quota
checkIfParentQuota(zk, path);
// this is valid node for quota
// start creating all the parents
if (zk.exists(quotaPath, false) == null) {
try {
zk.create(Quotas.procZookeeper, null, Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
zk.create(Quotas.quotaZookeeper, null, Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
} catch(KeeperException.NodeExistsException ne) {
// do nothing
}
}
// now create the direct children
// and the stat and quota nodes
String[] splits = path.split("/");
StringBuilder sb = new StringBuilder();
sb.append(quotaPath);
for (int i=1; i<splits.length; i++) {
sb.append("/" + splits[i]);
quotaPath = sb.toString();
try {
zk.create(quotaPath, null, Ids.OPEN_ACL_UNSAFE ,
CreateMode.PERSISTENT);
} catch(KeeperException.NodeExistsException ne) {
//do nothing
}
}
String statPath = quotaPath + "/" + Quotas.statNode;
quotaPath = quotaPath + "/" + Quotas.limitNode;
StatsTrack strack = new StatsTrack(null);
strack.setBytes(bytes);
strack.setCount(numNodes);
try {
zk.create(quotaPath, strack.toString().getBytes(),
Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
StatsTrack stats = new StatsTrack(null);
stats.setBytes(0L);
stats.setCount(0);
zk.create(statPath, stats.toString().getBytes(),
Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
} catch(KeeperException.NodeExistsException ne) {
byte[] data = zk.getData(quotaPath, false , new Stat());
StatsTrack strackC = new StatsTrack(new String(data));
if (bytes != -1L) {
strackC.setBytes(bytes);
}
if (numNodes != -1) {
strackC.setCount(numNodes);
}
zk.setData(quotaPath, strackC.toString().getBytes(), -1);
}
return true;
} | static boolean function(ZooKeeper zk, String path, long bytes, int numNodes) throws KeeperException, IOException, InterruptedException { Stat initStat = zk.exists(path, false); if (initStat == null) { throw new IllegalArgumentException(path + STR); } String quotaPath = Quotas.quotaZookeeper; String realPath = Quotas.quotaZookeeper + path; try { List<String> children = zk.getChildren(realPath, false); for (String child: children) { if (!child.startsWith(STR)) { throw new IllegalArgumentException(path + STR + child + STR); } } } catch(KeeperException.NoNodeException ne) { } checkIfParentQuota(zk, path); if (zk.exists(quotaPath, false) == null) { try { zk.create(Quotas.procZookeeper, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); zk.create(Quotas.quotaZookeeper, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); } catch(KeeperException.NodeExistsException ne) { } } String[] splits = path.split("/"); StringBuilder sb = new StringBuilder(); sb.append(quotaPath); for (int i=1; i<splits.length; i++) { sb.append("/" + splits[i]); quotaPath = sb.toString(); try { zk.create(quotaPath, null, Ids.OPEN_ACL_UNSAFE , CreateMode.PERSISTENT); } catch(KeeperException.NodeExistsException ne) { } } String statPath = quotaPath + "/" + Quotas.statNode; quotaPath = quotaPath + "/" + Quotas.limitNode; StatsTrack strack = new StatsTrack(null); strack.setBytes(bytes); strack.setCount(numNodes); try { zk.create(quotaPath, strack.toString().getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); StatsTrack stats = new StatsTrack(null); stats.setBytes(0L); stats.setCount(0); zk.create(statPath, stats.toString().getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); } catch(KeeperException.NodeExistsException ne) { byte[] data = zk.getData(quotaPath, false , new Stat()); StatsTrack strackC = new StatsTrack(new String(data)); if (bytes != -1L) { strackC.setBytes(bytes); } if (numNodes != -1) { strackC.setCount(numNodes); } zk.setData(quotaPath, strackC.toString().getBytes(), -1); } return true; } | /**
* this method creates a quota node for the path
* @param zk the ZooKeeper client
* @param path the path for which quota needs to be created
* @param bytes the limit of bytes on this path
* @param numNodes the limit of number of nodes on this path
* @return true if its successful and false if not.
*/ | this method creates a quota node for the path | createQuota | {
"repo_name": "intel-hadoop/zookeeper-rhino",
"path": "src/java/main/org/apache/zookeeper/ZooKeeperMain.java",
"license": "apache-2.0",
"size": 25483
} | [
"java.io.IOException",
"java.util.List",
"org.apache.zookeeper.ZooDefs",
"org.apache.zookeeper.data.Stat"
]
| import java.io.IOException; import java.util.List; import org.apache.zookeeper.ZooDefs; import org.apache.zookeeper.data.Stat; | import java.io.*; import java.util.*; import org.apache.zookeeper.*; import org.apache.zookeeper.data.*; | [
"java.io",
"java.util",
"org.apache.zookeeper"
]
| java.io; java.util; org.apache.zookeeper; | 1,134,230 |
protected void writeDocumentTotalLine(EntryReportDocumentNumberTotalLine documentNumberTotal, ReportWriterService reportWriterService) {
final CurrencyFormatter formatter = new CurrencyFormatter();
final int amountLength = getDataDictionaryService().getAttributeMaxLength(Entry.class, KFSPropertyConstants.TRANSACTION_LEDGER_ENTRY_AMOUNT);
reportWriterService.writeNewLines(1);
reportWriterService.writeFormattedMessageLine(" Total: %"+amountLength+"s %"+amountLength+"s %"+amountLength+"s", formatter.format(documentNumberTotal.getCreditAmount()), formatter.format(documentNumberTotal.getDebitAmount()), formatter.format(documentNumberTotal.getBudgetAmount()));
reportWriterService.writeNewLines(1);
} | void function(EntryReportDocumentNumberTotalLine documentNumberTotal, ReportWriterService reportWriterService) { final CurrencyFormatter formatter = new CurrencyFormatter(); final int amountLength = getDataDictionaryService().getAttributeMaxLength(Entry.class, KFSPropertyConstants.TRANSACTION_LEDGER_ENTRY_AMOUNT); reportWriterService.writeNewLines(1); reportWriterService.writeFormattedMessageLine(STR+amountLength+STR+amountLength+STR+amountLength+"s", formatter.format(documentNumberTotal.getCreditAmount()), formatter.format(documentNumberTotal.getDebitAmount()), formatter.format(documentNumberTotal.getBudgetAmount())); reportWriterService.writeNewLines(1); } | /**
* Writes totals for the document number we just finished writing out
*
* @param documentNumberTotal EntryReportDocumentNumberTotalLine containing totals to write
* @param reportWriterService ReportWriterService for writing output to report
*/ | Writes totals for the document number we just finished writing out | writeDocumentTotalLine | {
"repo_name": "Ariah-Group/Finance",
"path": "af_webapp/src/main/java/org/kuali/kfs/gl/batch/service/impl/NightlyOutServiceImpl.java",
"license": "apache-2.0",
"size": 22776
} | [
"org.kuali.kfs.gl.businessobject.Entry",
"org.kuali.kfs.sys.KFSPropertyConstants",
"org.kuali.kfs.sys.service.ReportWriterService",
"org.kuali.rice.core.web.format.CurrencyFormatter"
]
| import org.kuali.kfs.gl.businessobject.Entry; import org.kuali.kfs.sys.KFSPropertyConstants; import org.kuali.kfs.sys.service.ReportWriterService; import org.kuali.rice.core.web.format.CurrencyFormatter; | import org.kuali.kfs.gl.businessobject.*; import org.kuali.kfs.sys.*; import org.kuali.kfs.sys.service.*; import org.kuali.rice.core.web.format.*; | [
"org.kuali.kfs",
"org.kuali.rice"
]
| org.kuali.kfs; org.kuali.rice; | 1,595,526 |
FileSelector[] getSelectors(Project p); | FileSelector[] getSelectors(Project p); | /**
* Returns the set of selectors as an array.
* @param p the current project
* @return an array of selectors in this container
*/ | Returns the set of selectors as an array | getSelectors | {
"repo_name": "BIORIMP/biorimp",
"path": "BIO-RIMP/test_data/code/antapache/src/main/org/apache/tools/ant/types/selectors/SelectorContainer.java",
"license": "gpl-2.0",
"size": 5167
} | [
"org.apache.tools.ant.Project"
]
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.*; | [
"org.apache.tools"
]
| org.apache.tools; | 121,209 |
public AccountSubtype getSubtype() {
return subtype;
} | AccountSubtype function() { return subtype; } | /**
* Get subtype
* @return subtype
**/ | Get subtype | getSubtype | {
"repo_name": "plaid/plaid-java",
"path": "src/main/java/com/plaid/client/model/OverrideAccounts.java",
"license": "mit",
"size": 13904
} | [
"com.plaid.client.model.AccountSubtype"
]
| import com.plaid.client.model.AccountSubtype; | import com.plaid.client.model.*; | [
"com.plaid.client"
]
| com.plaid.client; | 2,443,320 |
public boolean addServerCache(byte[] tenantId, byte[] cacheId, ImmutableBytesWritable cachePtr, byte[] txState, ServerCacheFactory cacheFactory) throws SQLException;
public boolean removeServerCache(byte[] tenantId, byte[] cacheId) throws SQLException; | boolean addServerCache(byte[] tenantId, byte[] cacheId, ImmutableBytesWritable cachePtr, byte[] txState, ServerCacheFactory cacheFactory) throws SQLException; public boolean function(byte[] tenantId, byte[] cacheId) throws SQLException; | /**
* Remove the cache from the region server cache. Called upon completion of
* the operation when cache is no longer needed.
* @param tenantId the tenantId or null if not applicable
* @param cacheId unique identifier of the cache
* @return true on success and otherwise throws
* @throws SQLException
*/ | Remove the cache from the region server cache. Called upon completion of the operation when cache is no longer needed | removeServerCache | {
"repo_name": "apurtell/phoenix",
"path": "phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ServerCachingProtocol.java",
"license": "apache-2.0",
"size": 2677
} | [
"java.sql.SQLException",
"org.apache.hadoop.hbase.io.ImmutableBytesWritable"
]
| import java.sql.SQLException; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; | import java.sql.*; import org.apache.hadoop.hbase.io.*; | [
"java.sql",
"org.apache.hadoop"
]
| java.sql; org.apache.hadoop; | 1,683,588 |
@Test
public void testNode() {
Node result = new Node();
assertThat(result, is(notNullValue()));
}
/**
* Test method for
* {@link org.o3project.odenos.core.component.network.topology.Node#Node(java.lang.String)} | void function() { Node result = new Node(); assertThat(result, is(notNullValue())); } /** * Test method for * {@link org.o3project.odenos.core.component.network.topology.Node#Node(java.lang.String)} | /**
* Test method for
* {@link org.o3project.odenos.core.component.network.topology.Node#Node()}.
*/ | Test method for <code>org.o3project.odenos.core.component.network.topology.Node#Node()</code> | testNode | {
"repo_name": "haizawa/odenos",
"path": "src/test/java/org/o3project/odenos/core/component/network/topology/NodeTest.java",
"license": "apache-2.0",
"size": 36700
} | [
"org.hamcrest.CoreMatchers",
"org.junit.Assert",
"org.junit.Test"
]
| import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.junit.Test; | import org.hamcrest.*; import org.junit.*; | [
"org.hamcrest",
"org.junit"
]
| org.hamcrest; org.junit; | 2,691,547 |
public void setView(View view) {
this.view = view;
} | void function(View view) { this.view = view; } | /**
* Set the view.
*
* @param view the view
*/ | Set the view | setView | {
"repo_name": "arenadata/ambari",
"path": "ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewEntity.java",
"license": "apache-2.0",
"size": 20984
} | [
"org.apache.ambari.view.View"
]
| import org.apache.ambari.view.View; | import org.apache.ambari.view.*; | [
"org.apache.ambari"
]
| org.apache.ambari; | 2,698,032 |
public ContentCondition createContentCondition(String data)
throws CSSException {
throw new CSSException("Not implemented in CSS2");
} | ContentCondition function(String data) throws CSSException { throw new CSSException(STR); } | /**
* <b>SAC</b>: Implements {@link
* org.w3c.css.sac.ConditionFactory#createContentCondition(String)}.
*/ | SAC: Implements <code>org.w3c.css.sac.ConditionFactory#createContentCondition(String)</code> | createContentCondition | {
"repo_name": "shyamalschandra/flex-sdk",
"path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/css/engine/sac/CSSConditionFactory.java",
"license": "apache-2.0",
"size": 7476
} | [
"org.w3c.css.sac.CSSException",
"org.w3c.css.sac.ContentCondition"
]
| import org.w3c.css.sac.CSSException; import org.w3c.css.sac.ContentCondition; | import org.w3c.css.sac.*; | [
"org.w3c.css"
]
| org.w3c.css; | 2,882,607 |
public IChatComponent getValue()
{
return this.value;
} | IChatComponent function() { return this.value; } | /**
* Gets the value to perform the action on when this event is raised. For example, if the action is "show item",
* this would be the item to show.
*/ | Gets the value to perform the action on when this event is raised. For example, if the action is "show item", this would be the item to show | getValue | {
"repo_name": "TheHecticByte/BananaJ1.7.10Beta",
"path": "src/net/minecraft/Server1_7_10/event/HoverEvent.java",
"license": "gpl-3.0",
"size": 3547
} | [
"net.minecraft.Server1_7_10"
]
| import net.minecraft.Server1_7_10; | import net.minecraft.*; | [
"net.minecraft"
]
| net.minecraft; | 2,735,937 |
private void postMeetings(List<SignupMeeting> signupMeetings) throws PermissionException, Exception
{
//create the groups for the timeslots if enabled
//this also loads the groupId into the timeslot object to be saved afterwards
if(isCreateGroups()){
logger.info("Creating groups for each timeslot ...");
for(SignupMeeting s: signupMeetings) {
List<SignupTimeslot> timeslots = s.getSignupTimeSlots();
int index=1;
for(SignupTimeslot t: timeslots) {
String title = generateGroupTitle(s.getTitle(), t, index);
String description = generateGroupDescription(s.getTitle(), t);
List<String> attendees = convertAttendeesToUuids(t.getAttendees());
String groupId = sakaiFacade.createGroup(sakaiFacade.getCurrentLocationId(), title, description, attendees);
logger.debug("Created group for timeslot: " + groupId);
t.setGroupId(groupId);
index++;
}
}
}
this.signupMeetingService.saveMeetings(signupMeetings, sakaiFacade.getCurrentUserId());
Utilities.resetMeetingList();
SignupMeeting firstOne = signupMeetings.get(0);
if (firstOne.isRecurredMeeting()) {
Date lastRecurmeetingDate = signupMeetings.get(signupMeetings.size() - 1).getStartTime();
firstOne.setRepeatUntil(lastRecurmeetingDate);
firstOne.setApplyToAllRecurMeetings(assignParticitpantsToAllEvents);
}
if (sendEmail) {
try {
firstOne.setSendEmailToSelectedPeopleOnly(this.sendEmailToSelectedPeopleOnly);
signupMeetingService.sendEmail(firstOne, SIGNUP_NEW_MEETING);
} catch (Exception e) {
logger.error(Utilities.rb.getString("email.exception") + " - " + e.getMessage(), e);
Utilities.addErrorMessage(Utilities.rb.getString("email.exception"));
}
}
if(isPublishToCalendar()){
for (int i = 0; i < signupMeetings.size(); i++) {
try {
signupMeetingService.postToCalendar(signupMeetings.get(i));
} catch (PermissionException pe) {
Utilities
.addErrorMessage(Utilities.rb.getString("error.calendarEvent.posted_failed_due_to_permission"));
logger.info(Utilities.rb.getString("error.calendarEvent.posted_failed_due_to_permission")
+ " - Meeting title:" + signupMeetings.get(i).getTitle());
} catch (Exception e) {
Utilities.addErrorMessage(Utilities.rb.getString("error.calendarEvent.posted_failed"));
logger.info(Utilities.rb.getString("error.calendarEvent.posted_failed") + " - Meeting title:"
+ signupMeetings.get(i).getTitle());
}
}
}
String recurringInfo = firstOne.isRecurredMeeting() ? " recur_mtng" : "";
for (int i = 0; i < signupMeetings.size(); i++) {
logger.info(recurringInfo
+ "title:"
+ signupMeetings.get(i).getTitle()
+ " - UserId:"
+ sakaiFacade.getCurrentUserId()
+ " - has created new meeting(s) at meeting startTime:"
+ sakaiFacade.getTimeService().newTime(signupMeetings.get(i).getStartTime().getTime())
.toStringLocalFull());
Utilities.postEventTracking(SignupEventTypes.EVENT_SIGNUP_MTNG_ADD, ToolManager.getCurrentPlacement()
.getContext()
+ " meetingId|title:"
+ signupMeetings.get(i).getId()
+ "|"
+ signupMeetings.get(i).getTitle()
+ " at startTime:"
+ sakaiFacade.getTimeService().newTime(signupMeetings.get(i).getStartTime().getTime()).toStringLocalFull()
+ recurringInfo);
}
} | void function(List<SignupMeeting> signupMeetings) throws PermissionException, Exception { if(isCreateGroups()){ logger.info(STR); for(SignupMeeting s: signupMeetings) { List<SignupTimeslot> timeslots = s.getSignupTimeSlots(); int index=1; for(SignupTimeslot t: timeslots) { String title = generateGroupTitle(s.getTitle(), t, index); String description = generateGroupDescription(s.getTitle(), t); List<String> attendees = convertAttendeesToUuids(t.getAttendees()); String groupId = sakaiFacade.createGroup(sakaiFacade.getCurrentLocationId(), title, description, attendees); logger.debug(STR + groupId); t.setGroupId(groupId); index++; } } } this.signupMeetingService.saveMeetings(signupMeetings, sakaiFacade.getCurrentUserId()); Utilities.resetMeetingList(); SignupMeeting firstOne = signupMeetings.get(0); if (firstOne.isRecurredMeeting()) { Date lastRecurmeetingDate = signupMeetings.get(signupMeetings.size() - 1).getStartTime(); firstOne.setRepeatUntil(lastRecurmeetingDate); firstOne.setApplyToAllRecurMeetings(assignParticitpantsToAllEvents); } if (sendEmail) { try { firstOne.setSendEmailToSelectedPeopleOnly(this.sendEmailToSelectedPeopleOnly); signupMeetingService.sendEmail(firstOne, SIGNUP_NEW_MEETING); } catch (Exception e) { logger.error(Utilities.rb.getString(STR) + STR + e.getMessage(), e); Utilities.addErrorMessage(Utilities.rb.getString(STR)); } } if(isPublishToCalendar()){ for (int i = 0; i < signupMeetings.size(); i++) { try { signupMeetingService.postToCalendar(signupMeetings.get(i)); } catch (PermissionException pe) { Utilities .addErrorMessage(Utilities.rb.getString(STR)); logger.info(Utilities.rb.getString(STR) + STR + signupMeetings.get(i).getTitle()); } catch (Exception e) { Utilities.addErrorMessage(Utilities.rb.getString(STR)); logger.info(Utilities.rb.getString(STR) + STR + signupMeetings.get(i).getTitle()); } } } String recurringInfo = firstOne.isRecurredMeeting() ? STR : STRtitle:STR - UserId:STR - has created new meeting(s) at meeting startTime:STR meetingId title:STR STR at startTime:" + sakaiFacade.getTimeService().newTime(signupMeetings.get(i).getStartTime().getTime()).toStringLocalFull() + recurringInfo); } } | /**
* It will save the SignupMeeting list into DB and send email to notify
* participants
*
* @param signupMeetings
* a SignupMeeting object.
* @throws PermissionException
* a PermissionException object.
* @throws Exception
* a Exception Object.
*/ | It will save the SignupMeeting list into DB and send email to notify participants | postMeetings | {
"repo_name": "sakai-mirror/signup",
"path": "tool/src/java/org/sakaiproject/signup/tool/jsf/organizer/action/CreateMeetings.java",
"license": "apache-2.0",
"size": 21715
} | [
"java.util.Date",
"java.util.List",
"org.sakaiproject.exception.PermissionException",
"org.sakaiproject.signup.model.SignupMeeting",
"org.sakaiproject.signup.model.SignupTimeslot",
"org.sakaiproject.signup.tool.util.Utilities"
]
| import java.util.Date; import java.util.List; import org.sakaiproject.exception.PermissionException; import org.sakaiproject.signup.model.SignupMeeting; import org.sakaiproject.signup.model.SignupTimeslot; import org.sakaiproject.signup.tool.util.Utilities; | import java.util.*; import org.sakaiproject.exception.*; import org.sakaiproject.signup.model.*; import org.sakaiproject.signup.tool.util.*; | [
"java.util",
"org.sakaiproject.exception",
"org.sakaiproject.signup"
]
| java.util; org.sakaiproject.exception; org.sakaiproject.signup; | 308,635 |
@Override
public void put(K key, V value) {
TreeNode<K, V> newNode = TreeNodeFactory.createTreeNode(key, value);
TreeNode<K, V> y = this.nil;
TreeNode<K, V> x = this.root;
while (x != this.nil) {
y = x;
K newNodeKey = newNode.getKey();
K xKey = x.getKey();
if (newNodeKey.compareTo(xKey) < 0) {
x = x.getLeftNode();
} else {
x = x.getRightNode();
}
}
newNode.setParentNode(y);
if (y == this.nil) {
this.root = newNode;
} else if (newNode.getKey().compareTo(y.getKey()) < 0) {
y.setLeftNode(newNode);
} else {
y.setRightNode(newNode);
}
newNode.setLeftNode(this.nil);
newNode.setRightNode(this.nil);
newNode.setColor(NodeColor.RED);
fixInsert(newNode);
} | void function(K key, V value) { TreeNode<K, V> newNode = TreeNodeFactory.createTreeNode(key, value); TreeNode<K, V> y = this.nil; TreeNode<K, V> x = this.root; while (x != this.nil) { y = x; K newNodeKey = newNode.getKey(); K xKey = x.getKey(); if (newNodeKey.compareTo(xKey) < 0) { x = x.getLeftNode(); } else { x = x.getRightNode(); } } newNode.setParentNode(y); if (y == this.nil) { this.root = newNode; } else if (newNode.getKey().compareTo(y.getKey()) < 0) { y.setLeftNode(newNode); } else { y.setRightNode(newNode); } newNode.setLeftNode(this.nil); newNode.setRightNode(this.nil); newNode.setColor(NodeColor.RED); fixInsert(newNode); } | /**
* Insert method
*
*/ | Insert method | put | {
"repo_name": "HurmuzacheCiprian/ConcurrentTreeMap",
"path": "ro.ciprian.presentation/src/main/java/ro/ciprian/presentation/tree/TreeMap.java",
"license": "gpl-2.0",
"size": 8197
} | [
"ro.ciprian.presentation.model.NodeColor",
"ro.ciprian.presentation.model.TreeNode"
]
| import ro.ciprian.presentation.model.NodeColor; import ro.ciprian.presentation.model.TreeNode; | import ro.ciprian.presentation.model.*; | [
"ro.ciprian.presentation"
]
| ro.ciprian.presentation; | 2,523,182 |
@Test
public void shouldStripOutExceptionText() {
assertThat(
ValidationBean.notValid(new Exception("SVNKITException: The actual message")).getError(),
is("The actual message")
);
} | void function() { assertThat( ValidationBean.notValid(new Exception(STR)).getError(), is(STR) ); } | /**
* This is a straight test of what is already there.
* We are NOT sure that this is the correct behaviour.
* We think it was there for SVNKIT and can now be removed.
*/ | This is a straight test of what is already there. We are NOT sure that this is the correct behaviour. We think it was there for SVNKIT and can now be removed | shouldStripOutExceptionText | {
"repo_name": "kyleolivo/gocd",
"path": "common/test/unit/com/thoughtworks/go/domain/materials/ValidationBeanTest.java",
"license": "apache-2.0",
"size": 3139
} | [
"org.hamcrest.core.Is",
"org.junit.Assert"
]
| import org.hamcrest.core.Is; import org.junit.Assert; | import org.hamcrest.core.*; import org.junit.*; | [
"org.hamcrest.core",
"org.junit"
]
| org.hamcrest.core; org.junit; | 1,617,701 |
private String getNewId(String table, Class clazz) {
if (sequenceAccessorService == null) {
sequenceAccessorService = KRADServiceLocator.getSequenceAccessorService();
}
Long id = sequenceAccessorService.getNextAvailableSequenceNumber(table, clazz);
return id.toString();
} | String function(String table, Class clazz) { if (sequenceAccessorService == null) { sequenceAccessorService = KRADServiceLocator.getSequenceAccessorService(); } Long id = sequenceAccessorService.getNextAvailableSequenceNumber(table, clazz); return id.toString(); } | /**
* Returns the next available id for the given table and class.
* @return String the next available id for the given table and class.
*
*/ | Returns the next available id for the given table and class | getNewId | {
"repo_name": "ua-eas/ksd-kc5.2.1-rice2.3.6-ua",
"path": "rice-middleware/krms/impl/src/main/java/org/kuali/rice/krms/impl/repository/NaturalLanguageUsageBo.java",
"license": "apache-2.0",
"size": 6093
} | [
"org.kuali.rice.krad.service.KRADServiceLocator"
]
| import org.kuali.rice.krad.service.KRADServiceLocator; | import org.kuali.rice.krad.service.*; | [
"org.kuali.rice"
]
| org.kuali.rice; | 2,781,297 |
public static WsDiscoveryService createWsDiscoveryService(HelloType m) throws WsDiscoveryServiceDirectoryException {
return createWsDiscoveryService((Object)m);
} | static WsDiscoveryService function(HelloType m) throws WsDiscoveryServiceDirectoryException { return createWsDiscoveryService((Object)m); } | /**
* Creates a WS-Discovery service description based on a received Hello-packet.
*
* @param m Hello-packet.
* @throws WsDiscoveryServiceDirectoryException
*/ | Creates a WS-Discovery service description based on a received Hello-packet | createWsDiscoveryService | {
"repo_name": "thchu168/java-ws-discovery",
"path": "wsdiscovery-lib/src/main/java/com/ms/wsdiscovery/standard11/WsDiscoveryS11Utilities.java",
"license": "lgpl-3.0",
"size": 20884
} | [
"com.ms.wsdiscovery.jaxb.standard11.wsdiscovery.HelloType",
"com.ms.wsdiscovery.servicedirectory.WsDiscoveryService",
"com.ms.wsdiscovery.servicedirectory.exception.WsDiscoveryServiceDirectoryException"
]
| import com.ms.wsdiscovery.jaxb.standard11.wsdiscovery.HelloType; import com.ms.wsdiscovery.servicedirectory.WsDiscoveryService; import com.ms.wsdiscovery.servicedirectory.exception.WsDiscoveryServiceDirectoryException; | import com.ms.wsdiscovery.jaxb.standard11.wsdiscovery.*; import com.ms.wsdiscovery.servicedirectory.*; import com.ms.wsdiscovery.servicedirectory.exception.*; | [
"com.ms.wsdiscovery"
]
| com.ms.wsdiscovery; | 2,393,825 |
@Test(expected = IllegalArgumentException.class)
public void testObjectIdToLong() {
new ObjectId("4e9d87aa5825b60b6378150000").getTimestamp();
} | @Test(expected = IllegalArgumentException.class) void function() { new ObjectId(STR).getTimestamp(); } | /**
* Test Parsing a ObjectId(..) from a hex string that is too long.
*/ | Test Parsing a ObjectId(..) from a hex string that is too long | testObjectIdToLong | {
"repo_name": "allanbank/mongodb-async-driver",
"path": "src/test/java/com/allanbank/mongodb/bson/element/ObjectIdTest.java",
"license": "apache-2.0",
"size": 5460
} | [
"org.junit.Test"
]
| import org.junit.Test; | import org.junit.*; | [
"org.junit"
]
| org.junit; | 338,833 |
@Override
public void onReceive(Context context, Intent intent) {
try {
String event = intent.getAction();
Log_OC.d(TAG, "Received broadcast " + event);
String accountName = intent.getStringExtra(FileSyncAdapter.EXTRA_ACCOUNT_NAME);
String syncFolderRemotePath = intent.getStringExtra(FileSyncAdapter.EXTRA_FOLDER_PATH);
RemoteOperationResult syncResult = (RemoteOperationResult)
DataHolderUtil.getInstance().retrieve(intent.getStringExtra(FileSyncAdapter.EXTRA_RESULT));
boolean sameAccount = getAccount() != null && accountName.equals(getAccount().name)
&& getStorageManager() != null;
if (sameAccount) {
if (FileSyncAdapter.EVENT_FULL_SYNC_START.equals(event)) {
mSyncInProgress = true;
} else {
OCFile currentFile = (getFile() == null) ? null :
getStorageManager().getFileByPath(getFile().getRemotePath());
OCFile currentDir = (getCurrentFolder() == null) ? null :
getStorageManager().getFileByPath(getCurrentFolder().getRemotePath());
if (currentDir == null) {
// current folder was removed from the server
DisplayUtils.showSnackMessage(getActivity(),
R.string.sync_current_folder_was_removed,
getCurrentFolder().getFileName());
browseToRoot();
} else {
if (currentFile == null && !getFile().isFolder()) {
// currently selected file was removed in the server, and now we know it
currentFile = currentDir;
}
if (currentDir.getRemotePath().equals(syncFolderRemotePath)) {
OCFileListFragment fileListFragment = getListOfFilesFragment();
if (fileListFragment != null) {
fileListFragment.listDirectory(currentDir, false, false);
}
}
setFile(currentFile);
}
mSyncInProgress = (!FileSyncAdapter.EVENT_FULL_SYNC_END.equals(event) &&
!RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED.equals(event));
if (RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED.equals(event) &&
/// TODO refactor and make common
syncResult != null && !syncResult.isSuccess()) {
if (ResultCode.UNAUTHORIZED.equals(syncResult.getCode()) || (syncResult.isException()
&& syncResult.getException() instanceof AuthenticatorException)) {
requestCredentialsUpdate(context);
} else if (RemoteOperationResult.ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED
.equals(syncResult.getCode())) {
showUntrustedCertDialog(syncResult);
}
}
}
DataHolderUtil.getInstance().delete(intent.getStringExtra(FileSyncAdapter.EXTRA_RESULT));
Log_OC.d(TAG, "Setting progress visibility to " + mSyncInProgress);
getListOfFilesFragment().setLoading(mSyncInProgress);
setBackgroundText();
}
} catch (RuntimeException e) {
// avoid app crashes after changing the serial id of RemoteOperationResult
// in owncloud library with broadcast notifications pending to process
DataHolderUtil.getInstance().delete(intent.getStringExtra(FileSyncAdapter.EXTRA_RESULT));
}
}
} | void function(Context context, Intent intent) { try { String event = intent.getAction(); Log_OC.d(TAG, STR + event); String accountName = intent.getStringExtra(FileSyncAdapter.EXTRA_ACCOUNT_NAME); String syncFolderRemotePath = intent.getStringExtra(FileSyncAdapter.EXTRA_FOLDER_PATH); RemoteOperationResult syncResult = (RemoteOperationResult) DataHolderUtil.getInstance().retrieve(intent.getStringExtra(FileSyncAdapter.EXTRA_RESULT)); boolean sameAccount = getAccount() != null && accountName.equals(getAccount().name) && getStorageManager() != null; if (sameAccount) { if (FileSyncAdapter.EVENT_FULL_SYNC_START.equals(event)) { mSyncInProgress = true; } else { OCFile currentFile = (getFile() == null) ? null : getStorageManager().getFileByPath(getFile().getRemotePath()); OCFile currentDir = (getCurrentFolder() == null) ? null : getStorageManager().getFileByPath(getCurrentFolder().getRemotePath()); if (currentDir == null) { DisplayUtils.showSnackMessage(getActivity(), R.string.sync_current_folder_was_removed, getCurrentFolder().getFileName()); browseToRoot(); } else { if (currentFile == null && !getFile().isFolder()) { currentFile = currentDir; } if (currentDir.getRemotePath().equals(syncFolderRemotePath)) { OCFileListFragment fileListFragment = getListOfFilesFragment(); if (fileListFragment != null) { fileListFragment.listDirectory(currentDir, false, false); } } setFile(currentFile); } mSyncInProgress = (!FileSyncAdapter.EVENT_FULL_SYNC_END.equals(event) && !RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED.equals(event)); if (RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED.equals(event) && syncResult != null && !syncResult.isSuccess()) { if (ResultCode.UNAUTHORIZED.equals(syncResult.getCode()) (syncResult.isException() && syncResult.getException() instanceof AuthenticatorException)) { requestCredentialsUpdate(context); } else if (RemoteOperationResult.ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED .equals(syncResult.getCode())) { showUntrustedCertDialog(syncResult); } } } DataHolderUtil.getInstance().delete(intent.getStringExtra(FileSyncAdapter.EXTRA_RESULT)); Log_OC.d(TAG, STR + mSyncInProgress); getListOfFilesFragment().setLoading(mSyncInProgress); setBackgroundText(); } } catch (RuntimeException e) { DataHolderUtil.getInstance().delete(intent.getStringExtra(FileSyncAdapter.EXTRA_RESULT)); } } } | /**
* {@link BroadcastReceiver} to enable syncing feedback in UI
*/ | <code>BroadcastReceiver</code> to enable syncing feedback in UI | onReceive | {
"repo_name": "nextcloud/android",
"path": "src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.java",
"license": "gpl-2.0",
"size": 23129
} | [
"android.accounts.AuthenticatorException",
"android.content.Context",
"android.content.Intent",
"android.util.Log",
"com.owncloud.android.datamodel.OCFile",
"com.owncloud.android.lib.common.operations.RemoteOperationResult",
"com.owncloud.android.operations.RefreshFolderOperation",
"com.owncloud.android.syncadapter.FileSyncAdapter",
"com.owncloud.android.ui.fragment.OCFileListFragment",
"com.owncloud.android.utils.DataHolderUtil",
"com.owncloud.android.utils.DisplayUtils"
]
| import android.accounts.AuthenticatorException; import android.content.Context; import android.content.Intent; import android.util.Log; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.operations.RefreshFolderOperation; import com.owncloud.android.syncadapter.FileSyncAdapter; import com.owncloud.android.ui.fragment.OCFileListFragment; import com.owncloud.android.utils.DataHolderUtil; import com.owncloud.android.utils.DisplayUtils; | import android.accounts.*; import android.content.*; import android.util.*; import com.owncloud.android.datamodel.*; import com.owncloud.android.lib.common.operations.*; import com.owncloud.android.operations.*; import com.owncloud.android.syncadapter.*; import com.owncloud.android.ui.fragment.*; import com.owncloud.android.utils.*; | [
"android.accounts",
"android.content",
"android.util",
"com.owncloud.android"
]
| android.accounts; android.content; android.util; com.owncloud.android; | 1,367,529 |
private static void findResourcesInDirectory(GridUriDeploymentFileResourceLoader clsLdr, File dir,
Set<Class<? extends ComputeTask<?, ?>>> rsrcs) {
assert dir.isDirectory() == true;
for (File file : dir.listFiles()) {
if (file.isDirectory()) {
// Recurse down into directories.
findResourcesInDirectory(clsLdr, file, rsrcs);
}
else {
Class<? extends ComputeTask<?, ?>> rsrc = null;
try {
rsrc = clsLdr.createResource(file.getAbsolutePath(), true);
}
catch (IgniteSpiException e) {
// Must never happen because we use 'ignoreUnknownRsrc=true'.
assert false;
}
if (rsrc != null)
rsrcs.add(rsrc);
}
}
} | static void function(GridUriDeploymentFileResourceLoader clsLdr, File dir, Set<Class<? extends ComputeTask<?, ?>>> rsrcs) { assert dir.isDirectory() == true; for (File file : dir.listFiles()) { if (file.isDirectory()) { findResourcesInDirectory(clsLdr, file, rsrcs); } else { Class<? extends ComputeTask<?, ?>> rsrc = null; try { rsrc = clsLdr.createResource(file.getAbsolutePath(), true); } catch (IgniteSpiException e) { assert false; } if (rsrc != null) rsrcs.add(rsrc); } } } | /**
* Recursively scans given directory and load all found files by loader.
*
* @param clsLdr Loader that could load class from given file.
* @param dir Directory which should be scanned.
* @param rsrcs Set which will be filled in.
*/ | Recursively scans given directory and load all found files by loader | findResourcesInDirectory | {
"repo_name": "ilantukh/ignite",
"path": "modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentDiscovery.java",
"license": "apache-2.0",
"size": 4551
} | [
"java.io.File",
"java.util.Set",
"org.apache.ignite.compute.ComputeTask",
"org.apache.ignite.spi.IgniteSpiException"
]
| import java.io.File; import java.util.Set; import org.apache.ignite.compute.ComputeTask; import org.apache.ignite.spi.IgniteSpiException; | import java.io.*; import java.util.*; import org.apache.ignite.compute.*; import org.apache.ignite.spi.*; | [
"java.io",
"java.util",
"org.apache.ignite"
]
| java.io; java.util; org.apache.ignite; | 2,267,474 |
@Test
public void testRDNCloningOneNameComponent() throws LdapException
{
Rdn rdn = new Rdn( schemaManager, "CN", "B" );
Rdn rdnClone = rdn.clone();
rdn = new Rdn( schemaManager, "cn=d" );
assertEquals( "b", rdnClone.getValue( "Cn" ) );
} | void function() throws LdapException { Rdn rdn = new Rdn( schemaManager, "CN", "B" ); Rdn rdnClone = rdn.clone(); rdn = new Rdn( schemaManager, "cn=d" ); assertEquals( "b", rdnClone.getValue( "Cn" ) ); } | /**
* Test the clone method for a Rdn.
*
* @throws LdapException
*/ | Test the clone method for a Rdn | testRDNCloningOneNameComponent | {
"repo_name": "darranl/directory-shared",
"path": "integ/src/test/java/org/apache/directory/api/ldap/model/name/SchemaAwareRdnTest.java",
"license": "apache-2.0",
"size": 35457
} | [
"org.apache.directory.api.ldap.model.exception.LdapException",
"org.apache.directory.api.ldap.model.name.Rdn",
"org.junit.Assert"
]
| import org.apache.directory.api.ldap.model.exception.LdapException; import org.apache.directory.api.ldap.model.name.Rdn; import org.junit.Assert; | import org.apache.directory.api.ldap.model.exception.*; import org.apache.directory.api.ldap.model.name.*; import org.junit.*; | [
"org.apache.directory",
"org.junit"
]
| org.apache.directory; org.junit; | 779,264 |
IHASnapshotDigestResponse computeHASnapshotDigest(IHASnapshotDigestRequest req)
throws IOException, NoSuchAlgorithmException, DigestException;
//
// @Deprecated
// Future<Void> globalWriteLock(IHAGlobalWriteLockRequest req)
// throws IOException, TimeoutException, InterruptedException;
| IHASnapshotDigestResponse computeHASnapshotDigest(IHASnapshotDigestRequest req) throws IOException, NoSuchAlgorithmException, DigestException; | /**
* Compute the digest of the entire snapshot file - <strong>THIS METHOD IS
* ONLY FOR DIAGNOSTIC PURPOSES.</strong> This digest is computed for the
* compressed data so it may be compared directly with the digest of the
* backing store from which the snapshot was obtained.
*
* @throws FileNotFoundException
* if no snapshot exists for that commit point.
*/ | Compute the digest of the entire snapshot file - THIS METHOD IS ONLY FOR DIAGNOSTIC PURPOSES. This digest is computed for the compressed data so it may be compared directly with the digest of the backing store from which the snapshot was obtained | computeHASnapshotDigest | {
"repo_name": "rac021/blazegraph_1_5_3_cluster_2_nodes",
"path": "bigdata/src/java/com/bigdata/ha/HAGlue.java",
"license": "gpl-2.0",
"size": 13598
} | [
"com.bigdata.ha.msg.IHASnapshotDigestRequest",
"com.bigdata.ha.msg.IHASnapshotDigestResponse",
"java.io.IOException",
"java.security.DigestException",
"java.security.NoSuchAlgorithmException"
]
| import com.bigdata.ha.msg.IHASnapshotDigestRequest; import com.bigdata.ha.msg.IHASnapshotDigestResponse; import java.io.IOException; import java.security.DigestException; import java.security.NoSuchAlgorithmException; | import com.bigdata.ha.msg.*; import java.io.*; import java.security.*; | [
"com.bigdata.ha",
"java.io",
"java.security"
]
| com.bigdata.ha; java.io; java.security; | 278,463 |
@Test()
public void testGetSearchReferenceMissing()
throws Exception
{
final SearchResultReference r = new SearchResultReference(
new String[] { "ldap://server.example.com:389/dc=example,dc=com" },
null);
final GetServerIDResponseControl c = GetServerIDResponseControl.get(r);
assertNull(c);
} | @Test() void function() throws Exception { final SearchResultReference r = new SearchResultReference( new String[] { "ldap: null); final GetServerIDResponseControl c = GetServerIDResponseControl.get(r); assertNull(c); } | /**
* Tests the {@code get} method with a result that does not contain a get
* server ID response control.
*
* @throws Exception If an unexpected problem occurs.
*/ | Tests the get method with a result that does not contain a get server ID response control | testGetSearchReferenceMissing | {
"repo_name": "UnboundID/ldapsdk",
"path": "tests/unit/src/com/unboundid/ldap/sdk/unboundidds/controls/GetServerIDResponseControlTestCase.java",
"license": "gpl-2.0",
"size": 11471
} | [
"com.unboundid.ldap.sdk.SearchResultReference",
"org.testng.annotations.Test"
]
| import com.unboundid.ldap.sdk.SearchResultReference; import org.testng.annotations.Test; | import com.unboundid.ldap.sdk.*; import org.testng.annotations.*; | [
"com.unboundid.ldap",
"org.testng.annotations"
]
| com.unboundid.ldap; org.testng.annotations; | 925,537 |
public final synchronized byte[] buffer ()
{
try
{
_output.flush();
}
catch (final IOException ex)
{
// ignore?
}
return _outputStream.toByteArray();
} | final synchronized byte[] function () { try { _output.flush(); } catch (final IOException ex) { } return _outputStream.toByteArray(); } | /**
* Return the byte array used to store data types.
*/ | Return the byte array used to store data types | buffer | {
"repo_name": "nmcl/scratch",
"path": "graalvm/transactions/fork/narayana/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/OutputBuffer.java",
"license": "apache-2.0",
"size": 11356
} | [
"java.io.IOException"
]
| import java.io.IOException; | import java.io.*; | [
"java.io"
]
| java.io; | 550,771 |
public void addAllItems(List<E> data) {
if (data != null) {
List<T> tmp = new ArrayList<T>();
for (E item : data) {
T w = createWrapper();
w.data = item;
tmp.add(w);
}
addAll(tmp);
}
} | void function(List<E> data) { if (data != null) { List<T> tmp = new ArrayList<T>(); for (E item : data) { T w = createWrapper(); w.data = item; tmp.add(w); } addAll(tmp); } } | /**
* Adds all items to the list.
*
* @param data the list of items.
*/ | Adds all items to the list | addAllItems | {
"repo_name": "lorislab/smonitor",
"path": "smonitor-web/src/main/java/org/lorislab/smonitor/gwt/uc/table/EntityDataGrid.java",
"license": "apache-2.0",
"size": 13052
} | [
"java.util.ArrayList",
"java.util.List"
]
| import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
]
| java.util; | 2,389,050 |
protected void drawBar(Canvas canvas, float xMin, float yMin, float xMax,
float yMax, float halfDiffX, int seriesNr, int seriesIndex,
Paint paint) {
int scale = mDataset.getSeriesAt(seriesIndex).getScaleNumber();
if (mType == Type.STACKED) {
drawBar(canvas, xMin - halfDiffX, yMax, xMax + halfDiffX, yMin,
scale, seriesIndex, paint);
} else {
float startX = xMin - seriesNr * halfDiffX + seriesIndex * 2
* halfDiffX;
drawBar(canvas, startX, yMax, startX + 2 * halfDiffX, yMin, scale,
seriesIndex, paint);
}
} | void function(Canvas canvas, float xMin, float yMin, float xMax, float yMax, float halfDiffX, int seriesNr, int seriesIndex, Paint paint) { int scale = mDataset.getSeriesAt(seriesIndex).getScaleNumber(); if (mType == Type.STACKED) { drawBar(canvas, xMin - halfDiffX, yMax, xMax + halfDiffX, yMin, scale, seriesIndex, paint); } else { float startX = xMin - seriesNr * halfDiffX + seriesIndex * 2 * halfDiffX; drawBar(canvas, startX, yMax, startX + 2 * halfDiffX, yMin, scale, seriesIndex, paint); } } | /**
* Draws a bar.
*
* @param canvas
* the canvas
* @param xMin
* the X axis minimum
* @param yMin
* the Y axis minimum
* @param xMax
* the X axis maximum
* @param yMax
* the Y axis maximum
* @param halfDiffX
* half the size of a bar
* @param seriesNr
* the total number of series
* @param seriesIndex
* the current series index
* @param paint
* the paint
*/ | Draws a bar | drawBar | {
"repo_name": "panthole/AndroidChart",
"path": "src/com/panthole/androidchart/chart/BarChart.java",
"license": "mit",
"size": 16236
} | [
"android.graphics.Canvas",
"android.graphics.Paint"
]
| import android.graphics.Canvas; import android.graphics.Paint; | import android.graphics.*; | [
"android.graphics"
]
| android.graphics; | 1,905,676 |
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof DialCap)) {
return false;
}
DialCap that = (DialCap) obj;
if (this.radius != that.radius) {
return false;
}
if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) {
return false;
}
if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) {
return false;
}
if (!this.outlineStroke.equals(that.outlineStroke)) {
return false;
}
return super.equals(obj);
} | boolean function(Object obj) { if (obj == this) { return true; } if (!(obj instanceof DialCap)) { return false; } DialCap that = (DialCap) obj; if (this.radius != that.radius) { return false; } if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!this.outlineStroke.equals(that.outlineStroke)) { return false; } return super.equals(obj); } | /**
* Tests this instance for equality with an arbitrary object.
*
* @param obj the object (<code>null</code> permitted).
*
* @return A boolean.
*/ | Tests this instance for equality with an arbitrary object | equals | {
"repo_name": "greearb/jfreechart-fse-ct",
"path": "src/main/java/org/jfree/chart/plot/dial/DialCap.java",
"license": "lgpl-2.1",
"size": 10547
} | [
"org.jfree.chart.util.PaintUtilities"
]
| import org.jfree.chart.util.PaintUtilities; | import org.jfree.chart.util.*; | [
"org.jfree.chart"
]
| org.jfree.chart; | 2,389,375 |
@SuppressWarnings("unchecked")
private StringBuffer buildSubFolderMenu(StringBuffer stringbuf, Folder thisFolder, int numberOfLevels, int currentLevel, boolean addSpans, boolean isFirstItem, String firstItemClass, boolean isLastItem, String lastItemClass, String menuIdPrefix) throws DotStateException, DotDataException, DotSecurityException {
String thisFolderPath = "";
try {
thisFolderPath = APILocator.getIdentifierAPI().find(thisFolder).getPath();
} catch (Exception e1) {
Logger.error(NavigationWebAPI.class,e1.getMessage(),e1);
}
stringbuf.append("#set ($VTLSERVLET_DECODED_URI=\"$UtilMethods.decodeURL($VTLSERVLET_URI)\")");
stringbuf.append("#if ($UtilMethods.inString($VTLSERVLET_DECODED_URI,\"").append(thisFolderPath).append("\") || ($UtilMethods.isSet($openAllLevels) && $openAllLevels == true))");
stringbuf.append("<li class=\"active\" id=\"").append(menuIdPrefix+ thisFolder.getName()).append("\">");
stringbuf.append(" #else ");
stringbuf.append("<li id=\"").append(menuIdPrefix).append(thisFolder.getName()).append("\">");
stringbuf.append(" #end ");
// gets menu items for this folder
java.util.List<Inode> itemsChildrenList2 = new ArrayList();
try {
itemsChildrenList2 = APILocator.getFolderAPI().findMenuItems(thisFolder, user, true);
} catch (Exception e1) {
Logger.error(NavigationWebAPI.class,e1.getMessage(),e1);
}
// do we have any children?
boolean nextLevelItems = (itemsChildrenList2.size() > 0 && currentLevel < numberOfLevels);
String folderChildPath = thisFolderPath.substring(0, thisFolderPath.length() - 1);
folderChildPath = folderChildPath.substring(0, folderChildPath.lastIndexOf("/"));
stringbuf.append("<a ");
if(isFirstItem && !firstItemClass.equals("")){
stringbuf.append(firstItemClass).append(currentLevel).append("\"");
}else if(isLastItem && !lastItemClass.equals("")){
stringbuf.append(lastItemClass).append(currentLevel).append("\"");
}
stringbuf.append(" href=\"").append(UtilMethods.encodeURIComponent(thisFolderPath)).append("\">");
stringbuf.append((addSpans?"<span>":"")).append(UtilHTML.escapeHTMLSpecialChars(thisFolder.getTitle())).append((addSpans?"</span>":""));
stringbuf.append("</a>");
if (currentLevel < numberOfLevels) {
if (nextLevelItems) {
stringbuf.append("#set ($VTLSERVLET_DECODED_URI=\"$UtilMethods.decodeURL($VTLSERVLET_URI)\")");
stringbuf.append("#if ($UtilMethods.inString($VTLSERVLET_DECODED_URI,\"").append(thisFolderPath).append("\") || ($UtilMethods.isSet($openAllLevels) && $openAllLevels == true))");
stringbuf.append("<ul>");
}
isLastItem = false;
isFirstItem = true;
int index = 0;
for (Inode childChild2 : itemsChildrenList2) {
index++;
if(index == itemsChildrenList2.size()){
isLastItem = true;
isFirstItem = false;
}else if(index > 1){
isFirstItem = false;
}
String styleClass = " ";
if(isFirstItem && !firstItemClass.equals("")){
styleClass =firstItemClass+currentLevel+"\"";
} else if(isLastItem && !lastItemClass.equals("")){
styleClass = lastItemClass+currentLevel+"\"";
}
if (childChild2 instanceof Folder) {
Folder folderChildChild2 = (Folder) childChild2;
String path = "";
try {
path = APILocator.getIdentifierAPI().find(folderChildChild2).getPath();
} catch (Exception e) {
Logger.error(NavigationWebAPI.class,e.getMessage(),e);
}
Logger.debug(this, "folderChildChild2= " + folderChildChild2.getTitle() + " currentLevel=" + currentLevel + " numberOfLevels="
+ numberOfLevels);
if (currentLevel <= numberOfLevels) {
stringbuf = buildSubFolderMenu(stringbuf, folderChildChild2, numberOfLevels, currentLevel + 1, addSpans,isFirstItem, firstItemClass, isLastItem, lastItemClass, menuIdPrefix);
} else {
stringbuf.append("<li><a href=\"").append(UtilMethods.encodeURIComponent(path)).append("index.").append(Config.getStringProperty("VELOCITY_PAGE_EXTENSION")).append("\">");
stringbuf.append((addSpans?"<span>":"")).append(UtilHTML.escapeHTMLSpecialChars(folderChildChild2.getTitle())).append((addSpans?"</span>":"")).append("</a></li>");
}
} else if (childChild2 instanceof Link) {
if (((Link) childChild2).isWorking() && !((Link) childChild2).isDeleted()) {
Link link = (Link) childChild2;
if(link.getLinkType().equals(LinkType.CODE.toString())) {
stringbuf.append("$UtilMethods.evaluateVelocity($UtilMethods.restoreVariableForVelocity('").append(UtilMethods.espaceVariableForVelocity(link.getLinkCode())).append("'), $velocityContext) ");
} else {
stringbuf.append("#set ($VTLSERVLET_DECODED_URI=\"$UtilMethods.decodeURL($VTLSERVLET_URI)\")");
stringbuf.append("#if ($VTLSERVLET_DECODED_URI != '").append(((Link) childChild2).getProtocal()).append(((Link) childChild2).getUrl()).append("')");
stringbuf.append("<li><a ").append(styleClass).append(" href=\"").append(((Link) childChild2).getProtocal()).append(((Link) childChild2).getUrl()).append("\" target=\"")
.append(((Link) childChild2).getTarget()).append("\">");
stringbuf.append((addSpans?"<span>":"")).append(UtilHTML.escapeHTMLSpecialChars(((Link) childChild2).getTitle())).append((addSpans?"</span>":"")).append("</a></li>");
stringbuf.append(" #else ");
stringbuf.append("<li class=\"active\"><a ").append(styleClass).append(" href=\"").append(((Link) childChild2).getProtocal()).append(((Link) childChild2).getUrl())
.append("\" target=\"").append(((Link) childChild2).getTarget()).append("\">");
stringbuf.append((addSpans?"<span>":"")).append(UtilHTML.escapeHTMLSpecialChars(((Link) childChild2).getTitle())).append((addSpans?"</span>":"")).append("</a></li>");
stringbuf.append(" #end ");
}
}
} else if (childChild2 instanceof HTMLPage) {
if (((HTMLPage) childChild2).isWorking() && !((HTMLPage) childChild2).isDeleted()) {
stringbuf.append("#set ($VTLSERVLET_DECODED_URI=\"$UtilMethods.decodeURL($VTLSERVLET_URI)\")");
stringbuf.append("#if ($VTLSERVLET_DECODED_URI != '" + thisFolderPath + ((HTMLPage) childChild2).getPageUrl() + "')");
stringbuf.append("<li><a ").append(styleClass).append(" href=\"").append(UtilMethods.encodeURIComponent(thisFolderPath + ((HTMLPage) childChild2).getPageUrl())).append("\">");
stringbuf.append((addSpans?"<span>":"")).append(UtilHTML.escapeHTMLSpecialChars(((HTMLPage) childChild2).getTitle())).append((addSpans?"</span>":"")).append("</a></li>");
stringbuf.append(" #else ");
stringbuf.append("<li class=\"active\"><a ").append(styleClass).append(" href=\"").append(UtilMethods.encodeURIComponent(thisFolderPath + ((HTMLPage) childChild2).getPageUrl())).append("\">");
stringbuf.append((addSpans?"<span>":"")).append(UtilHTML.escapeHTMLSpecialChars(((HTMLPage) childChild2).getTitle())).append((addSpans?"</span>":"")).append("</a></li>");
stringbuf.append(" #end ");
}
} else if (childChild2 instanceof IFileAsset) {
if (((IFileAsset) childChild2).isWorking() && !((IFileAsset) childChild2).isDeleted()) {
stringbuf.append("#set ($VTLSERVLET_DECODED_URI=\"$UtilMethods.decodeURL($VTLSERVLET_URI)\")");
stringbuf.append("#if ($VTLSERVLET_DECODED_URI != '").append(thisFolderPath).append(((IFileAsset) childChild2).getFileName()).append("')");
stringbuf.append("<li><a ").append(styleClass).append(" href=\"").append(UtilMethods.encodeURIComponent(thisFolderPath + ((IFileAsset) childChild2).getFileName())).append("\">");
stringbuf.append((addSpans?"<span>":"")).append(UtilHTML.escapeHTMLSpecialChars(((IFileAsset) childChild2).getTitle())).append((addSpans?"</span>":"")).append("</a></li>");
stringbuf.append(" #else ");
stringbuf.append("<li class=\"active\"><a ").append(styleClass).append(" href=\"").append(UtilMethods.encodeURIComponent(thisFolderPath + ((IFileAsset) childChild2).getFileName())).append("\">");
stringbuf.append((addSpans?"<span>":"")).append(UtilHTML.escapeHTMLSpecialChars(((IFileAsset) childChild2).getTitle())).append((addSpans?"</span>":"")).append("</a></li>");
stringbuf.append(" #end ");
}
}
}
}
if (nextLevelItems) {
stringbuf.append("</ul>");
stringbuf.append(" #end ");
}
stringbuf.append("</li>");
return stringbuf;
} | @SuppressWarnings(STR) StringBuffer function(StringBuffer stringbuf, Folder thisFolder, int numberOfLevels, int currentLevel, boolean addSpans, boolean isFirstItem, String firstItemClass, boolean isLastItem, String lastItemClass, String menuIdPrefix) throws DotStateException, DotDataException, DotSecurityException { String thisFolderPath = STR#set ($VTLSERVLET_DECODED_URI=\STR)STR#if ($UtilMethods.inString($VTLSERVLET_DECODED_URI,\STR\") ($UtilMethods.isSet($openAllLevels) && $openAllLevels == true))STR<li class=\"active\STRSTR\">STR #else STR<li id=\"STR\">STR #end "); java.util.List<Inode> itemsChildrenList2 = new ArrayList(); try { itemsChildrenList2 = APILocator.getFolderAPI().findMenuItems(thisFolder, user, true); } catch (Exception e1) { Logger.error(NavigationWebAPI.class,e1.getMessage(),e1); } boolean nextLevelItems = (itemsChildrenList2.size() > 0 && currentLevel < numberOfLevels); String folderChildPath = thisFolderPath.substring(0, thisFolderPath.length() - 1); folderChildPath = folderChildPath.substring(0, folderChildPath.lastIndexOf("/")); stringbuf.append(STR); if(isFirstItem && !firstItemClass.equals(STR\STRSTR\STR href=\STR\">"); stringbuf.append((addSpans?STR:STR</span>":"STR</a>STR#set ($VTLSERVLET_DECODED_URI=\STR)STR#if ($UtilMethods.inString($VTLSERVLET_DECODED_URI,\STR\") ($UtilMethods.isSet($openAllLevels) && $openAllLevels == true))STR<ul>"); } isLastItem = false; isFirstItem = true; int index = 0; for (Inode childChild2 : itemsChildrenList2) { index++; if(index == itemsChildrenList2.size()){ isLastItem = true; isFirstItem = false; }else if(index > 1){ isFirstItem = false; } String styleClass = " "; if(isFirstItem && !firstItemClass.equals(STR\STRSTR\STRSTRfolderChildChild2= STR currentLevel=STR numberOfLevels=STR<li><a href=\STRindex.STRVELOCITY_PAGE_EXTENSIONSTR\">"); stringbuf.append((addSpans?STR:STR</span>":"STR</a></li>STR$UtilMethods.evaluateVelocity($UtilMethods.restoreVariableForVelocity('STR'), $velocityContext) STR#set ($VTLSERVLET_DECODED_URI=\STR)STR#if ($VTLSERVLET_DECODED_URI != 'STR')STR<li><a STR href=\"STR\STRSTR\">"); stringbuf.append((addSpans?STR:STR</span>":"STR</a></li>STR #else STR<li class=\STR><a STR href=\STR\STRSTR\">"); stringbuf.append((addSpans?STR:STR</span>":"STR</a></li>STR #end STR#set ($VTLSERVLET_DECODED_URI=\STR)STR#if ($VTLSERVLET_DECODED_URI != 'STR')STR<li><a STR href=\STR\">"); stringbuf.append((addSpans?STR:STR</span>":"STR</a></li>STR #else STR<li class=\STR><a STR href=\STR\">"); stringbuf.append((addSpans?STR:STR</span>":"STR</a></li>STR #end STR#set ($VTLSERVLET_DECODED_URI=\STR)STR#if ($VTLSERVLET_DECODED_URI != 'STR')STR<li><a STR href=\STR\">"); stringbuf.append((addSpans?STR:STR</span>":"STR</a></li>STR #else STR<li class=\STR><a STR href=\STR\">"); stringbuf.append((addSpans?STR:STR</span>":"STR</a></li>STR #end STR</ul>STR #end STR</li>"); return stringbuf; } | /**
* Concatenate the submenu htmlcode to the menu htmlcode
* @param stringbuf StringBuffer.
* @param thisFolder Folder.
* @param numberOfLevels int.
* @param currentLevel int.
* @param addSpans boolean.
* @param isFirstItem boolean.
* @param firstItemClass String.
* @param isLastItem boolean.
* @param lastItemClass String.
* @param menuIdPrefix String.
* @return StringBuffer
* @throws DotSecurityException
* @throws DotDataException
* @throws DotStateException
*/ | Concatenate the submenu htmlcode to the menu htmlcode | buildSubFolderMenu | {
"repo_name": "ggonzales/ksl",
"path": "src/com/dotmarketing/viewtools/NavigationWebAPI.java",
"license": "gpl-3.0",
"size": 79879
} | [
"com.dotmarketing.beans.Inode",
"com.dotmarketing.business.APILocator",
"com.dotmarketing.business.DotStateException",
"com.dotmarketing.exception.DotDataException",
"com.dotmarketing.exception.DotSecurityException",
"com.dotmarketing.portlets.folders.model.Folder",
"com.dotmarketing.util.Logger",
"com.dotmarketing.util.UtilMethods",
"java.util.ArrayList",
"java.util.List"
]
| import com.dotmarketing.beans.Inode; import com.dotmarketing.business.APILocator; import com.dotmarketing.business.DotStateException; import com.dotmarketing.exception.DotDataException; import com.dotmarketing.exception.DotSecurityException; import com.dotmarketing.portlets.folders.model.Folder; import com.dotmarketing.util.Logger; import com.dotmarketing.util.UtilMethods; import java.util.ArrayList; import java.util.List; | import com.dotmarketing.beans.*; import com.dotmarketing.business.*; import com.dotmarketing.exception.*; import com.dotmarketing.portlets.folders.model.*; import com.dotmarketing.util.*; import java.util.*; | [
"com.dotmarketing.beans",
"com.dotmarketing.business",
"com.dotmarketing.exception",
"com.dotmarketing.portlets",
"com.dotmarketing.util",
"java.util"
]
| com.dotmarketing.beans; com.dotmarketing.business; com.dotmarketing.exception; com.dotmarketing.portlets; com.dotmarketing.util; java.util; | 942,390 |
@Override
public Streamlet<R> repartition(int numPartitions) {
return this.map((a) -> a).setNumPartitions(numPartitions);
} | Streamlet<R> function(int numPartitions) { return this.map((a) -> a).setNumPartitions(numPartitions); } | /**
* Same as filter(Identity).setNumPartitions(nPartitions)
*/ | Same as filter(Identity).setNumPartitions(nPartitions) | repartition | {
"repo_name": "ashvina/heron",
"path": "heron/api/src/java/org/apache/heron/streamlet/impl/StreamletImpl.java",
"license": "apache-2.0",
"size": 19552
} | [
"org.apache.heron.streamlet.Streamlet"
]
| import org.apache.heron.streamlet.Streamlet; | import org.apache.heron.streamlet.*; | [
"org.apache.heron"
]
| org.apache.heron; | 1,011,893 |
@ApiOperation(value = "delete attribute that matches the given id", notes = "Returns status 204 if removal was successful, 404 if id not found, 409 if it couldn't be removed, or 500 if something else went wrong.")
@ApiResponses(value = { @ApiResponse(code = 204, message = "attribute was successfully deleted"),
@ApiResponse(code = 404, message = "could not find an attribute for the given id"),
@ApiResponse(code = 409, message = "attribute couldn't be deleted (maybe there are some existing constraints to related objects)"),
@ApiResponse(code = 500, message = "internal processing error (see body for details)") })
@DELETE
@Path("/{id}")
@Override
public Response deleteObject(@ApiParam(value = "attribute identifier", required = true) @PathParam("id") final String id)
throws DMPControllerException {
return super.deleteObject(id);
} | @ApiOperation(value = STR, notes = STR) @ApiResponses(value = { @ApiResponse(code = 204, message = STR), @ApiResponse(code = 404, message = STR), @ApiResponse(code = 409, message = STR), @ApiResponse(code = 500, message = STR) }) @Path("/{id}") Response function(@ApiParam(value = STR, required = true) @PathParam("id") final String id) throws DMPControllerException { return super.deleteObject(id); } | /**
* This endpoint deletes a attribute that matches the given id.
*
* @param id an attribute identifier
* @return status 204 if removal was successful, 404 if id not found, 409 if it couldn't be removed, or 500 if something else
* went wrong
* @throws DMPControllerException
*/ | This endpoint deletes a attribute that matches the given id | deleteObject | {
"repo_name": "zazi/dswarm",
"path": "controller/src/main/java/org/dswarm/controller/resources/schema/AttributesResource.java",
"license": "apache-2.0",
"size": 7470
} | [
"com.wordnik.swagger.annotations.ApiOperation",
"com.wordnik.swagger.annotations.ApiParam",
"com.wordnik.swagger.annotations.ApiResponse",
"com.wordnik.swagger.annotations.ApiResponses",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"javax.ws.rs.core.Response",
"org.dswarm.controller.DMPControllerException"
]
| import com.wordnik.swagger.annotations.ApiOperation; import com.wordnik.swagger.annotations.ApiParam; import com.wordnik.swagger.annotations.ApiResponse; import com.wordnik.swagger.annotations.ApiResponses; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.Response; import org.dswarm.controller.DMPControllerException; | import com.wordnik.swagger.annotations.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.dswarm.controller.*; | [
"com.wordnik.swagger",
"javax.ws",
"org.dswarm.controller"
]
| com.wordnik.swagger; javax.ws; org.dswarm.controller; | 2,248,670 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<GenericResourceInner> updateAsync(
String resourceGroupName,
String resourceProviderNamespace,
String parentResourcePath,
String resourceType,
String resourceName,
String apiVersion,
GenericResourceInner parameters,
Context context) {
return beginUpdateAsync(
resourceGroupName,
resourceProviderNamespace,
parentResourcePath,
resourceType,
resourceName,
apiVersion,
parameters,
context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<GenericResourceInner> function( String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters, Context context) { return beginUpdateAsync( resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, context) .last() .flatMap(this.client::getLroFinalResultOrError); } | /**
* Updates a resource.
*
* @param resourceGroupName The name of the resource group for the resource. The name is case insensitive.
* @param resourceProviderNamespace The namespace of the resource provider.
* @param parentResourcePath The parent resource identity.
* @param resourceType The resource type of the resource to update.
* @param resourceName The name of the resource to update.
* @param apiVersion The API version to use for the operation.
* @param parameters Parameters for updating the resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return resource information on successful completion of {@link Mono}.
*/ | Updates a resource | updateAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/implementation/ResourcesClientImpl.java",
"license": "mit",
"size": 230225
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.util.Context",
"com.azure.resourcemanager.resources.fluent.models.GenericResourceInner"
]
| import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.util.Context; import com.azure.resourcemanager.resources.fluent.models.GenericResourceInner; | import com.azure.core.annotation.*; import com.azure.core.util.*; import com.azure.resourcemanager.resources.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
]
| com.azure.core; com.azure.resourcemanager; | 573,583 |
public InventoryCloseEvent getEvent()
{
return event;
} | InventoryCloseEvent function() { return event; } | /**
* Returns the associated InventoryCloseEvent
*
* @return the associated InventoryCloseEvent
*/ | Returns the associated InventoryCloseEvent | getEvent | {
"repo_name": "insou22/gui",
"path": "src/main/java/co/insou/gui/page/anvil/AnvilCloseEvent.java",
"license": "unlicense",
"size": 989
} | [
"org.bukkit.event.inventory.InventoryCloseEvent"
]
| import org.bukkit.event.inventory.InventoryCloseEvent; | import org.bukkit.event.inventory.*; | [
"org.bukkit.event"
]
| org.bukkit.event; | 1,443,201 |
public void process(PDFOperator operator, List arguments)
{
context.getGraphicsStack().push( (PDGraphicsState) context.getGraphicsState().clone() );
((PDFObjectExtractor)context).pushClipBounds();
} | void function(PDFOperator operator, List arguments) { context.getGraphicsStack().push( (PDGraphicsState) context.getGraphicsState().clone() ); ((PDFObjectExtractor)context).pushClipBounds(); } | /**
* process : q : Save graphics state.
The operator that is being executed.
List
*/ | process : q : Save graphics state | process | {
"repo_name": "malcolmgreaves/pdfxtk",
"path": "src/main/java/at/ac/tuwien/dbai/pdfwrap/operator/GSave.java",
"license": "apache-2.0",
"size": 2625
} | [
"at.ac.tuwien.dbai.pdfwrap.pdfread.PDFObjectExtractor",
"java.util.List",
"org.apache.pdfbox.pdmodel.graphics.PDGraphicsState",
"org.apache.pdfbox.util.PDFOperator"
]
| import at.ac.tuwien.dbai.pdfwrap.pdfread.PDFObjectExtractor; import java.util.List; import org.apache.pdfbox.pdmodel.graphics.PDGraphicsState; import org.apache.pdfbox.util.PDFOperator; | import at.ac.tuwien.dbai.pdfwrap.pdfread.*; import java.util.*; import org.apache.pdfbox.pdmodel.graphics.*; import org.apache.pdfbox.util.*; | [
"at.ac.tuwien",
"java.util",
"org.apache.pdfbox"
]
| at.ac.tuwien; java.util; org.apache.pdfbox; | 866,476 |
public ByteBuffer memoryChunk(int offset, int size) {
allocateMemory(offset, size);
byte[] chunk;
if (memory != null && size != 0)
chunk = Arrays.copyOfRange(memory.array(), offset, offset + size);
else
chunk = new byte[size];
return ByteBuffer.wrap(chunk);
} | ByteBuffer function(int offset, int size) { allocateMemory(offset, size); byte[] chunk; if (memory != null && size != 0) chunk = Arrays.copyOfRange(memory.array(), offset, offset + size); else chunk = new byte[size]; return ByteBuffer.wrap(chunk); } | /**
* Returns a piece of memory from a given offset and specified size
* If the offset + size exceed the current memory-size,
* the remainder will be filled with empty bytes.
*
* @param offset byte address in memory
* @param size the amount of bytes to return
* @return ByteBuffer containing the chunk of memory data
*/ | Returns a piece of memory from a given offset and specified size If the offset + size exceed the current memory-size, the remainder will be filled with empty bytes | memoryChunk | {
"repo_name": "swaldman/ethereumj",
"path": "ethereumj-core/src/main/java/org/ethereum/vm/Program.java",
"license": "mit",
"size": 34209
} | [
"java.nio.ByteBuffer",
"java.util.Arrays"
]
| import java.nio.ByteBuffer; import java.util.Arrays; | import java.nio.*; import java.util.*; | [
"java.nio",
"java.util"
]
| java.nio; java.util; | 1,855,276 |
public QuoteMode getQuoteMode() {
return quoteMode;
}
| QuoteMode function() { return quoteMode; } | /**
* Gets the quote mode.
* If {@code null} then the default one of the format used.
*
* @return Quote mode
*/ | Gets the quote mode. If null then the default one of the format used | getQuoteMode | {
"repo_name": "joakibj/camel",
"path": "components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvDataFormat.java",
"license": "apache-2.0",
"size": 22813
} | [
"org.apache.commons.csv.QuoteMode"
]
| import org.apache.commons.csv.QuoteMode; | import org.apache.commons.csv.*; | [
"org.apache.commons"
]
| org.apache.commons; | 1,914,280 |
@Test(timeout = 10000)
public void sphereAndBoxTest() {
openPage(application, Pages.IntersectionSphereAndBoxCase.name());
checkScreenshot("sphereAndBoxTest");
} | @Test(timeout = 10000) void function() { openPage(application, Pages.IntersectionSphereAndBoxCase.name()); checkScreenshot(STR); } | /**
* Test for intersection of Sphere and Box.
*/ | Test for intersection of Sphere and Box | sphereAndBoxTest | {
"repo_name": "teamfx/openjfx-8u-dev-tests",
"path": "functional/3DTests/test/test/scenegraph/fx3d/depth/IntersectionTest.java",
"license": "gpl-2.0",
"size": 3361
} | [
"org.junit.Test"
]
| import org.junit.Test; | import org.junit.*; | [
"org.junit"
]
| org.junit; | 1,863,529 |
EAttribute getTDocumentation_Any(); | EAttribute getTDocumentation_Any(); | /**
* Returns the meta object for the attribute list '{@link org.wso2.developerstudio.eclipse.humantask.model.ht.TDocumentation#getAny <em>Any</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute list '<em>Any</em>'.
* @see org.wso2.developerstudio.eclipse.humantask.model.ht.TDocumentation#getAny()
* @see #getTDocumentation()
* @generated
*/ | Returns the meta object for the attribute list '<code>org.wso2.developerstudio.eclipse.humantask.model.ht.TDocumentation#getAny Any</code>'. | getTDocumentation_Any | {
"repo_name": "chanakaudaya/developer-studio",
"path": "humantask/org.wso2.tools.humantask.model/src/org/wso2/carbonstudio/eclipse/humantask/model/ht/HTPackage.java",
"license": "apache-2.0",
"size": 247810
} | [
"org.eclipse.emf.ecore.EAttribute"
]
| import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
]
| org.eclipse.emf; | 1,563,386 |
public List<String> getOperators() {
return operators;
} | List<String> function() { return operators; } | /**
* Gets the list of class names for any custom boolean operators.
* Classes must implement {@link gate.jape.constraint.ConstraintPredicate}.
*/ | Gets the list of class names for any custom boolean operators. Classes must implement <code>gate.jape.constraint.ConstraintPredicate</code> | getOperators | {
"repo_name": "TsangLab/Annotators",
"path": "substrateMINE/plugins/JAPE_Plus/src/gate/jape/plus/Transducer.java",
"license": "mit",
"size": 31241
} | [
"java.util.List"
]
| import java.util.List; | import java.util.*; | [
"java.util"
]
| java.util; | 659,752 |
public OffsetDateTime startTime() {
return this.startTime;
} | OffsetDateTime function() { return this.startTime; } | /**
* Get the startTime property: Start time of the correlated event.
*
* @return the startTime value.
*/ | Get the startTime property: Start time of the correlated event | startTime | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-appservice/src/main/java/com/azure/resourcemanager/appservice/models/DetectorAbnormalTimePeriod.java",
"license": "mit",
"size": 6286
} | [
"java.time.OffsetDateTime"
]
| import java.time.OffsetDateTime; | import java.time.*; | [
"java.time"
]
| java.time; | 2,481,804 |
public void computeConflicts(ExamPlacement exam, Collection<ExamPlacement> other, ExamRoom room, Set<ExamPlacement> conflicts) {
// more than one room is required -> no sharing
if (exam.getRoomPlacements().size() != 1) {
conflicts.addAll(other);
return;
}
computeConflicts(exam.variable(), other, room, conflicts);
} | void function(ExamPlacement exam, Collection<ExamPlacement> other, ExamRoom room, Set<ExamPlacement> conflicts) { if (exam.getRoomPlacements().size() != 1) { conflicts.addAll(other); return; } computeConflicts(exam.variable(), other, room, conflicts); } | /**
* Compute conflicting placement for the case when a given examination needs to be placed in the same room at the same period as the other examinations
* @param exam examination placement in question
* @param other exams currently assigned in the room at the requested period
* @param room examination room in questions
* @param conflicts set of conflicting assignments
*/ | Compute conflicting placement for the case when a given examination needs to be placed in the same room at the same period as the other examinations | computeConflicts | {
"repo_name": "UniTime/cpsolver",
"path": "src/org/cpsolver/exam/model/ExamRoomSharing.java",
"license": "lgpl-3.0",
"size": 6527
} | [
"java.util.Collection",
"java.util.Set"
]
| import java.util.Collection; import java.util.Set; | import java.util.*; | [
"java.util"
]
| java.util; | 635,877 |
return salesLead;
}
/**
* Sets the value of the salesLead property.
*
* @param value
* allowed object is
* {@link MklLead }
| return salesLead; } /** * Sets the value of the salesLead property. * * @param value * allowed object is * {@link MklLead } | /**
* Gets the value of the salesLead property.
*
* @return
* possible object is
* {@link MklLead }
*
*/ | Gets the value of the salesLead property | getSalesLead | {
"repo_name": "dushmis/Oracle-Cloud",
"path": "PaaS_SaaS_Accelerator_RESTFulFacade/XJC_Beans/src/com/oracle/xmlns/apps/marketing/leadmgmt/leads/leadservice/types/CreateSalesLeadAsync.java",
"license": "bsd-3-clause",
"size": 2086
} | [
"com.oracle.xmlns.oracle.apps.marketing.leadmgmt.leads.leadservice.MklLead"
]
| import com.oracle.xmlns.oracle.apps.marketing.leadmgmt.leads.leadservice.MklLead; | import com.oracle.xmlns.oracle.apps.marketing.leadmgmt.leads.leadservice.*; | [
"com.oracle.xmlns"
]
| com.oracle.xmlns; | 341,932 |
public List<LexicalAnalyzer> getAnalyzers() {
return this.analyzers;
} | List<LexicalAnalyzer> function() { return this.analyzers; } | /**
* Get the analyzers property: The analyzers for the index.
*
* @return the analyzers value.
*/ | Get the analyzers property: The analyzers for the index | getAnalyzers | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/models/SearchIndex.java",
"license": "mit",
"size": 17969
} | [
"java.util.List"
]
| import java.util.List; | import java.util.*; | [
"java.util"
]
| java.util; | 2,782,693 |
public SecureRandom getSecureRandom() {
return secureRandom;
} | SecureRandom function() { return secureRandom; } | /**
* Get the SecureRandom used to initialize the Signature service
*/ | Get the SecureRandom used to initialize the Signature service | getSecureRandom | {
"repo_name": "Fabryprog/camel",
"path": "components/camel-crypto/src/main/java/org/apache/camel/component/crypto/DigitalSignatureConfiguration.java",
"license": "apache-2.0",
"size": 16253
} | [
"java.security.SecureRandom"
]
| import java.security.SecureRandom; | import java.security.*; | [
"java.security"
]
| java.security; | 160,708 |
public static horizontalWithVerticalVelocityType fromPerAligned(byte[] encodedBytes) {
horizontalWithVerticalVelocityType result = new horizontalWithVerticalVelocityType();
result.decodePerAligned(new BitStreamReader(encodedBytes));
return result;
} | static horizontalWithVerticalVelocityType function(byte[] encodedBytes) { horizontalWithVerticalVelocityType result = new horizontalWithVerticalVelocityType(); result.decodePerAligned(new BitStreamReader(encodedBytes)); return result; } | /**
* Creates a new horizontalWithVerticalVelocityType from encoded stream.
*/ | Creates a new horizontalWithVerticalVelocityType from encoded stream | fromPerAligned | {
"repo_name": "google/supl-client",
"path": "src/main/java/com/google/location/suplclient/asn1/supl2/lpp/VelocityTypes.java",
"license": "apache-2.0",
"size": 21891
} | [
"com.google.location.suplclient.asn1.base.BitStreamReader"
]
| import com.google.location.suplclient.asn1.base.BitStreamReader; | import com.google.location.suplclient.asn1.base.*; | [
"com.google.location"
]
| com.google.location; | 12,536 |
public DeviceInfo getDeviceInfo() throws V4L4JException {
if (deviceInfo != null)
return deviceInfo;
throw new V4L4JException("Error getting information about device");
} | DeviceInfo function() throws V4L4JException { if (deviceInfo != null) return deviceInfo; throw new V4L4JException(STR); } | /**
* This method creates a <code>DeviceInfo</code> object which contains
* information about this video device. This method (as well as
* {@link #getTunerList()} does not have an equivalent release method. In
* other word, the returned {@link DeviceInfo} object does not need to be
* released before releasing the {@link VideoDevice}.
*
* @return a <code>DeviceInfo</code> object describing this video device.
* @throws V4L4JException
* if there was an error gathering information about the video
* device. This happens for example, when another application is
* currently using the device.
* @see DeviceInfo
*/ | This method creates a <code>DeviceInfo</code> object which contains information about this video device. This method (as well as <code>#getTunerList()</code> does not have an equivalent release method. In other word, the returned <code>DeviceInfo</code> object does not need to be released before releasing the <code>VideoDevice</code> | getDeviceInfo | {
"repo_name": "mailmindlin/v4l4j",
"path": "src/au/edu/jcu/v4l4j/VideoDevice.java",
"license": "gpl-3.0",
"size": 72177
} | [
"au.edu.jcu.v4l4j.exceptions.V4L4JException"
]
| import au.edu.jcu.v4l4j.exceptions.V4L4JException; | import au.edu.jcu.v4l4j.exceptions.*; | [
"au.edu.jcu"
]
| au.edu.jcu; | 2,103,590 |
public TreeMap<byte[], ReferenceContainer<ReferenceType>> searchConjunction(final HandleSet wordHashes, final HandleSet urlselection);
| TreeMap<byte[], ReferenceContainer<ReferenceType>> function(final HandleSet wordHashes, final HandleSet urlselection); | /**
* collect containers for given word hashes. This collection stops if a single container does not contain any references.
* In that case only a empty result is returned.
* @param wordHashes
* @param urlselection
* @return map of wordhash:indexContainer
*/ | collect containers for given word hashes. This collection stops if a single container does not contain any references. In that case only a empty result is returned | searchConjunction | {
"repo_name": "automenta/kelondro",
"path": "src/main/java/yacy/kelondro/rwi/Index.java",
"license": "lgpl-2.1",
"size": 7474
} | [
"java.util.TreeMap",
"net.yacy.cora.storage.HandleSet"
]
| import java.util.TreeMap; import net.yacy.cora.storage.HandleSet; | import java.util.*; import net.yacy.cora.storage.*; | [
"java.util",
"net.yacy.cora"
]
| java.util; net.yacy.cora; | 2,582,520 |
private void initDHKeys(DistributionConfig config) throws Exception {
dhSKAlgo = config.getSecurityUDPDHAlgo();
// Initialize the keys when either the host is a peer that has
// non-blank setting for DH symmetric algo, or this is a server
// that has authenticator defined.
if ((dhSKAlgo != null && dhSKAlgo.length() > 0)) {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DH");
DHParameterSpec dhSpec = new DHParameterSpec(dhP, dhG, dhL);
keyGen.initialize(dhSpec);
KeyPair keypair = keyGen.generateKeyPair();
// Get the generated public and private keys
dhPrivateKey = keypair.getPrivate();
dhPublicKey = keypair.getPublic();
}
} | void function(DistributionConfig config) throws Exception { dhSKAlgo = config.getSecurityUDPDHAlgo(); if ((dhSKAlgo != null && dhSKAlgo.length() > 0)) { KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DH"); DHParameterSpec dhSpec = new DHParameterSpec(dhP, dhG, dhL); keyGen.initialize(dhSpec); KeyPair keypair = keyGen.generateKeyPair(); dhPrivateKey = keypair.getPrivate(); dhPublicKey = keypair.getPublic(); } } | /**
* Initialize the Diffie-Hellman keys. This method is not thread safe
*/ | Initialize the Diffie-Hellman keys. This method is not thread safe | initDHKeys | {
"repo_name": "smanvi-pivotal/geode",
"path": "geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/messenger/GMSEncrypt.java",
"license": "apache-2.0",
"size": 20268
} | [
"java.security.KeyPair",
"java.security.KeyPairGenerator",
"javax.crypto.spec.DHParameterSpec",
"org.apache.geode.distributed.internal.DistributionConfig"
]
| import java.security.KeyPair; import java.security.KeyPairGenerator; import javax.crypto.spec.DHParameterSpec; import org.apache.geode.distributed.internal.DistributionConfig; | import java.security.*; import javax.crypto.spec.*; import org.apache.geode.distributed.internal.*; | [
"java.security",
"javax.crypto",
"org.apache.geode"
]
| java.security; javax.crypto; org.apache.geode; | 1,236,684 |
public static DocumentBuilder getDocumentBuilder() {
try {
return DocumentBuilderFactory.newInstance().newDocumentBuilder();
} catch (Exception exc) {
throw new ExceptionInInitializerError(exc);
}
} | static DocumentBuilder function() { try { return DocumentBuilderFactory.newInstance().newDocumentBuilder(); } catch (Exception exc) { throw new ExceptionInInitializerError(exc); } } | /**
* Create a DocumentBuilder.
* @return a DocumentBuilder.
*/ | Create a DocumentBuilder | getDocumentBuilder | {
"repo_name": "plutext/sling",
"path": "testing/junit/core/src/main/java/org/apache/sling/junit/impl/servlet/XmlRenderer.java",
"license": "apache-2.0",
"size": 9258
} | [
"javax.xml.parsers.DocumentBuilder",
"javax.xml.parsers.DocumentBuilderFactory"
]
| import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; | import javax.xml.parsers.*; | [
"javax.xml"
]
| javax.xml; | 2,585,913 |
public void testSupportLevelFacetWiderThanSuper() throws Exception {
// Including a component, that violates support level restriction, as facet
DefDescriptor<ComponentDef> parentCmp = addSourceAutoCleanup(ComponentDef.class,
"<aura:component extensible='true' support='BETA'></aura:component>", "validateReferences_parentCmp");
DefDescriptor<ComponentDef> childCmp = addSourceAutoCleanup(ComponentDef.class, "<aura:component extends='"
+ parentCmp.getDescriptorName() + "' support='GA'></aura:component>", "validateReferences_childCmp");
DefDescriptor<T> testDesc = addSourceAutoCleanup(getDefClass(),
String.format(baseTag, "", "<" + childCmp.getDescriptorName() + "/>"), "validateReferences_testCmp");
try {
definitionService.getDefinition(testDesc);
fail("Test component's facet has a component which tries to widen the support level of its parent.");
} catch (QuickFixException e) {
checkExceptionFull(e, InvalidDefinitionException.class,
String.format("%s cannot widen the support level to GA from %s's level of BETA",
childCmp.getQualifiedName(), parentCmp.getQualifiedName()), childCmp.getQualifiedName());
}
} | void function() throws Exception { DefDescriptor<ComponentDef> parentCmp = addSourceAutoCleanup(ComponentDef.class, STR, STR); DefDescriptor<ComponentDef> childCmp = addSourceAutoCleanup(ComponentDef.class, STR + parentCmp.getDescriptorName() + STR, STR); DefDescriptor<T> testDesc = addSourceAutoCleanup(getDefClass(), String.format(baseTag, STR<STR/>STRvalidateReferences_testCmpSTRTest component's facet has a component which tries to widen the support level of its parent.STR%s cannot widen the support level to GA from %s's level of BETA", childCmp.getQualifiedName(), parentCmp.getQualifiedName()), childCmp.getQualifiedName()); } } | /**
* InvalidDefinitionException if component has facet that specifies wider support level than super.
*/ | InvalidDefinitionException if component has facet that specifies wider support level than super | testSupportLevelFacetWiderThanSuper | {
"repo_name": "badlogicmanpreet/aura",
"path": "aura-impl/src/test/java/org/auraframework/impl/root/component/BaseComponentDefTest.java",
"license": "apache-2.0",
"size": 99025
} | [
"org.auraframework.def.ComponentDef",
"org.auraframework.def.DefDescriptor"
]
| import org.auraframework.def.ComponentDef; import org.auraframework.def.DefDescriptor; | import org.auraframework.def.*; | [
"org.auraframework.def"
]
| org.auraframework.def; | 1,618,647 |
@Test
public void testTestVectorLengths()
{
assertEquals( "DES length", 56, DES_ENCRYPTED_TIME_STAMP.length );
assertEquals( "DES3 length", 60, TRIPLE_DES_ENCRYPTED_TIME_STAMP.length );
assertEquals( "AES128 length", 56, AES128_ENCRYPTED_TIME_STAMP.length );
assertEquals( "AES256 length", 56, AES256_ENCRYPTED_TIME_STAMP.length );
assertEquals( "RC4-HMAC length", 52, ARCFOUR_ENCRYPTED_TIME_STAMP.length );
} | void function() { assertEquals( STR, 56, DES_ENCRYPTED_TIME_STAMP.length ); assertEquals( STR, 60, TRIPLE_DES_ENCRYPTED_TIME_STAMP.length ); assertEquals( STR, 56, AES128_ENCRYPTED_TIME_STAMP.length ); assertEquals( STR, 56, AES256_ENCRYPTED_TIME_STAMP.length ); assertEquals( STR, 52, ARCFOUR_ENCRYPTED_TIME_STAMP.length ); } | /**
* Tests the lengths of the test vectors for encrypted timestamps for each
* of the supported encryption types. The length of the Kerberos Cipher Text
* is relevant to the structure of the underlying plaintext.
*/ | Tests the lengths of the test vectors for encrypted timestamps for each of the supported encryption types. The length of the Kerberos Cipher Text is relevant to the structure of the underlying plaintext | testTestVectorLengths | {
"repo_name": "drankye/directory-server",
"path": "kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/CipherTextHandlerTest.java",
"license": "apache-2.0",
"size": 21386
} | [
"org.junit.Assert"
]
| import org.junit.Assert; | import org.junit.*; | [
"org.junit"
]
| org.junit; | 2,468,682 |
@Test
public void testUploadNewContentFiresContentUpdatePolicies() throws Exception
{
flag = false;
counter = 0;
policyComponent.bindClassBehaviour(OnContentUpdatePolicy.QNAME, ContentModel.TYPE_CONTENT, new JavaBehaviour(this, "doOnContentUpdate"));
String fileName = "file-" + GUID.generate();
NodeRef fileNoderef = null;
try
{
executeMethod(WebDAV.METHOD_LOCK, fileName, davLockInfoFile, null);
ResultSet resultSet = searchService.query(storeRef, SearchService.LANGUAGE_LUCENE, "PATH:\"/app:company_home//cm:" + fileName + "\"");
fileNoderef = resultSet.getNodeRef(0);
resultSet.close();
assertEquals("File should be locked", LockStatus.LOCK_OWNER, lockService.getLockStatus(fileNoderef));
}
catch (Exception e)
{
fail("Failed to lock a file: " + (e.getCause() != null ? e.getCause().getMessage() : e.getMessage()));
}
txn.commit();
txn = transactionService.getUserTransaction();
txn.begin();
// Construct IF HEADER
String lockToken = fileNoderef.getId() + WebDAV.LOCK_TOKEN_SEPERATOR + AuthenticationUtil.getAdminUserName();
String lockHeaderValue = "(<" + WebDAV.OPAQUE_LOCK_TOKEN + lockToken + ">)";
HashMap<String, String> headers = new HashMap<String, String>();
headers.put(WebDAV.HEADER_IF, lockHeaderValue);
try
{
executeMethod(WebDAV.METHOD_PUT, fileName, testDataFile, headers);
assertTrue("File does not exist.", nodeService.exists(fileNoderef));
assertEquals("Filename is not correct", fileName, nodeService.getProperty(fileNoderef, ContentModel.PROP_NAME));
assertTrue("Expected return status is " + HttpServletResponse.SC_NO_CONTENT + ", but returned is " + response.getStatus(),
HttpServletResponse.SC_NO_CONTENT == response.getStatus());
assertTrue("File should have NO_CONTENT aspect", nodeService.hasAspect(fileNoderef, ContentModel.ASPECT_NO_CONTENT));
InputStream updatedFileIS = fileFolderService.getReader(fileNoderef).getContentInputStream();
byte[] updatedFile = IOUtils.toByteArray(updatedFileIS);
updatedFileIS.close();
assertTrue("The content has to be equal", ArrayUtils.isEquals(testDataFile, updatedFile));
}
catch (Exception e)
{
fail("Failed to upload a file: " + (e.getCause() != null ? e.getCause().getMessage() : e.getMessage()));
}
txn.commit();
txn = transactionService.getUserTransaction();
txn.begin();
headers = new HashMap<String, String>();
headers.put(WebDAV.HEADER_LOCK_TOKEN, "<" + WebDAV.OPAQUE_LOCK_TOKEN + lockToken + ">");
try
{
executeMethod(WebDAV.METHOD_UNLOCK, fileName, null, headers);
assertTrue("Expected return status is " + HttpServletResponse.SC_NO_CONTENT + ", but returned is " + response.getStatus(),
HttpServletResponse.SC_NO_CONTENT == response.getStatus());
assertFalse("File should not have NO_CONTENT aspect", nodeService.hasAspect(fileNoderef, ContentModel.ASPECT_NO_CONTENT));
assertEquals("File should be unlocked", LockStatus.NO_LOCK, lockService.getLockStatus(fileNoderef));
}
catch (Exception e)
{
fail("Failed to unlock a file: " + (e.getCause() != null ? e.getCause().getMessage() : e.getMessage()));
}
assertTrue("onContentUpdate policies were not triggered", flag);
assertEquals("onContentUpdate policies should be triggered only once", counter, 1);
if (fileNoderef != null)
{
nodeService.deleteNode(fileNoderef);
}
}
| void function() throws Exception { flag = false; counter = 0; policyComponent.bindClassBehaviour(OnContentUpdatePolicy.QNAME, ContentModel.TYPE_CONTENT, new JavaBehaviour(this, STR)); String fileName = "file-" + GUID.generate(); NodeRef fileNoderef = null; try { executeMethod(WebDAV.METHOD_LOCK, fileName, davLockInfoFile, null); ResultSet resultSet = searchService.query(storeRef, SearchService.LANGUAGE_LUCENE, STR/app:company_home fileNoderef = resultSet.getNodeRef(0); resultSet.close(); assertEquals(STR, LockStatus.LOCK_OWNER, lockService.getLockStatus(fileNoderef)); } catch (Exception e) { fail(STR + (e.getCause() != null ? e.getCause().getMessage() : e.getMessage())); } txn.commit(); txn = transactionService.getUserTransaction(); txn.begin(); String lockToken = fileNoderef.getId() + WebDAV.LOCK_TOKEN_SEPERATOR + AuthenticationUtil.getAdminUserName(); String lockHeaderValue = "(<" + WebDAV.OPAQUE_LOCK_TOKEN + lockToken + ">)"; HashMap<String, String> headers = new HashMap<String, String>(); headers.put(WebDAV.HEADER_IF, lockHeaderValue); try { executeMethod(WebDAV.METHOD_PUT, fileName, testDataFile, headers); assertTrue(STR, nodeService.exists(fileNoderef)); assertEquals(STR, fileName, nodeService.getProperty(fileNoderef, ContentModel.PROP_NAME)); assertTrue(STR + HttpServletResponse.SC_NO_CONTENT + STR + response.getStatus(), HttpServletResponse.SC_NO_CONTENT == response.getStatus()); assertTrue(STR, nodeService.hasAspect(fileNoderef, ContentModel.ASPECT_NO_CONTENT)); InputStream updatedFileIS = fileFolderService.getReader(fileNoderef).getContentInputStream(); byte[] updatedFile = IOUtils.toByteArray(updatedFileIS); updatedFileIS.close(); assertTrue(STR, ArrayUtils.isEquals(testDataFile, updatedFile)); } catch (Exception e) { fail(STR + (e.getCause() != null ? e.getCause().getMessage() : e.getMessage())); } txn.commit(); txn = transactionService.getUserTransaction(); txn.begin(); headers = new HashMap<String, String>(); headers.put(WebDAV.HEADER_LOCK_TOKEN, "<" + WebDAV.OPAQUE_LOCK_TOKEN + lockToken + ">"); try { executeMethod(WebDAV.METHOD_UNLOCK, fileName, null, headers); assertTrue(STR + HttpServletResponse.SC_NO_CONTENT + STR + response.getStatus(), HttpServletResponse.SC_NO_CONTENT == response.getStatus()); assertFalse(STR, nodeService.hasAspect(fileNoderef, ContentModel.ASPECT_NO_CONTENT)); assertEquals(STR, LockStatus.NO_LOCK, lockService.getLockStatus(fileNoderef)); } catch (Exception e) { fail(STR + (e.getCause() != null ? e.getCause().getMessage() : e.getMessage())); } assertTrue(STR, flag); assertEquals(STR, counter, 1); if (fileNoderef != null) { nodeService.deleteNode(fileNoderef); } } | /**
* Put a content file and check that onContentUpdate fired
* <p>
* Lock the file
* <p>
* Put the contents
* <p>
* Unlock the node
*/ | Put a content file and check that onContentUpdate fired Lock the file Put the contents Unlock the node | testUploadNewContentFiresContentUpdatePolicies | {
"repo_name": "Alfresco/community-edition",
"path": "projects/remote-api/source/test-java/org/alfresco/repo/webdav/WebDAVonContentUpdateTest.java",
"license": "lgpl-3.0",
"size": 12370
} | [
"java.io.InputStream",
"java.util.HashMap",
"javax.servlet.http.HttpServletResponse",
"org.alfresco.model.ContentModel",
"org.alfresco.repo.content.ContentServicePolicies",
"org.alfresco.repo.policy.JavaBehaviour",
"org.alfresco.repo.security.authentication.AuthenticationUtil",
"org.alfresco.service.cmr.lock.LockStatus",
"org.alfresco.service.cmr.repository.NodeRef",
"org.alfresco.service.cmr.search.ResultSet",
"org.alfresco.service.cmr.search.SearchService",
"org.alfresco.util.GUID",
"org.apache.commons.io.IOUtils",
"org.apache.commons.lang.ArrayUtils",
"org.junit.Assert"
]
| import java.io.InputStream; import java.util.HashMap; import javax.servlet.http.HttpServletResponse; import org.alfresco.model.ContentModel; import org.alfresco.repo.content.ContentServicePolicies; import org.alfresco.repo.policy.JavaBehaviour; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.service.cmr.lock.LockStatus; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.search.ResultSet; import org.alfresco.service.cmr.search.SearchService; import org.alfresco.util.GUID; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.ArrayUtils; import org.junit.Assert; | import java.io.*; import java.util.*; import javax.servlet.http.*; import org.alfresco.model.*; import org.alfresco.repo.content.*; import org.alfresco.repo.policy.*; import org.alfresco.repo.security.authentication.*; import org.alfresco.service.cmr.lock.*; import org.alfresco.service.cmr.repository.*; import org.alfresco.service.cmr.search.*; import org.alfresco.util.*; import org.apache.commons.io.*; import org.apache.commons.lang.*; import org.junit.*; | [
"java.io",
"java.util",
"javax.servlet",
"org.alfresco.model",
"org.alfresco.repo",
"org.alfresco.service",
"org.alfresco.util",
"org.apache.commons",
"org.junit"
]
| java.io; java.util; javax.servlet; org.alfresco.model; org.alfresco.repo; org.alfresco.service; org.alfresco.util; org.apache.commons; org.junit; | 274,678 |
public void clear() {
fFrames = new ArrayDeque<Map<String, Value>>();
fObjectVisibility = new ArrayDeque<Boolean>();
pushFrame(true);
}
| void function() { fFrames = new ArrayDeque<Map<String, Value>>(); fObjectVisibility = new ArrayDeque<Boolean>(); pushFrame(true); } | /**
* Restores the initial state, which consists of one level, with one
* frame containing no variable mappings
*/ | Restores the initial state, which consists of one level, with one frame containing no variable mappings | clear | {
"repo_name": "anonymous100001/maxuse",
"path": "src/main/org/tzi/use/util/soil/VariableEnvironment.java",
"license": "gpl-2.0",
"size": 12388
} | [
"java.util.ArrayDeque",
"java.util.Map",
"org.tzi.use.uml.ocl.value.Value"
]
| import java.util.ArrayDeque; import java.util.Map; import org.tzi.use.uml.ocl.value.Value; | import java.util.*; import org.tzi.use.uml.ocl.value.*; | [
"java.util",
"org.tzi.use"
]
| java.util; org.tzi.use; | 959,930 |
public void setRound(TimeUnit round) {
getAxis().getScale().getTime().setRound(round);
} | void function(TimeUnit round) { getAxis().getScale().getTime().setRound(round); } | /**
* If defined, dates will be rounded to the start of this unit.
*
* @param round If defined, this will override the data minimum.
*/ | If defined, dates will be rounded to the start of this unit | setRound | {
"repo_name": "pepstock-org/Charba",
"path": "src/org/pepstock/charba/client/configuration/Time.java",
"license": "apache-2.0",
"size": 5289
} | [
"org.pepstock.charba.client.enums.TimeUnit"
]
| import org.pepstock.charba.client.enums.TimeUnit; | import org.pepstock.charba.client.enums.*; | [
"org.pepstock.charba"
]
| org.pepstock.charba; | 2,228,675 |
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.fillPaint = SerialUtilities.readPaint(stream);
this.outlinePaint = SerialUtilities.readPaint(stream);
}
} | void function(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.fillPaint = SerialUtilities.readPaint(stream); this.outlinePaint = SerialUtilities.readPaint(stream); } } | /**
* Provides serialization support.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/ | Provides serialization support | readObject | {
"repo_name": "Epsilon2/Memetic-Algorithm-for-TSP",
"path": "jfreechart-1.0.16/source/org/jfree/chart/plot/dial/DialPointer.java",
"license": "mit",
"size": 19046
} | [
"java.io.IOException",
"java.io.ObjectInputStream",
"org.jfree.io.SerialUtilities"
]
| import java.io.IOException; import java.io.ObjectInputStream; import org.jfree.io.SerialUtilities; | import java.io.*; import org.jfree.io.*; | [
"java.io",
"org.jfree.io"
]
| java.io; org.jfree.io; | 1,107,471 |
@Test
public void path() throws Exception {
final MkContainer container = new MkGrizzlyContainer()
.next(
new MkAnswer.Simple("hello, world!")
).start();
new RtHub(
container.home()
).entry().fetch();
container.stop();
MatcherAssert.assertThat(
container.take().uri(),
CoreMatchers.equalTo(
new URI("/hub/api/rest")
)
);
} | void function() throws Exception { final MkContainer container = new MkGrizzlyContainer() .next( new MkAnswer.Simple(STR) ).start(); new RtHub( container.home() ).entry().fetch(); container.stop(); MatcherAssert.assertThat( container.take().uri(), CoreMatchers.equalTo( new URI(STR) ) ); } | /**
* RtHub return Request with path.
* @throws Exception If fails
*/ | RtHub return Request with path | path | {
"repo_name": "smallcreep/jb-hub-client",
"path": "src/test/java/com/github/smallcreep/jb/hub/api/RtHubTest.java",
"license": "mit",
"size": 4643
} | [
"com.jcabi.http.mock.MkAnswer",
"com.jcabi.http.mock.MkContainer",
"com.jcabi.http.mock.MkGrizzlyContainer",
"org.hamcrest.CoreMatchers",
"org.hamcrest.MatcherAssert"
]
| import com.jcabi.http.mock.MkAnswer; import com.jcabi.http.mock.MkContainer; import com.jcabi.http.mock.MkGrizzlyContainer; import org.hamcrest.CoreMatchers; import org.hamcrest.MatcherAssert; | import com.jcabi.http.mock.*; import org.hamcrest.*; | [
"com.jcabi.http",
"org.hamcrest"
]
| com.jcabi.http; org.hamcrest; | 2,672,553 |
public static String putPasswordResetPasswordPolicyPattern(final RequestContext requestContext, final String policyPattern) {
val flowScope = requestContext.getFlowScope();
return flowScope.getString("policyPattern");
} | static String function(final RequestContext requestContext, final String policyPattern) { val flowScope = requestContext.getFlowScope(); return flowScope.getString(STR); } | /**
* Put password reset password policy pattern string.
*
* @param requestContext the request context
* @param policyPattern the policy pattern
* @return the string
*/ | Put password reset password policy pattern string | putPasswordResetPasswordPolicyPattern | {
"repo_name": "rrenomeron/cas",
"path": "support/cas-server-support-pm-webflow/src/main/java/org/apereo/cas/pm/web/flow/PasswordManagementWebflowUtils.java",
"license": "apache-2.0",
"size": 4079
} | [
"org.springframework.webflow.execution.RequestContext"
]
| import org.springframework.webflow.execution.RequestContext; | import org.springframework.webflow.execution.*; | [
"org.springframework.webflow"
]
| org.springframework.webflow; | 2,246,019 |
public void generateUpdate(JavaWriter out,
String maskVar,
String pstmt,
String index)
throws IOException
{
// jpa/0x02
//
// int group = getIndex() / 64;
//
// out.println();
// out.println("if (" + maskVar + "_" + group + " != 0L) {");
// out.pushDepth();
generateSetVersion(out, pstmt, index);
// out.popDepth();
// out.println("}");
} | void function(JavaWriter out, String maskVar, String pstmt, String index) throws IOException { generateSetVersion(out, pstmt, index); } | /**
* Generates loading cache
*/ | Generates loading cache | generateUpdate | {
"repo_name": "christianchristensen/resin",
"path": "modules/resin/src/com/caucho/amber/field/VersionField.java",
"license": "gpl-2.0",
"size": 4885
} | [
"com.caucho.java.JavaWriter",
"java.io.IOException"
]
| import com.caucho.java.JavaWriter; import java.io.IOException; | import com.caucho.java.*; import java.io.*; | [
"com.caucho.java",
"java.io"
]
| com.caucho.java; java.io; | 331,406 |
private static Set<String> webXmlRoutes(FilterConfig config) throws Exception
{
//Try to read the routes from the web.xml file
try
{
//Get the routes
String routes = config.getInitParameter("routes");
//Check if routes is set
if(routes == null)
return new HashSet<String>();
//Split the routes
String[] split = routes.split(";");
//Create the set
Set<String> classes = new HashSet<String>();
//Add the classes
for(String item : split)
if(!item.trim().equals(""))
classes.add(item.trim());
//Return the set
return classes;
}
//Failed
catch(Exception ex)
{
throw new Exception("Failed to read web.xml routes", ex);
}
}
| static Set<String> function(FilterConfig config) throws Exception { try { String routes = config.getInitParameter(STR); if(routes == null) return new HashSet<String>(); String[] split = routes.split(";"); Set<String> classes = new HashSet<String>(); for(String item : split) if(!item.trim().equals(STRFailed to read web.xml routes", ex); } } | /**
* Read the routes from the web.xml file.
* @param config
* @return
* @throws Exception
*/ | Read the routes from the web.xml file | webXmlRoutes | {
"repo_name": "jhertz123/katujo-web-utils",
"path": "src/main/java/com/katujo/web/utils/RouterFilter.java",
"license": "mit",
"size": 21400
} | [
"java.util.HashSet",
"java.util.Set",
"javax.servlet.FilterConfig"
]
| import java.util.HashSet; import java.util.Set; import javax.servlet.FilterConfig; | import java.util.*; import javax.servlet.*; | [
"java.util",
"javax.servlet"
]
| java.util; javax.servlet; | 946,257 |
public boolean hasPossibleMethod(String name, Expression arguments) {
int count = 0;
if (arguments instanceof TupleExpression) {
TupleExpression tuple = (TupleExpression) arguments;
// TODO this won't strictly be true when using list expansion in argument calls
count = tuple.getExpressions().size();
}
ClassNode node = this;
do {
for (MethodNode method : getMethods(name)) {
if (method.getParameters().length == count && !method.isStatic()) {
return true;
}
}
node = node.getSuperClass();
}
while (node != null);
return false;
} | boolean function(String name, Expression arguments) { int count = 0; if (arguments instanceof TupleExpression) { TupleExpression tuple = (TupleExpression) arguments; count = tuple.getExpressions().size(); } ClassNode node = this; do { for (MethodNode method : getMethods(name)) { if (method.getParameters().length == count && !method.isStatic()) { return true; } } node = node.getSuperClass(); } while (node != null); return false; } | /**
* Returns true if the given method has a possibly matching instance method with the given name and arguments.
*
* @param name the name of the method of interest
* @param arguments the arguments to match against
* @return true if a matching method was found
*/ | Returns true if the given method has a possibly matching instance method with the given name and arguments | hasPossibleMethod | {
"repo_name": "avafanasiev/groovy",
"path": "src/main/org/codehaus/groovy/ast/ClassNode.java",
"license": "apache-2.0",
"size": 52791
} | [
"org.codehaus.groovy.ast.expr.Expression",
"org.codehaus.groovy.ast.expr.TupleExpression"
]
| import org.codehaus.groovy.ast.expr.Expression; import org.codehaus.groovy.ast.expr.TupleExpression; | import org.codehaus.groovy.ast.expr.*; | [
"org.codehaus.groovy"
]
| org.codehaus.groovy; | 2,433,169 |
private UnzipAar createUnzipAar(
BuildRuleParams originalBuildRuleParams,
SourcePath aarFile,
BuildRuleResolver ruleResolver) {
SourcePathResolver resolver = new SourcePathResolver(ruleResolver);
UnflavoredBuildTarget originalBuildTarget =
originalBuildRuleParams.getBuildTarget().checkUnflavored();
BuildRuleParams unzipAarParams = originalBuildRuleParams.copyWithChanges(
BuildTargets.createFlavoredBuildTarget(originalBuildTarget, AAR_UNZIP_FLAVOR),
Suppliers.ofInstance(ImmutableSortedSet.<BuildRule>of()),
Suppliers.ofInstance(ImmutableSortedSet.copyOf(
resolver.filterBuildRuleInputs(aarFile))));
UnzipAar unzipAar = new UnzipAar(unzipAarParams, resolver, aarFile);
return ruleResolver.addToIndex(unzipAar);
} | UnzipAar function( BuildRuleParams originalBuildRuleParams, SourcePath aarFile, BuildRuleResolver ruleResolver) { SourcePathResolver resolver = new SourcePathResolver(ruleResolver); UnflavoredBuildTarget originalBuildTarget = originalBuildRuleParams.getBuildTarget().checkUnflavored(); BuildRuleParams unzipAarParams = originalBuildRuleParams.copyWithChanges( BuildTargets.createFlavoredBuildTarget(originalBuildTarget, AAR_UNZIP_FLAVOR), Suppliers.ofInstance(ImmutableSortedSet.<BuildRule>of()), Suppliers.ofInstance(ImmutableSortedSet.copyOf( resolver.filterBuildRuleInputs(aarFile)))); UnzipAar unzipAar = new UnzipAar(unzipAarParams, resolver, aarFile); return ruleResolver.addToIndex(unzipAar); } | /**
* Creates a build rule to unzip the prebuilt AAR and get the components needed for the
* AndroidPrebuiltAar, PrebuiltJar, and AndroidResource
*/ | Creates a build rule to unzip the prebuilt AAR and get the components needed for the AndroidPrebuiltAar, PrebuiltJar, and AndroidResource | createUnzipAar | {
"repo_name": "rowillia/buck",
"path": "src/com/facebook/buck/android/AndroidPrebuiltAarDescription.java",
"license": "apache-2.0",
"size": 7902
} | [
"com.facebook.buck.model.BuildTargets",
"com.facebook.buck.model.UnflavoredBuildTarget",
"com.facebook.buck.rules.BuildRule",
"com.facebook.buck.rules.BuildRuleParams",
"com.facebook.buck.rules.BuildRuleResolver",
"com.facebook.buck.rules.SourcePath",
"com.facebook.buck.rules.SourcePathResolver",
"com.google.common.base.Suppliers",
"com.google.common.collect.ImmutableSortedSet"
]
| import com.facebook.buck.model.BuildTargets; import com.facebook.buck.model.UnflavoredBuildTarget; import com.facebook.buck.rules.BuildRule; import com.facebook.buck.rules.BuildRuleParams; import com.facebook.buck.rules.BuildRuleResolver; import com.facebook.buck.rules.SourcePath; import com.facebook.buck.rules.SourcePathResolver; import com.google.common.base.Suppliers; import com.google.common.collect.ImmutableSortedSet; | import com.facebook.buck.model.*; import com.facebook.buck.rules.*; import com.google.common.base.*; import com.google.common.collect.*; | [
"com.facebook.buck",
"com.google.common"
]
| com.facebook.buck; com.google.common; | 1,118,156 |
private void setSourceInfo(Node newNode) {
Node provideStringNode = getProvideStringNode();
int offset = provideStringNode == null ? 0 : getSourceInfoOffset();
Node sourceInfoNode = provideStringNode == null ? firstNode : provideStringNode;
newNode.useSourceInfoWithoutLengthIfMissingFromForTree(sourceInfoNode);
if (offset != 0) {
newNode.setSourceEncodedPositionForTree(
sourceInfoNode.getSourcePosition() + offset);
}
} | void function(Node newNode) { Node provideStringNode = getProvideStringNode(); int offset = provideStringNode == null ? 0 : getSourceInfoOffset(); Node sourceInfoNode = provideStringNode == null ? firstNode : provideStringNode; newNode.useSourceInfoWithoutLengthIfMissingFromForTree(sourceInfoNode); if (offset != 0) { newNode.setSourceEncodedPositionForTree( sourceInfoNode.getSourcePosition() + offset); } } | /**
* Copy source info to the new node.
*/ | Copy source info to the new node | setSourceInfo | {
"repo_name": "anomaly/closure-compiler",
"path": "src/com/google/javascript/jscomp/ProcessClosurePrimitives.java",
"license": "apache-2.0",
"size": 56907
} | [
"com.google.javascript.rhino.Node"
]
| import com.google.javascript.rhino.Node; | import com.google.javascript.rhino.*; | [
"com.google.javascript"
]
| com.google.javascript; | 2,048,665 |
public static Context current() {
Context current = storage().current();
if (current == null) {
return ROOT;
}
return current;
}
final CancellableContext cancellableAncestor;
final Node<Key<?>, Object> keyValueEntries;
// The number parents between this context and the root context.
final int generation;
private Context(Node<Key<?>, Object> keyValueEntries, int generation) {
this.cancellableAncestor = null;
this.keyValueEntries = keyValueEntries;
this.generation = generation;
validateGeneration(generation);
}
private Context(Context parent, Node<Key<?>, Object> keyValueEntries) {
this.cancellableAncestor = cancellableAncestor(parent);
this.keyValueEntries = keyValueEntries;
this.generation = parent.generation + 1;
validateGeneration(generation);
}
private Context() {
this.cancellableAncestor = null;
this.keyValueEntries = null;
this.generation = 0;
validateGeneration(generation);
}
/**
* Create a new context which is independently cancellable and also cascades cancellation from
* its parent. Callers <em>must</em> ensure that either {@link
* CancellableContext#cancel(Throwable)} or {@link CancellableContext#detachAndCancel(Context,
* Throwable)} are called at a later point, in order to allow this context to be garbage
* collected.
*
* <p>Sample usage:
* <pre>
* Context.CancellableContext withCancellation = Context.current().withCancellation();
* try {
* withCancellation.run(new Runnable() {
* public void run() {
* Context current = Context.current();
* while (!current.isCancelled()) {
* keepWorking();
* }
* }
* });
* } finally {
* withCancellation.cancel(null);
* } | static Context function() { Context current = storage().current(); if (current == null) { return ROOT; } return current; } final CancellableContext cancellableAncestor; final Node<Key<?>, Object> keyValueEntries; final int generation; Context(Node<Key<?>, Object> keyValueEntries, int generation) { this.cancellableAncestor = null; this.keyValueEntries = keyValueEntries; this.generation = generation; validateGeneration(generation); } private Context(Context parent, Node<Key<?>, Object> keyValueEntries) { this.cancellableAncestor = cancellableAncestor(parent); this.keyValueEntries = keyValueEntries; this.generation = parent.generation + 1; validateGeneration(generation); } private Context() { this.cancellableAncestor = null; this.keyValueEntries = null; this.generation = 0; validateGeneration(generation); } /** * Create a new context which is independently cancellable and also cascades cancellation from * its parent. Callers <em>must</em> ensure that either { * CancellableContext#cancel(Throwable)} or {@link CancellableContext#detachAndCancel(Context, * Throwable)} are called at a later point, in order to allow this context to be garbage * collected. * * <p>Sample usage: * <pre> * Context.CancellableContext withCancellation = Context.current().withCancellation(); * try { * withCancellation.run(new Runnable() { * public void run() { * Context function = Context.current(); * while (!current.isCancelled()) { * keepWorking(); * } * } * }); * } finally { * withCancellation.cancel(null); * } | /**
* Return the context associated with the current scope, will never return {@code null}.
*
* <p>Will never return {@link CancellableContext} even if one is attached, instead a
* {@link Context} is returned with the same properties and lifetime. This is to avoid
* code stealing the ability to cancel arbitrarily.
*/ | Return the context associated with the current scope, will never return null. Will never return <code>CancellableContext</code> even if one is attached, instead a <code>Context</code> is returned with the same properties and lifetime. This is to avoid code stealing the ability to cancel arbitrarily | current | {
"repo_name": "grpc/grpc-java",
"path": "context/src/main/java/io/grpc/Context.java",
"license": "apache-2.0",
"size": 40529
} | [
"io.grpc.PersistentHashArrayMappedTrie"
]
| import io.grpc.PersistentHashArrayMappedTrie; | import io.grpc.*; | [
"io.grpc"
]
| io.grpc; | 2,407,116 |
public void setIamPolicy(
com.google.iam.v1.SetIamPolicyRequest request,
io.grpc.stub.StreamObserver<com.google.iam.v1.Policy> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getSetIamPolicyMethodHelper(), getCallOptions()),
request,
responseObserver);
} | void function( com.google.iam.v1.SetIamPolicyRequest request, io.grpc.stub.StreamObserver<com.google.iam.v1.Policy> responseObserver) { asyncUnaryCall( getChannel().newCall(getSetIamPolicyMethodHelper(), getCallOptions()), request, responseObserver); } | /**
*
*
* <pre>
* Sets the access control policy on the specified note or occurrence.
* Requires `containeranalysis.notes.setIamPolicy` or
* `containeranalysis.occurrences.setIamPolicy` permission if the resource is
* a note or an occurrence, respectively.
* The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
* notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
* occurrences.
* </pre>
*/ | <code> Sets the access control policy on the specified note or occurrence. Requires `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` permission if the resource is a note or an occurrence, respectively. The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. </code> | setIamPolicy | {
"repo_name": "vam-google/google-cloud-java",
"path": "google-api-grpc/grpc-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/ContainerAnalysisV1Beta1Grpc.java",
"license": "apache-2.0",
"size": 47183
} | [
"io.grpc.stub.ClientCalls",
"io.grpc.stub.ServerCalls"
]
| import io.grpc.stub.ClientCalls; import io.grpc.stub.ServerCalls; | import io.grpc.stub.*; | [
"io.grpc.stub"
]
| io.grpc.stub; | 336,967 |
public List<Submission> getAllByEvaluation(String evalId, long limit, long offset)
throws DatastoreException, NotFoundException;
| List<Submission> function(String evalId, long limit, long offset) throws DatastoreException, NotFoundException; | /**
* Get all of the Submissions for a given Evaluation
*
* @param evalId
* @param limit
* @param offset
* @return
* @throws DatastoreException
* @throws NotFoundException
*/ | Get all of the Submissions for a given Evaluation | getAllByEvaluation | {
"repo_name": "zimingd/Synapse-Repository-Services",
"path": "lib/jdomodels/src/main/java/org/sagebionetworks/evaluation/dao/SubmissionDAO.java",
"license": "apache-2.0",
"size": 7572
} | [
"java.util.List",
"org.sagebionetworks.evaluation.model.Submission",
"org.sagebionetworks.repo.model.DatastoreException",
"org.sagebionetworks.repo.web.NotFoundException"
]
| import java.util.List; import org.sagebionetworks.evaluation.model.Submission; import org.sagebionetworks.repo.model.DatastoreException; import org.sagebionetworks.repo.web.NotFoundException; | import java.util.*; import org.sagebionetworks.evaluation.model.*; import org.sagebionetworks.repo.model.*; import org.sagebionetworks.repo.web.*; | [
"java.util",
"org.sagebionetworks.evaluation",
"org.sagebionetworks.repo"
]
| java.util; org.sagebionetworks.evaluation; org.sagebionetworks.repo; | 1,947,955 |
public CertificateList toASN1Structure()
{
return x509CRL;
} | CertificateList function() { return x509CRL; } | /**
* Return the underlying ASN.1 structure for the CRL in this holder.
*
* @return a CertificateList object.
*/ | Return the underlying ASN.1 structure for the CRL in this holder | toASN1Structure | {
"repo_name": "sake/bouncycastle-java",
"path": "src/org/bouncycastle/cert/X509CRLHolder.java",
"license": "mit",
"size": 9182
} | [
"org.bouncycastle.asn1.x509.CertificateList"
]
| import org.bouncycastle.asn1.x509.CertificateList; | import org.bouncycastle.asn1.x509.*; | [
"org.bouncycastle.asn1"
]
| org.bouncycastle.asn1; | 1,215,350 |
public double decodeDouble(PositionedByteRange src) {
return OrderedBytes.decodeFloat64(src);
} | double function(PositionedByteRange src) { return OrderedBytes.decodeFloat64(src); } | /**
* Read a {@code double} value from the buffer {@code src}.
*/ | Read a double value from the buffer src | decodeDouble | {
"repo_name": "Jackygq1982/hbase_src",
"path": "hbase-common/src/main/java/org/apache/hadoop/hbase/types/OrderedFloat64.java",
"license": "apache-2.0",
"size": 2545
} | [
"org.apache.hadoop.hbase.util.OrderedBytes",
"org.apache.hadoop.hbase.util.PositionedByteRange"
]
| import org.apache.hadoop.hbase.util.OrderedBytes; import org.apache.hadoop.hbase.util.PositionedByteRange; | import org.apache.hadoop.hbase.util.*; | [
"org.apache.hadoop"
]
| org.apache.hadoop; | 2,179,674 |
public void clear()
{
stereotypeListViewer.setInput(Collections.emptyList());
} | void function() { stereotypeListViewer.setInput(Collections.emptyList()); } | /**
* Clears the stereotype list
*/ | Clears the stereotype list | clear | {
"repo_name": "pgaufillet/topcased-req",
"path": "plugins/org.topcased.requirement.import.document/src/org/topcased/requirement/document/ui/StereotypeComposite.java",
"license": "epl-1.0",
"size": 9290
} | [
"java.util.Collections"
]
| import java.util.Collections; | import java.util.*; | [
"java.util"
]
| java.util; | 2,616,800 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.