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
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public static RuntimeCamelException wrapRuntimeCamelException(Throwable e) {
if (e instanceof RuntimeCamelException) {
// don't double wrap
return (RuntimeCamelException)e;
} else {
return new RuntimeCamelException(e);
}
} | static RuntimeCamelException function(Throwable e) { if (e instanceof RuntimeCamelException) { return (RuntimeCamelException)e; } else { return new RuntimeCamelException(e); } } | /**
* Wraps the caused exception in a {@link RuntimeCamelException} if its not
* already such an exception.
*
* @param e the caused exception
* @return the wrapper exception
*/ | Wraps the caused exception in a <code>RuntimeCamelException</code> if its not already such an exception | wrapRuntimeCamelException | {
"repo_name": "onders86/camel",
"path": "camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java",
"license": "apache-2.0",
"size": 79581
} | [
"org.apache.camel.RuntimeCamelException"
] | import org.apache.camel.RuntimeCamelException; | import org.apache.camel.*; | [
"org.apache.camel"
] | org.apache.camel; | 2,615,928 |
public Level getLogLevel(); | Level function(); | /**
* The current log level. Default is {@link Level#INFO}. Be sure to log everything in your
* implementation regardless of the log level, as the filtering on the selected log level is
* done automatically by the {@link LogViewer}.
*
* @return the log level
*/ | The current log level. Default is <code>Level#INFO</code>. Be sure to log everything in your implementation regardless of the log level, as the filtering on the selected log level is done automatically by the <code>LogViewer</code> | getLogLevel | {
"repo_name": "transwarpio/rapidminer",
"path": "rapidMiner/rapidminer-studio-core/src/main/java/com/rapidminer/gui/tools/logging/LogModel.java",
"license": "gpl-3.0",
"size": 4742
} | [
"java.util.logging.Level"
] | import java.util.logging.Level; | import java.util.logging.*; | [
"java.util"
] | java.util; | 1,436,530 |
private InetAddress getHostAddress() {
if (__activeExternalHost != null) {
return __activeExternalHost;
} else {
// default local address
return getLocalAddress();
}
} | InetAddress function() { if (__activeExternalHost != null) { return __activeExternalHost; } else { return getLocalAddress(); } } | /**
* Get the host address for active mode; allows the local address to be overridden.
*
* @return __activeExternalHost if non-null, else getLocalAddress()
* @see #setActiveExternalIPAddress(String)
*/ | Get the host address for active mode; allows the local address to be overridden | getHostAddress | {
"repo_name": "AriaLyy/DownloadUtil",
"path": "AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTPClient.java",
"license": "apache-2.0",
"size": 152886
} | [
"java.net.InetAddress"
] | import java.net.InetAddress; | import java.net.*; | [
"java.net"
] | java.net; | 2,541,541 |
boolean initialize(JdbcDatastore datastore); | boolean initialize(JdbcDatastore datastore); | /**
* Initializes the presenter with data from a given datastore.
*
* @param datastore
* @return true if the datastore is accepted and presentable by this
* {@link DatabaseConnectionPresenter}, or false if the presenter is
* not able to present it.
*/ | Initializes the presenter with data from a given datastore | initialize | {
"repo_name": "datacleaner/DataCleaner",
"path": "desktop/ui/src/main/java/org/datacleaner/widgets/database/DatabaseConnectionPresenter.java",
"license": "lgpl-3.0",
"size": 1777
} | [
"org.datacleaner.connection.JdbcDatastore"
] | import org.datacleaner.connection.JdbcDatastore; | import org.datacleaner.connection.*; | [
"org.datacleaner.connection"
] | org.datacleaner.connection; | 2,704,576 |
ApiResponse<ChannelList> searchChannels(String teamId, ChannelSearch search);
| ApiResponse<ChannelList> searchChannels(String teamId, ChannelSearch search); | /**
* returns the channels on a team matching the provided search term.
*/ | returns the channels on a team matching the provided search term | searchChannels | {
"repo_name": "maruTA-bis5/mattermost4j",
"path": "mattermost4j-core/src/main/java/net/bis5/mattermost/client4/api/ChannelApi.java",
"license": "apache-2.0",
"size": 10269
} | [
"net.bis5.mattermost.client4.ApiResponse",
"net.bis5.mattermost.model.ChannelList",
"net.bis5.mattermost.model.ChannelSearch"
] | import net.bis5.mattermost.client4.ApiResponse; import net.bis5.mattermost.model.ChannelList; import net.bis5.mattermost.model.ChannelSearch; | import net.bis5.mattermost.client4.*; import net.bis5.mattermost.model.*; | [
"net.bis5.mattermost"
] | net.bis5.mattermost; | 2,625,780 |
private void requestSucceeded(final @NonNull ResponseModel responseModel)
{
try
{
if (responseModel.isComplete())
{
status.append("Completed in %sms with status %s\nDigest:\n\t%s"
, responseModel.getElaspedTimeMilli()
, responseModel.getStatus()
, responseModel.getDigest().replaceAll("\n", "\n\t"));
headers.setText(responseModel.getHeaders());
response.setText(responseModel.getBody());
progress.setVisible(false);
cancellable = false;
button.setText("Close");
}
}
catch (InterruptedException | ExecutionException e)
{
status.append("Could not complete request: " + e.getMessage());
Thread.currentThread().interrupt();
}
} | void function(final @NonNull ResponseModel responseModel) { try { if (responseModel.isComplete()) { status.append(STR , responseModel.getElaspedTimeMilli() , responseModel.getStatus() , responseModel.getDigest().replaceAll("\n", "\n\t")); headers.setText(responseModel.getHeaders()); response.setText(responseModel.getBody()); progress.setVisible(false); cancellable = false; button.setText("Close"); } } catch (InterruptedException ExecutionException e) { status.append(STR + e.getMessage()); Thread.currentThread().interrupt(); } } | /**
* Handler for succeed task events
* <p>
* Update the window status and provide output
*/ | Handler for succeed task events Update the window status and provide output | requestSucceeded | {
"repo_name": "technosf/Posterer",
"path": "App/src/main/java/com/github/technosf/posterer/ui/controllers/impl/ResponseController.java",
"license": "apache-2.0",
"size": 12428
} | [
"com.github.technosf.posterer.models.ResponseModel",
"java.util.concurrent.ExecutionException",
"org.eclipse.jdt.annotation.NonNull"
] | import com.github.technosf.posterer.models.ResponseModel; import java.util.concurrent.ExecutionException; import org.eclipse.jdt.annotation.NonNull; | import com.github.technosf.posterer.models.*; import java.util.concurrent.*; import org.eclipse.jdt.annotation.*; | [
"com.github.technosf",
"java.util",
"org.eclipse.jdt"
] | com.github.technosf; java.util; org.eclipse.jdt; | 2,578,013 |
public static Integer evalInteger(String attrName, String attrValue,
Tag tagObject, PageContext pageContext) throws JspException {
Object result = null;
if (attrValue != null) {
result = ExpressionEvaluatorManager.evaluate(attrName, attrValue,
Integer.class, tagObject, pageContext);
}
return (Integer) result;
}
| static Integer function(String attrName, String attrValue, Tag tagObject, PageContext pageContext) throws JspException { Object result = null; if (attrValue != null) { result = ExpressionEvaluatorManager.evaluate(attrName, attrValue, Integer.class, tagObject, pageContext); } return (Integer) result; } | /**
* Evaluates the attribute value in the JSTL EL engine, assuming the
* resulting value is an Integer object. If the original expression is null,
* or the resulting value is null, it will return null.
*/ | Evaluates the attribute value in the JSTL EL engine, assuming the resulting value is an Integer object. If the original expression is null, or the resulting value is null, it will return null | evalInteger | {
"repo_name": "YangYongZhi/csims",
"path": "src/com/gtm/csims/webs/taglib/EvalHelper.java",
"license": "apache-2.0",
"size": 3214
} | [
"javax.servlet.jsp.JspException",
"javax.servlet.jsp.PageContext",
"javax.servlet.jsp.tagext.Tag",
"org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager"
] | import javax.servlet.jsp.JspException; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.tagext.Tag; import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; | import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import org.apache.taglibs.standard.lang.support.*; | [
"javax.servlet",
"org.apache.taglibs"
] | javax.servlet; org.apache.taglibs; | 419,715 |
public void addMapper(Mapper mapper) {
synchronized(mappers) {
if (mappers.get(mapper.getProtocol()) != null)
throw new IllegalArgumentException("addMapper: Protocol '" +
mapper.getProtocol() +
"' is not unique");
mapper.setContainer((Container) this); // May throw IAE
if (started && (mapper instanceof Lifecycle)) {
try {
((Lifecycle) mapper).start();
} catch (LifecycleException e) {
log("ContainerBase.addMapper: start: ", e);
throw new IllegalStateException
("ContainerBase.addMapper: start: " + e);
}
}
mappers.put(mapper.getProtocol(), mapper);
if (mappers.size() == 1)
this.mapper = mapper;
else
this.mapper = null;
fireContainerEvent(ADD_MAPPER_EVENT, mapper);
}
} | void function(Mapper mapper) { synchronized(mappers) { if (mappers.get(mapper.getProtocol()) != null) throw new IllegalArgumentException(STR + mapper.getProtocol() + STR); mapper.setContainer((Container) this); if (started && (mapper instanceof Lifecycle)) { try { ((Lifecycle) mapper).start(); } catch (LifecycleException e) { log(STR, e); throw new IllegalStateException (STR + e); } } mappers.put(mapper.getProtocol(), mapper); if (mappers.size() == 1) this.mapper = mapper; else this.mapper = null; fireContainerEvent(ADD_MAPPER_EVENT, mapper); } } | /**
* Add the specified Mapper associated with this Container.
*
* @param mapper The corresponding Mapper implementation
*
* @exception IllegalArgumentException if this exception is thrown by
* the <code>setContainer()</code> method of the Mapper
*/ | Add the specified Mapper associated with this Container | addMapper | {
"repo_name": "devjin24/howtomcatworks",
"path": "bookrefer/jakarta-tomcat-4.1.12-src/catalina/src/share/org/apache/catalina/core/ContainerBase.java",
"license": "apache-2.0",
"size": 44660
} | [
"org.apache.catalina.Container",
"org.apache.catalina.Lifecycle",
"org.apache.catalina.LifecycleException",
"org.apache.catalina.Mapper"
] | import org.apache.catalina.Container; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleException; import org.apache.catalina.Mapper; | import org.apache.catalina.*; | [
"org.apache.catalina"
] | org.apache.catalina; | 2,070,204 |
GetTaskRequestBuilder prepareGetTask(String taskId); | GetTaskRequestBuilder prepareGetTask(String taskId); | /**
* Fetch a task by id.
*/ | Fetch a task by id | prepareGetTask | {
"repo_name": "coding0011/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/client/ClusterAdminClient.java",
"license": "apache-2.0",
"size": 26995
} | [
"org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskRequestBuilder"
] | import org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskRequestBuilder; | import org.elasticsearch.action.admin.cluster.node.tasks.get.*; | [
"org.elasticsearch.action"
] | org.elasticsearch.action; | 2,036,602 |
public Observable<ServiceResponse<Void>> deleteWithServiceResponseAsync(String resourceGroupName, String virtualNetworkName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (virtualNetworkName == null) {
throw new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2019-04-01";
Observable<Response<ResponseBody>> observable = service.delete(resourceGroupName, virtualNetworkName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent());
return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<Void>() { }.getType());
} | Observable<ServiceResponse<Void>> function(String resourceGroupName, String virtualNetworkName) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (virtualNetworkName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } final String apiVersion = STR; Observable<Response<ResponseBody>> observable = service.delete(resourceGroupName, virtualNetworkName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<Void>() { }.getType()); } | /**
* Deletes the specified virtual network.
*
* @param resourceGroupName The name of the resource group.
* @param virtualNetworkName The name of the virtual network.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/ | Deletes the specified virtual network | deleteWithServiceResponseAsync | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_04_01/src/main/java/com/microsoft/azure/management/network/v2019_04_01/implementation/VirtualNetworksInner.java",
"license": "mit",
"size": 98691
} | [
"com.google.common.reflect.TypeToken",
"com.microsoft.rest.ServiceResponse"
] | import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceResponse; | import com.google.common.reflect.*; import com.microsoft.rest.*; | [
"com.google.common",
"com.microsoft.rest"
] | com.google.common; com.microsoft.rest; | 368,076 |
public static String getDropBoxPath() throws IOException {
Diodable diode = null;
if (SystemUtils.IS_OS_WINDOWS) {
diode = new WindowsDiode();
} else if (SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC) {
diode = new NixDiode();
}
return diode != null ? diode.getDropBoxPath() : null;
} | static String function() throws IOException { Diodable diode = null; if (SystemUtils.IS_OS_WINDOWS) { diode = new WindowsDiode(); } else if (SystemUtils.IS_OS_LINUX SystemUtils.IS_OS_MAC) { diode = new NixDiode(); } return diode != null ? diode.getDropBoxPath() : null; } | /**
* Get Dropbox path of the system
* @return path of dropbox folder
* @throws IOException
*/ | Get Dropbox path of the system | getDropBoxPath | {
"repo_name": "geniussoftlk/brainiac",
"path": "src/main/java/com/officialgenius/brainiac/Brainiac.java",
"license": "apache-2.0",
"size": 1393
} | [
"com.officialgenius.brainiac.diodes.Diodable",
"com.officialgenius.brainiac.diodes.NixDiode",
"com.officialgenius.brainiac.diodes.WindowsDiode",
"java.io.IOException",
"org.apache.commons.lang3.SystemUtils"
] | import com.officialgenius.brainiac.diodes.Diodable; import com.officialgenius.brainiac.diodes.NixDiode; import com.officialgenius.brainiac.diodes.WindowsDiode; import java.io.IOException; import org.apache.commons.lang3.SystemUtils; | import com.officialgenius.brainiac.diodes.*; import java.io.*; import org.apache.commons.lang3.*; | [
"com.officialgenius.brainiac",
"java.io",
"org.apache.commons"
] | com.officialgenius.brainiac; java.io; org.apache.commons; | 243,863 |
public static int readEnum(int iParentNode, String sName, String[] saEnumNames,
int[] iaEnumValues, int iDefaultValue)
throws XMLException
{
if (saEnumNames.length != iaEnumValues.length)
{
throw new IllegalArgumentException("Enum names array is of different length than the values array.");
}
if (saEnumNames.length == 0)
{
throw new IllegalArgumentException("Enum names array is empty.");
}
String sValue = readString(iParentNode, sName, null);
if (sValue == null)
{
return iDefaultValue;
}
for (int i = 0; i < saEnumNames.length; i++)
{
String sEnumName = saEnumNames[i];
if (sEnumName.equals(sValue))
{
return iaEnumValues[i];
}
}
throw new XMLException("Illegal value '" + sValue + "' for element " + sName);
}
| static int function(int iParentNode, String sName, String[] saEnumNames, int[] iaEnumValues, int iDefaultValue) throws XMLException { if (saEnumNames.length != iaEnumValues.length) { throw new IllegalArgumentException(STR); } if (saEnumNames.length == 0) { throw new IllegalArgumentException(STR); } String sValue = readString(iParentNode, sName, null); if (sValue == null) { return iDefaultValue; } for (int i = 0; i < saEnumNames.length; i++) { String sEnumName = saEnumNames[i]; if (sEnumName.equals(sValue)) { return iaEnumValues[i]; } } throw new XMLException(STR + sValue + STR + sName); } | /**
* Reads an enumerated value from the node text.
*
* @param iParentNode Current node.
* @param sName Element name.
* @param saEnumNames Enum names.
* @param iaEnumValues Enum values.
* @param iDefaultValue Default enum value.
*
* @return Enum value.
*
* @throws XMLException Thrown if the operation failed.
*/ | Reads an enumerated value from the node text | readEnum | {
"repo_name": "MatthiasEberl/cordysfilecon",
"path": "src/cws/FileConnector/com-cordys-coe/fileconnector/java/source/com/cordys/coe/ac/fileconnector/utils/XMLSerializer.java",
"license": "apache-2.0",
"size": 13701
} | [
"com.eibus.xml.nom.XMLException"
] | import com.eibus.xml.nom.XMLException; | import com.eibus.xml.nom.*; | [
"com.eibus.xml"
] | com.eibus.xml; | 1,981,338 |
public void shutdown() {
BBoxDBInstanceManager.getInstance().removeListener(distributedEventConsumer);
unregisterTreeChangeListener();
} | void function() { BBoxDBInstanceManager.getInstance().removeListener(distributedEventConsumer); unregisterTreeChangeListener(); } | /**
* Shutdown the GUI model
*/ | Shutdown the GUI model | shutdown | {
"repo_name": "jnidzwetzki/bboxdb",
"path": "bboxdb-tools/src/main/java/org/bboxdb/tools/gui/GuiModel.java",
"license": "apache-2.0",
"size": 9353
} | [
"org.bboxdb.distribution.membership.BBoxDBInstanceManager"
] | import org.bboxdb.distribution.membership.BBoxDBInstanceManager; | import org.bboxdb.distribution.membership.*; | [
"org.bboxdb.distribution"
] | org.bboxdb.distribution; | 2,024,448 |
@SuppressWarnings("unchecked")
@AuraTestLabels("auraSanity")
public void testVerifyPostWithoutToken() throws Exception {
Map<String, String> params = makeBasePostParams();
params.put("aura.context", String.format("{\"mode\":\"FTEST\",\"fwuid\":\"%s\"}",
Aura.getConfigAdapter().getAuraFrameworkNonce()));
HttpPost post = obtainPostMethod("/aura", params);
HttpResponse httpResponse = perform(post);
int statusCode = getStatusCode(httpResponse);
String response = getResponseBody(httpResponse);
post.releaseConnection();
assertNotNull(response);
if (statusCode != HttpStatus.SC_OK || !response.endsWith("")) {
fail("Should not be able to post to aura servlet without a valid CSRF token");
}
if (response.startsWith(AuraBaseServlet.CSRF_PROTECT)) {
response = "/*" + response;
}
Map<String, Object> json = (Map<String, Object>) new JsonReader().read(response);
assertEquals(true, json.get("exceptionEvent"));
Map<String, Object> event = (Map<String, Object>) json.get("event");
assertEquals("Expected to see a aura:systemError event", "markup://aura:systemError", event.get("descriptor"));
assertEquals("Missing parameter value for aura.token",
((Map<String, Object>) ((Map<String, Object>) ((Map<String, Object>) (event.get("attributes")))
.get("value")).get("values")).get("message"));
Object f = json.get("defaultHandler");
assertEquals(JsFunction.class, f.getClass());
assertEquals("$A.error('unknown error');", ((JsFunction) f).getBody());
} | @SuppressWarnings(STR) @AuraTestLabels(STR) void function() throws Exception { Map<String, String> params = makeBasePostParams(); params.put(STR, String.format("{\"mode\":\"FTEST\",\"fwuid\":\"%s\"}", Aura.getConfigAdapter().getAuraFrameworkNonce())); HttpPost post = obtainPostMethod("/aura", params); HttpResponse httpResponse = perform(post); int statusCode = getStatusCode(httpResponse); String response = getResponseBody(httpResponse); post.releaseConnection(); assertNotNull(response); if (statusCode != HttpStatus.SC_OK !response.endsWith(STRShould not be able to post to aura servlet without a valid CSRF tokenSTR/*STRexceptionEventSTReventSTRExpected to see a aura:systemError eventSTRmarkup: assertEquals(STR, ((Map<String, Object>) ((Map<String, Object>) ((Map<String, Object>) (event.get(STR))) .get("value")).get(STR)).get(STR)); Object f = json.get(STR); assertEquals(JsFunction.class, f.getClass()); assertEquals(STR, ((JsFunction) f).getBody()); } | /**
* Test to post a request to aura servlet without a CSRF token. This test
* tries to request a action defined on a controller. But the request does
* not have a valid CSRF token, hence the request should fail to fetch the
* def.
*/ | Test to post a request to aura servlet without a CSRF token. This test tries to request a action defined on a controller. But the request does not have a valid CSRF token, hence the request should fail to fetch the def | testVerifyPostWithoutToken | {
"repo_name": "igor-sfdc/aura",
"path": "aura/src/test/java/org/auraframework/impl/security/CSRFTokenValidationHttpTest.java",
"license": "apache-2.0",
"size": 6299
} | [
"java.util.Map",
"org.apache.http.HttpResponse",
"org.apache.http.HttpStatus",
"org.apache.http.client.methods.HttpPost",
"org.auraframework.Aura",
"org.auraframework.test.annotation.AuraTestLabels",
"org.auraframework.util.json.JsFunction"
] | import java.util.Map; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.methods.HttpPost; import org.auraframework.Aura; import org.auraframework.test.annotation.AuraTestLabels; import org.auraframework.util.json.JsFunction; | import java.util.*; import org.apache.http.*; import org.apache.http.client.methods.*; import org.auraframework.*; import org.auraframework.test.annotation.*; import org.auraframework.util.json.*; | [
"java.util",
"org.apache.http",
"org.auraframework",
"org.auraframework.test",
"org.auraframework.util"
] | java.util; org.apache.http; org.auraframework; org.auraframework.test; org.auraframework.util; | 2,306,816 |
public QuotaCounterCollectionInner withValue(List<QuotaCounterContractInner> value) {
this.value = value;
return this;
} | QuotaCounterCollectionInner function(List<QuotaCounterContractInner> value) { this.value = value; return this; } | /**
* Set quota counter values.
*
* @param value the value value to set
* @return the QuotaCounterCollectionInner object itself.
*/ | Set quota counter values | withValue | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/apimanagement/mgmt-v2019_12_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_12_01/implementation/QuotaCounterCollectionInner.java",
"license": "mit",
"size": 2274
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,421,805 |
//@Override
public void run() {
logger.info("Begin " + Thread.currentThread().getName());
try {
while (true) {
if (Thread.interrupted()) {
return;
}
try {
connectAndProcess();
}
catch (SocketTimeoutException ex) {
// Handle like an IOException even though it's
// an InterruptedIOException.
logger.log(Level.WARNING,
credentials.getUserName()
+ ": Error fetching from " + baseUrl,
ex);
tcpBackOff.backOff();
}
catch (InterruptedException ex) {
// Don't let this be handled as a generic Exception.
return;
}
catch (InterruptedIOException ex) {
return;
}
catch (HttpException ex) {
logger.log(Level.WARNING,
credentials.getUserName()
+ ": Error fetching from " + baseUrl,
ex);
httpBackOff.backOff();
}
catch (IOException ex) {
logger.log(Level.WARNING,
credentials.getUserName()
+ ": Error fetching from " + baseUrl,
ex);
tcpBackOff.backOff();
}
catch (Exception ex) {
// This could be a NumberFormatException or
// something. Open a new connection to
// resync.
logger.log(Level.WARNING,
credentials.getUserName()
+ ": Error fetching from " + baseUrl,
ex);
}
}
}
catch (InterruptedException ex) {
return;
}
finally {
logger.info("End " + Thread.currentThread().getName());
}
} | logger.info(STR + Thread.currentThread().getName()); try { while (true) { if (Thread.interrupted()) { return; } try { connectAndProcess(); } catch (SocketTimeoutException ex) { logger.log(Level.WARNING, credentials.getUserName() + STR + baseUrl, ex); tcpBackOff.backOff(); } catch (InterruptedException ex) { return; } catch (InterruptedIOException ex) { return; } catch (HttpException ex) { logger.log(Level.WARNING, credentials.getUserName() + STR + baseUrl, ex); httpBackOff.backOff(); } catch (IOException ex) { logger.log(Level.WARNING, credentials.getUserName() + STR + baseUrl, ex); tcpBackOff.backOff(); } catch (Exception ex) { logger.log(Level.WARNING, credentials.getUserName() + STR + baseUrl, ex); } } } catch (InterruptedException ex) { return; } finally { logger.info(STR + Thread.currentThread().getName()); } } | /**
* Connects to twitter and processes the streams. On
* exception, backs off and reconnects. Runs until the thread
* is interrupted.
*/ | Connects to twitter and processes the streams. On exception, backs off and reconnects. Runs until the thread is interrupted | run | {
"repo_name": "jenkinjk/TwitterClient",
"path": "src/com/gist/twitter/TwitterClient.java",
"license": "apache-2.0",
"size": 17886
} | [
"java.io.IOException",
"java.io.InterruptedIOException",
"java.net.SocketTimeoutException",
"java.util.logging.Level",
"org.apache.commons.httpclient.HttpException"
] | import java.io.IOException; import java.io.InterruptedIOException; import java.net.SocketTimeoutException; import java.util.logging.Level; import org.apache.commons.httpclient.HttpException; | import java.io.*; import java.net.*; import java.util.logging.*; import org.apache.commons.httpclient.*; | [
"java.io",
"java.net",
"java.util",
"org.apache.commons"
] | java.io; java.net; java.util; org.apache.commons; | 2,533,207 |
protected void fireBaseAttributeListeners(String pn) {
if (targetListeners != null) {
LinkedList ll = (LinkedList) targetListeners.get(pn);
if (ll != null) {
for (Object aLl : ll) {
AnimationTargetListener l =
(AnimationTargetListener) aLl;
l.baseValueChanged((AnimationTarget) e, null, pn, true);
}
}
}
} | void function(String pn) { if (targetListeners != null) { LinkedList ll = (LinkedList) targetListeners.get(pn); if (ll != null) { for (Object aLl : ll) { AnimationTargetListener l = (AnimationTargetListener) aLl; l.baseValueChanged((AnimationTarget) e, null, pn, true); } } } } | /**
* Fires the listeners registered for changes to the base value of the
* given CSS property.
*/ | Fires the listeners registered for changes to the base value of the given CSS property | fireBaseAttributeListeners | {
"repo_name": "apache/batik",
"path": "batik-bridge/src/main/java/org/apache/batik/bridge/AnimatableSVGBridge.java",
"license": "apache-2.0",
"size": 3102
} | [
"java.util.LinkedList",
"org.apache.batik.anim.dom.AnimationTarget",
"org.apache.batik.anim.dom.AnimationTargetListener"
] | import java.util.LinkedList; import org.apache.batik.anim.dom.AnimationTarget; import org.apache.batik.anim.dom.AnimationTargetListener; | import java.util.*; import org.apache.batik.anim.dom.*; | [
"java.util",
"org.apache.batik"
] | java.util; org.apache.batik; | 1,149,409 |
public void report(I_CmsReport report, CmsMessageContainer message, Throwable throwable)
throws CmsVfsException, CmsException {
if (report != null) {
if (message != null) {
report.println(message, I_CmsReport.FORMAT_ERROR);
}
if (throwable != null) {
report.println(throwable);
}
}
throwException(message, throwable);
}
| void function(I_CmsReport report, CmsMessageContainer message, Throwable throwable) throws CmsVfsException, CmsException { if (report != null) { if (message != null) { report.println(message, I_CmsReport.FORMAT_ERROR); } if (throwable != null) { report.println(throwable); } } throwException(message, throwable); } | /**
* Reports an error to the given report (if available) and to the OpenCms log file.<p>
*
* @param report the report to write the error to
* @param message the message to write to the report / log
* @param throwable the exception to write to the report / log
*
* @throws CmsException if the throwable parameter is not null and a CmsException
* @throws CmsVfsException if the throwable parameter is not null and no CmsException
*/ | Reports an error to the given report (if available) and to the OpenCms log file | report | {
"repo_name": "comundus/opencms-comundus",
"path": "src/main/java/org/opencms/db/CmsDbContext.java",
"license": "lgpl-2.1",
"size": 7640
} | [
"org.opencms.file.CmsVfsException",
"org.opencms.i18n.CmsMessageContainer",
"org.opencms.main.CmsException"
] | import org.opencms.file.CmsVfsException; import org.opencms.i18n.CmsMessageContainer; import org.opencms.main.CmsException; | import org.opencms.file.*; import org.opencms.i18n.*; import org.opencms.main.*; | [
"org.opencms.file",
"org.opencms.i18n",
"org.opencms.main"
] | org.opencms.file; org.opencms.i18n; org.opencms.main; | 1,767,309 |
public void testSerialization() {
CompassPlot p1 = new CompassPlot(null);
CompassPlot p2 = null;
try {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
ObjectOutput out = new ObjectOutputStream(buffer);
out.writeObject(p1);
out.close();
ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
p2 = (CompassPlot) in.readObject();
in.close();
}
catch (Exception e) {
System.out.println(e.toString());
}
assertEquals(p1, p2);
} | void function() { CompassPlot p1 = new CompassPlot(null); CompassPlot p2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(p1); out.close(); ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); p2 = (CompassPlot) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(p1, p2); } | /**
* Serialize an instance, restore it, and check for equality.
*/ | Serialize an instance, restore it, and check for equality | testSerialization | {
"repo_name": "simeshev/parabuild-ci",
"path": "3rdparty/jfreechart0921/source/org/jfree/chart/plot/junit/CompassPlotTests.java",
"license": "lgpl-3.0",
"size": 3594
} | [
"java.io.ByteArrayInputStream",
"java.io.ByteArrayOutputStream",
"java.io.ObjectInput",
"java.io.ObjectInputStream",
"java.io.ObjectOutput",
"java.io.ObjectOutputStream",
"org.jfree.chart.plot.CompassPlot"
] | import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInput; import java.io.ObjectInputStream; import java.io.ObjectOutput; import java.io.ObjectOutputStream; import org.jfree.chart.plot.CompassPlot; | import java.io.*; import org.jfree.chart.plot.*; | [
"java.io",
"org.jfree.chart"
] | java.io; org.jfree.chart; | 1,852,050 |
@Override
public void close() throws IOException {
if (SecurityUtil.isPackageProtectionEnabled()){
try{
AccessController.doPrivileged(
new PrivilegedExceptionAction<Void>(){ | void function() throws IOException { if (SecurityUtil.isPackageProtectionEnabled()){ try{ AccessController.doPrivileged( new PrivilegedExceptionAction<Void>(){ | /**
* Close the stream
* Since we re-cycle, we can't allow the call to super.close()
* which would permanently disable us.
*/ | Close the stream Since we re-cycle, we can't allow the call to super.close() which would permanently disable us | close | {
"repo_name": "plumer/codana",
"path": "tomcat_files/7.0.0/CoyoteInputStream.java",
"license": "mit",
"size": 7241
} | [
"java.io.IOException",
"java.security.AccessController",
"java.security.PrivilegedExceptionAction",
"org.apache.catalina.security.SecurityUtil"
] | import java.io.IOException; import java.security.AccessController; import java.security.PrivilegedExceptionAction; import org.apache.catalina.security.SecurityUtil; | import java.io.*; import java.security.*; import org.apache.catalina.security.*; | [
"java.io",
"java.security",
"org.apache.catalina"
] | java.io; java.security; org.apache.catalina; | 2,340,989 |
@Test
public final void test_that_a_Message_lines_retain_their_indentation()
{
final Iterator<String> lineIt = message.iterator();
assertEquals(" Hello", lineIt.next());
assertEquals("World", lineIt.next());
assertFalse(lineIt.hasNext());
} | final void function() { final Iterator<String> lineIt = message.iterator(); assertEquals(STR, lineIt.next()); assertEquals("World", lineIt.next()); assertFalse(lineIt.hasNext()); } | /**
* Tests that a {@code Message}'s lines retain their indentation.
*/ | Tests that a Message's lines retain their indentation | test_that_a_Message_lines_retain_their_indentation | {
"repo_name": "Hilco-Wijbenga/blueprint",
"path": "terminals/src/test/java/org/cavebeetle/blueprint/MessageTest.java",
"license": "apache-2.0",
"size": 4641
} | [
"java.util.Iterator",
"org.junit.Assert"
] | import java.util.Iterator; import org.junit.Assert; | import java.util.*; import org.junit.*; | [
"java.util",
"org.junit"
] | java.util; org.junit; | 1,623,392 |
Class<T> configurationClass = (Class<T>) configurationObject.getClass();
List<Method> methods = getGetMethods(configurationClass);
StringBuffer out = new StringBuffer();
for (Method method : methods) {
out.append(String.format(
"%1$-20s"
,
method.getName().substring(3)
) + " : ");
try {
out.append(
"\""
+ method.invoke(configurationObject, (Object[]) null).toString()
+ "\""
);
} catch (OptionNotPresentException e) {
// This should be thrown for every options that has not
// been set,
//
out.append("- not set -");
} catch (InvocationTargetException e) {
// But instead this is. How odd.
//
out.append("- not set -");
} catch (IllegalArgumentException e) { throw new RuntimeException(e); }
catch (IllegalAccessException e) { throw new RuntimeException(e); }
out.append("\n");
}
return out.toString();
} | Class<T> configurationClass = (Class<T>) configurationObject.getClass(); List<Method> methods = getGetMethods(configurationClass); StringBuffer out = new StringBuffer(); for (Method method : methods) { out.append(String.format( STR , method.getName().substring(3) ) + STR); try { out.append( "\"STR\STR\n"); } return out.toString(); } | /**
*
* This method will iterate over the getMethods defined in T and call
* them on the configurationObject. The results are summarised in a table
* which is returned as a string.
*
* @param configurationObject
* @return A string summarising the contents of the configuration object.
*
*/ | This method will iterate over the getMethods defined in T and call them on the configurationObject. The results are summarised in a table which is returned as a string | dump | {
"repo_name": "Ensembl/ensj-healthcheck",
"path": "src/org/ensembl/healthcheck/configurationmanager/ConfigurationDumper.java",
"license": "apache-2.0",
"size": 2431
} | [
"java.lang.reflect.Method",
"java.util.List"
] | import java.lang.reflect.Method; import java.util.List; | import java.lang.reflect.*; import java.util.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 1,718,408 |
private void workOnChangeSet(IndexWriter indexWriter, SVNLogEntry logEntry) {
Set<?> changedPathsSet = logEntry.getChangedPaths().keySet();
TagBranchRecognition tbr = new TagBranchRecognition(getRepository());
TagBranch res = null;
// Check if we have a Tag, Branch, Maven Tag or Subversion Tag.
if (changedPathsSet.size() == 1) {
res = tbr.checkForTagOrBranch(logEntry, changedPathsSet);
} else {
res = tbr.checkForMavenTag(logEntry, changedPathsSet);
if (res == null) {
res = tbr.checkForSubverisonTag(logEntry, changedPathsSet);
}
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Number of files for revision: " + changedPathsSet.size());
}
startIndexChangeSet();
for (Iterator<?> changedPaths = changedPathsSet.iterator(); changedPaths.hasNext();) {
// It is needed to check it in every entry
// This will result in making entries for every record of the
// ChangeSet.
SVNLogEntryPath entryPath = (SVNLogEntryPath) logEntry.getChangedPaths().get(changedPaths.next());
// If the given path should be ignored than just do it.
if (getFiltering().ignorePath(entryPath.getPath())) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("The following " + entryPath.getPath() + " is beeing ignored based on fitlering.");
}
continue;
}
RevisionDocument indexRevision = new RevisionDocument();
addTagBranchToDoc(res, indexRevision);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("SVNEntry: "
+ entryPath.getType()
+ " "
+ entryPath.getPath()
+ ((entryPath.getCopyPath() != null) ? " (from " + entryPath.getCopyPath() + " revision "
+ entryPath.getCopyRevision() + ")" : ""));
}
// We would like to know something about the entry.
SVNDirEntry dirEntry = tbr.getEntryCache().getEntry(logEntry.getRevision(), entryPath.getPath());
try {
beginIndexChangeSetItem(dirEntry);
indexFile(indexRevision, indexWriter, dirEntry, logEntry, entryPath);
} catch (IOException e) {
LOGGER.error("IOExcepiton: ", e);
} catch (SVNException e) {
LOGGER.error("SVNExcepiton: ", e);
} catch (Exception e) {
LOGGER.error("something wrong: ", e);
} finally {
endIndexChangeSetItem(dirEntry);
}
}
stopIndexChangeSet();
}
| void function(IndexWriter indexWriter, SVNLogEntry logEntry) { Set<?> changedPathsSet = logEntry.getChangedPaths().keySet(); TagBranchRecognition tbr = new TagBranchRecognition(getRepository()); TagBranch res = null; if (changedPathsSet.size() == 1) { res = tbr.checkForTagOrBranch(logEntry, changedPathsSet); } else { res = tbr.checkForMavenTag(logEntry, changedPathsSet); if (res == null) { res = tbr.checkForSubverisonTag(logEntry, changedPathsSet); } } if (LOGGER.isDebugEnabled()) { LOGGER.debug(STR + changedPathsSet.size()); } startIndexChangeSet(); for (Iterator<?> changedPaths = changedPathsSet.iterator(); changedPaths.hasNext();) { SVNLogEntryPath entryPath = (SVNLogEntryPath) logEntry.getChangedPaths().get(changedPaths.next()); if (getFiltering().ignorePath(entryPath.getPath())) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(STR + entryPath.getPath() + STR); } continue; } RevisionDocument indexRevision = new RevisionDocument(); addTagBranchToDoc(res, indexRevision); if (LOGGER.isDebugEnabled()) { LOGGER.debug(STR + entryPath.getType() + " " + entryPath.getPath() + ((entryPath.getCopyPath() != null) ? STR + entryPath.getCopyPath() + STR + entryPath.getCopyRevision() + ")" : STRIOExcepiton: STRSVNExcepiton: STRsomething wrong: ", e); } finally { endIndexChangeSetItem(dirEntry); } } stopIndexChangeSet(); } | /**
* Here we have a single ChangeSet which will be analyzed separate.
*
* @param indexWriter
* @param logEntry
*/ | Here we have a single ChangeSet which will be analyzed separate | workOnChangeSet | {
"repo_name": "khmarbaise/supose",
"path": "supose-core/src/main/java/com/soebes/supose/core/scan/ScanRepository.java",
"license": "gpl-2.0",
"size": 19842
} | [
"com.soebes.supose.core.recognition.TagBranch",
"com.soebes.supose.core.recognition.TagBranchRecognition",
"java.util.Iterator",
"java.util.Set",
"org.apache.lucene.index.IndexWriter",
"org.tmatesoft.svn.core.SVNLogEntry",
"org.tmatesoft.svn.core.SVNLogEntryPath"
] | import com.soebes.supose.core.recognition.TagBranch; import com.soebes.supose.core.recognition.TagBranchRecognition; import java.util.Iterator; import java.util.Set; import org.apache.lucene.index.IndexWriter; import org.tmatesoft.svn.core.SVNLogEntry; import org.tmatesoft.svn.core.SVNLogEntryPath; | import com.soebes.supose.core.recognition.*; import java.util.*; import org.apache.lucene.index.*; import org.tmatesoft.svn.core.*; | [
"com.soebes.supose",
"java.util",
"org.apache.lucene",
"org.tmatesoft.svn"
] | com.soebes.supose; java.util; org.apache.lucene; org.tmatesoft.svn; | 1,569,399 |
void updateDepartment(DepartmentDTO department) throws IllegalArgumentException; | void updateDepartment(DepartmentDTO department) throws IllegalArgumentException; | /**
* Method updates given DepartmentDTO inside database via DAO layer call.
* @param department to be updated
* @throws IllegalArgumentException when ID is null
*/ | Method updates given DepartmentDTO inside database via DAO layer call | updateDepartment | {
"repo_name": "empt-ak/bis",
"path": "bis-api/src/main/java/cz/muni/ics/phil/bis/api/DepartmentService.java",
"license": "apache-2.0",
"size": 2667
} | [
"cz.muni.ics.phil.bis.api.domain.DepartmentDTO"
] | import cz.muni.ics.phil.bis.api.domain.DepartmentDTO; | import cz.muni.ics.phil.bis.api.domain.*; | [
"cz.muni.ics"
] | cz.muni.ics; | 1,966,029 |
public BeanDefinitionBuilder addPropertyValue(String name, Object value) {
this.beanDefinition.getPropertyValues().addPropertyValue(new PropertyValue(name, value));
return this;
}
| BeanDefinitionBuilder function(String name, Object value) { this.beanDefinition.getPropertyValues().addPropertyValue(new PropertyValue(name, value)); return this; } | /**
* Add the supplied property value under the given name.
*/ | Add the supplied property value under the given name | addPropertyValue | {
"repo_name": "codeApeFromChina/resource",
"path": "frame_packages/java_libs/spring-2.5.6-src/src/org/springframework/beans/factory/support/BeanDefinitionBuilder.java",
"license": "unlicense",
"size": 11485
} | [
"org.springframework.beans.PropertyValue"
] | import org.springframework.beans.PropertyValue; | import org.springframework.beans.*; | [
"org.springframework.beans"
] | org.springframework.beans; | 978,998 |
public JsonDataSource subDataSource(String selectExpression) throws JRException {
if(currentJsonNode == null)
{
throw new JRException("No node available. Iterate or rewind the data source.");
}
try {
return new JsonDataSource(new ByteArrayInputStream(currentJsonNode.toString().getBytes("UTF-8")), selectExpression);
} catch(UnsupportedEncodingException e) {
throw new JRRuntimeException(e);
}
} | JsonDataSource function(String selectExpression) throws JRException { if(currentJsonNode == null) { throw new JRException(STR); } try { return new JsonDataSource(new ByteArrayInputStream(currentJsonNode.toString().getBytes("UTF-8")), selectExpression); } catch(UnsupportedEncodingException e) { throw new JRRuntimeException(e); } } | /**
* Creates a sub data source using the current node as the base for its input stream.
* An additional expression specifies the select criteria that will be applied to the
* JSON tree node.
*
* @param selectExpression
* @return the JSON sub data source
* @throws JRException
*/ | Creates a sub data source using the current node as the base for its input stream. An additional expression specifies the select criteria that will be applied to the JSON tree node | subDataSource | {
"repo_name": "sikachu/jasperreports",
"path": "src/net/sf/jasperreports/engine/data/JsonDataSource.java",
"license": "lgpl-3.0",
"size": 14638
} | [
"java.io.ByteArrayInputStream",
"java.io.UnsupportedEncodingException",
"net.sf.jasperreports.engine.JRException",
"net.sf.jasperreports.engine.JRRuntimeException"
] | import java.io.ByteArrayInputStream; import java.io.UnsupportedEncodingException; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRRuntimeException; | import java.io.*; import net.sf.jasperreports.engine.*; | [
"java.io",
"net.sf.jasperreports"
] | java.io; net.sf.jasperreports; | 1,477,375 |
URL publicKey = PrimitiveInjectionTest.class.getResource("/publicKey.pem");
WebArchive webArchive = ShrinkWrap
.create(WebArchive.class, "PrimitiveInjectionTest.war")
.addAsManifestResource(new StringAsset(MpJwtTestVersion.MPJWT_V_1_0.name()), MpJwtTestVersion.MANIFEST_NAME)
.addAsResource(publicKey, "/publicKey.pem")
.addClass(PrimitiveInjectionEndpoint.class)
.addClass(TCKApplication.class)
.addAsWebInfResource("beans.xml", "beans.xml")
;
System.out.printf("WebArchive: %s\n", webArchive.toString(true));
return webArchive;
} | URL publicKey = PrimitiveInjectionTest.class.getResource(STR); WebArchive webArchive = ShrinkWrap .create(WebArchive.class, STR) .addAsManifestResource(new StringAsset(MpJwtTestVersion.MPJWT_V_1_0.name()), MpJwtTestVersion.MANIFEST_NAME) .addAsResource(publicKey, STR) .addClass(PrimitiveInjectionEndpoint.class) .addClass(TCKApplication.class) .addAsWebInfResource(STR, STR) ; System.out.printf(STR, webArchive.toString(true)); return webArchive; } | /**
* Create a CDI aware base web application archive
* @return the base base web application archive
* @throws IOException - on resource failure
*/ | Create a CDI aware base web application archive | createDeployment | {
"repo_name": "MicroProfileJWT/microprofile-jwt-auth",
"path": "tck/src/test/java/org/eclipse/microprofile/jwt/tck/container/jaxrs/PrimitiveInjectionTest.java",
"license": "apache-2.0",
"size": 14776
} | [
"org.eclipse.microprofile.jwt.tck.util.MpJwtTestVersion",
"org.jboss.shrinkwrap.api.ShrinkWrap",
"org.jboss.shrinkwrap.api.asset.StringAsset",
"org.jboss.shrinkwrap.api.spec.WebArchive"
] | import org.eclipse.microprofile.jwt.tck.util.MpJwtTestVersion; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.StringAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; | import org.eclipse.microprofile.jwt.tck.util.*; import org.jboss.shrinkwrap.api.*; import org.jboss.shrinkwrap.api.asset.*; import org.jboss.shrinkwrap.api.spec.*; | [
"org.eclipse.microprofile",
"org.jboss.shrinkwrap"
] | org.eclipse.microprofile; org.jboss.shrinkwrap; | 245,917 |
public Form infoAdicional() {
if(info == null) {
info = new Form("Info Adicional");
info.addCommand(new Command("Voltar", Command.BACK, 1));
infoAdicional = new StringItem("", "");
infoAnexos = new StringItem("", "");
info.append(infoAdicional);
info.append(infoAnexos);
}
return info;
} | Form function() { if(info == null) { info = new Form(STR); info.addCommand(new Command(STR, Command.BACK, 1)); infoAdicional = new StringItem(STR"); infoAnexos = new StringItem(STR"); info.append(infoAdicional); info.append(infoAnexos); } return info; } | /**
* o formulario onde e mostrada a informacao adicional de um mail
* @return o form
*/ | o formulario onde e mostrada a informacao adicional de um mail | infoAdicional | {
"repo_name": "rvelhote/university",
"path": "bluetooth/bluetooth.cliente/src/bluetooth/cliente/gui/MailsGUI.java",
"license": "unlicense",
"size": 5058
} | [
"javax.microedition.lcdui.Command",
"javax.microedition.lcdui.Form",
"javax.microedition.lcdui.StringItem"
] | import javax.microedition.lcdui.Command; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.StringItem; | import javax.microedition.lcdui.*; | [
"javax.microedition"
] | javax.microedition; | 1,540,777 |
protected void addHistoryEntry(HostDynamicWorkload host, double metric) {
int hostId = host.getId();
if (!getTimeHistory().containsKey(hostId)) {
getTimeHistory().put(hostId, new LinkedList<Double>());
}
if (!getUtilizationHistory().containsKey(hostId)) {
getUtilizationHistory().put(hostId, new LinkedList<Double>());
}
if (!getMetricHistory().containsKey(hostId)) {
getMetricHistory().put(hostId, new LinkedList<Double>());
}
if (!getTimeHistory().get(hostId).contains(CloudSim.clock())) {
getTimeHistory().get(hostId).add(CloudSim.clock());
getUtilizationHistory().get(hostId).add(host.getUtilizationOfCpu());
getMetricHistory().get(hostId).add(metric);
}
}
| void function(HostDynamicWorkload host, double metric) { int hostId = host.getId(); if (!getTimeHistory().containsKey(hostId)) { getTimeHistory().put(hostId, new LinkedList<Double>()); } if (!getUtilizationHistory().containsKey(hostId)) { getUtilizationHistory().put(hostId, new LinkedList<Double>()); } if (!getMetricHistory().containsKey(hostId)) { getMetricHistory().put(hostId, new LinkedList<Double>()); } if (!getTimeHistory().get(hostId).contains(CloudSim.clock())) { getTimeHistory().get(hostId).add(CloudSim.clock()); getUtilizationHistory().get(hostId).add(host.getUtilizationOfCpu()); getMetricHistory().get(hostId).add(metric); } } | /**
* Adds the history value.
*
* @param host the host
* @param metric the metric
*/ | Adds the history value | addHistoryEntry | {
"repo_name": "hieuvt/tccloudsim",
"path": "sources/org/cloudbus/cloudsim/power/PowerVmAllocationPolicyMigrationAbstract.java",
"license": "lgpl-3.0",
"size": 20796
} | [
"java.util.LinkedList",
"org.cloudbus.cloudsim.HostDynamicWorkload",
"org.cloudbus.cloudsim.core.CloudSim"
] | import java.util.LinkedList; import org.cloudbus.cloudsim.HostDynamicWorkload; import org.cloudbus.cloudsim.core.CloudSim; | import java.util.*; import org.cloudbus.cloudsim.*; import org.cloudbus.cloudsim.core.*; | [
"java.util",
"org.cloudbus.cloudsim"
] | java.util; org.cloudbus.cloudsim; | 121,583 |
@RequestMapping("/doGetAOIParam")
public ModelAndView doGetAOIParam(
@RequestParam("serviceUrl") String serviceUrl,
@RequestParam("featureType") String featureType) throws IOException, PortalServiceException {
JSONArray dataItems = new JSONArray();
String group = "";
for (String key : this.AOI_TITLE_TO_LAYER_MAP.keySet()) {
if (this.AOI_TITLE_TO_LAYER_MAP.get(key).equals(featureType)) {
group = key;
break;
}
}
String filter = this.capdfHydroGeoChemService.getMeasurementLimits(group);
final CSVParser parser = new CSVParser(this.newReader(this.capdfHydroGeoChemService.downloadCSV(serviceUrl,
CAPDF_MEASUREMENTLIMIT, filter, null)), CSVFormat.EXCEL.withHeader());
for (final CSVRecord record : parser) {
JSONArray tableRow = new JSONArray();
tableRow.add(record.get("classifier"));
tableRow.add(record.get("pref_name"));
tableRow.add(record.get("min"));
tableRow.add(record.get("max"));
dataItems.add(tableRow);
}
parser.close();
return generateJSONResponseMAV(true, dataItems, "");
} | @RequestMapping(STR) ModelAndView function( @RequestParam(STR) String serviceUrl, @RequestParam(STR) String featureType) throws IOException, PortalServiceException { JSONArray dataItems = new JSONArray(); String group = STRclassifierSTRpref_nameSTRminSTRmaxSTR"); } | /**
* Handler for the download of the hydrochemistry data in CSV format
*
* @param serviceUrl
* the url of the service to query
* @param featureType
* The grouping of the dataset correlate to the featureType.
* @return ModelAndView
* @throws IOException
* ,PortalServiceException
*/ | Handler for the download of the hydrochemistry data in CSV format | doGetAOIParam | {
"repo_name": "GeoscienceAustralia/geoscience-portal",
"path": "src/main/java/org/auscope/portal/server/web/controllers/CapdfHydroGeoChemController.java",
"license": "lgpl-3.0",
"size": 24200
} | [
"java.io.IOException",
"net.sf.json.JSONArray",
"org.auscope.portal.core.services.PortalServiceException",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.bind.annotation.RequestParam",
"org.springframework.web.servlet.ModelAndView"
] | import java.io.IOException; import net.sf.json.JSONArray; import org.auscope.portal.core.services.PortalServiceException; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; | import java.io.*; import net.sf.json.*; import org.auscope.portal.core.services.*; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.*; | [
"java.io",
"net.sf.json",
"org.auscope.portal",
"org.springframework.web"
] | java.io; net.sf.json; org.auscope.portal; org.springframework.web; | 1,903,771 |
protected RegisterApplicationMasterResponse registerApplicationMaster(
final int testAppId) throws Exception, YarnException, IOException {
final ApplicationUserInfo ugi = getApplicationUserInfo(testAppId); | RegisterApplicationMasterResponse function( final int testAppId) throws Exception, YarnException, IOException { final ApplicationUserInfo ugi = getApplicationUserInfo(testAppId); | /**
* Helper method to register an application master using specified testAppId
* as the application identifier and return the response
*
* @param testAppId
* @return
* @throws Exception
* @throws YarnException
* @throws IOException
*/ | Helper method to register an application master using specified testAppId as the application identifier and return the response | registerApplicationMaster | {
"repo_name": "ronny-macmaster/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/BaseAMRMProxyTest.java",
"license": "apache-2.0",
"size": 25566
} | [
"java.io.IOException",
"org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse",
"org.apache.hadoop.yarn.exceptions.YarnException"
] | import java.io.IOException; import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse; import org.apache.hadoop.yarn.exceptions.YarnException; | import java.io.*; import org.apache.hadoop.yarn.api.protocolrecords.*; import org.apache.hadoop.yarn.exceptions.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,772,107 |
public void setErrorMessageProvider(
@Nullable ErrorMessageProvider<? super PlaybackException> errorMessageProvider) {
if (this.errorMessageProvider != errorMessageProvider) {
this.errorMessageProvider = errorMessageProvider;
updateErrorMessage();
}
} | void function( @Nullable ErrorMessageProvider<? super PlaybackException> errorMessageProvider) { if (this.errorMessageProvider != errorMessageProvider) { this.errorMessageProvider = errorMessageProvider; updateErrorMessage(); } } | /**
* Sets the optional {@link ErrorMessageProvider}.
*
* @param errorMessageProvider The error message provider.
*/ | Sets the optional <code>ErrorMessageProvider</code> | setErrorMessageProvider | {
"repo_name": "google/ExoPlayer",
"path": "library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java",
"license": "apache-2.0",
"size": 60285
} | [
"androidx.annotation.Nullable",
"com.google.android.exoplayer2.PlaybackException",
"com.google.android.exoplayer2.util.ErrorMessageProvider"
] | import androidx.annotation.Nullable; import com.google.android.exoplayer2.PlaybackException; import com.google.android.exoplayer2.util.ErrorMessageProvider; | import androidx.annotation.*; import com.google.android.exoplayer2.*; import com.google.android.exoplayer2.util.*; | [
"androidx.annotation",
"com.google.android"
] | androidx.annotation; com.google.android; | 956,644 |
public static Version parseVersionLenient(String toParse, Version defaultValue) {
return LenientParser.parse(toParse, defaultValue);
} | static Version function(String toParse, Version defaultValue) { return LenientParser.parse(toParse, defaultValue); } | /**
* Parses the version string lenient and returns the default value if the given string is null or empty
*/ | Parses the version string lenient and returns the default value if the given string is null or empty | parseVersionLenient | {
"repo_name": "LeoYao/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/common/lucene/Lucene.java",
"license": "apache-2.0",
"size": 34227
} | [
"org.apache.lucene.util.Version"
] | import org.apache.lucene.util.Version; | import org.apache.lucene.util.*; | [
"org.apache.lucene"
] | org.apache.lucene; | 457,138 |
@Override
public Member updateMemberCache(final IMemberInformation inInformation) throws SQLException, VException {
// intentionally left empty
return null;
} | Member function(final IMemberInformation inInformation) throws SQLException, VException { return null; } | /** Not applicable in this case, therefore, no implementation provided.
*
* @see org.hip.vif.bom.MemberHome#updateMemberCache(org.hip.vif.member.IMemberInformation) */ | Not applicable in this case, therefore, no implementation provided | updateMemberCache | {
"repo_name": "aktion-hip/vif",
"path": "org.hip.vif.member.ldap/src/org/hip/vif/member/ldap/LDAPMemberHome.java",
"license": "gpl-2.0",
"size": 6130
} | [
"java.sql.SQLException",
"org.hip.kernel.exc.VException",
"org.hip.vif.core.bom.Member",
"org.hip.vif.core.member.IMemberInformation"
] | import java.sql.SQLException; import org.hip.kernel.exc.VException; import org.hip.vif.core.bom.Member; import org.hip.vif.core.member.IMemberInformation; | import java.sql.*; import org.hip.kernel.exc.*; import org.hip.vif.core.bom.*; import org.hip.vif.core.member.*; | [
"java.sql",
"org.hip.kernel",
"org.hip.vif"
] | java.sql; org.hip.kernel; org.hip.vif; | 1,937,367 |
public Color getBrushColor() {
return this.brushColor;
} | Color function() { return this.brushColor; } | /**
* Getter for property brushColor.
* @return Value of property brushColor.
*/ | Getter for property brushColor | getBrushColor | {
"repo_name": "Mindtoeye/Hoop",
"path": "src/org/jdesktop/swingx/painter/effects/AbstractAreaEffect.java",
"license": "lgpl-3.0",
"size": 13731
} | [
"java.awt.Color"
] | import java.awt.Color; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,006,032 |
public void setURIResolver(URIResolver uriResolver) {
this.uriResolver = uriResolver;
// entityResolver = new MyEntityResolver(uriResolver);
}
| void function(URIResolver uriResolver) { this.uriResolver = uriResolver; } | /**
* Set the URI Resolver to use.
*
* @param uriResolver
* The URI Resolver to use.
*/ | Set the URI Resolver to use | setURIResolver | {
"repo_name": "angelozerr/eclipse-wtp-json",
"path": "core/org.eclipse.wst.json.core/src/org/eclipse/wst/json/core/internal/validation/JSONValidator.java",
"license": "mit",
"size": 11133
} | [
"org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver"
] | import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver; | import org.eclipse.wst.common.uriresolver.internal.provisional.*; | [
"org.eclipse.wst"
] | org.eclipse.wst; | 684,632 |
LocalContainerEntityManagerFactoryBean newEntityManagerFactoryBean(JpaConfigurationContext config,
AbstractJpaProperties jpaProperties); | LocalContainerEntityManagerFactoryBean newEntityManagerFactoryBean(JpaConfigurationContext config, AbstractJpaProperties jpaProperties); | /**
* New entity manager factory bean local container entity manager factory bean.
*
* @param config the config
* @param jpaProperties the jpa properties
* @return the local container entity manager factory bean
*/ | New entity manager factory bean local container entity manager factory bean | newEntityManagerFactoryBean | {
"repo_name": "fogbeam/cas_mirror",
"path": "support/cas-server-support-jpa-util/src/main/java/org/apereo/cas/jpa/JpaBeanFactory.java",
"license": "apache-2.0",
"size": 2089
} | [
"org.apereo.cas.configuration.model.support.jpa.AbstractJpaProperties",
"org.apereo.cas.configuration.model.support.jpa.JpaConfigurationContext",
"org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
] | import org.apereo.cas.configuration.model.support.jpa.AbstractJpaProperties; import org.apereo.cas.configuration.model.support.jpa.JpaConfigurationContext; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; | import org.apereo.cas.configuration.model.support.jpa.*; import org.springframework.orm.jpa.*; | [
"org.apereo.cas",
"org.springframework.orm"
] | org.apereo.cas; org.springframework.orm; | 1,688,131 |
private static Exception extractException(Exception e) {
while (e instanceof PrivilegedActionException) {
e = ((PrivilegedActionException)e).getException();
}
return e;
}
private static class IdAndFilter {
private Integer id;
private NotificationFilter filter;
IdAndFilter(Integer id, NotificationFilter filter) {
this.id = id;
this.filter = filter;
} | static Exception function(Exception e) { while (e instanceof PrivilegedActionException) { e = ((PrivilegedActionException)e).getException(); } return e; } private static class IdAndFilter { private Integer id; private NotificationFilter filter; IdAndFilter(Integer id, NotificationFilter filter) { this.id = id; this.filter = filter; } | /**
* Iterate until we extract the real exception
* from a stack of PrivilegedActionExceptions.
*/ | Iterate until we extract the real exception from a stack of PrivilegedActionExceptions | extractException | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk2/jdk/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java",
"license": "mit",
"size": 18551
} | [
"java.security.PrivilegedActionException",
"javax.management.NotificationFilter"
] | import java.security.PrivilegedActionException; import javax.management.NotificationFilter; | import java.security.*; import javax.management.*; | [
"java.security",
"javax.management"
] | java.security; javax.management; | 2,179,726 |
public int smnt(String dir) throws IOException
{
return sendCommand(FTPCmd.SMNT, dir);
} | int function(String dir) throws IOException { return sendCommand(FTPCmd.SMNT, dir); } | /***
* A convenience method to send the FTP SMNT command to the server,
* receive the reply, and return the reply code.
*
* @param dir The directory name.
* @return The reply code received from the server.
* @throws FTPConnectionClosedException
* If the FTP server prematurely closes the connection as a result
* of the client being idle or some other reason causing the server
* to send FTP reply code 421. This exception may be caught either
* as an IOException or independently as itself.
* @throws IOException If an I/O error occurs while either sending the
* command or receiving the server reply.
***/ | A convenience method to send the FTP SMNT command to the server, receive the reply, and return the reply code | smnt | {
"repo_name": "grtlinux/KIEA_JAVA7",
"path": "KIEA_JAVA7/src/tain/kr/com/commons/net/v01/ftp/FTP.java",
"license": "gpl-3.0",
"size": 77693
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,518,720 |
public void setRound(@Nonnull Round round) {
this.round = round;
} | void function(@Nonnull Round round) { this.round = round; } | /**
* Sets the round associated with the event.
*
* @param round
* The round.
*/ | Sets the round associated with the event | setRound | {
"repo_name": "SiphonSquirrel/jepperscore",
"path": "dao/src/main/java/jepperscore/dao/model/Event.java",
"license": "apache-2.0",
"size": 4318
} | [
"javax.annotation.Nonnull"
] | import javax.annotation.Nonnull; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 93,205 |
public void testDefaultsToClassTransactionAttribute() throws Exception {
Method method = TestBean.class.getMethod("getAge", (Class[]) null);
TransactionAttribute txAtt = new DefaultTransactionAttribute();
MapAttributes ma = new MapAttributes();
AttributesTransactionAttributeSource atas = new AttributesTransactionAttributeSource(ma);
ma.register(TestBean.class, new Object[]{new Object(), "", txAtt, "er"});
TransactionAttribute actual = atas.getTransactionAttribute(method, null);
assertEquals(txAtt, actual);
}
| void function() throws Exception { Method method = TestBean.class.getMethod(STR, (Class[]) null); TransactionAttribute txAtt = new DefaultTransactionAttribute(); MapAttributes ma = new MapAttributes(); AttributesTransactionAttributeSource atas = new AttributesTransactionAttributeSource(ma); ma.register(TestBean.class, new Object[]{new Object(), STRer"}); TransactionAttribute actual = atas.getTransactionAttribute(method, null); assertEquals(txAtt, actual); } | /**
* Test that transaction attribute is inherited from class
* if not specified on method.
*/ | Test that transaction attribute is inherited from class if not specified on method | testDefaultsToClassTransactionAttribute | {
"repo_name": "codeApeFromChina/resource",
"path": "frame_packages/java_libs/spring-2.5.6-src/test/org/springframework/transaction/interceptor/CommonsAttributesTransactionAttributeSourceTests.java",
"license": "unlicense",
"size": 9078
} | [
"java.lang.reflect.Method",
"org.springframework.beans.TestBean",
"org.springframework.metadata.support.MapAttributes"
] | import java.lang.reflect.Method; import org.springframework.beans.TestBean; import org.springframework.metadata.support.MapAttributes; | import java.lang.reflect.*; import org.springframework.beans.*; import org.springframework.metadata.support.*; | [
"java.lang",
"org.springframework.beans",
"org.springframework.metadata"
] | java.lang; org.springframework.beans; org.springframework.metadata; | 666,259 |
boolean reclaimValue(K key, int hash, ValueReference<K, V> valueReference) {
lock();
try {
int newCount = this.count - 1;
AtomicReferenceArray<ReferenceEntry<K, V>> table = this.table;
int index = hash & (table.length() - 1);
ReferenceEntry<K, V> first = table.get(index);
for (ReferenceEntry<K, V> e = first; e != null; e = e.getNext()) {
K entryKey = e.getKey();
if (e.getHash() == hash
&& entryKey != null
&& map.keyEquivalence.equivalent(key, entryKey)) {
ValueReference<K, V> v = e.getValueReference();
if (v == valueReference) {
++modCount;
ReferenceEntry<K, V> newFirst =
removeValueFromChain(
first,
e,
entryKey,
hash,
valueReference.get(),
valueReference,
RemovalCause.COLLECTED);
newCount = this.count - 1;
table.set(index, newFirst);
this.count = newCount; // write-volatile
return true;
}
return false;
}
}
return false;
} finally {
unlock();
if (!isHeldByCurrentThread()) { // don't cleanup inside of put
postWriteCleanup();
}
}
} | boolean reclaimValue(K key, int hash, ValueReference<K, V> valueReference) { lock(); try { int newCount = this.count - 1; AtomicReferenceArray<ReferenceEntry<K, V>> table = this.table; int index = hash & (table.length() - 1); ReferenceEntry<K, V> first = table.get(index); for (ReferenceEntry<K, V> e = first; e != null; e = e.getNext()) { K entryKey = e.getKey(); if (e.getHash() == hash && entryKey != null && map.keyEquivalence.equivalent(key, entryKey)) { ValueReference<K, V> v = e.getValueReference(); if (v == valueReference) { ++modCount; ReferenceEntry<K, V> newFirst = removeValueFromChain( first, e, entryKey, hash, valueReference.get(), valueReference, RemovalCause.COLLECTED); newCount = this.count - 1; table.set(index, newFirst); this.count = newCount; return true; } return false; } } return false; } finally { unlock(); if (!isHeldByCurrentThread()) { postWriteCleanup(); } } } | /**
* Removes an entry whose value has been garbage collected.
*/ | Removes an entry whose value has been garbage collected | reclaimValue | {
"repo_name": "DavesMan/guava",
"path": "guava/src/com/google/common/cache/LocalCache.java",
"license": "apache-2.0",
"size": 153965
} | [
"java.util.concurrent.atomic.AtomicReferenceArray"
] | import java.util.concurrent.atomic.AtomicReferenceArray; | import java.util.concurrent.atomic.*; | [
"java.util"
] | java.util; | 21,977 |
public int showCancelableIntent(
PendingIntent intent, IntentCallback callback, Integer errorId) {
Log.d(TAG, "Can't show intent as context is not an Activity: " + intent);
return START_INTENT_FAILURE;
} | int function( PendingIntent intent, IntentCallback callback, Integer errorId) { Log.d(TAG, STR + intent); return START_INTENT_FAILURE; } | /**
* Shows an intent that could be canceled and returns the results to the callback object.
* @param intent The PendingIntent that needs to be shown.
* @param callback The object that will receive the results for the intent.
* @param errorId The ID of error string to be show if activity is paused before intent
* results, or null if no message is required.
* @return A non-negative request code that could be used for finishActivity, or
* START_INTENT_FAILURE if failed.
*/ | Shows an intent that could be canceled and returns the results to the callback object | showCancelableIntent | {
"repo_name": "hujiajie/chromium-crosswalk",
"path": "ui/android/java/src/org/chromium/ui/base/WindowAndroid.java",
"license": "bsd-3-clause",
"size": 25998
} | [
"android.app.PendingIntent",
"android.util.Log"
] | import android.app.PendingIntent; import android.util.Log; | import android.app.*; import android.util.*; | [
"android.app",
"android.util"
] | android.app; android.util; | 1,632,851 |
public void setAxisLinePaint(Paint paint) {
ParamChecks.nullNotPermitted(paint, "paint");
this.axisLinePaint = paint;
fireChangeEvent();
} | void function(Paint paint) { ParamChecks.nullNotPermitted(paint, "paint"); this.axisLinePaint = paint; fireChangeEvent(); } | /**
* Sets the paint used to draw the axis line and sends an
* {@link AxisChangeEvent} to all registered listeners.
*
* @param paint the paint (<code>null</code> not permitted).
*
* @see #getAxisLinePaint()
*/ | Sets the paint used to draw the axis line and sends an <code>AxisChangeEvent</code> to all registered listeners | setAxisLinePaint | {
"repo_name": "Epsilon2/Memetic-Algorithm-for-TSP",
"path": "jfreechart-1.0.16/source/org/jfree/chart/axis/Axis.java",
"license": "mit",
"size": 58723
} | [
"java.awt.Paint",
"org.jfree.chart.util.ParamChecks"
] | import java.awt.Paint; import org.jfree.chart.util.ParamChecks; | import java.awt.*; import org.jfree.chart.util.*; | [
"java.awt",
"org.jfree.chart"
] | java.awt; org.jfree.chart; | 2,080,270 |
public KualiDecimal getTotalApplied() {
KualiDecimal amount = KualiDecimal.ZERO;
amount = amount.add(getSumOfInvoicePaidApplieds());
amount = amount.add(getSumOfNonInvoiceds());
amount = amount.add(getNonAppliedHoldingAmount());
return amount;
} | KualiDecimal function() { KualiDecimal amount = KualiDecimal.ZERO; amount = amount.add(getSumOfInvoicePaidApplieds()); amount = amount.add(getSumOfNonInvoiceds()); amount = amount.add(getNonAppliedHoldingAmount()); return amount; } | /**
* This method returns the total amount allocated against the cash control total.
*
* @return
*/ | This method returns the total amount allocated against the cash control total | getTotalApplied | {
"repo_name": "quikkian-ua-devops/will-financials",
"path": "kfs-ar/src/main/java/org/kuali/kfs/module/ar/document/PaymentApplicationDocument.java",
"license": "agpl-3.0",
"size": 79628
} | [
"org.kuali.rice.core.api.util.type.KualiDecimal"
] | import org.kuali.rice.core.api.util.type.KualiDecimal; | import org.kuali.rice.core.api.util.type.*; | [
"org.kuali.rice"
] | org.kuali.rice; | 2,666,322 |
public static void grant(AccessControlService.BlockingInterface protocol,
String userShortName, Permission.Action... actions) throws ServiceException {
List<AccessControlProtos.Permission.Action> permActions =
Lists.newArrayListWithCapacity(actions.length);
for (Permission.Action a : actions) {
permActions.add(ProtobufUtil.toPermissionAction(a));
}
AccessControlProtos.GrantRequest request = RequestConverter.
buildGrantRequest(userShortName, permActions.toArray(
new AccessControlProtos.Permission.Action[actions.length]));
protocol.grant(null, request);
} | static void function(AccessControlService.BlockingInterface protocol, String userShortName, Permission.Action... actions) throws ServiceException { List<AccessControlProtos.Permission.Action> permActions = Lists.newArrayListWithCapacity(actions.length); for (Permission.Action a : actions) { permActions.add(ProtobufUtil.toPermissionAction(a)); } AccessControlProtos.GrantRequest request = RequestConverter. buildGrantRequest(userShortName, permActions.toArray( new AccessControlProtos.Permission.Action[actions.length])); protocol.grant(null, request); } | /**
* A utility used to grant a user global permissions.
* <p>
* It's also called by the shell, in case you want to find references.
*
* @param protocol the AccessControlService protocol proxy
* @param userShortName the short name of the user to grant permissions
* @param actions the permissions to be granted
* @throws ServiceException
*/ | A utility used to grant a user global permissions. It's also called by the shell, in case you want to find references | grant | {
"repo_name": "lshmouse/hbase",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java",
"license": "apache-2.0",
"size": 118965
} | [
"com.google.common.collect.Lists",
"com.google.protobuf.ServiceException",
"java.util.List",
"org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos",
"org.apache.hadoop.hbase.security.access.Permission"
] | import com.google.common.collect.Lists; import com.google.protobuf.ServiceException; import java.util.List; import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos; import org.apache.hadoop.hbase.security.access.Permission; | import com.google.common.collect.*; import com.google.protobuf.*; import java.util.*; import org.apache.hadoop.hbase.protobuf.generated.*; import org.apache.hadoop.hbase.security.access.*; | [
"com.google.common",
"com.google.protobuf",
"java.util",
"org.apache.hadoop"
] | com.google.common; com.google.protobuf; java.util; org.apache.hadoop; | 186,490 |
@ApiModelProperty(value = "")
public List<String> getTargets() {
return targets;
} | @ApiModelProperty(value = "") List<String> function() { return targets; } | /**
* Get targets
* @return targets
**/ | Get targets | getTargets | {
"repo_name": "rswijesena/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/dto/LifecycleState_checkItemBeanListDTO.java",
"license": "apache-2.0",
"size": 5514
} | [
"io.swagger.annotations.ApiModelProperty",
"java.util.List"
] | import io.swagger.annotations.ApiModelProperty; import java.util.List; | import io.swagger.annotations.*; import java.util.*; | [
"io.swagger.annotations",
"java.util"
] | io.swagger.annotations; java.util; | 1,548,527 |
switch (section) {
case AutofillDialogConstants.SECTION_CC :
return R.id.cc_spinner;
case AutofillDialogConstants.SECTION_CC_BILLING :
return R.id.cc_billing_spinner;
case AutofillDialogConstants.SECTION_SHIPPING :
return R.id.address_spinner;
case AutofillDialogConstants.SECTION_BILLING :
return R.id.billing_spinner;
case AutofillDialogConstants.SECTION_EMAIL :
return R.id.email_spinner;
default:
assert(false);
return INVALID_ID;
}
} | switch (section) { case AutofillDialogConstants.SECTION_CC : return R.id.cc_spinner; case AutofillDialogConstants.SECTION_CC_BILLING : return R.id.cc_billing_spinner; case AutofillDialogConstants.SECTION_SHIPPING : return R.id.address_spinner; case AutofillDialogConstants.SECTION_BILLING : return R.id.billing_spinner; case AutofillDialogConstants.SECTION_EMAIL : return R.id.email_spinner; default: assert(false); return INVALID_ID; } } | /**
* Returns the {@link Spinner} ID for the given section in the AutofillDialog
* layout
* @param section The section to return the spinner ID for.
* @return The Android ID for the spinner dropdown for the given section.
*/ | Returns the <code>Spinner</code> ID for the given section in the AutofillDialog layout | getSpinnerIDForSection | {
"repo_name": "plxaye/chromium",
"path": "src/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogUtils.java",
"license": "apache-2.0",
"size": 10124
} | [
"org.chromium.chrome.browser.autofill.AutofillDialogConstants"
] | import org.chromium.chrome.browser.autofill.AutofillDialogConstants; | import org.chromium.chrome.browser.autofill.*; | [
"org.chromium.chrome"
] | org.chromium.chrome; | 1,770,634 |
protected void assureSystemProperties() throws MojoExecutionException {
// explicitly specify SDK root, as auto-discovery fails when
// appengine-tools-api.jar is loaded from Maven repo, not SDK
String sdk = System.getProperty("appengine.sdk.root");
if (sdk == null) {
if (sdkDir == null) {
throw new MojoExecutionException(this,
"${gae.home} property not set", gaeProperties
.getProperty("home_undefined"));
}
System.setProperty("appengine.sdk.root", sdk = sdkDir);
}
if (!new File(sdk).isDirectory()) {
throw new MojoExecutionException(this,
"${gae.home} is not a directory", gaeProperties
.getProperty("home_invalid"));
}
// hack for getting appengine-tools-api.jar on a runtime classpath
// (GAEStarter checks java.class.path system property for classpath
// entries)
final String classpath = System.getProperty("java.class.path");
final String toolsJar = sdkDir + "/lib/appengine-tools-api.jar";
if (!classpath.contains(toolsJar)) {
System.setProperty("java.class.path", classpath
+ File.pathSeparator + toolsJar);
}
} | void function() throws MojoExecutionException { String sdk = System.getProperty(STR); if (sdk == null) { if (sdkDir == null) { throw new MojoExecutionException(this, STR, gaeProperties .getProperty(STR)); } System.setProperty(STR, sdk = sdkDir); } if (!new File(sdk).isDirectory()) { throw new MojoExecutionException(this, STR, gaeProperties .getProperty(STR)); } final String classpath = System.getProperty(STR); final String toolsJar = sdkDir + STR; if (!classpath.contains(toolsJar)) { System.setProperty(STR, classpath + File.pathSeparator + toolsJar); } } | /**
* Groups alterations to System properties for the proper execution of the
* actual GAE code.
*
* @throws MojoExecutionException
* When the gae.home variable cannot be set.
*/ | Groups alterations to System properties for the proper execution of the actual GAE code | assureSystemProperties | {
"repo_name": "phuongnd08/maven-geaForTest-plugin",
"path": "src/main/java/org/seamoo/gaeForTest/EngineGoalBase.java",
"license": "apache-2.0",
"size": 7468
} | [
"java.io.File",
"org.apache.maven.plugin.MojoExecutionException"
] | import java.io.File; import org.apache.maven.plugin.MojoExecutionException; | import java.io.*; import org.apache.maven.plugin.*; | [
"java.io",
"org.apache.maven"
] | java.io; org.apache.maven; | 58,078 |
@Test
public void matrixTest2() {
Dataset v = Random.rand(3);
Dataset nz = Comparisons.nonZero(Comparisons.greaterThan(v, 0.5)).get(0);
System.out.println("" + a.getByIndexes(null, nz));
}
| void function() { Dataset v = Random.rand(3); Dataset nz = Comparisons.nonZero(Comparisons.greaterThan(v, 0.5)).get(0); System.out.println("" + a.getByIndexes(null, nz)); } | /**extract the columms of a where vector v > 0.5
a(:,find(v>0.5)) a[:,nonzero(v>0.5)[0]] a[:,nonzero(v.A>0.5)[0]]
**/ | extract the columms of a where vector v > 0.5 | matrixTest2 | {
"repo_name": "Anthchirp/dawnsci",
"path": "org.eclipse.dawnsci.analysis.examples/src/org/eclipse/dawnsci/analysis/examples/dataset/NumpyExamples.java",
"license": "epl-1.0",
"size": 24495
} | [
"org.eclipse.dawnsci.analysis.dataset.impl.Comparisons",
"org.eclipse.dawnsci.analysis.dataset.impl.Dataset",
"org.eclipse.dawnsci.analysis.dataset.impl.Random"
] | import org.eclipse.dawnsci.analysis.dataset.impl.Comparisons; import org.eclipse.dawnsci.analysis.dataset.impl.Dataset; import org.eclipse.dawnsci.analysis.dataset.impl.Random; | import org.eclipse.dawnsci.analysis.dataset.impl.*; | [
"org.eclipse.dawnsci"
] | org.eclipse.dawnsci; | 2,679,389 |
@Override
public void removeTaskStatus(final JobId jobId) throws InterruptedException {
taskStatuses.remove(jobId.toString());
} | void function(final JobId jobId) throws InterruptedException { taskStatuses.remove(jobId.toString()); } | /**
* Remove the {@link TaskStatus} for the job identified by {@code jobId}.
*/ | Remove the <code>TaskStatus</code> for the job identified by jobId | removeTaskStatus | {
"repo_name": "mavenraven/helios",
"path": "helios-services/src/main/java/com/spotify/helios/agent/ZooKeeperAgentModel.java",
"license": "apache-2.0",
"size": 8625
} | [
"com.spotify.helios.common.descriptors.JobId"
] | import com.spotify.helios.common.descriptors.JobId; | import com.spotify.helios.common.descriptors.*; | [
"com.spotify.helios"
] | com.spotify.helios; | 2,820,363 |
protected static boolean insertTreeNode(PO po)
{
//
// services
final IPOTreeSupportFactory treeSupportFactory = Services.get(IPOTreeSupportFactory.class);
// TODO: check self contained tree
final int AD_Table_ID = po.get_Table_ID();
if (!MTree.hasTree(AD_Table_ID))
{
return false;
}
final int id = po.get_ID();
final int AD_Client_ID = po.getAD_Client_ID();
final String treeTableName = MTree.getNodeTableName(AD_Table_ID);
final String trxName = po.get_TrxName();
final Logger log = po.get_Logger();
final IPOTreeSupport treeSupport = treeSupportFactory.get(po.get_TableName());
final int AD_Tree_ID = treeSupport.getAD_Tree_ID(po);
int parentId = treeSupport.getParent_ID(po);
if (parentId < 0 || parentId == IPOTreeSupport.UNKNOWN_ParentID)
{
parentId = ROOT_Node_ID;
}
//
// Insert
final StringBuilder sb = new StringBuilder("INSERT INTO ")
.append(treeTableName)
.append(" (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, ")
.append("AD_Tree_ID, Node_ID, Parent_ID, SeqNo) ")
//
.append("SELECT t.AD_Client_ID,0, 'Y', now(), " + po.getUpdatedBy() + ", now(), " + po.getUpdatedBy() + ",")
.append("t.AD_Tree_ID, ").append(id).append(", ").append(parentId).append(", 999 ")
.append("FROM AD_Tree t ")
.append("WHERE t.AD_Client_ID=").append(AD_Client_ID).append(" AND t.IsActive='Y'");
if (AD_Tree_ID > 0)
{
sb.append(" AND t.AD_Tree_ID=").append(AD_Tree_ID);
}
else
// std trees
{
sb.append(" AND t.IsAllNodes='Y' AND t.AD_Table_ID=").append(AD_Table_ID);
}
// Duplicate Check
sb.append(" AND NOT EXISTS (SELECT * FROM ").append(treeTableName).append(" e ")
.append("WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=").append(id).append(")");
//
int no = DB.executeUpdateEx(sb.toString(), trxName);
if (no < 0)
{
log.warn("#" + no + " - AD_Table_ID=" + AD_Table_ID);
return false;
}
log.debug("#" + no + " - AD_Table_ID=" + AD_Table_ID);
// MigrationLogger.instance.logMigrationSQL(po, sb.toString()); // metas: not needed because it's called directly from PO
listeners.onNodeInserted(po);
return true;
} // insert_Tree | static boolean function(PO po) { final IPOTreeSupportFactory treeSupportFactory = Services.get(IPOTreeSupportFactory.class); final int AD_Table_ID = po.get_Table_ID(); if (!MTree.hasTree(AD_Table_ID)) { return false; } final int id = po.get_ID(); final int AD_Client_ID = po.getAD_Client_ID(); final String treeTableName = MTree.getNodeTableName(AD_Table_ID); final String trxName = po.get_TrxName(); final Logger log = po.get_Logger(); final IPOTreeSupport treeSupport = treeSupportFactory.get(po.get_TableName()); final int AD_Tree_ID = treeSupport.getAD_Tree_ID(po); int parentId = treeSupport.getParent_ID(po); if (parentId < 0 parentId == IPOTreeSupport.UNKNOWN_ParentID) { parentId = ROOT_Node_ID; } final StringBuilder sb = new StringBuilder(STR) .append(treeTableName) .append(STR) .append(STR) .append(STR).append(id).append(STR).append(parentId).append(STR) .append(STR) .append(STR).append(AD_Client_ID).append(STR); if (AD_Tree_ID > 0) { sb.append(STR).append(AD_Tree_ID); } else { sb.append(STR).append(AD_Table_ID); } sb.append(STR).append(treeTableName).append(STR) .append(STR).append(id).append(")"); if (no < 0) { log.warn("#" + no + STR + AD_Table_ID); return false; } log.debug("#" + no + STR + AD_Table_ID); listeners.onNodeInserted(po); return true; } | /**************************************************************************
* Insert id data into Tree
*
* @return true if inserted
*/ | Insert id data into Tree | insertTreeNode | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.adempiere.adempiere/base/src/main/java-legacy/org/compiere/model/MTree_Base.java",
"license": "gpl-2.0",
"size": 28656
} | [
"org.adempiere.model.tree.IPOTreeSupportFactory",
"org.adempiere.model.tree.spi.IPOTreeSupport",
"org.adempiere.util.Services",
"org.slf4j.Logger"
] | import org.adempiere.model.tree.IPOTreeSupportFactory; import org.adempiere.model.tree.spi.IPOTreeSupport; import org.adempiere.util.Services; import org.slf4j.Logger; | import org.adempiere.model.tree.*; import org.adempiere.model.tree.spi.*; import org.adempiere.util.*; import org.slf4j.*; | [
"org.adempiere.model",
"org.adempiere.util",
"org.slf4j"
] | org.adempiere.model; org.adempiere.util; org.slf4j; | 948,517 |
private InsightsContentDetail countTrendResult(List<InsightsKPIResultDetails> inferenceResults) {
InsightsContentDetail inferenceContentResult = null;
Map<String, Object> resultValuesMap = new HashMap<>();
double resultValue = 0.0;
try {
long startTime = System.nanoTime();
ReportEngineEnum.KPISentiment sentiment = ReportEngineEnum.KPISentiment.NEUTRAL;
InsightsKPIResultDetails resultFirstData = inferenceResults.get(0);
addTimeValueinResult(resultValuesMap, contentConfigDefinition.getSchedule());
for (InsightsKPIResultDetails inferenceResultDetails : inferenceResults) {
String comparisonField = getResultFieldFromContentDefination();
resultValue = resultValue + ((double) inferenceResultDetails.getResults().get(comparisonField));
}
resultValuesMap.put("result", resultValue);
inferenceContentResult = prepareContentMessageAndResult(inferenceContentResult, resultValuesMap,
resultValue, sentiment, resultFirstData);
long processingTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime);
log.debug("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}",
contentConfigDefinition.getExecutionId(),contentConfigDefinition.getWorkflowId(),contentConfigDefinition.getReportId(),
"-",
contentConfigDefinition.getKpiId(),contentConfigDefinition.getCategory(),processingTime,
" ContentId :" + contentConfigDefinition.getContentId() + " ContentName :" +contentConfigDefinition.getContentName() +
" action :" + contentConfigDefinition.getAction()
+ " ContentResult :" + contentConfigDefinition.getNoOfResult());
} catch (Exception e) {
log.error(e);
log.error(" Errro while content processing for trend KPIId {} contentId {} ",
getContentConfig().getKpiId(), getContentConfig().getContentId());
log.error("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}",
contentConfigDefinition.getExecutionId(),contentConfigDefinition.getWorkflowId(),contentConfigDefinition.getReportId()
,"-",
contentConfigDefinition.getKpiId(),contentConfigDefinition.getCategory(),0,
"ContentId :" + contentConfigDefinition.getContentId() + "ContentName :" +contentConfigDefinition.getContentName() +
"action :" + contentConfigDefinition.getAction()
+ "ContentResult :" + contentConfigDefinition.getNoOfResult() + " Exception while running neo4j operation" + e.getMessage() );
throw new InsightsJobFailedException("Exception while running neo4j operation {} " + e.getMessage());
}
return inferenceContentResult;
}
| InsightsContentDetail function(List<InsightsKPIResultDetails> inferenceResults) { InsightsContentDetail inferenceContentResult = null; Map<String, Object> resultValuesMap = new HashMap<>(); double resultValue = 0.0; try { long startTime = System.nanoTime(); ReportEngineEnum.KPISentiment sentiment = ReportEngineEnum.KPISentiment.NEUTRAL; InsightsKPIResultDetails resultFirstData = inferenceResults.get(0); addTimeValueinResult(resultValuesMap, contentConfigDefinition.getSchedule()); for (InsightsKPIResultDetails inferenceResultDetails : inferenceResults) { String comparisonField = getResultFieldFromContentDefination(); resultValue = resultValue + ((double) inferenceResultDetails.getResults().get(comparisonField)); } resultValuesMap.put(STR, resultValue); inferenceContentResult = prepareContentMessageAndResult(inferenceContentResult, resultValuesMap, resultValue, sentiment, resultFirstData); long processingTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime); log.debug(STR, contentConfigDefinition.getExecutionId(),contentConfigDefinition.getWorkflowId(),contentConfigDefinition.getReportId(), "-", contentConfigDefinition.getKpiId(),contentConfigDefinition.getCategory(),processingTime, STR + contentConfigDefinition.getContentId() + STR +contentConfigDefinition.getContentName() + STR + contentConfigDefinition.getAction() + STR + contentConfigDefinition.getNoOfResult()); } catch (Exception e) { log.error(e); log.error(STR, getContentConfig().getKpiId(), getContentConfig().getContentId()); log.error(STR, contentConfigDefinition.getExecutionId(),contentConfigDefinition.getWorkflowId(),contentConfigDefinition.getReportId() ,"-", contentConfigDefinition.getKpiId(),contentConfigDefinition.getCategory(),0, STR + contentConfigDefinition.getContentId() + STR +contentConfigDefinition.getContentName() + STR + contentConfigDefinition.getAction() + STR + contentConfigDefinition.getNoOfResult() + STR + e.getMessage() ); throw new InsightsJobFailedException(STR + e.getMessage()); } return inferenceContentResult; } | /**
* Process KPI result to create content text using count and precentage method
*
* @param inferenceResults
* @return
*/ | Process KPI result to create content text using count and precentage method | countTrendResult | {
"repo_name": "CognizantOneDevOps/Insights",
"path": "PlatformReports/src/main/java/com/cognizant/devops/platformreports/assessment/content/TrendCategoryImpl.java",
"license": "apache-2.0",
"size": 11573
} | [
"com.cognizant.devops.platformreports.assessment.datamodel.InsightsContentDetail",
"com.cognizant.devops.platformreports.assessment.datamodel.InsightsKPIResultDetails",
"com.cognizant.devops.platformreports.assessment.util.ReportEngineEnum",
"com.cognizant.devops.platformreports.exception.InsightsJobFailedException",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"java.util.concurrent.TimeUnit"
] | import com.cognizant.devops.platformreports.assessment.datamodel.InsightsContentDetail; import com.cognizant.devops.platformreports.assessment.datamodel.InsightsKPIResultDetails; import com.cognizant.devops.platformreports.assessment.util.ReportEngineEnum; import com.cognizant.devops.platformreports.exception.InsightsJobFailedException; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; | import com.cognizant.devops.platformreports.assessment.datamodel.*; import com.cognizant.devops.platformreports.assessment.util.*; import com.cognizant.devops.platformreports.exception.*; import java.util.*; import java.util.concurrent.*; | [
"com.cognizant.devops",
"java.util"
] | com.cognizant.devops; java.util; | 2,362,146 |
@Test
public void testWrongCreation() {
// Build not allowed string
String wrongString = Strings.repeat("x", 1025);
// Define expected exception
exceptionWrongId.expect(IllegalArgumentException.class);
// Create policer id
PolicerId.policerId(wrongString);
} | void function() { String wrongString = Strings.repeat("x", 1025); exceptionWrongId.expect(IllegalArgumentException.class); PolicerId.policerId(wrongString); } | /**
* Test wrong creation of a policer id.
*/ | Test wrong creation of a policer id | testWrongCreation | {
"repo_name": "gkatsikas/onos",
"path": "core/api/src/test/java/org/onosproject/net/behaviour/trafficcontrol/PolicerIdTest.java",
"license": "apache-2.0",
"size": 4560
} | [
"com.google.common.base.Strings"
] | import com.google.common.base.Strings; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 1,166,765 |
public List<String> getCustomFeaturesList() {
return customFeatures;
} | List<String> function() { return customFeatures; } | /**
* A list of features enabled when the selected profile is CUSTOM. The - method returns the set of
* features that can be specified in this list. This field must be empty if the profile is not
* CUSTOM.
*/ | A list of features enabled when the selected profile is CUSTOM. The - method returns the set of features that can be specified in this list. This field must be empty if the profile is not CUSTOM | getCustomFeaturesList | {
"repo_name": "vam-google/google-cloud-java",
"path": "google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPolicy.java",
"license": "apache-2.0",
"size": 21500
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 601,767 |
public static Process compile(
final String command,
final String[] env,
final File outputFile,
final File directory,
final Action onSuccess,
final Action onFailure,
final MessageList compilationOutput,
boolean synchronous)
throws Exception {
Pattern p = Pattern.compile("([^\\s\"']+|\"[^\"]*\"|'[^']*')");
Matcher m = p.matcher(command);
ArrayList<String> commandList = new ArrayList<String>();
while(m.find()) {
String arg = m.group();
if (arg.length() > 1 && (arg.charAt(0) == '"' || arg.charAt(0) == '\'')) {
arg = arg.substring(1, arg.length() - 1);
}
commandList.add(arg);
}
return compile(commandList.toArray(new String[commandList.size()]), env, outputFile, directory, onSuccess, onFailure, compilationOutput, synchronous);
} | static Process function( final String command, final String[] env, final File outputFile, final File directory, final Action onSuccess, final Action onFailure, final MessageList compilationOutput, boolean synchronous) throws Exception { Pattern p = Pattern.compile(STR']+ \"[^\"]*\STR); Matcher m = p.matcher(command); ArrayList<String> commandList = new ArrayList<String>(); while(m.find()) { String arg = m.group(); if (arg.length() > 1 && (arg.charAt(0) == '"' arg.charAt(0) == '\'')) { arg = arg.substring(1, arg.length() - 1); } commandList.add(arg); } return compile(commandList.toArray(new String[commandList.size()]), env, outputFile, directory, onSuccess, onFailure, compilationOutput, synchronous); } | /**
* Executes a Contiki compilation command.
*
* @param command Command
* @param env (Optional) Environment. May be null.
* @param outputFile Expected output. May be null.
* @param directory Directory in which to execute command
* @param onSuccess Action called if compilation succeeds
* @param onFailure Action called if compilation fails
* @param compilationOutput Is written both std and err process output
* @param synchronous If true, method blocks until process completes
* @return Sub-process if called asynchronously
* @throws Exception If process returns error, or outputFile does not exist
*/ | Executes a Contiki compilation command | compile | {
"repo_name": "CaptFrank/Contiki-Sensor-Node",
"path": "Contiki/contiki/tools/cooja/java/se/sics/cooja/dialogs/CompileContiki.java",
"license": "gpl-2.0",
"size": 20397
} | [
"java.io.File",
"java.util.ArrayList",
"java.util.regex.Matcher",
"java.util.regex.Pattern",
"javax.swing.Action"
] | import java.io.File; import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.swing.Action; | import java.io.*; import java.util.*; import java.util.regex.*; import javax.swing.*; | [
"java.io",
"java.util",
"javax.swing"
] | java.io; java.util; javax.swing; | 272,743 |
public RectF getDestinyRect() {
return mDstRect;
} | RectF function() { return mDstRect; } | /**
* Gets the rect that will take the scene when a Ken Burns transition ends.
* @return the rect that ends the transition.
*/ | Gets the rect that will take the scene when a Ken Burns transition ends | getDestinyRect | {
"repo_name": "Koteczeg/WarsawCityGame",
"path": "WarsawCityGame/WarsawCityGames.App/src/main/java/com/warsawcitygame/Transitions/Transition.java",
"license": "mit",
"size": 3703
} | [
"android.graphics.RectF"
] | import android.graphics.RectF; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 402,478 |
@Test
public void testPostMultipartSharedTextFileMimeTypeNotInAccepts() {
ShareTargetBuilder shareTargetBuilder = new ShareTargetBuilder("/share.html");
shareTargetBuilder.setMethod(ShareTarget.METHOD_POST);
shareTargetBuilder.setEncodingType(ShareTarget.ENCODING_TYPE_MULTIPART);
shareTargetBuilder.addParamFile("name", new String[] {"image, null , uris);
WebApkShareTargetUtil.PostData postData =
computePostData(shareTargetBuilder.build(), shareData);
assertPostData(postData, new String[] {"share-text"}, new boolean[] {true},
new String[] {"text-file-mock-uri"}, new String[] {""},
new String[] {"text/plain"});
} | void function() { ShareTargetBuilder shareTargetBuilder = new ShareTargetBuilder(STR); shareTargetBuilder.setMethod(ShareTarget.METHOD_POST); shareTargetBuilder.setEncodingType(ShareTarget.ENCODING_TYPE_MULTIPART); shareTargetBuilder.addParamFile("name", new String[] {STRshare-textSTRtext-file-mock-uriSTRSTRtext/plain"}); } | /**
* Test that when SHARE_PARAM_ACCEPTS doesn't accept text, but we receive a text file, and that
* we don't receive shared text, that we send the text file as shared text.
*/ | Test that when SHARE_PARAM_ACCEPTS doesn't accept text, but we receive a text file, and that we don't receive shared text, that we send the text file as shared text | testPostMultipartSharedTextFileMimeTypeNotInAccepts | {
"repo_name": "ric2b/Vivaldi-browser",
"path": "chromium/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkShareTargetUtilTest.java",
"license": "bsd-3-clause",
"size": 22950
} | [
"androidx.browser.trusted.sharing.ShareTarget"
] | import androidx.browser.trusted.sharing.ShareTarget; | import androidx.browser.trusted.sharing.*; | [
"androidx.browser"
] | androidx.browser; | 2,200,215 |
public void finishWrite(FileOutputStream stream) throws IOException {
try {
stream.close();
} catch (IOException e) {
failWrite(stream);
throw e;
}
if (!workFile.renameTo(activeFile)) {
failWrite(stream);
throw new IOException("Cannot commit transaction");
}
} | void function(FileOutputStream stream) throws IOException { try { stream.close(); } catch (IOException e) { failWrite(stream); throw e; } if (!workFile.renameTo(activeFile)) { failWrite(stream); throw new IOException(STR); } } | /**
* Atomically replaces the active file with the work file, and closes the stream.
* @param stream
* @throws IOException
*/ | Atomically replaces the active file with the work file, and closes the stream | finishWrite | {
"repo_name": "KevinSJ/dns66",
"path": "app/src/main/java/org/jak_linux/dns66/SingleWriterMultipleReaderFile.java",
"license": "gpl-3.0",
"size": 3005
} | [
"java.io.FileOutputStream",
"java.io.IOException"
] | import java.io.FileOutputStream; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,522,498 |
protected void parseColumnsAndConstraints( DdlTokenStream tokens,
AstNode tableNode ) throws ParsingException {
assert tokens != null;
assert tableNode != null;
if (!tokens.matches(L_PAREN)) {
return;
}
String tableElementString = getTableElementsString(tokens, false);
DdlTokenStream localTokens = new DdlTokenStream(tableElementString, DdlTokenStream.ddlTokenizer(false), false);
localTokens.start();
StringBuilder unusedTokensSB = new StringBuilder();
do {
if (isTableConstraint(localTokens)) {
parseTableConstraint(localTokens, tableNode, false);
} else if (isColumnDefinitionStart(localTokens)) {
parseColumnDefinition(localTokens, tableNode, false);
} else {
unusedTokensSB.append(SPACE).append(localTokens.consume());
}
} while (localTokens.canConsume(COMMA));
if (unusedTokensSB.length() > 0) {
String msg = DdlSequencerI18n.unusedTokensParsingColumnsAndConstraints.text(tableNode.getName());
DdlParserProblem problem = new DdlParserProblem(DdlConstants.Problems.WARNING, Position.EMPTY_CONTENT_POSITION, msg);
problem.setUnusedSource(unusedTokensSB.toString());
addProblem(problem, tableNode);
}
} | void function( DdlTokenStream tokens, AstNode tableNode ) throws ParsingException { assert tokens != null; assert tableNode != null; if (!tokens.matches(L_PAREN)) { return; } String tableElementString = getTableElementsString(tokens, false); DdlTokenStream localTokens = new DdlTokenStream(tableElementString, DdlTokenStream.ddlTokenizer(false), false); localTokens.start(); StringBuilder unusedTokensSB = new StringBuilder(); do { if (isTableConstraint(localTokens)) { parseTableConstraint(localTokens, tableNode, false); } else if (isColumnDefinitionStart(localTokens)) { parseColumnDefinition(localTokens, tableNode, false); } else { unusedTokensSB.append(SPACE).append(localTokens.consume()); } } while (localTokens.canConsume(COMMA)); if (unusedTokensSB.length() > 0) { String msg = DdlSequencerI18n.unusedTokensParsingColumnsAndConstraints.text(tableNode.getName()); DdlParserProblem problem = new DdlParserProblem(DdlConstants.Problems.WARNING, Position.EMPTY_CONTENT_POSITION, msg); problem.setUnusedSource(unusedTokensSB.toString()); addProblem(problem, tableNode); } } | /**
* Utility method to parse columns and table constraints within either a CREATE TABLE statement. Method first parses and
* copies the text enclosed within the bracketed "( xxxx )" statement. Then the individual column definition or table
* constraint definition sub-statements are parsed assuming they are comma delimited.
*
* @param tokens the {@link DdlTokenStream} representing the tokenized DDL content; may not be null
* @param tableNode
* @throws ParsingException
*/ | Utility method to parse columns and table constraints within either a CREATE TABLE statement. Method first parses and copies the text enclosed within the bracketed "( xxxx )" statement. Then the individual column definition or table constraint definition sub-statements are parsed assuming they are comma delimited | parseColumnsAndConstraints | {
"repo_name": "okulikov/modeshape",
"path": "sequencers/modeshape-sequencer-ddl/src/main/java/org/modeshape/sequencer/ddl/StandardDdlParser.java",
"license": "apache-2.0",
"size": 125381
} | [
"org.modeshape.common.text.ParsingException",
"org.modeshape.common.text.Position",
"org.modeshape.sequencer.ddl.node.AstNode"
] | import org.modeshape.common.text.ParsingException; import org.modeshape.common.text.Position; import org.modeshape.sequencer.ddl.node.AstNode; | import org.modeshape.common.text.*; import org.modeshape.sequencer.ddl.node.*; | [
"org.modeshape.common",
"org.modeshape.sequencer"
] | org.modeshape.common; org.modeshape.sequencer; | 158,985 |
static void annotateRxn(Reaction rxn, List<Interaction> interacts) {
List<URI> interactIdentities = new LinkedList<URI>();
for (Interaction interact : interacts)
interactIdentities.add(interact.getIdentity());
SBOLAnnotation rxnAnno = new SBOLAnnotation(rxn.getMetaId(),
interacts.get(0).getClass().getSimpleName(), interactIdentities);
AnnotationUtility.setSBOLAnnotation(rxn, rxnAnno);
}
| static void annotateRxn(Reaction rxn, List<Interaction> interacts) { List<URI> interactIdentities = new LinkedList<URI>(); for (Interaction interact : interacts) interactIdentities.add(interact.getIdentity()); SBOLAnnotation rxnAnno = new SBOLAnnotation(rxn.getMetaId(), interacts.get(0).getClass().getSimpleName(), interactIdentities); AnnotationUtility.setSBOLAnnotation(rxn, rxnAnno); } | /**
* Annotate SBML reaction with a list of SBOL interactions.
*
* @param rxn - The SBML reaction to be annotated with SBOL interactions
* @param interacts - The SBOL Interactions to be annotated into SBML reaction.
*/ | Annotate SBML reaction with a list of SBOL interactions | annotateRxn | {
"repo_name": "MyersResearchGroup/iBioSim",
"path": "conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBOL2SBML.java",
"license": "apache-2.0",
"size": 84633
} | [
"edu.utah.ece.async.ibiosim.dataModels.biomodel.annotation.AnnotationUtility",
"edu.utah.ece.async.ibiosim.dataModels.biomodel.annotation.SBOLAnnotation",
"java.util.LinkedList",
"java.util.List",
"org.sbml.jsbml.Reaction",
"org.sbolstandard.core2.Interaction"
] | import edu.utah.ece.async.ibiosim.dataModels.biomodel.annotation.AnnotationUtility; import edu.utah.ece.async.ibiosim.dataModels.biomodel.annotation.SBOLAnnotation; import java.util.LinkedList; import java.util.List; import org.sbml.jsbml.Reaction; import org.sbolstandard.core2.Interaction; | import edu.utah.ece.async.ibiosim.*; import java.util.*; import org.sbml.jsbml.*; import org.sbolstandard.core2.*; | [
"edu.utah.ece",
"java.util",
"org.sbml.jsbml",
"org.sbolstandard.core2"
] | edu.utah.ece; java.util; org.sbml.jsbml; org.sbolstandard.core2; | 382,311 |
public Observable<Map<String, Object>> queryToKBase(final Object javaObject, final Object... params){
if (javaObject == null)
throw new NullPointerException("A query must always be about something, querying null is not possible.");
// temporarly disabled caching for debugging purposes
//if (subjects.containsKey(javaObject))
// return (Observable<Map<String, Object>>) subjects.get(javaObject).asObservable();
final Subject<Map<String, Object>,Map<String, Object>> result;
result = ReplaySubject.create();
Observer o = null;
Formula query = null;
try
{
query = JSAReasoningCapability.getFormulaForObject(
javaObject,
params
);
} catch (Exception e1)
{
log.error("Query "+javaObject+" could not be created.", e1);
return null;
}
QueryResult value = null;
value = this.getKBase().query(query);
o = new ObserverAdapter(this.getKBase(),query)
{
| Observable<Map<String, Object>> function(final Object javaObject, final Object... params){ if (javaObject == null) throw new NullPointerException(STR); final Subject<Map<String, Object>,Map<String, Object>> result; result = ReplaySubject.create(); Observer o = null; Formula query = null; try { query = JSAReasoningCapability.getFormulaForObject( javaObject, params ); } catch (Exception e1) { log.error(STR+javaObject+STR, e1); return null; } QueryResult value = null; value = this.getKBase().query(query); o = new ObserverAdapter(this.getKBase(),query) { | /**
* Observer for the queryResults
* @param javaObject
* @param params
* @return
*/ | Observer for the queryResults | queryToKBase | {
"repo_name": "krevelen/coala",
"path": "coala-adapters/coala-jsa-adapter/src/main/java/io/coala/jsa/JSAReasoningCapability.java",
"license": "apache-2.0",
"size": 12585
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,473,238 |
public Query makeQuery(PathQuery pathQuery, Map<String, BagQueryResult> pathToBagQueryResult,
Map<String, QuerySelectable> pathToQueryNode) throws ObjectStoreException {
Map<String, InterMineBag> allBags = bagManager.getBags(profile);
Query q = MainHelper.makeQuery(pathQuery, allBags, pathToQueryNode, bagQueryRunner,
pathToBagQueryResult);
return q;
} | Query function(PathQuery pathQuery, Map<String, BagQueryResult> pathToBagQueryResult, Map<String, QuerySelectable> pathToQueryNode) throws ObjectStoreException { Map<String, InterMineBag> allBags = bagManager.getBags(profile); Query q = MainHelper.makeQuery(pathQuery, allBags, pathToQueryNode, bagQueryRunner, pathToBagQueryResult); return q; } | /**
* Creates an IQL query from a PathQuery.
*
* @param pathQuery the query to convert
* @param pathToBagQueryResult will be populated with results from bag queries used in any
* LOOKUP constraints
* @param pathToQueryNode a Map from String path in the PathQuery to QuerySelectable in the
* resulting IQL Query
* @return an IQL Query object
* @throws ObjectStoreException if problem creating query
*/ | Creates an IQL query from a PathQuery | makeQuery | {
"repo_name": "joshkh/intermine",
"path": "intermine/api/main/src/org/intermine/api/query/WebResultsExecutor.java",
"license": "lgpl-2.1",
"size": 8123
} | [
"java.util.Map",
"org.intermine.api.bag.BagQueryResult",
"org.intermine.api.profile.InterMineBag",
"org.intermine.objectstore.ObjectStoreException",
"org.intermine.objectstore.query.Query",
"org.intermine.objectstore.query.QuerySelectable",
"org.intermine.pathquery.PathQuery"
] | import java.util.Map; import org.intermine.api.bag.BagQueryResult; import org.intermine.api.profile.InterMineBag; import org.intermine.objectstore.ObjectStoreException; import org.intermine.objectstore.query.Query; import org.intermine.objectstore.query.QuerySelectable; import org.intermine.pathquery.PathQuery; | import java.util.*; import org.intermine.api.bag.*; import org.intermine.api.profile.*; import org.intermine.objectstore.*; import org.intermine.objectstore.query.*; import org.intermine.pathquery.*; | [
"java.util",
"org.intermine.api",
"org.intermine.objectstore",
"org.intermine.pathquery"
] | java.util; org.intermine.api; org.intermine.objectstore; org.intermine.pathquery; | 1,052,955 |
@ApiModelProperty(
example = "Foobar",
value =
"(NZ Only) Optional references for the batch payment transaction. It will also show with"
+ " the batch payment transaction in the bank reconciliation Find & Match screen."
+ " Depending on your individual bank, the detail may also show on the bank"
+ " statement you import into Xero.")
public String getReference() {
return reference;
} | @ApiModelProperty( example = STR, value = STR + STR + STR + STR) String function() { return reference; } | /**
* (NZ Only) Optional references for the batch payment transaction. It will also show with the
* batch payment transaction in the bank reconciliation Find & Match screen. Depending on your
* individual bank, the detail may also show on the bank statement you import into Xero.
*
* @return reference
*/ | (NZ Only) Optional references for the batch payment transaction. It will also show with the batch payment transaction in the bank reconciliation Find & Match screen. Depending on your individual bank, the detail may also show on the bank statement you import into Xero | getReference | {
"repo_name": "XeroAPI/Xero-Java",
"path": "src/main/java/com/xero/models/accounting/BatchPaymentDetails.java",
"license": "mit",
"size": 10892
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 2,083,257 |
public void createSubEntry(final CmsClientSitemapEntry parent, final CmsUUID structureId) {
CmsSitemapTreeItem item = CmsSitemapTreeItem.getItemById(parent.getId());
AsyncCallback<CmsClientSitemapEntry> callback = new AsyncCallback<CmsClientSitemapEntry>() { | void function(final CmsClientSitemapEntry parent, final CmsUUID structureId) { CmsSitemapTreeItem item = CmsSitemapTreeItem.getItemById(parent.getId()); AsyncCallback<CmsClientSitemapEntry> callback = new AsyncCallback<CmsClientSitemapEntry>() { | /**
* Creates a new sub-entry of an existing sitemap entry.<p>
*
* @param parent the entry to which a new sub-entry should be added
* @param structureId the structure id of the model page (if null, uses default model page)
*/ | Creates a new sub-entry of an existing sitemap entry | createSubEntry | {
"repo_name": "sbonoc/opencms-core",
"path": "src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java",
"license": "lgpl-2.1",
"size": 64474
} | [
"com.google.gwt.user.client.rpc.AsyncCallback",
"org.opencms.ade.sitemap.client.CmsSitemapTreeItem",
"org.opencms.ade.sitemap.shared.CmsClientSitemapEntry",
"org.opencms.util.CmsUUID"
] | import com.google.gwt.user.client.rpc.AsyncCallback; import org.opencms.ade.sitemap.client.CmsSitemapTreeItem; import org.opencms.ade.sitemap.shared.CmsClientSitemapEntry; import org.opencms.util.CmsUUID; | import com.google.gwt.user.client.rpc.*; import org.opencms.ade.sitemap.client.*; import org.opencms.ade.sitemap.shared.*; import org.opencms.util.*; | [
"com.google.gwt",
"org.opencms.ade",
"org.opencms.util"
] | com.google.gwt; org.opencms.ade; org.opencms.util; | 1,643,024 |
protected void ensureClusterStateConsistency() throws IOException {
if (cluster() != null && cluster().size() > 0) {
final NamedWriteableRegistry namedWriteableRegistry = cluster().getNamedWriteableRegistry();
final Client masterClient = client();
ClusterState masterClusterState = masterClient.admin().cluster().prepareState().all().get().getState();
byte[] masterClusterStateBytes = ClusterState.Builder.toBytes(masterClusterState);
// remove local node reference
masterClusterState = ClusterState.Builder.fromBytes(masterClusterStateBytes, null, namedWriteableRegistry);
Map<String, Object> masterStateMap = convertToMap(masterClusterState);
int masterClusterStateSize = ClusterState.Builder.toBytes(masterClusterState).length;
String masterId = masterClusterState.nodes().getMasterNodeId();
for (Client client : cluster().getClients()) {
ClusterState localClusterState = client.admin().cluster().prepareState().all().setLocal(true).get().getState();
byte[] localClusterStateBytes = ClusterState.Builder.toBytes(localClusterState);
// remove local node reference
localClusterState = ClusterState.Builder.fromBytes(localClusterStateBytes, null, namedWriteableRegistry);
final Map<String, Object> localStateMap = convertToMap(localClusterState);
final int localClusterStateSize = ClusterState.Builder.toBytes(localClusterState).length;
// Check that the non-master node has the same version of the cluster state as the master and
// that the master node matches the master (otherwise there is no requirement for the cluster state to match)
if (masterClusterState.version() == localClusterState.version()
&& masterId.equals(localClusterState.nodes().getMasterNodeId())) {
try {
assertEquals("cluster state UUID does not match", masterClusterState.stateUUID(), localClusterState.stateUUID());
if (isTransportClient(masterClient) == isTransportClient(client)) {
// We cannot compare serialization bytes since serialization order of maps is not guaranteed
// but we can compare serialization sizes - they should be the same
assertEquals("cluster state size does not match", masterClusterStateSize, localClusterStateSize);
// Compare JSON serialization
assertNull(
"cluster state JSON serialization does not match",
differenceBetweenMapsIgnoringArrayOrder(masterStateMap, localStateMap));
} else {
// remove non-core customs and compare the cluster states
assertNull(
"cluster state JSON serialization does not match (after removing some customs)",
differenceBetweenMapsIgnoringArrayOrder(
convertToMap(removePluginCustoms(masterClusterState)),
convertToMap(removePluginCustoms(localClusterState))));
}
} catch (final AssertionError error) {
logger.error(
"Cluster state from master:\n{}\nLocal cluster state:\n{}",
masterClusterState.toString(),
localClusterState.toString());
throw error;
}
}
}
}
} | void function() throws IOException { if (cluster() != null && cluster().size() > 0) { final NamedWriteableRegistry namedWriteableRegistry = cluster().getNamedWriteableRegistry(); final Client masterClient = client(); ClusterState masterClusterState = masterClient.admin().cluster().prepareState().all().get().getState(); byte[] masterClusterStateBytes = ClusterState.Builder.toBytes(masterClusterState); masterClusterState = ClusterState.Builder.fromBytes(masterClusterStateBytes, null, namedWriteableRegistry); Map<String, Object> masterStateMap = convertToMap(masterClusterState); int masterClusterStateSize = ClusterState.Builder.toBytes(masterClusterState).length; String masterId = masterClusterState.nodes().getMasterNodeId(); for (Client client : cluster().getClients()) { ClusterState localClusterState = client.admin().cluster().prepareState().all().setLocal(true).get().getState(); byte[] localClusterStateBytes = ClusterState.Builder.toBytes(localClusterState); localClusterState = ClusterState.Builder.fromBytes(localClusterStateBytes, null, namedWriteableRegistry); final Map<String, Object> localStateMap = convertToMap(localClusterState); final int localClusterStateSize = ClusterState.Builder.toBytes(localClusterState).length; if (masterClusterState.version() == localClusterState.version() && masterId.equals(localClusterState.nodes().getMasterNodeId())) { try { assertEquals(STR, masterClusterState.stateUUID(), localClusterState.stateUUID()); if (isTransportClient(masterClient) == isTransportClient(client)) { assertEquals(STR, masterClusterStateSize, localClusterStateSize); assertNull( STR, differenceBetweenMapsIgnoringArrayOrder(masterStateMap, localStateMap)); } else { assertNull( STR, differenceBetweenMapsIgnoringArrayOrder( convertToMap(removePluginCustoms(masterClusterState)), convertToMap(removePluginCustoms(localClusterState)))); } } catch (final AssertionError error) { logger.error( STR, masterClusterState.toString(), localClusterState.toString()); throw error; } } } } } | /**
* Verifies that all nodes that have the same version of the cluster state as master have same cluster state
*/ | Verifies that all nodes that have the same version of the cluster state as master have same cluster state | ensureClusterStateConsistency | {
"repo_name": "vroyer/elassandra",
"path": "test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java",
"license": "apache-2.0",
"size": 110257
} | [
"java.io.IOException",
"java.util.Map",
"org.elasticsearch.client.Client",
"org.elasticsearch.cluster.ClusterState",
"org.elasticsearch.common.io.stream.NamedWriteableRegistry",
"org.elasticsearch.test.XContentTestUtils"
] | import java.io.IOException; import java.util.Map; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.test.XContentTestUtils; | import java.io.*; import java.util.*; import org.elasticsearch.client.*; import org.elasticsearch.cluster.*; import org.elasticsearch.common.io.stream.*; import org.elasticsearch.test.*; | [
"java.io",
"java.util",
"org.elasticsearch.client",
"org.elasticsearch.cluster",
"org.elasticsearch.common",
"org.elasticsearch.test"
] | java.io; java.util; org.elasticsearch.client; org.elasticsearch.cluster; org.elasticsearch.common; org.elasticsearch.test; | 342,046 |
@Override
public void initialize(AbstractSession session) throws DescriptorException {
getMappedKeyMapContainerPolicy().setDescriptorForKeyMapping(this.getDescriptor());
if (getKeyConverter() != null) {
getKeyConverter().initialize(this, session);
}
super.initialize(session);
} | void function(AbstractSession session) throws DescriptorException { getMappedKeyMapContainerPolicy().setDescriptorForKeyMapping(this.getDescriptor()); if (getKeyConverter() != null) { getKeyConverter().initialize(this, session); } super.initialize(session); } | /**
* INTERNAL:
* Initialize and validate the mapping properties.
*/ | Initialize and validate the mapping properties | initialize | {
"repo_name": "RallySoftware/eclipselink.runtime",
"path": "foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/mappings/DirectMapMapping.java",
"license": "epl-1.0",
"size": 56004
} | [
"org.eclipse.persistence.exceptions.DescriptorException",
"org.eclipse.persistence.internal.sessions.AbstractSession"
] | import org.eclipse.persistence.exceptions.DescriptorException; import org.eclipse.persistence.internal.sessions.AbstractSession; | import org.eclipse.persistence.exceptions.*; import org.eclipse.persistence.internal.sessions.*; | [
"org.eclipse.persistence"
] | org.eclipse.persistence; | 920,918 |
public WallEditQuery edit(UserActor actor, int postId) {
return new WallEditQuery(getClient(), actor, postId);
} | WallEditQuery function(UserActor actor, int postId) { return new WallEditQuery(getClient(), actor, postId); } | /**
* Edits a post on a user wall or community wall.
*
* @param actor vk actor
* @param postId
* @return query
*/ | Edits a post on a user wall or community wall | edit | {
"repo_name": "VKCOM/vk-java-sdk",
"path": "sdk/src/main/java/com/vk/api/sdk/actions/Wall.java",
"license": "mit",
"size": 17618
} | [
"com.vk.api.sdk.client.actors.UserActor",
"com.vk.api.sdk.queries.wall.WallEditQuery"
] | import com.vk.api.sdk.client.actors.UserActor; import com.vk.api.sdk.queries.wall.WallEditQuery; | import com.vk.api.sdk.client.actors.*; import com.vk.api.sdk.queries.wall.*; | [
"com.vk.api"
] | com.vk.api; | 1,433,501 |
public Object post(Map<String, Object> args) throws Exception; | Object function(Map<String, Object> args) throws Exception; | /**
* execute post
* @param args
* @return
* @throws Exception
*/ | execute post | post | {
"repo_name": "classfoo/onyx",
"path": "org.classfoo.onyx/src/main/java/org/classfoo/onyx/api/web/OnyxApi.java",
"license": "gpl-3.0",
"size": 1732
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,341,707 |
@Test
public void ifAddTaskAndSetDescriptionCompareItWithExpected() {
Tracker tracker = new Tracker(new ConsoleInput("task1\nsome desc\ntask1\ndescription"));
tracker.new AddTask().action();
tracker.new AddCommentToTask().action();
tracker.getTaskManager().getAllTasks()[0].getComments()[0].setDescription("new description");
assertThat("new description",
is(equalTo(tracker.getTaskManager().getAllTasks()[0].getComments()[0].getDescription())));
} | void function() { Tracker tracker = new Tracker(new ConsoleInput(STR)); tracker.new AddTask().action(); tracker.new AddCommentToTask().action(); tracker.getTaskManager().getAllTasks()[0].getComments()[0].setDescription(STR); assertThat(STR, is(equalTo(tracker.getTaskManager().getAllTasks()[0].getComments()[0].getDescription()))); } | /**
* Add task to tracker, add comment and compare description of comment with expected.
* */ | Add task to tracker, add comment and compare description of comment with expected | ifAddTaskAndSetDescriptionCompareItWithExpected | {
"repo_name": "kuznetsovsergeyymailcom/homework",
"path": "chapter_002/tracker/src/test/java/ru/skuznetsov/TrackerTest.java",
"license": "apache-2.0",
"size": 10439
} | [
"org.hamcrest.MatcherAssert",
"org.hamcrest.Matchers",
"ru.skuznetsov.input.ConsoleInput"
] | import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import ru.skuznetsov.input.ConsoleInput; | import org.hamcrest.*; import ru.skuznetsov.input.*; | [
"org.hamcrest",
"ru.skuznetsov.input"
] | org.hamcrest; ru.skuznetsov.input; | 1,309,448 |
private void commitPrepared(Xid xid) throws XAException {
try {
// Check preconditions. The connection mustn't be used for another
// other XA or local transaction, or the COMMIT PREPARED command
// would mess it up.
if (state != State.IDLE
|| conn.getTransactionState() != TransactionState.IDLE) {
throw new PGXAException(
GT.tr("Not implemented: 2nd phase commit must be issued using an idle connection. commit xid={0}, currentXid={1}, state={2}, transactionState={3}", xid, currentXid, state, conn.getTransactionState()),
XAException.XAER_RMERR);
}
String s = RecoveredXid.xidToString(xid);
localAutoCommitMode = conn.getAutoCommit();
conn.setAutoCommit(true);
Statement stmt = conn.createStatement();
try {
stmt.executeUpdate("COMMIT PREPARED '" + s + "'");
} finally {
stmt.close();
conn.setAutoCommit(localAutoCommitMode);
}
committedOrRolledBack = true;
} catch (SQLException ex) {
int errorCode = XAException.XAER_RMERR;
if (PSQLState.UNDEFINED_OBJECT.getState().equals(ex.getSQLState())) {
if (committedOrRolledBack || !xid.equals(preparedXid)) {
if (LOGGER.isLoggable(Level.FINEST)) {
debug("committing xid " + xid + " while the connection prepared xid is " + preparedXid
+ (committedOrRolledBack ? ", but the connection was already committed/rolled-back" : ""));
}
errorCode = XAException.XAER_NOTA;
}
}
if (PSQLState.isConnectionError(ex.getSQLState())) {
if (LOGGER.isLoggable(Level.FINEST)) {
debug("commit connection failure (sql error code " + ex.getSQLState() + "), reconnection could be expected");
}
errorCode = XAException.XAER_RMFAIL;
}
throw new PGXAException(GT.tr("Error committing prepared transaction. commit xid={0}, preparedXid={1}, currentXid={2}", xid, preparedXid, currentXid), ex, errorCode);
}
} | void function(Xid xid) throws XAException { try { if (state != State.IDLE conn.getTransactionState() != TransactionState.IDLE) { throw new PGXAException( GT.tr(STR, xid, currentXid, state, conn.getTransactionState()), XAException.XAER_RMERR); } String s = RecoveredXid.xidToString(xid); localAutoCommitMode = conn.getAutoCommit(); conn.setAutoCommit(true); Statement stmt = conn.createStatement(); try { stmt.executeUpdate(STR + s + "'"); } finally { stmt.close(); conn.setAutoCommit(localAutoCommitMode); } committedOrRolledBack = true; } catch (SQLException ex) { int errorCode = XAException.XAER_RMERR; if (PSQLState.UNDEFINED_OBJECT.getState().equals(ex.getSQLState())) { if (committedOrRolledBack !xid.equals(preparedXid)) { if (LOGGER.isLoggable(Level.FINEST)) { debug(STR + xid + STR + preparedXid + (committedOrRolledBack ? STR : STRcommit connection failure (sql error code STR), reconnection could be expectedSTRError committing prepared transaction. commit xid={0}, preparedXid={1}, currentXid={2}", xid, preparedXid, currentXid), ex, errorCode); } } | /**
* <p>Commits prepared transaction. Preconditions:</p>
* <ol>
* <li>xid must be in prepared state in the server</li>
* </ol>
*
* <p>Implementation deficiency preconditions:</p>
* <ol>
* <li>Connection must be in idle state</li>
* </ol>
*
* <p>Postconditions:</p>
* <ol>
* <li>Transaction is committed</li>
* </ol>
*/ | Commits prepared transaction. Preconditions: xid must be in prepared state in the server Implementation deficiency preconditions: Connection must be in idle state Postconditions: Transaction is committed | commitPrepared | {
"repo_name": "AlexElin/pgjdbc",
"path": "pgjdbc/src/main/java/org/postgresql/xa/PGXAConnection.java",
"license": "bsd-2-clause",
"size": 23958
} | [
"java.sql.SQLException",
"java.sql.Statement",
"java.util.logging.Level",
"javax.transaction.xa.XAException",
"javax.transaction.xa.Xid",
"org.postgresql.core.TransactionState",
"org.postgresql.util.GT",
"org.postgresql.util.PSQLState"
] | import java.sql.SQLException; import java.sql.Statement; import java.util.logging.Level; import javax.transaction.xa.XAException; import javax.transaction.xa.Xid; import org.postgresql.core.TransactionState; import org.postgresql.util.GT; import org.postgresql.util.PSQLState; | import java.sql.*; import java.util.logging.*; import javax.transaction.xa.*; import org.postgresql.core.*; import org.postgresql.util.*; | [
"java.sql",
"java.util",
"javax.transaction",
"org.postgresql.core",
"org.postgresql.util"
] | java.sql; java.util; javax.transaction; org.postgresql.core; org.postgresql.util; | 2,433,308 |
@Override
public Var evalVar(Env env)
{
Value value = _expr.evalVar(env);
value = value.toAutoArray();
return value.getVar(_index.eval(env));
} | Var function(Env env) { Value value = _expr.evalVar(env); value = value.toAutoArray(); return value.getVar(_index.eval(env)); } | /**
* Evaluates the expression.
*
* @param env the calling environment.
*
* @return the expression value.
*/ | Evaluates the expression | evalVar | {
"repo_name": "christianchristensen/resin",
"path": "modules/quercus/src/com/caucho/quercus/expr/ArrayGetExpr.java",
"license": "gpl-2.0",
"size": 5257
} | [
"com.caucho.quercus.env.Env",
"com.caucho.quercus.env.Value",
"com.caucho.quercus.env.Var"
] | import com.caucho.quercus.env.Env; import com.caucho.quercus.env.Value; import com.caucho.quercus.env.Var; | import com.caucho.quercus.env.*; | [
"com.caucho.quercus"
] | com.caucho.quercus; | 313,259 |
private ArrayList getAncestors(IJavaElement element) {
ArrayList parents = new ArrayList();
IJavaElement parent = element.getParent();
while (parent != null) {
parents.add(parent);
parent = parent.getParent();
}
parents.trimToSize();
return parents;
} | ArrayList function(IJavaElement element) { ArrayList parents = new ArrayList(); IJavaElement parent = element.getParent(); while (parent != null) { parents.add(parent); parent = parent.getParent(); } parents.trimToSize(); return parents; } | /**
* Returns a collection of all the parents of this element
* in bottom-up order.
*
*/ | Returns a collection of all the parents of this element in bottom-up order | getAncestors | {
"repo_name": "trylimits/Eclipse-Postfix-Code-Completion-Juno38",
"path": "juno38/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/Region.java",
"license": "epl-1.0",
"size": 3785
} | [
"java.util.ArrayList",
"org.eclipse.jdt.core.IJavaElement"
] | import java.util.ArrayList; import org.eclipse.jdt.core.IJavaElement; | import java.util.*; import org.eclipse.jdt.core.*; | [
"java.util",
"org.eclipse.jdt"
] | java.util; org.eclipse.jdt; | 2,503,023 |
public void removeLifecycleListener(LifecycleListener listener) {
lifecycle.removeLifecycleListener(listener);
} | void function(LifecycleListener listener) { lifecycle.removeLifecycleListener(listener); } | /**
* Remove a lifecycle event listener from this component.
*
* @param listener The listener to remove
*/ | Remove a lifecycle event listener from this component | removeLifecycleListener | {
"repo_name": "devjin24/howtomcatworks",
"path": "bookrefer/jakarta-tomcat-4.1.12-src/catalina/src/share/org/apache/catalina/core/ContainerBase.java",
"license": "apache-2.0",
"size": 44660
} | [
"org.apache.catalina.LifecycleListener"
] | import org.apache.catalina.LifecycleListener; | import org.apache.catalina.*; | [
"org.apache.catalina"
] | org.apache.catalina; | 2,070,219 |
Iterable<Tag> httpRequestTags(RequestEvent event); | Iterable<Tag> httpRequestTags(RequestEvent event); | /**
* Provides tags to be associated with metrics for the given {@code event}.
*
* @param event
* the request event
* @return tags to associate with metrics recorded for the request
*/ | Provides tags to be associated with metrics for the given event | httpRequestTags | {
"repo_name": "micrometer-metrics/micrometer",
"path": "micrometer-binders/src/main/java/io/micrometer/binder/jersey/server/JerseyTagsProvider.java",
"license": "apache-2.0",
"size": 1559
} | [
"io.micrometer.core.instrument.Tag",
"org.glassfish.jersey.server.monitoring.RequestEvent"
] | import io.micrometer.core.instrument.Tag; import org.glassfish.jersey.server.monitoring.RequestEvent; | import io.micrometer.core.instrument.*; import org.glassfish.jersey.server.monitoring.*; | [
"io.micrometer.core",
"org.glassfish.jersey"
] | io.micrometer.core; org.glassfish.jersey; | 341,209 |
Collection<Spec> getSpecs(SpecSearchObject specSearchObject) throws IOException; | Collection<Spec> getSpecs(SpecSearchObject specSearchObject) throws IOException; | /***
* Retrieve {@link Spec}s by {@link SpecSearchObject} from the {@link SpecStore}.
* @param specSearchObject {@link SpecSearchObject} for the {@link Spec} to be retrieved.
* @throws IOException Exception in retrieving the {@link Spec}.
*/ | Retrieve <code>Spec</code>s by <code>SpecSearchObject</code> from the <code>SpecStore</code> | getSpecs | {
"repo_name": "arjun4084346/gobblin",
"path": "gobblin-runtime/src/main/java/org/apache/gobblin/runtime/api/SpecStore.java",
"license": "apache-2.0",
"size": 5944
} | [
"java.io.IOException",
"java.util.Collection"
] | import java.io.IOException; import java.util.Collection; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,898,185 |
JMeterContext context = getThreadContext();
JMeterVariables vars = context.getVariables();
SampleResult previousResult = context.getPreviousResult();
ByteArrayInputStream resultStream = new ByteArrayInputStream(previousResult.getResponseData());
vars.put(histogramNbytes, Integer.toString(previousResult.getBytes()));
BufferedImage image = null;
int nbands = 0;
try {
image = ImageIO.read(resultStream);
} catch (java.io.IOException e) {
vars.put(imageFound, "false");
return; // May as well stop here...
}
if (null == image) {
// Not an image
vars.put(imageFound, "false");
return;
}
ParameterBlock pb = new ParameterBlock();
pb.addSource(image);
RenderedOp op = JAI.create("histogram", pb, null);
Histogram hist = (Histogram) op.getProperty("histogram");
int redBuckets = 0;
int greenBuckets = 0;
int blueBuckets = 0;
nbands = hist.getNumBands();
vars.put(histogramNbands, Integer.toString(nbands));
for (int i = 0; i < hist.getNumBins()[0]; i++) {
int red = hist.getBinSize(0, i);
int green = 0;
int blue = 0;
// If it's a B&W image there might be an alpha band but I'm not going
// to worry about it.
if (nbands > 2) {
green = hist.getBinSize(1, i);
blue = hist.getBinSize(2, i);
}
String counter = Integer.toString(i);
if (red > 0) {
redBuckets++;
}
if (green > 0) {
greenBuckets++;
}
if (blue > 0) {
blueBuckets++;
}
vars.put(histogramRedBucket + "_" + counter, Integer.toString(red));
vars.put(histogramGreenBucket + "_" + counter, Integer.toString(green));
vars.put(histogramBlueBucket + "_" + counter, Integer.toString(blue));
}
vars.put(nonzeroRed, Integer.toString(redBuckets));
vars.put(nonzeroGreen, Integer.toString(greenBuckets));
vars.put(nonzeroBlue, Integer.toString(blueBuckets));
vars.put(imageFound, "true");
} | JMeterContext context = getThreadContext(); JMeterVariables vars = context.getVariables(); SampleResult previousResult = context.getPreviousResult(); ByteArrayInputStream resultStream = new ByteArrayInputStream(previousResult.getResponseData()); vars.put(histogramNbytes, Integer.toString(previousResult.getBytes())); BufferedImage image = null; int nbands = 0; try { image = ImageIO.read(resultStream); } catch (java.io.IOException e) { vars.put(imageFound, "false"); return; } if (null == image) { vars.put(imageFound, "false"); return; } ParameterBlock pb = new ParameterBlock(); pb.addSource(image); RenderedOp op = JAI.create(STR, pb, null); Histogram hist = (Histogram) op.getProperty(STR); int redBuckets = 0; int greenBuckets = 0; int blueBuckets = 0; nbands = hist.getNumBands(); vars.put(histogramNbands, Integer.toString(nbands)); for (int i = 0; i < hist.getNumBins()[0]; i++) { int red = hist.getBinSize(0, i); int green = 0; int blue = 0; if (nbands > 2) { green = hist.getBinSize(1, i); blue = hist.getBinSize(2, i); } String counter = Integer.toString(i); if (red > 0) { redBuckets++; } if (green > 0) { greenBuckets++; } if (blue > 0) { blueBuckets++; } vars.put(histogramRedBucket + "_" + counter, Integer.toString(red)); vars.put(histogramGreenBucket + "_" + counter, Integer.toString(green)); vars.put(histogramBlueBucket + "_" + counter, Integer.toString(blue)); } vars.put(nonzeroRed, Integer.toString(redBuckets)); vars.put(nonzeroGreen, Integer.toString(greenBuckets)); vars.put(nonzeroBlue, Integer.toString(blueBuckets)); vars.put(imageFound, "true"); } | /**
* Grabs an image from a sampler and generates a histogram using
* JAI. Then it writes all the histogram data into variables.
*/ | Grabs an image from a sampler and generates a histogram using JAI. Then it writes all the histogram data into variables | process | {
"repo_name": "FlyingRhenquest/JmeterHistogram",
"path": "src/main/java/com/flyingrhenquest/JmeterHistogram/JmeterHistogram.java",
"license": "apache-2.0",
"size": 5829
} | [
"java.awt.image.BufferedImage",
"java.awt.image.renderable.ParameterBlock",
"java.io.ByteArrayInputStream",
"javax.imageio.ImageIO",
"javax.media.jai.Histogram",
"javax.media.jai.JAI",
"javax.media.jai.RenderedOp",
"org.apache.jmeter.samplers.SampleResult",
"org.apache.jmeter.threads.JMeterContext",
"org.apache.jmeter.threads.JMeterVariables"
] | import java.awt.image.BufferedImage; import java.awt.image.renderable.ParameterBlock; import java.io.ByteArrayInputStream; import javax.imageio.ImageIO; import javax.media.jai.Histogram; import javax.media.jai.JAI; import javax.media.jai.RenderedOp; import org.apache.jmeter.samplers.SampleResult; import org.apache.jmeter.threads.JMeterContext; import org.apache.jmeter.threads.JMeterVariables; | import java.awt.image.*; import java.awt.image.renderable.*; import java.io.*; import javax.imageio.*; import javax.media.jai.*; import org.apache.jmeter.samplers.*; import org.apache.jmeter.threads.*; | [
"java.awt",
"java.io",
"javax.imageio",
"javax.media",
"org.apache.jmeter"
] | java.awt; java.io; javax.imageio; javax.media; org.apache.jmeter; | 124,296 |
@Deprecated
public ServerBuilder port(int port, String protocol) {
return port(port, SessionProtocol.of(requireNonNull(protocol, "protocol")));
} | ServerBuilder function(int port, String protocol) { return port(port, SessionProtocol.of(requireNonNull(protocol, STR))); } | /**
* Adds a new {@link ServerPort} that listens to the specified {@code port} of all available network
* interfaces using the specified protocol.
*
* @deprecated Use {@link #http(int)} or {@link #https(int)}.
* @see <a href="#no_port_specified">What happens if no HTTP(S) port is specified?</a>
*/ | Adds a new <code>ServerPort</code> that listens to the specified port of all available network interfaces using the specified protocol | port | {
"repo_name": "jmostella/armeria",
"path": "core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java",
"license": "apache-2.0",
"size": 48086
} | [
"com.linecorp.armeria.common.SessionProtocol"
] | import com.linecorp.armeria.common.SessionProtocol; | import com.linecorp.armeria.common.*; | [
"com.linecorp.armeria"
] | com.linecorp.armeria; | 2,111,740 |
private HttpResponse ingestAclString(final String resourcePath, final String acl, final String username)
throws IOException {
final String aclPath = (resourcePath.endsWith("/fcr:acl") ? resourcePath : resourcePath + "/fcr:acl");
final HttpPut putReq = new HttpPut(aclPath);
setAuth(putReq, username);
putReq.setHeader("Content-type", "text/turtle");
putReq.setEntity(new StringEntity(acl, turtleContentType));
return execute(putReq);
} | HttpResponse function(final String resourcePath, final String acl, final String username) throws IOException { final String aclPath = (resourcePath.endsWith(STR) ? resourcePath : resourcePath + STR); final HttpPut putReq = new HttpPut(aclPath); setAuth(putReq, username); putReq.setHeader(STR, STR); putReq.setEntity(new StringEntity(acl, turtleContentType)); return execute(putReq); } | /**
* Utility function to ingest a ACL from a string.
*
* @param resourcePath Path to the resource if doesn't end with "/fcr:acl" it is added.
* @param acl the text/turtle ACL as a string
* @param username user to ingest as
* @return the response from the ACL ingest.
* @throws IOException on StringEntity encoding or client execute
*/ | Utility function to ingest a ACL from a string | ingestAclString | {
"repo_name": "robyj/fcrepo4",
"path": "fcrepo-auth-webac/src/test/java/org/fcrepo/integration/auth/webac/WebACRecipesIT.java",
"license": "apache-2.0",
"size": 104885
} | [
"java.io.IOException",
"org.apache.http.HttpResponse",
"org.apache.http.client.methods.HttpPut",
"org.apache.http.entity.StringEntity"
] | import java.io.IOException; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpPut; import org.apache.http.entity.StringEntity; | import java.io.*; import org.apache.http.*; import org.apache.http.client.methods.*; import org.apache.http.entity.*; | [
"java.io",
"org.apache.http"
] | java.io; org.apache.http; | 818,495 |
public String getContentType(String outputFormat) {
return servicesConfiguration.getExporter(outputFormat.toLowerCase()).getContentType();
}
protected class RunReportUnitStrategy extends GenericRunReportStrategy<ReportUnit> { | String function(String outputFormat) { return servicesConfiguration.getExporter(outputFormat.toLowerCase()).getContentType(); } protected class RunReportUnitStrategy extends GenericRunReportStrategy<ReportUnit> { | /**
* Get content type for resource type.
*
* @param outputFormat - resource output format
* @return content type
*/ | Get content type for resource type | getContentType | {
"repo_name": "leocockroach/JasperServer5.6",
"path": "jasperserver-remote/src/main/java/com/jaspersoft/jasperserver/remote/services/impl/ReportExecutorImpl.java",
"license": "gpl-2.0",
"size": 17774
} | [
"com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.ReportUnit"
] | import com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.ReportUnit; | import com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.*; | [
"com.jaspersoft.jasperserver"
] | com.jaspersoft.jasperserver; | 1,656,528 |
public InterceptFromDefinition interceptFrom() {
if (!getRouteCollection().getRoutes().isEmpty()) {
throw new IllegalArgumentException("interceptFrom must be defined before any routes in the RouteBuilder");
}
getRouteCollection().setCamelContext(getContext());
return getRouteCollection().interceptFrom();
} | InterceptFromDefinition function() { if (!getRouteCollection().getRoutes().isEmpty()) { throw new IllegalArgumentException(STR); } getRouteCollection().setCamelContext(getContext()); return getRouteCollection().interceptFrom(); } | /**
* Adds a route for an interceptor that intercepts incoming messages on any inputs in this route
*
* @return the builder
*/ | Adds a route for an interceptor that intercepts incoming messages on any inputs in this route | interceptFrom | {
"repo_name": "punkhorn/camel-upstream",
"path": "core/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java",
"license": "apache-2.0",
"size": 19978
} | [
"org.apache.camel.model.InterceptFromDefinition"
] | import org.apache.camel.model.InterceptFromDefinition; | import org.apache.camel.model.*; | [
"org.apache.camel"
] | org.apache.camel; | 1,711,546 |
private boolean delete(FTPClient client, Path file, boolean recursive)
throws IOException {
Path workDir = new Path(client.printWorkingDirectory());
Path absolute = makeAbsolute(workDir, file);
String pathName = absolute.toUri().getPath();
FileStatus fileStat = getFileStatus(client, absolute);
if (!fileStat.isDir()) {
return client.deleteFile(pathName);
}
FileStatus[] dirEntries = listStatus(client, absolute);
if (dirEntries != null && dirEntries.length > 0 && !(recursive)) {
throw new IOException("Directory: " + file + " is not empty.");
}
if (dirEntries != null) {
for (int i = 0; i < dirEntries.length; i++) {
delete(client, new Path(absolute, dirEntries[i].getPath()),
recursive);
}
}
return client.removeDirectory(pathName);
} | boolean function(FTPClient client, Path file, boolean recursive) throws IOException { Path workDir = new Path(client.printWorkingDirectory()); Path absolute = makeAbsolute(workDir, file); String pathName = absolute.toUri().getPath(); FileStatus fileStat = getFileStatus(client, absolute); if (!fileStat.isDir()) { return client.deleteFile(pathName); } FileStatus[] dirEntries = listStatus(client, absolute); if (dirEntries != null && dirEntries.length > 0 && !(recursive)) { throw new IOException(STR + file + STR); } if (dirEntries != null) { for (int i = 0; i < dirEntries.length; i++) { delete(client, new Path(absolute, dirEntries[i].getPath()), recursive); } } return client.removeDirectory(pathName); } | /**
* Convenience method, so that we don't open a new connection when using
* this method from within another method. Otherwise every API invocation
* incurs the overhead of opening/closing a TCP connection.
*/ | Convenience method, so that we don't open a new connection when using this method from within another method. Otherwise every API invocation incurs the overhead of opening/closing a TCP connection | delete | {
"repo_name": "shot/hadoop-source-reading",
"path": "src/core/org/apache/hadoop/fs/ftp/FTPFileSystem.java",
"license": "apache-2.0",
"size": 19410
} | [
"java.io.IOException",
"org.apache.commons.net.ftp.FTPClient",
"org.apache.hadoop.fs.FileStatus",
"org.apache.hadoop.fs.Path"
] | import java.io.IOException; import org.apache.commons.net.ftp.FTPClient; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.Path; | import java.io.*; import org.apache.commons.net.ftp.*; import org.apache.hadoop.fs.*; | [
"java.io",
"org.apache.commons",
"org.apache.hadoop"
] | java.io; org.apache.commons; org.apache.hadoop; | 2,405,098 |
@Test
public void testRun5() throws Exception {
blockingQueue = new ArrayBlockingQueue(5);
channel = EasyMock.createMock(Channel.class);
ospfArea = new OspfAreaImpl();
lsaWrapper = new LsaWrapperImpl();
routerLsa = new RouterLsa();
routerLsa.setLsType(2);
lsaWrapper.addLsa(OspfLsaType.NETWORK, routerLsa);
ospfInterface = new OspfInterfaceImpl();
ospfInterface.setState(OspfInterfaceState.DR);
lsaWrapper.setOspfInterface(ospfInterface);
lsaWrapper.setIsSelfOriginated(true);
lsaHeader = new LsaHeader();
lsaHeader.setLsType(2);
lsaWrapper.setLsaHeader(lsaHeader);
lsaWrapper.setLsaProcessing("maxAgeLsa");
lsaWrapper.setLsdbAge(new LsdbAgeImpl(new OspfAreaImpl()));
blockingQueue.add(lsaWrapper);
lsaQueueConsumer = new LsaQueueConsumer(blockingQueue, channel, ospfArea);
lsaQueueConsumer.run();
assertThat(lsaQueueConsumer, is(notNullValue()));
} | void function() throws Exception { blockingQueue = new ArrayBlockingQueue(5); channel = EasyMock.createMock(Channel.class); ospfArea = new OspfAreaImpl(); lsaWrapper = new LsaWrapperImpl(); routerLsa = new RouterLsa(); routerLsa.setLsType(2); lsaWrapper.addLsa(OspfLsaType.NETWORK, routerLsa); ospfInterface = new OspfInterfaceImpl(); ospfInterface.setState(OspfInterfaceState.DR); lsaWrapper.setOspfInterface(ospfInterface); lsaWrapper.setIsSelfOriginated(true); lsaHeader = new LsaHeader(); lsaHeader.setLsType(2); lsaWrapper.setLsaHeader(lsaHeader); lsaWrapper.setLsaProcessing(STR); lsaWrapper.setLsdbAge(new LsdbAgeImpl(new OspfAreaImpl())); blockingQueue.add(lsaWrapper); lsaQueueConsumer = new LsaQueueConsumer(blockingQueue, channel, ospfArea); lsaQueueConsumer.run(); assertThat(lsaQueueConsumer, is(notNullValue())); } | /**
* Tests run() method.
*/ | Tests run() method | testRun5 | {
"repo_name": "sonu283304/onos",
"path": "protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/lsdb/LsaQueueConsumerTest.java",
"license": "apache-2.0",
"size": 6433
} | [
"java.util.concurrent.ArrayBlockingQueue",
"org.easymock.EasyMock",
"org.hamcrest.CoreMatchers",
"org.hamcrest.MatcherAssert",
"org.jboss.netty.channel.Channel",
"org.onosproject.ospf.controller.OspfLsaType",
"org.onosproject.ospf.controller.area.OspfAreaImpl",
"org.onosproject.ospf.controller.area.OspfInterfaceImpl",
"org.onosproject.ospf.protocol.lsa.LsaHeader",
"org.onosproject.ospf.protocol.lsa.types.RouterLsa",
"org.onosproject.ospf.protocol.util.OspfInterfaceState"
] | import java.util.concurrent.ArrayBlockingQueue; import org.easymock.EasyMock; import org.hamcrest.CoreMatchers; import org.hamcrest.MatcherAssert; import org.jboss.netty.channel.Channel; import org.onosproject.ospf.controller.OspfLsaType; import org.onosproject.ospf.controller.area.OspfAreaImpl; import org.onosproject.ospf.controller.area.OspfInterfaceImpl; import org.onosproject.ospf.protocol.lsa.LsaHeader; import org.onosproject.ospf.protocol.lsa.types.RouterLsa; import org.onosproject.ospf.protocol.util.OspfInterfaceState; | import java.util.concurrent.*; import org.easymock.*; import org.hamcrest.*; import org.jboss.netty.channel.*; import org.onosproject.ospf.controller.*; import org.onosproject.ospf.controller.area.*; import org.onosproject.ospf.protocol.lsa.*; import org.onosproject.ospf.protocol.lsa.types.*; import org.onosproject.ospf.protocol.util.*; | [
"java.util",
"org.easymock",
"org.hamcrest",
"org.jboss.netty",
"org.onosproject.ospf"
] | java.util; org.easymock; org.hamcrest; org.jboss.netty; org.onosproject.ospf; | 1,996,926 |
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (DBG) {
Log.d(LOG_TAG, "onItemClick() position " + position);
}
onItemClicked(position, KeyEvent.KEYCODE_UNKNOWN, null);
}
};
private final OnItemSelectedListener mOnItemSelectedListener = new OnItemSelectedListener() { | void function(AdapterView<?> parent, View view, int position, long id) { if (DBG) { Log.d(LOG_TAG, STR + position); } onItemClicked(position, KeyEvent.KEYCODE_UNKNOWN, null); } }; private final OnItemSelectedListener mOnItemSelectedListener = new OnItemSelectedListener() { | /**
* Implements OnItemClickListener
*/ | Implements OnItemClickListener | onItemClick | {
"repo_name": "the-diamond-dogs-group-oss/ActionBarSherlock",
"path": "actionbarsherlock/src/com/actionbarsherlock/widget/SearchView.java",
"license": "apache-2.0",
"size": 62724
} | [
"android.util.Log",
"android.view.KeyEvent",
"android.view.View",
"android.widget.AdapterView"
] | import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.widget.AdapterView; | import android.util.*; import android.view.*; import android.widget.*; | [
"android.util",
"android.view",
"android.widget"
] | android.util; android.view; android.widget; | 1,668,746 |
public static Element resolveMapping(NabuccoMultiplicityType multiplicity, AssociationStrategyType association,
XmlTemplate template) throws XmlTemplateException {
if (multiplicity == null) {
throw new NabuccoVisitorException("Multiplicity is not valid " + multiplicity + ".");
}
if (association == AssociationStrategyType.AGGREGATION) {
if (multiplicity.isMultiple()) {
if (multiplicity.isOptional()) {
// Optional M:M Relation Template (ManyToMany)
return (Element) template.copyNodesByXPath(XPATH_MANY_TO_MANY).get(0);
}
// Mandatory M:M Relation Template (ManyToMany)
return (Element) template.copyNodesByXPath(XPATH_MANY_TO_MANY).get(1);
}
if (multiplicity.isOptional()) {
// Optional M:1 Relation Template (ManyToOne)
return (Element) template.copyNodesByXPath(XPATH_MANY_TO_ONE).get(0);
}
// Mandatory M:1 Relation Template (ManyToOne)
return (Element) template.copyNodesByXPath(XPATH_MANY_TO_ONE).get(1);
}
if (multiplicity.isMultiple()) {
if (multiplicity.isOptional()) {
// Optional 1:M Relation Template (OneToMany)
return (Element) template.copyNodesByXPath(XPATH_ONE_TO_MANY).get(0);
}
// Mandatory 1:M Relation Template (OneToMany)
return (Element) template.copyNodesByXPath(XPATH_ONE_TO_MANY).get(0);
}
if (multiplicity.isOptional()) {
// Optional 1:1 Relation Template (OneToOne)
return (Element) template.copyNodesByXPath(XPATH_ONE_TO_ONE).get(0);
}
// Mandatory 1:1 Relation Template (OneToOne)
return (Element) template.copyNodesByXPath(XPATH_ONE_TO_ONE).get(1);
} | static Element function(NabuccoMultiplicityType multiplicity, AssociationStrategyType association, XmlTemplate template) throws XmlTemplateException { if (multiplicity == null) { throw new NabuccoVisitorException(STR + multiplicity + "."); } if (association == AssociationStrategyType.AGGREGATION) { if (multiplicity.isMultiple()) { if (multiplicity.isOptional()) { return (Element) template.copyNodesByXPath(XPATH_MANY_TO_MANY).get(0); } return (Element) template.copyNodesByXPath(XPATH_MANY_TO_MANY).get(1); } if (multiplicity.isOptional()) { return (Element) template.copyNodesByXPath(XPATH_MANY_TO_ONE).get(0); } return (Element) template.copyNodesByXPath(XPATH_MANY_TO_ONE).get(1); } if (multiplicity.isMultiple()) { if (multiplicity.isOptional()) { return (Element) template.copyNodesByXPath(XPATH_ONE_TO_MANY).get(0); } return (Element) template.copyNodesByXPath(XPATH_ONE_TO_MANY).get(0); } if (multiplicity.isOptional()) { return (Element) template.copyNodesByXPath(XPATH_ONE_TO_ONE).get(0); } return (Element) template.copyNodesByXPath(XPATH_ONE_TO_ONE).get(1); } | /**
* Copies <code>one-to-one</code>, <code>one-to-many</code>, <code>many-to-one</code> or
* <code>many-to-many</code> tags from the template depending on multiplicity and association
* type.</p>
*
* <table border=true>
* <col width="10%"/> <col width="30%"/> <col width="30%"/> <thead>
* <tr>
* <th> </th>
* <th>COMPOSITION</th>
* <th>AGGREGATION</th>
* </tr>
* </thead> <tbody>
* <tr>
* <td>1</td>
* <td>1:1</td>
* <td>M:1</td>
* </tr>
* <tr>
* <td>*</td>
* <td>1:N</td>
* <td>M:N</td>
* </tr>
* <tr>
* </tr>
* </tbody>
* </table>
* <p/>
*
* @param multiplicity
* the multiplicity
* @param association
* the association strategy defining
* @param template
* the template containing the tags
*
* @return the extracted {@link Element} instance.
*
* @throws XmlTemplateException
*/ | Copies <code>one-to-one</code>, <code>one-to-many</code>, <code>many-to-one</code> or <code>many-to-many</code> tags from the template depending on multiplicity and association type. COMPOSITION AGGREGATION 1 1:1 * 1:N | resolveMapping | {
"repo_name": "NABUCCO/org.nabucco.framework.generator",
"path": "org.nabucco.framework.generator.compiler/src/main/org/nabucco/framework/generator/compiler/transformation/xml/datatype/NabuccoToXmlDatatypeVisitorSupport.java",
"license": "epl-1.0",
"size": 13093
} | [
"org.nabucco.framework.generator.compiler.transformation.common.annotation.association.AssociationStrategyType",
"org.nabucco.framework.generator.compiler.visitor.NabuccoVisitorException",
"org.nabucco.framework.generator.parser.model.multiplicity.NabuccoMultiplicityType",
"org.nabucco.framework.mda.template.xml.XmlTemplate",
"org.nabucco.framework.mda.template.xml.XmlTemplateException",
"org.w3c.dom.Element"
] | import org.nabucco.framework.generator.compiler.transformation.common.annotation.association.AssociationStrategyType; import org.nabucco.framework.generator.compiler.visitor.NabuccoVisitorException; import org.nabucco.framework.generator.parser.model.multiplicity.NabuccoMultiplicityType; import org.nabucco.framework.mda.template.xml.XmlTemplate; import org.nabucco.framework.mda.template.xml.XmlTemplateException; import org.w3c.dom.Element; | import org.nabucco.framework.generator.compiler.transformation.common.annotation.association.*; import org.nabucco.framework.generator.compiler.visitor.*; import org.nabucco.framework.generator.parser.model.multiplicity.*; import org.nabucco.framework.mda.template.xml.*; import org.w3c.dom.*; | [
"org.nabucco.framework",
"org.w3c.dom"
] | org.nabucco.framework; org.w3c.dom; | 2,523,103 |
public Observable<Long> count() {
throw new UnsupportedOperationException();
} | Observable<Long> function() { throw new UnsupportedOperationException(); } | /**
* This method counts number of elements in stream and creates another
* stream with that value that is consumed by the subscriber
*
* @return
*/ | This method counts number of elements in stream and creates another stream with that value that is consumed by the subscriber | count | {
"repo_name": "bhatti/RxJava8",
"path": "src/main/java/com/plexobject/rx/impl/ObservableNever.java",
"license": "mit",
"size": 3580
} | [
"com.plexobject.rx.Observable"
] | import com.plexobject.rx.Observable; | import com.plexobject.rx.*; | [
"com.plexobject.rx"
] | com.plexobject.rx; | 2,657,131 |
@SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Class key) {
if (key.equals(IContentOutlinePage.class)) {
return showOutlineView() ? getContentOutlinePage() : null;
}
else if (key.equals(IPropertySheetPage.class)) {
return getPropertySheetPage();
}
else if (key.equals(IGotoMarker.class)) {
return this;
}
else {
return super.getAdapter(key);
}
} | @SuppressWarnings(STR) Object function(Class key) { if (key.equals(IContentOutlinePage.class)) { return showOutlineView() ? getContentOutlinePage() : null; } else if (key.equals(IPropertySheetPage.class)) { return getPropertySheetPage(); } else if (key.equals(IGotoMarker.class)) { return this; } else { return super.getAdapter(key); } } | /**
* This is how the framework determines which interfaces we implement.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This is how the framework determines which interfaces we implement. | getAdapter | {
"repo_name": "BaSys-PC1/models",
"path": "de.dfki.iui.basys.model.domain.editor/src/de/dfki/iui/basys/model/domain/material/presentation/MaterialEditor.java",
"license": "epl-1.0",
"size": 57455
} | [
"org.eclipse.ui.ide.IGotoMarker",
"org.eclipse.ui.views.contentoutline.IContentOutlinePage",
"org.eclipse.ui.views.properties.IPropertySheetPage"
] | import org.eclipse.ui.ide.IGotoMarker; import org.eclipse.ui.views.contentoutline.IContentOutlinePage; import org.eclipse.ui.views.properties.IPropertySheetPage; | import org.eclipse.ui.ide.*; import org.eclipse.ui.views.contentoutline.*; import org.eclipse.ui.views.properties.*; | [
"org.eclipse.ui"
] | org.eclipse.ui; | 2,657,228 |
public void setInterpolation(int newType)
{
switch(newType)
{
case(EditorState.INTERPOLATION_BICUBIC):
{
//interpolation = RenderingHints.VALUE_INTERPOLATION_BICUBIC;
break;
}
case(EditorState.INTERPOLATION_BILINEAR):
{
//interpolation = RenderingHints.VALUE_INTERPOLATION_BILINEAR;
break;
}
case(EditorState.INTERPOLATION_NEAREST_NEIGHBOR):
{
//interpolation = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
break;
}
}
} | void function(int newType) { switch(newType) { case(EditorState.INTERPOLATION_BICUBIC): { break; } case(EditorState.INTERPOLATION_BILINEAR): { break; } case(EditorState.INTERPOLATION_NEAREST_NEIGHBOR): { break; } } } | /**
* Sets the interpolation type used for drawing to the argument
* (must be one of the
* INTERPOLATION_xyz constants of EditorState), but does not
* do a redraw.
*/ | Sets the interpolation type used for drawing to the argument (must be one of the INTERPOLATION_xyz constants of EditorState), but does not do a redraw | setInterpolation | {
"repo_name": "juehv/DentalImageViewer",
"path": "DentalImageViewer/lib/jiu-0.14.3/net/sourceforge/jiu/gui/awt/ImageCanvas.java",
"license": "gpl-3.0",
"size": 5096
} | [
"net.sourceforge.jiu.apps.EditorState"
] | import net.sourceforge.jiu.apps.EditorState; | import net.sourceforge.jiu.apps.*; | [
"net.sourceforge.jiu"
] | net.sourceforge.jiu; | 1,736,337 |
public void isOnGround() {
TempVars vars = TempVars.get();
Vector3f location = vars.vect1;
Vector3f rayVector = vars.vect2;
location.set(localUp).multLocal(getCurrentHeight()).addLocal(this.rigidBody_location);
//values chosen after testing
float multBy = -getCurrentHeight() - FastMath.ZERO_TOLERANCE;
rayVector.set(localUp).multLocal(multBy).addLocal(location);
List<PhysicsRayTestResult> results = physicsSpace.rayTest(location, rayVector);
vars.release();
for (PhysicsRayTestResult physicsRayTestResult : results) {
if (!physicsRayTestResult.getCollisionObject().equals(rigidBody)) {
onGround = true;
return;
}
}
onGround = false;
} | void function() { TempVars vars = TempVars.get(); Vector3f location = vars.vect1; Vector3f rayVector = vars.vect2; location.set(localUp).multLocal(getCurrentHeight()).addLocal(this.rigidBody_location); float multBy = -getCurrentHeight() - FastMath.ZERO_TOLERANCE; rayVector.set(localUp).multLocal(multBy).addLocal(location); List<PhysicsRayTestResult> results = physicsSpace.rayTest(location, rayVector); vars.release(); for (PhysicsRayTestResult physicsRayTestResult : results) { if (!physicsRayTestResult.getCollisionObject().equals(rigidBody)) { onGround = true; return; } } onGround = false; } | /**
* Check if the character is on the ground. This is determined by a ray test
* in the center of the character and might return false even if the
* character is not falling yet.
*
* @return
*/ | Check if the character is on the ground. This is determined by a ray test in the center of the character and might return false even if the character is not falling yet | isOnGround | {
"repo_name": "virtualillusions/Machello",
"path": "src/com/vi/machello/scene/dynamics/control/DynamicPhysicsControl.java",
"license": "gpl-2.0",
"size": 34742
} | [
"com.jme3.bullet.collision.PhysicsRayTestResult",
"com.jme3.math.FastMath",
"com.jme3.math.Vector3f",
"com.jme3.util.TempVars",
"java.util.List"
] | import com.jme3.bullet.collision.PhysicsRayTestResult; import com.jme3.math.FastMath; import com.jme3.math.Vector3f; import com.jme3.util.TempVars; import java.util.List; | import com.jme3.bullet.collision.*; import com.jme3.math.*; import com.jme3.util.*; import java.util.*; | [
"com.jme3.bullet",
"com.jme3.math",
"com.jme3.util",
"java.util"
] | com.jme3.bullet; com.jme3.math; com.jme3.util; java.util; | 2,461,833 |
public void setPositionalInfo(Calendar calendar, double latitude, double longitude, Moon moon) {
double julianDate = DateTimeUtils.dateToJulianDate(calendar);
setMoonPhase(calendar, moon);
setAzimuthElevationZodiac(julianDate, latitude, longitude, moon);
MoonDistance distance = moon.getDistance();
distance.setDate(Calendar.getInstance());
distance.setDistance(getDistance(julianDate));
} | void function(Calendar calendar, double latitude, double longitude, Moon moon) { double julianDate = DateTimeUtils.dateToJulianDate(calendar); setMoonPhase(calendar, moon); setAzimuthElevationZodiac(julianDate, latitude, longitude, moon); MoonDistance distance = moon.getDistance(); distance.setDate(Calendar.getInstance()); distance.setDistance(getDistance(julianDate)); } | /**
* Calculates the moon illumination and distance.
*/ | Calculates the moon illumination and distance | setPositionalInfo | {
"repo_name": "clinique/openhab2",
"path": "bundles/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/internal/calc/MoonCalc.java",
"license": "epl-1.0",
"size": 38554
} | [
"java.util.Calendar",
"org.openhab.binding.astro.internal.model.Moon",
"org.openhab.binding.astro.internal.model.MoonDistance",
"org.openhab.binding.astro.internal.util.DateTimeUtils"
] | import java.util.Calendar; import org.openhab.binding.astro.internal.model.Moon; import org.openhab.binding.astro.internal.model.MoonDistance; import org.openhab.binding.astro.internal.util.DateTimeUtils; | import java.util.*; import org.openhab.binding.astro.internal.model.*; import org.openhab.binding.astro.internal.util.*; | [
"java.util",
"org.openhab.binding"
] | java.util; org.openhab.binding; | 589,339 |
public void dispatchViewUpdates(EventDispatcher eventDispatcher, int batchId) {
updateViewHierarchy(eventDispatcher);
mNativeViewHierarchyOptimizer.onBatchComplete();
mOperationsQueue.dispatchViewUpdates(batchId);
} | void function(EventDispatcher eventDispatcher, int batchId) { updateViewHierarchy(eventDispatcher); mNativeViewHierarchyOptimizer.onBatchComplete(); mOperationsQueue.dispatchViewUpdates(batchId); } | /**
* Invoked at the end of the transaction to commit any updates to the node hierarchy.
*/ | Invoked at the end of the transaction to commit any updates to the node hierarchy | dispatchViewUpdates | {
"repo_name": "bohanapp/PropertyFinder",
"path": "node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java",
"license": "mit",
"size": 28698
} | [
"com.facebook.react.uimanager.events.EventDispatcher"
] | import com.facebook.react.uimanager.events.EventDispatcher; | import com.facebook.react.uimanager.events.*; | [
"com.facebook.react"
] | com.facebook.react; | 2,533,238 |
public static MozuClient<com.mozu.api.contracts.productadmin.DiscountTarget> getDiscountTargetClient(com.mozu.api.DataViewMode dataViewMode, Integer discountId) throws Exception
{
return getDiscountTargetClient(dataViewMode, discountId, null);
} | static MozuClient<com.mozu.api.contracts.productadmin.DiscountTarget> function(com.mozu.api.DataViewMode dataViewMode, Integer discountId) throws Exception { return getDiscountTargetClient(dataViewMode, discountId, null); } | /**
* Retrieves the discount target, that is which products, categories, or shipping methods are eligible for the discount.
* <p><pre><code>
* MozuClient<com.mozu.api.contracts.productadmin.DiscountTarget> mozuClient=GetDiscountTargetClient(dataViewMode, discountId);
* client.setBaseAddress(url);
* client.executeRequest();
* DiscountTarget discountTarget = client.Result();
* </code></pre></p>
* @param discountId discountId parameter description DOCUMENT_HERE
* @return Mozu.Api.MozuClient <com.mozu.api.contracts.productadmin.DiscountTarget>
* @see com.mozu.api.contracts.productadmin.DiscountTarget
*/ | Retrieves the discount target, that is which products, categories, or shipping methods are eligible for the discount. <code><code> MozuClient mozuClient=GetDiscountTargetClient(dataViewMode, discountId); client.setBaseAddress(url); client.executeRequest(); DiscountTarget discountTarget = client.Result(); </code></code> | getDiscountTargetClient | {
"repo_name": "bhewett/mozu-java",
"path": "mozu-java-core/src/main/java/com/mozu/api/clients/commerce/catalog/admin/discounts/DiscountTargetClient.java",
"license": "mit",
"size": 6274
} | [
"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; | 897,331 |
public void testCloning() {
ShipNeedle n1 = new ShipNeedle();
ShipNeedle n2 = null;
try {
n2 = (ShipNeedle) n1.clone();
}
catch (CloneNotSupportedException e) {
e.printStackTrace();
System.err.println("Failed to clone.");
}
assertTrue(n1 != n2);
assertTrue(n1.getClass() == n2.getClass());
assertTrue(n1.equals(n2));
} | void function() { ShipNeedle n1 = new ShipNeedle(); ShipNeedle n2 = null; try { n2 = (ShipNeedle) n1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); System.err.println(STR); } assertTrue(n1 != n2); assertTrue(n1.getClass() == n2.getClass()); assertTrue(n1.equals(n2)); } | /**
* Check that cloning works.
*/ | Check that cloning works | testCloning | {
"repo_name": "raedle/univis",
"path": "lib/jfreechart-1.0.1/src/org/jfree/chart/needle/junit/ShipNeedleTests.java",
"license": "lgpl-2.1",
"size": 3913
} | [
"org.jfree.chart.needle.ShipNeedle"
] | import org.jfree.chart.needle.ShipNeedle; | import org.jfree.chart.needle.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 617,532 |
public Thing getSubject() {
return Base.getAll_as(this.model, this.getResource(), SUBJECT,
Thing.class).firstValue();
} | Thing function() { return Base.getAll_as(this.model, this.getResource(), SUBJECT, Thing.class).firstValue(); } | /**
* Get all values of property Subject * @return a ClosableIterator of $type
* [Generated from RDFReactor template rule #get12dynamic]
*/ | Get all values of property Subject [Generated from RDFReactor template rule #get12dynamic] | getSubject | {
"repo_name": "m0ep/master-thesis",
"path": "source/apis/rdf2go/rdf2go-foaf/src/main/java/com/xmlns/foaf/Thing.java",
"license": "mit",
"size": 274766
} | [
"org.ontoware.rdfreactor.runtime.Base"
] | import org.ontoware.rdfreactor.runtime.Base; | import org.ontoware.rdfreactor.runtime.*; | [
"org.ontoware.rdfreactor"
] | org.ontoware.rdfreactor; | 2,809,754 |
@Override
public List<PropagationTask> getRoleDeleteTaskIds(final Long roleKey, final Collection<String> noPropResourceNames)
throws NotFoundException, UnauthorizedRoleException {
Role role = roleDAO.authFetch(roleKey);
return getDeleteTaskIds(role, role.getResourceNames(), noPropResourceNames);
} | List<PropagationTask> function(final Long roleKey, final Collection<String> noPropResourceNames) throws NotFoundException, UnauthorizedRoleException { Role role = roleDAO.authFetch(roleKey); return getDeleteTaskIds(role, role.getResourceNames(), noPropResourceNames); } | /**
* Perform delete on each resource associated to the user. It is possible to ask for a mandatory provisioning for
* some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if
* the creation fails onto a mandatory resource.
*
* @param roleKey to be deleted
* @param noPropResourceNames name of external resources not to be considered for propagation
* @return list of propagation tasks
* @throws NotFoundException if role is not found
* @throws UnauthorizedRoleException if caller doesn't own enough entitlements to administer the given role
*/ | Perform delete on each resource associated to the user. It is possible to ask for a mandatory provisioning for some resources specifying a set of resource names. Exceptions won't be ignored and the process will be stopped if the creation fails onto a mandatory resource | getRoleDeleteTaskIds | {
"repo_name": "massx1/syncope",
"path": "core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java",
"license": "apache-2.0",
"size": 37015
} | [
"java.util.Collection",
"java.util.List",
"org.apache.syncope.core.misc.security.UnauthorizedRoleException",
"org.apache.syncope.core.persistence.api.dao.NotFoundException",
"org.apache.syncope.core.persistence.api.entity.role.Role",
"org.apache.syncope.core.persistence.api.entity.task.PropagationTask"
] | import java.util.Collection; import java.util.List; import org.apache.syncope.core.misc.security.UnauthorizedRoleException; import org.apache.syncope.core.persistence.api.dao.NotFoundException; import org.apache.syncope.core.persistence.api.entity.role.Role; import org.apache.syncope.core.persistence.api.entity.task.PropagationTask; | import java.util.*; import org.apache.syncope.core.misc.security.*; import org.apache.syncope.core.persistence.api.dao.*; import org.apache.syncope.core.persistence.api.entity.role.*; import org.apache.syncope.core.persistence.api.entity.task.*; | [
"java.util",
"org.apache.syncope"
] | java.util; org.apache.syncope; | 1,971,633 |
public COSName getKey()
{
return key;
} | COSName function() { return key; } | /**
* Get the key for this entry.
*
* @return The entry's key.
*/ | Get the key for this entry | getKey | {
"repo_name": "joansmith/pdfbox",
"path": "debugger/src/main/java/org/apache/pdfbox/debugger/ui/MapEntry.java",
"license": "apache-2.0",
"size": 2490
} | [
"org.apache.pdfbox.cos.COSName"
] | import org.apache.pdfbox.cos.COSName; | import org.apache.pdfbox.cos.*; | [
"org.apache.pdfbox"
] | org.apache.pdfbox; | 2,175,224 |
public void onSuccess(HttpContext context, T response); | void function(HttpContext context, T response); | /**
* On Completed callback for API calls
* @param context The context of the API request
* @param response The response received from the API Call
*/ | On Completed callback for API calls | onSuccess | {
"repo_name": "information-machine/information-machine-api-android",
"path": "InformationMachineAPILib/src/main/java/co/iamdata/api/http/client/APICallBack.java",
"license": "mit",
"size": 744
} | [
"co.iamdata.api.http.client.HttpContext"
] | import co.iamdata.api.http.client.HttpContext; | import co.iamdata.api.http.client.*; | [
"co.iamdata.api"
] | co.iamdata.api; | 1,212,552 |
public ResourceConfigInfo getResourceSystemInfoFor(VResourceSystem vrs) throws VrsException {
// todo: query actual instance instead of registry.
return getResourceSystemInfoFor(vrs.getServerVRL(), false);
} | ResourceConfigInfo function(VResourceSystem vrs) throws VrsException { return getResourceSystemInfoFor(vrs.getServerVRL(), false); } | /**
* Return actual ResourceSystemInfo used for the specified ResourceSystem.
*/ | Return actual ResourceSystemInfo used for the specified ResourceSystem | getResourceSystemInfoFor | {
"repo_name": "NLeSC/Platinum",
"path": "ptk-vbrowser-vrs/src/main/java/nl/esciencecenter/vbrowser/vrs/VRSContext.java",
"license": "apache-2.0",
"size": 8849
} | [
"nl.esciencecenter.vbrowser.vrs.exceptions.VrsException",
"nl.esciencecenter.vbrowser.vrs.registry.ResourceConfigInfo"
] | import nl.esciencecenter.vbrowser.vrs.exceptions.VrsException; import nl.esciencecenter.vbrowser.vrs.registry.ResourceConfigInfo; | import nl.esciencecenter.vbrowser.vrs.exceptions.*; import nl.esciencecenter.vbrowser.vrs.registry.*; | [
"nl.esciencecenter.vbrowser"
] | nl.esciencecenter.vbrowser; | 196,078 |
List<String> list() throws IOException;
/**
* Returns the size of the value of a user-defined attribute.
*
* @param name
* The attribute name
*
* @return The size of the attribute value, in bytes.
*
* @throws ArithmeticException
* If the size of the attribute is larger than {@link Integer#MAX_VALUE} | List<String> list() throws IOException; /** * Returns the size of the value of a user-defined attribute. * * @param name * The attribute name * * @return The size of the attribute value, in bytes. * * @throws ArithmeticException * If the size of the attribute is larger than {@link Integer#MAX_VALUE} | /**
* Returns a list containing the names of the user-defined attributes.
*
* @return An unmodifiable list continaing the names of the file's
* user-defined
*
* @throws IOException
* If an I/O error occurs
* @throws SecurityException
* In the case of the default provider, a security manager is
* installed, and it denies {@link
* RuntimePermission}<tt>("accessUserDefinedAttributes")</tt>
* or its {@link SecurityManager#checkRead(String) checkRead} method
* denies read access to the file.
*/ | Returns a list containing the names of the user-defined attributes | list | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk/jdk/src/share/classes/java/nio/file/attribute/UserDefinedFileAttributeView.java",
"license": "mit",
"size": 10354
} | [
"java.io.IOException",
"java.util.List"
] | import java.io.IOException; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 723,896 |
protected HttpClientConfigurer createHttpClientConfigurer(Map<String, Object> parameters, boolean secure) throws Exception {
// prefer to use endpoint configured over component configured
HttpClientConfigurer configurer = resolveAndRemoveReferenceParameter(parameters, "httpClientConfigurer", HttpClientConfigurer.class);
if (configurer == null) {
// fallback to component configured
configurer = getHttpClientConfigurer();
}
configurer = configureBasicAuthentication(parameters, configurer);
configurer = configureHttpProxy(parameters, configurer, secure);
return configurer;
} | HttpClientConfigurer function(Map<String, Object> parameters, boolean secure) throws Exception { HttpClientConfigurer configurer = resolveAndRemoveReferenceParameter(parameters, STR, HttpClientConfigurer.class); if (configurer == null) { configurer = getHttpClientConfigurer(); } configurer = configureBasicAuthentication(parameters, configurer); configurer = configureHttpProxy(parameters, configurer, secure); return configurer; } | /**
* Creates the HttpClientConfigurer based on the given parameters
*
* @param parameters the map of parameters
* @param secure whether the endpoint is secure (eg https4)
* @return the configurer
* @throws Exception is thrown if error creating configurer
*/ | Creates the HttpClientConfigurer based on the given parameters | createHttpClientConfigurer | {
"repo_name": "jonmcewen/camel",
"path": "components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java",
"license": "apache-2.0",
"size": 29984
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,332,523 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.