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
@Override public Schema getSchema() { return schema$; }
Schema function() { return schema$; }
/** * This method supports the Avro framework and is not intended to be called * directly by the user. * * @return the schema object describing this class. * */
This method supports the Avro framework and is not intended to be called directly by the user
getSchema
{ "repo_name": "GPUdb/gpudb-api-java", "path": "api/src/main/java/com/gpudb/protocol/DeleteProcRequest.java", "license": "mit", "size": 5973 }
[ "org.apache.avro.Schema" ]
import org.apache.avro.Schema;
import org.apache.avro.*;
[ "org.apache.avro" ]
org.apache.avro;
2,599,232
Format getSelectedFormat();
Format getSelectedFormat();
/** * Returns the {@link Format} of the individual selected track. */
Returns the <code>Format</code> of the individual selected track
getSelectedFormat
{ "repo_name": "profosure/porogram", "path": "TMessagesProj/src/main/java/com/porogram/profosure1/messenger/exoplayer2/trackselection/TrackSelection.java", "license": "gpl-2.0", "size": 5712 }
[ "com.porogram.profosure1.messenger.exoplayer2.Format" ]
import com.porogram.profosure1.messenger.exoplayer2.Format;
import com.porogram.profosure1.messenger.exoplayer2.*;
[ "com.porogram.profosure1" ]
com.porogram.profosure1;
2,712,605
String getAuthenticateUrl( final URL requestUrl, @Nullable final String requestMethod, @Nullable final String signatureMethod) throws OAuthAuthenticationException { try { final GenericUrl callbackUrl = new GenericUrl(redirectUri); String userId = getParameterFromState(requestUrl.getQuery(), USER_ID_PARAM_KEY); String currentUserId = EnvironmentContext.getCurrent().getSubject().getUserId(); if (userId != null) { if (currentUserId.equals(userId)) { callbackUrl.put(STATE_PARAM_KEY, requestUrl.getQuery()); } else { throw new OAuthAuthenticationException( "Provided query parameter " + USER_ID_PARAM_KEY + "=" + userId + " does not match the current user id: " + currentUserId); } } else { callbackUrl.put( STATE_PARAM_KEY, requestUrl.getQuery() + "&" + USER_ID_PARAM_KEY + "=" + currentUserId); } OAuthGetTemporaryToken temporaryToken; if (requestMethod != null && "post".equalsIgnoreCase(requestMethod)) { temporaryToken = new OAuthPostTemporaryToken(requestTokenUri); } else { temporaryToken = new OAuthGetTemporaryToken(requestTokenUri); } if (signatureMethod != null && "rsa".equalsIgnoreCase(signatureMethod)) { temporaryToken.signer = getOAuthRsaSigner(); } else { temporaryToken.signer = getOAuthHmacSigner(null, null); } temporaryToken.consumerKey = clientId; temporaryToken.callback = callbackUrl.build(); temporaryToken.transport = httpTransport; final OAuthCredentialsResponse credentialsResponse = temporaryToken.execute(); final OAuthAuthorizeTemporaryTokenUrl authorizeTemporaryTokenUrl = new OAuthAuthorizeTemporaryTokenUrl(authorizeTokenUri); authorizeTemporaryTokenUrl.temporaryToken = credentialsResponse.token; sharedTokenSecrets.put(credentialsResponse.token, credentialsResponse.tokenSecret); return authorizeTemporaryTokenUrl.build(); } catch (Exception e) { throw new OAuthAuthenticationException(e.getMessage()); } }
String getAuthenticateUrl( final URL requestUrl, @Nullable final String requestMethod, @Nullable final String signatureMethod) throws OAuthAuthenticationException { try { final GenericUrl callbackUrl = new GenericUrl(redirectUri); String userId = getParameterFromState(requestUrl.getQuery(), USER_ID_PARAM_KEY); String currentUserId = EnvironmentContext.getCurrent().getSubject().getUserId(); if (userId != null) { if (currentUserId.equals(userId)) { callbackUrl.put(STATE_PARAM_KEY, requestUrl.getQuery()); } else { throw new OAuthAuthenticationException( STR + USER_ID_PARAM_KEY + "=" + userId + STR + currentUserId); } } else { callbackUrl.put( STATE_PARAM_KEY, requestUrl.getQuery() + "&" + USER_ID_PARAM_KEY + "=" + currentUserId); } OAuthGetTemporaryToken temporaryToken; if (requestMethod != null && "post".equalsIgnoreCase(requestMethod)) { temporaryToken = new OAuthPostTemporaryToken(requestTokenUri); } else { temporaryToken = new OAuthGetTemporaryToken(requestTokenUri); } if (signatureMethod != null && "rsa".equalsIgnoreCase(signatureMethod)) { temporaryToken.signer = getOAuthRsaSigner(); } else { temporaryToken.signer = getOAuthHmacSigner(null, null); } temporaryToken.consumerKey = clientId; temporaryToken.callback = callbackUrl.build(); temporaryToken.transport = httpTransport; final OAuthCredentialsResponse credentialsResponse = temporaryToken.execute(); final OAuthAuthorizeTemporaryTokenUrl authorizeTemporaryTokenUrl = new OAuthAuthorizeTemporaryTokenUrl(authorizeTokenUri); authorizeTemporaryTokenUrl.temporaryToken = credentialsResponse.token; sharedTokenSecrets.put(credentialsResponse.token, credentialsResponse.tokenSecret); return authorizeTemporaryTokenUrl.build(); } catch (Exception e) { throw new OAuthAuthenticationException(e.getMessage()); } }
/** * Create authentication URL. * * @param requestUrl URL of current HTTP request. This parameter required to be able determine URL * for redirection after authentication. If URL contains query parameters they will be copied * to 'state' parameter and returned to callback method. * @param requestMethod HTTP request method that will be used to request temporary token * @param signatureMethod OAuth signature algorithm * @return URL for authentication. * @throws OAuthAuthenticationException if authentication failed. */
Create authentication URL
getAuthenticateUrl
{ "repo_name": "codenvy/che", "path": "wsmaster/che-core-api-auth/src/main/java/org/eclipse/che/security/oauth1/OAuthAuthenticator.java", "license": "epl-1.0", "size": 14217 }
[ "com.google.api.client.auth.oauth.OAuthAuthorizeTemporaryTokenUrl", "com.google.api.client.auth.oauth.OAuthCredentialsResponse", "com.google.api.client.auth.oauth.OAuthGetTemporaryToken", "com.google.api.client.http.GenericUrl", "org.eclipse.che.commons.annotation.Nullable", "org.eclipse.che.commons.env.EnvironmentContext" ]
import com.google.api.client.auth.oauth.OAuthAuthorizeTemporaryTokenUrl; import com.google.api.client.auth.oauth.OAuthCredentialsResponse; import com.google.api.client.auth.oauth.OAuthGetTemporaryToken; import com.google.api.client.http.GenericUrl; import org.eclipse.che.commons.annotation.Nullable; import org.eclipse.che.commons.env.EnvironmentContext;
import com.google.api.client.auth.oauth.*; import com.google.api.client.http.*; import org.eclipse.che.commons.annotation.*; import org.eclipse.che.commons.env.*;
[ "com.google.api", "org.eclipse.che" ]
com.google.api; org.eclipse.che;
1,088,980
public void select( String name ) throws RemoteException;
void function( String name ) throws RemoteException;
/** * Select view * * @param name the name of the view of select * @throws RemoteException */
Select view
select
{ "repo_name": "Axway/ats-framework", "path": "corelibrary/src/main/java/com/axway/ats/core/uiengine/swt/ISwtView.java", "license": "apache-2.0", "size": 953 }
[ "java.rmi.RemoteException" ]
import java.rmi.RemoteException;
import java.rmi.*;
[ "java.rmi" ]
java.rmi;
2,113,490
public static LayoutAnimationController loadLayoutAnimation(Context context, int id) throws NotFoundException { XmlResourceParser parser = null; try { parser = context.getResources().getAnimation(id); return createLayoutAnimationFromXml(context, parser); } catch (XmlPullParserException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } catch (IOException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } finally { if (parser != null) parser.close(); } }
static LayoutAnimationController function(Context context, int id) throws NotFoundException { XmlResourceParser parser = null; try { parser = context.getResources().getAnimation(id); return createLayoutAnimationFromXml(context, parser); } catch (XmlPullParserException ex) { NotFoundException rnf = new NotFoundException(STR + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } catch (IOException ex) { NotFoundException rnf = new NotFoundException(STR + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } finally { if (parser != null) parser.close(); } }
/** * Loads a {@link LayoutAnimationController} object from a resource * * @param context Application context used to access resources * @param id The resource id of the animation to load * @return The animation object reference by the specified id * @throws NotFoundException when the layout animation controller cannot be loaded */
Loads a <code>LayoutAnimationController</code> object from a resource
loadLayoutAnimation
{ "repo_name": "s20121035/rk3288_android5.1_repo", "path": "frameworks/base/core/java/android/view/animation/AnimationUtils.java", "license": "gpl-3.0", "size": 13836 }
[ "android.content.Context", "android.content.res.Resources", "android.content.res.XmlResourceParser", "java.io.IOException", "org.xmlpull.v1.XmlPullParserException" ]
import android.content.Context; import android.content.res.Resources; import android.content.res.XmlResourceParser; import java.io.IOException; import org.xmlpull.v1.XmlPullParserException;
import android.content.*; import android.content.res.*; import java.io.*; import org.xmlpull.v1.*;
[ "android.content", "java.io", "org.xmlpull.v1" ]
android.content; java.io; org.xmlpull.v1;
2,061,632
@Test public void testParserCacheMisses() { LongMetric misses = ignite.context().metric().registry(QUERY_PARSER_METRIC_GROUP_NAME).findMetric("misses"); Assert.assertNotNull("Unable to find metric with name " + QUERY_PARSER_METRIC_GROUP_NAME + ".misses", misses); misses.reset(); cache.query(new SqlFieldsQuery("CREATE TABLE tbl_misses (id LONG PRIMARY KEY, val LONG)")); Assert.assertEquals(1, misses.value()); for (int i = 0; i < 10; i++) cache.query(new SqlFieldsQuery("INSERT INTO tbl_misses (id, val) values (?, ?)").setArgs(i, i)); Assert.assertEquals(2, misses.value()); cache.query(new SqlFieldsQuery("SELECT * FROM tbl_misses")); Assert.assertEquals(3, misses.value()); cache.query(new SqlFieldsQuery("SELECT * FROM tbl_misses")); Assert.assertEquals(3, misses.value()); }
void function() { LongMetric misses = ignite.context().metric().registry(QUERY_PARSER_METRIC_GROUP_NAME).findMetric(STR); Assert.assertNotNull(STR + QUERY_PARSER_METRIC_GROUP_NAME + STR, misses); misses.reset(); cache.query(new SqlFieldsQuery(STR)); Assert.assertEquals(1, misses.value()); for (int i = 0; i < 10; i++) cache.query(new SqlFieldsQuery(STR).setArgs(i, i)); Assert.assertEquals(2, misses.value()); cache.query(new SqlFieldsQuery(STR)); Assert.assertEquals(3, misses.value()); cache.query(new SqlFieldsQuery(STR)); Assert.assertEquals(3, misses.value()); }
/** * Ensure that query cache misses statistic is properly collected */
Ensure that query cache misses statistic is properly collected
testParserCacheMisses
{ "repo_name": "NSAmelchev/ignite", "path": "modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/QueryParserMetricsHolderSelfTest.java", "license": "apache-2.0", "size": 3907 }
[ "org.apache.ignite.cache.query.SqlFieldsQuery", "org.apache.ignite.spi.metric.LongMetric", "org.junit.Assert" ]
import org.apache.ignite.cache.query.SqlFieldsQuery; import org.apache.ignite.spi.metric.LongMetric; import org.junit.Assert;
import org.apache.ignite.cache.query.*; import org.apache.ignite.spi.metric.*; import org.junit.*;
[ "org.apache.ignite", "org.junit" ]
org.apache.ignite; org.junit;
2,831,073
@Test @Deployment public void testQueryProcessInstancesWithVariables() throws Exception { HashMap<String, Object> processVariables = new HashMap<>(); processVariables.put("stringVar", "Azerty"); processVariables.put("intVar", 67890); processVariables.put("booleanVar", false); Authentication.setAuthenticatedUserId("historyQueryAndSortUser"); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", processVariables); Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult(); taskService.complete(task.getId()); ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("oneTaskProcess", processVariables); String url = RestUrls.createRelativeResourceUrl(RestUrls.URL_HISTORIC_PROCESS_INSTANCE_QUERY); // Process variables ObjectNode requestNode = objectMapper.createObjectNode(); ArrayNode variableArray = objectMapper.createArrayNode(); ObjectNode variableNode = objectMapper.createObjectNode(); variableArray.add(variableNode); requestNode.set("variables", variableArray); // String equals variableNode.put("name", "stringVar"); variableNode.put("value", "Azerty"); variableNode.put("operation", "equals"); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); // Integer equals variableNode.removeAll(); variableNode.put("name", "intVar"); variableNode.put("value", 67890); variableNode.put("operation", "equals"); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); // Boolean equals variableNode.removeAll(); variableNode.put("name", "booleanVar"); variableNode.put("value", false); variableNode.put("operation", "equals"); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); // String not equals variableNode.removeAll(); variableNode.put("name", "stringVar"); variableNode.put("value", "ghijkl"); variableNode.put("operation", "notEquals"); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); // Integer not equals variableNode.removeAll(); variableNode.put("name", "intVar"); variableNode.put("value", 45678); variableNode.put("operation", "notEquals"); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); // Boolean not equals variableNode.removeAll(); variableNode.put("name", "booleanVar"); variableNode.put("value", true); variableNode.put("operation", "notEquals"); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); // String equals ignore case variableNode.removeAll(); variableNode.put("name", "stringVar"); variableNode.put("value", "azeRTY"); variableNode.put("operation", "equalsIgnoreCase"); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); // String not equals ignore case (not supported) variableNode.removeAll(); variableNode.put("name", "stringVar"); variableNode.put("value", "HIJKLm"); variableNode.put("operation", "notEqualsIgnoreCase"); assertErrorResult(url, requestNode, HttpStatus.SC_BAD_REQUEST); // String equals without value variableNode.removeAll(); variableNode.put("value", "Azerty"); variableNode.put("operation", "equals"); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); // String equals with non existing value variableNode.removeAll(); variableNode.put("value", "Azerty2"); variableNode.put("operation", "equals"); assertResultsPresentInPostDataResponse(url, requestNode); // String like ignore case variableNode.removeAll(); variableNode.put("name", "stringVar"); variableNode.put("value", "azerty"); variableNode.put("operation", "likeIgnoreCase"); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); variableNode.removeAll(); variableNode.put("name", "stringVar"); variableNode.put("value", "azerty2"); variableNode.put("operation", "likeIgnoreCase"); assertResultsPresentInPostDataResponse(url, requestNode); requestNode = objectMapper.createObjectNode(); requestNode.put("finished", true); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId()); requestNode = objectMapper.createObjectNode(); requestNode.put("finished", false); assertResultsPresentInPostDataResponse(url, requestNode, processInstance2.getId()); requestNode = objectMapper.createObjectNode(); requestNode.put("processDefinitionId", processInstance.getProcessDefinitionId()); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); requestNode = objectMapper.createObjectNode(); requestNode.put("processDefinitionKey", "oneTaskProcess"); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); requestNode = objectMapper.createObjectNode(); requestNode.put("processDefinitionKey", "oneTaskProcess"); HttpPost httpPost = new HttpPost(SERVER_URL_PREFIX + url + "?sort=startTime"); httpPost.setEntity(new StringEntity(requestNode.toString())); CloseableHttpResponse response = executeRequest(httpPost, HttpStatus.SC_OK); // Check status and size JsonNode dataNode = objectMapper.readTree(response.getEntity().getContent()).get("data"); closeResponse(response); assertThatJson(dataNode) .when(Option.IGNORING_EXTRA_FIELDS) .isEqualTo("[" + "{" + " id: '" + processInstance.getId() + "'," + " processDefinitionName: 'The One Task Process'," + " processDefinitionDescription: 'One task process description'," + " startTime: '${json-unit.any-string}'," + " startUserId: '" + processInstance.getStartUserId() + "'" + "}," + "{" + " id: '" + processInstance2.getId() + "'" + "}" + "]"); }
void function() throws Exception { HashMap<String, Object> processVariables = new HashMap<>(); processVariables.put(STR, STR); processVariables.put(STR, 67890); processVariables.put(STR, false); Authentication.setAuthenticatedUserId(STR); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(STR, processVariables); Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult(); taskService.complete(task.getId()); ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey(STR, processVariables); String url = RestUrls.createRelativeResourceUrl(RestUrls.URL_HISTORIC_PROCESS_INSTANCE_QUERY); ObjectNode requestNode = objectMapper.createObjectNode(); ArrayNode variableArray = objectMapper.createArrayNode(); ObjectNode variableNode = objectMapper.createObjectNode(); variableArray.add(variableNode); requestNode.set(STR, variableArray); variableNode.put("name", STR); variableNode.put("value", STR); variableNode.put(STR, STR); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); variableNode.removeAll(); variableNode.put("name", STR); variableNode.put("value", 67890); variableNode.put(STR, STR); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); variableNode.removeAll(); variableNode.put("name", STR); variableNode.put("value", false); variableNode.put(STR, STR); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); variableNode.removeAll(); variableNode.put("name", STR); variableNode.put("value", STR); variableNode.put(STR, STR); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); variableNode.removeAll(); variableNode.put("name", STR); variableNode.put("value", 45678); variableNode.put(STR, STR); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); variableNode.removeAll(); variableNode.put("name", STR); variableNode.put("value", true); variableNode.put(STR, STR); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); variableNode.removeAll(); variableNode.put("name", STR); variableNode.put("value", STR); variableNode.put(STR, STR); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); variableNode.removeAll(); variableNode.put("name", STR); variableNode.put("value", STR); variableNode.put(STR, STR); assertErrorResult(url, requestNode, HttpStatus.SC_BAD_REQUEST); variableNode.removeAll(); variableNode.put("value", STR); variableNode.put(STR, STR); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); variableNode.removeAll(); variableNode.put("value", STR); variableNode.put(STR, STR); assertResultsPresentInPostDataResponse(url, requestNode); variableNode.removeAll(); variableNode.put("name", STR); variableNode.put("value", STR); variableNode.put(STR, STR); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); variableNode.removeAll(); variableNode.put("name", STR); variableNode.put("value", STR); variableNode.put(STR, STR); assertResultsPresentInPostDataResponse(url, requestNode); requestNode = objectMapper.createObjectNode(); requestNode.put(STR, true); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId()); requestNode = objectMapper.createObjectNode(); requestNode.put(STR, false); assertResultsPresentInPostDataResponse(url, requestNode, processInstance2.getId()); requestNode = objectMapper.createObjectNode(); requestNode.put(STR, processInstance.getProcessDefinitionId()); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); requestNode = objectMapper.createObjectNode(); requestNode.put(STR, STR); assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId(), processInstance2.getId()); requestNode = objectMapper.createObjectNode(); requestNode.put(STR, STR); HttpPost httpPost = new HttpPost(SERVER_URL_PREFIX + url + STR); httpPost.setEntity(new StringEntity(requestNode.toString())); CloseableHttpResponse response = executeRequest(httpPost, HttpStatus.SC_OK); JsonNode dataNode = objectMapper.readTree(response.getEntity().getContent()).get("data"); closeResponse(response); assertThatJson(dataNode) .when(Option.IGNORING_EXTRA_FIELDS) .isEqualTo("[" + "{" + STR + processInstance.getId() + "'," + STR + STR + STR + STR + processInstance.getStartUserId() + "'" + "}," + "{" + STR + processInstance2.getId() + "'" + "}" + "]"); }
/** * Test querying historic process instance based on variables. POST query/historic-process-instances */
Test querying historic process instance based on variables. POST query/historic-process-instances
testQueryProcessInstancesWithVariables
{ "repo_name": "paulstapleton/flowable-engine", "path": "modules/flowable-rest/src/test/java/org/flowable/rest/service/api/history/HistoricProcessInstanceQueryResourceTest.java", "license": "apache-2.0", "size": 8800 }
[ "com.fasterxml.jackson.databind.JsonNode", "com.fasterxml.jackson.databind.node.ArrayNode", "com.fasterxml.jackson.databind.node.ObjectNode", "java.util.HashMap", "net.javacrumbs.jsonunit.assertj.JsonAssertions", "net.javacrumbs.jsonunit.core.Option", "org.apache.http.HttpStatus", "org.apache.http.client.methods.CloseableHttpResponse", "org.apache.http.client.methods.HttpPost", "org.apache.http.entity.StringEntity", "org.flowable.common.engine.impl.identity.Authentication", "org.flowable.engine.runtime.ProcessInstance", "org.flowable.rest.service.api.RestUrls", "org.flowable.task.api.Task" ]
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import java.util.HashMap; import net.javacrumbs.jsonunit.assertj.JsonAssertions; import net.javacrumbs.jsonunit.core.Option; import org.apache.http.HttpStatus; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.flowable.common.engine.impl.identity.Authentication; import org.flowable.engine.runtime.ProcessInstance; import org.flowable.rest.service.api.RestUrls; import org.flowable.task.api.Task;
import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.node.*; import java.util.*; import net.javacrumbs.jsonunit.assertj.*; import net.javacrumbs.jsonunit.core.*; import org.apache.http.*; import org.apache.http.client.methods.*; import org.apache.http.entity.*; import org.flowable.common.engine.impl.identity.*; import org.flowable.engine.runtime.*; import org.flowable.rest.service.api.*; import org.flowable.task.api.*;
[ "com.fasterxml.jackson", "java.util", "net.javacrumbs.jsonunit", "org.apache.http", "org.flowable.common", "org.flowable.engine", "org.flowable.rest", "org.flowable.task" ]
com.fasterxml.jackson; java.util; net.javacrumbs.jsonunit; org.apache.http; org.flowable.common; org.flowable.engine; org.flowable.rest; org.flowable.task;
454,991
static String[] getListFromProperty(Map<String, String> properties, String key) { return (String[]) ObjectUtils.defaultIfNull(StringUtils.stripAll(StringUtils.split(properties.get(key), ',')), new String[0]); }
static String[] getListFromProperty(Map<String, String> properties, String key) { return (String[]) ObjectUtils.defaultIfNull(StringUtils.stripAll(StringUtils.split(properties.get(key), ',')), new String[0]); }
/** * Transforms a comma-separated list String property in to a array of trimmed strings. * * This works even if they are separated by whitespace characters (space char, EOL, ...) * */
Transforms a comma-separated list String property in to a array of trimmed strings. This works even if they are separated by whitespace characters (space char, EOL, ...)
getListFromProperty
{ "repo_name": "vamsirajendra/sonarqube", "path": "sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorBuilder.java", "license": "lgpl-3.0", "size": 18336 }
[ "java.util.Map", "org.apache.commons.lang.ObjectUtils", "org.apache.commons.lang.StringUtils" ]
import java.util.Map; import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.StringUtils;
import java.util.*; import org.apache.commons.lang.*;
[ "java.util", "org.apache.commons" ]
java.util; org.apache.commons;
2,534,268
ApplicationSubmissionContext getSubmissionContext();
ApplicationSubmissionContext getSubmissionContext();
/** * The application submission context for this {@link RMAppAttempt}. * @return the application submission context for this Application. */
The application submission context for this <code>RMAppAttempt</code>
getSubmissionContext
{ "repo_name": "tseen/Federated-HDFS", "path": "tseenliu/FedHDFS-hadoop-src/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttempt.java", "license": "apache-2.0", "size": 7454 }
[ "org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext" ]
import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
import org.apache.hadoop.yarn.api.records.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,314,919
@Override public V2WikiPage updateV2WikiPage(String ownerId, ObjectType ownerType, V2WikiPage toUpdate) throws SynapseException { ValidateArgument.required(ownerId, "ownerId"); ValidateArgument.required(ownerType, "ownerType"); ValidateArgument.required(toUpdate, "WikiPage"); ValidateArgument.required(toUpdate.getId(), "WikiPage Id"); String uri = String.format(WIKI_ID_URI_TEMPLATE_V2, ownerType.name() .toLowerCase(), ownerId, toUpdate.getId()); return putJSONEntity(getRepoEndpoint(), uri, toUpdate, V2WikiPage.class); }
V2WikiPage function(String ownerId, ObjectType ownerType, V2WikiPage toUpdate) throws SynapseException { ValidateArgument.required(ownerId, STR); ValidateArgument.required(ownerType, STR); ValidateArgument.required(toUpdate, STR); ValidateArgument.required(toUpdate.getId(), STR); String uri = String.format(WIKI_ID_URI_TEMPLATE_V2, ownerType.name() .toLowerCase(), ownerId, toUpdate.getId()); return putJSONEntity(getRepoEndpoint(), uri, toUpdate, V2WikiPage.class); }
/** * Update a V2 WikiPage * * @param ownerId * @param ownerType * @param toUpdate * @return * @throws SynapseException */
Update a V2 WikiPage
updateV2WikiPage
{ "repo_name": "xschildw/Synapse-Repository-Services", "path": "client/synapseJavaClient/src/main/java/org/sagebionetworks/client/SynapseClientImpl.java", "license": "apache-2.0", "size": 223652 }
[ "org.sagebionetworks.client.exceptions.SynapseException", "org.sagebionetworks.repo.model.ObjectType", "org.sagebionetworks.repo.model.v2.wiki.V2WikiPage", "org.sagebionetworks.util.ValidateArgument" ]
import org.sagebionetworks.client.exceptions.SynapseException; import org.sagebionetworks.repo.model.ObjectType; import org.sagebionetworks.repo.model.v2.wiki.V2WikiPage; import org.sagebionetworks.util.ValidateArgument;
import org.sagebionetworks.client.exceptions.*; import org.sagebionetworks.repo.model.*; import org.sagebionetworks.repo.model.v2.wiki.*; import org.sagebionetworks.util.*;
[ "org.sagebionetworks.client", "org.sagebionetworks.repo", "org.sagebionetworks.util" ]
org.sagebionetworks.client; org.sagebionetworks.repo; org.sagebionetworks.util;
1,581,475
void enterIntegralType(@NotNull Java8Parser.IntegralTypeContext ctx);
void enterIntegralType(@NotNull Java8Parser.IntegralTypeContext ctx);
/** * Enter a parse tree produced by {@link Java8Parser#integralType}. * * @param ctx the parse tree */
Enter a parse tree produced by <code>Java8Parser#integralType</code>
enterIntegralType
{ "repo_name": "BigDaddy-Germany/WHOAMI", "path": "WHOAMI/src/de/aima13/whoami/modules/syntaxcheck/languages/antlrgen/Java8Listener.java", "license": "mit", "size": 97945 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
100,410
public static void setup() throws SVNClientException { if (!isAvailable()) { throw new SVNClientException("Javahl client adapter is not available"); } SVNClientAdapterFactory.registerAdapterFactory(new JhlClientAdapterFactory()); }
static void function() throws SVNClientException { if (!isAvailable()) { throw new SVNClientException(STR); } SVNClientAdapterFactory.registerAdapterFactory(new JhlClientAdapterFactory()); }
/** * Setup the client adapter implementation and register it in the adapters factory * @throws SVNClientException */
Setup the client adapter implementation and register it in the adapters factory
setup
{ "repo_name": "apicloudcom/APICloud-Studio", "path": "org.tigris.subversion.clientadapter.javahl/src/org/tigris/subversion/svnclientadapter/javahl/JhlClientAdapterFactory.java", "license": "gpl-3.0", "size": 8039 }
[ "org.tigris.subversion.svnclientadapter.SVNClientAdapterFactory", "org.tigris.subversion.svnclientadapter.SVNClientException" ]
import org.tigris.subversion.svnclientadapter.SVNClientAdapterFactory; import org.tigris.subversion.svnclientadapter.SVNClientException;
import org.tigris.subversion.svnclientadapter.*;
[ "org.tigris.subversion" ]
org.tigris.subversion;
2,342,547
static int[] findActualFoldValues(Vec f) { Vec fc = VecUtils.toCategoricalVec(f); final String[] actualDomain; try { if (!f.isCategorical()) { actualDomain = fc.domain(); } else { actualDomain = VecUtils.collectDomainFast(fc); } } finally { fc.remove(); } int N = actualDomain.length; if (Arrays.equals(actualDomain, fc.domain())) { int offset = f.isCategorical() ? 0 : (int) f.min(); return ArrayUtils.seq(offset, N + offset); } else { int[] mapping = new int[N]; String[] fullDomain = fc.domain(); for (int i = 0; i < N; i++) { int pos = ArrayUtils.find(fullDomain, actualDomain[i]); assert pos >= 0; mapping[i] = pos; } return mapping; } } } class TransformFoldAssignment extends FoldAssignment { private final Vec _adaptedFold; TransformFoldAssignment(Vec fold, int[] usedFoldValues) { super(fold); _adaptedFold = makeAdaptedFold(usedFoldValues); }
static int[] findActualFoldValues(Vec f) { Vec fc = VecUtils.toCategoricalVec(f); final String[] actualDomain; try { if (!f.isCategorical()) { actualDomain = fc.domain(); } else { actualDomain = VecUtils.collectDomainFast(fc); } } finally { fc.remove(); } int N = actualDomain.length; if (Arrays.equals(actualDomain, fc.domain())) { int offset = f.isCategorical() ? 0 : (int) f.min(); return ArrayUtils.seq(offset, N + offset); } else { int[] mapping = new int[N]; String[] fullDomain = fc.domain(); for (int i = 0; i < N; i++) { int pos = ArrayUtils.find(fullDomain, actualDomain[i]); assert pos >= 0; mapping[i] = pos; } return mapping; } } } class TransformFoldAssignment extends FoldAssignment { private final Vec _adaptedFold; TransformFoldAssignment(Vec fold, int[] usedFoldValues) { super(fold); _adaptedFold = makeAdaptedFold(usedFoldValues); }
/** * For a given fold Vec finds the actual used fold values (only used levels). * * @param f input Vec * @return indices of the used domain levels (for categorical fold) or the used values (for a numerical fold) */
For a given fold Vec finds the actual used fold values (only used levels)
findActualFoldValues
{ "repo_name": "h2oai/h2o-3", "path": "h2o-core/src/main/java/hex/FoldAssignment.java", "license": "apache-2.0", "size": 4426 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
2,811,912
public void validateKickstartFile(KickstartData ksdata) { try { if (ksdata.isValid()) { String text = renderKickstart(ksdata); if (text.contains("Traceback (most recent call last):") || text.contains("There is a templating error preventing this file from")) { ValidatorException. raiseException("kickstart.jsp.error.template_generation", LocalizationService.getInstance(). getMessage("kickstartdownload.jsp.header")); } } } catch (DownloadException de) { ValidatorException.raiseException("kickstart.jsp.error.template_generation", LocalizationService.getInstance().getMessage("kickstartdownload.jsp.header")); } }
void function(KickstartData ksdata) { try { if (ksdata.isValid()) { String text = renderKickstart(ksdata); if (text.contains(STR) text.contains(STR)) { ValidatorException. raiseException(STR, LocalizationService.getInstance(). getMessage(STR)); } } } catch (DownloadException de) { ValidatorException.raiseException(STR, LocalizationService.getInstance().getMessage(STR)); } }
/** * Simple method to validate a generated kickstart * @param ksdata the kickstart data file whose ks * templates will be checked * @throws ValidatorException on parse error or ISE.. */
Simple method to validate a generated kickstart
validateKickstartFile
{ "repo_name": "dmacvicar/spacewalk", "path": "java/code/src/com/redhat/rhn/manager/kickstart/KickstartManager.java", "license": "gpl-2.0", "size": 9247 }
[ "com.redhat.rhn.common.localization.LocalizationService", "com.redhat.rhn.common.util.download.DownloadException", "com.redhat.rhn.common.validator.ValidatorException", "com.redhat.rhn.domain.kickstart.KickstartData" ]
import com.redhat.rhn.common.localization.LocalizationService; import com.redhat.rhn.common.util.download.DownloadException; import com.redhat.rhn.common.validator.ValidatorException; import com.redhat.rhn.domain.kickstart.KickstartData;
import com.redhat.rhn.common.localization.*; import com.redhat.rhn.common.util.download.*; import com.redhat.rhn.common.validator.*; import com.redhat.rhn.domain.kickstart.*;
[ "com.redhat.rhn" ]
com.redhat.rhn;
1,694,900
private static boolean interested(String[] regGroups, Set desiredGroups) { if(desiredGroups == null) return true; if(desiredGroups.size() == 0) return false; for(int i=0;i<regGroups.length;i++) { if( desiredGroups.contains(regGroups[i]) ) return true; }//end loop return false; }//end interested
static boolean function(String[] regGroups, Set desiredGroups) { if(desiredGroups == null) return true; if(desiredGroups.size() == 0) return false; for(int i=0;i<regGroups.length;i++) { if( desiredGroups.contains(regGroups[i]) ) return true; } return false; }
/** This method determines if a particular registration (regInfo) is * interested in discovering, through group discovery, the registrar * belonging to a given set of member groups. * * @param regGroups array of the member groups from the registrar * (cannot be null) * @param desiredGroups groups the registration wishes to discover * (can be null = ALL_GROUPS) * * @return <code>true</code> if at least one of the registrar's member * groups is contained in the registration's set of groups to * discover; <code>false</code> otherwise */
This method determines if a particular registration (regInfo) is interested in discovering, through group discovery, the registrar belonging to a given set of member groups
interested
{ "repo_name": "apache/river", "path": "src/com/sun/jini/fiddler/FiddlerImpl.java", "license": "apache-2.0", "size": 419910 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,415,285
private void checkForIPv6() throws Exception { boolean preferIpV6Addr = Boolean.getBoolean("java.net.preferIPv6Addresses"); if (!preferIpV6Addr) { logger.debug("forcing JGroups to think IPv4 is being used so it will choose an IPv4 address"); Field m = org.jgroups.util.Util.class.getDeclaredField("ip_stack_type"); m.setAccessible(true); m.set(null, org.jgroups.util.StackType.IPv4); } } @Override public void started() {}
void function() throws Exception { boolean preferIpV6Addr = Boolean.getBoolean(STR); if (!preferIpV6Addr) { logger.debug(STR); Field m = org.jgroups.util.Util.class.getDeclaredField(STR); m.setAccessible(true); m.set(null, org.jgroups.util.StackType.IPv4); } } public void started() {}
/** * JGroups picks an IPv6 address if preferIPv4Stack is false or not set and preferIPv6Addresses is * not set or is true. We want it to use an IPv4 address for a dual-IP stack so that both IPv4 and * IPv6 messaging work */
JGroups picks an IPv6 address if preferIPv4Stack is false or not set and preferIPv6Addresses is not set or is true. We want it to use an IPv4 address for a dual-IP stack so that both IPv4 and IPv6 messaging work
checkForIPv6
{ "repo_name": "deepakddixit/incubator-geode", "path": "geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/messenger/JGroupsMessenger.java", "license": "apache-2.0", "size": 52073 }
[ "java.lang.reflect.Field" ]
import java.lang.reflect.Field;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
2,239,194
public void addToOtherConfig(Connection c, String key, String value) throws Types.BadServerResponse, XmlRpcException { String method_call = "VIF.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; Map response = c.dispatch(method_call, method_params); if(response.get("Status").equals("Success")) { Object result = response.get("Value"); return; } throw new Types.BadServerResponse(response); }
void function(Connection c, String key, String value) throws Types.BadServerResponse, XmlRpcException { String method_call = STR; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; Map response = c.dispatch(method_call, method_params); if(response.get(STR).equals(STR)) { Object result = response.get("Value"); return; } throw new Types.BadServerResponse(response); }
/** * Add the given key-value pair to the other_config field of the given VIF. * * @param key Key to add * @param value Value to add */
Add the given key-value pair to the other_config field of the given VIF
addToOtherConfig
{ "repo_name": "cc14514/hq6", "path": "hq-plugin/xen-plugin/src/main/java/com/xensource/xenapi/VIF.java", "license": "unlicense", "size": 34400 }
[ "java.util.Map", "org.apache.xmlrpc.XmlRpcException" ]
import java.util.Map; import org.apache.xmlrpc.XmlRpcException;
import java.util.*; import org.apache.xmlrpc.*;
[ "java.util", "org.apache.xmlrpc" ]
java.util; org.apache.xmlrpc;
2,764,916
public void if_tcmple(TypeMirror type, String target) throws IOException { pushType(type); if_tcmple(target); popType(); }
void function(TypeMirror type, String target) throws IOException { pushType(type); if_tcmple(target); popType(); }
/** * le succeeds if and only if value1 &lt;= value2 * <p>Stack: ..., value1, value2 =&gt; ... * @param type * @param target * @throws IOException */
le succeeds if and only if value1 &lt;= value2 Stack: ..., value1, value2 =&gt; ..
if_tcmple
{ "repo_name": "tvesalainen/bcc", "path": "src/main/java/org/vesalainen/bcc/Assembler.java", "license": "gpl-3.0", "size": 53751 }
[ "java.io.IOException", "javax.lang.model.type.TypeMirror" ]
import java.io.IOException; import javax.lang.model.type.TypeMirror;
import java.io.*; import javax.lang.model.type.*;
[ "java.io", "javax.lang" ]
java.io; javax.lang;
713,209
public void resetTask() { ((PathNavigateGround)this.entity.getNavigator()).setBreakDoors(true); ((PathNavigateGround)this.entity.getNavigator()).setEnterDoors(true); this.frontDoor = null; }
void function() { ((PathNavigateGround)this.entity.getNavigator()).setBreakDoors(true); ((PathNavigateGround)this.entity.getNavigator()).setEnterDoors(true); this.frontDoor = null; }
/** * Reset the task's internal state. Called when this task is interrupted by another one */
Reset the task's internal state. Called when this task is interrupted by another one
resetTask
{ "repo_name": "TheGreatAndPowerfulWeegee/wipunknown", "path": "build/tmp/recompileMc/sources/net/minecraft/entity/ai/EntityAIRestrictOpenDoor.java", "license": "gpl-3.0", "size": 2797 }
[ "net.minecraft.pathfinding.PathNavigateGround" ]
import net.minecraft.pathfinding.PathNavigateGround;
import net.minecraft.pathfinding.*;
[ "net.minecraft.pathfinding" ]
net.minecraft.pathfinding;
352,289
@Override public Session createSession(final boolean transacted, final int acknowledgeMode) throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createSession(" + transacted + ", " + acknowledgeMode + ")"); } checkClosed(); return allocateConnection(transacted, acknowledgeMode, type); }
Session function(final boolean transacted, final int acknowledgeMode) throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace(STR + transacted + STR + acknowledgeMode + ")"); } checkClosed(); return allocateConnection(transacted, acknowledgeMode, type); }
/** * Create a session * * @param transacted Use transactions * @param acknowledgeMode The acknowledge mode * @return The session * @throws JMSException Thrown if an error occurs */
Create a session
createSession
{ "repo_name": "jbertram/activemq-artemis", "path": "artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASessionFactoryImpl.java", "license": "apache-2.0", "size": 32037 }
[ "javax.jms.JMSException", "javax.jms.Session" ]
import javax.jms.JMSException; import javax.jms.Session;
import javax.jms.*;
[ "javax.jms" ]
javax.jms;
2,756,189
public Filter jwtAuthenticationFilter() { ManagementPortalOauthKeyStoreHandler keyStoreKeyFactory = ManagementPortalOauthKeyStoreHandler.build(managementPortalProperties); return new JwtAuthenticationFilter(keyStoreKeyFactory.getTokenValidator()); }
Filter function() { ManagementPortalOauthKeyStoreHandler keyStoreKeyFactory = ManagementPortalOauthKeyStoreHandler.build(managementPortalProperties); return new JwtAuthenticationFilter(keyStoreKeyFactory.getTokenValidator()); }
/** * Create a {@link JwtAuthenticationFilter}. * * @return the JwtAuthenticationFilter */
Create a <code>JwtAuthenticationFilter</code>
jwtAuthenticationFilter
{ "repo_name": "RADAR-CNS/ManagementPortal", "path": "src/main/java/org/radarcns/management/config/SecurityConfiguration.java", "license": "apache-2.0", "size": 6151 }
[ "javax.servlet.Filter", "org.radarcns.management.security.JwtAuthenticationFilter", "org.radarcns.management.security.jwt.ManagementPortalOauthKeyStoreHandler" ]
import javax.servlet.Filter; import org.radarcns.management.security.JwtAuthenticationFilter; import org.radarcns.management.security.jwt.ManagementPortalOauthKeyStoreHandler;
import javax.servlet.*; import org.radarcns.management.security.*; import org.radarcns.management.security.jwt.*;
[ "javax.servlet", "org.radarcns.management" ]
javax.servlet; org.radarcns.management;
2,517,270
//---------------------------------------------------------------------------- public short getParaAdjust() throws TextException { try { short paragraphAdjust = ((Short)getXPropertySet().getPropertyValue("ParaAdjust")).shortValue(); if(paragraphAdjust == ParagraphAdjust.RIGHT_value) return IParagraphProperties.ALIGN_RIGHT; else if(paragraphAdjust == ParagraphAdjust.LEFT_value) return IParagraphProperties.ALIGN_LEFT; else if(paragraphAdjust == ParagraphAdjust.CENTER_value) return IParagraphProperties.ALIGN_CENTER; return ALIGN_UNDEFINED; } catch(Exception exception) { TextException textException = new TextException(exception.getMessage()); textException.initCause(exception); throw textException; } }
short function() throws TextException { try { short paragraphAdjust = ((Short)getXPropertySet().getPropertyValue(STR)).shortValue(); if(paragraphAdjust == ParagraphAdjust.RIGHT_value) return IParagraphProperties.ALIGN_RIGHT; else if(paragraphAdjust == ParagraphAdjust.LEFT_value) return IParagraphProperties.ALIGN_LEFT; else if(paragraphAdjust == ParagraphAdjust.CENTER_value) return IParagraphProperties.ALIGN_CENTER; return ALIGN_UNDEFINED; } catch(Exception exception) { TextException textException = new TextException(exception.getMessage()); textException.initCause(exception); throw textException; } }
/** * Returns para adjust. * * @return para adjust * * @throws TextException if the break type is not available * * @author Andreas Bröker */
Returns para adjust
getParaAdjust
{ "repo_name": "LibreOffice/noa-libre", "path": "src/ag/ion/bion/officelayer/internal/text/ParagraphProperties.java", "license": "lgpl-2.1", "size": 11175 }
[ "ag.ion.bion.officelayer.text.IParagraphProperties", "ag.ion.bion.officelayer.text.TextException", "com.sun.star.style.ParagraphAdjust" ]
import ag.ion.bion.officelayer.text.IParagraphProperties; import ag.ion.bion.officelayer.text.TextException; import com.sun.star.style.ParagraphAdjust;
import ag.ion.bion.officelayer.text.*; import com.sun.star.style.*;
[ "ag.ion.bion", "com.sun.star" ]
ag.ion.bion; com.sun.star;
506,894
public static void removeInventory(Inventory i) { Operation.addToUndo(new Operation(i, Operation.REMOVED)); for(Component c: options.getComponents()) { if(c instanceof InventoryButton) { if(((InventoryButton)c).getInventory().equals(i)) { options.remove(c); break; } } } updateSelected(MasterInventory.getInventory()); gui.pack(); }
static void function(Inventory i) { Operation.addToUndo(new Operation(i, Operation.REMOVED)); for(Component c: options.getComponents()) { if(c instanceof InventoryButton) { if(((InventoryButton)c).getInventory().equals(i)) { options.remove(c); break; } } } updateSelected(MasterInventory.getInventory()); gui.pack(); }
/** * Updates the display to remove the inventory. * * @param i The deleted inventory */
Updates the display to remove the inventory
removeInventory
{ "repo_name": "giacalone99/WackyWozniaks", "path": "src/GUI.java", "license": "mit", "size": 14099 }
[ "java.awt.Component" ]
import java.awt.Component;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,970,427
private void resolveTopOfStack(YangLinkingPhase linkingPhase) throws DataModelException { List<T> entityToResolve = (List<T>) ((Resolvable) getCurrentEntityToResolveFromStack()).resolve(); if (entityToResolve != null && !entityToResolve.isEmpty()) { Iterator<T> entityToResolveIterator = entityToResolve.listIterator(); while (entityToResolveIterator.hasNext()) { addUnresolvedEntitiesToStack(entityToResolveIterator.next()); } } if (((Resolvable) getCurrentEntityToResolveFromStack()).getResolvableStatus() != INTRA_FILE_RESOLVED && ((Resolvable) getCurrentEntityToResolveFromStack()).getResolvableStatus() != UNDEFINED) { // Sets the resolution status in inside the type/uses/if-feature/leafref. ((Resolvable) getCurrentEntityToResolveFromStack()).setResolvableStatus(RESOLVED); } }
void function(YangLinkingPhase linkingPhase) throws DataModelException { List<T> entityToResolve = (List<T>) ((Resolvable) getCurrentEntityToResolveFromStack()).resolve(); if (entityToResolve != null && !entityToResolve.isEmpty()) { Iterator<T> entityToResolveIterator = entityToResolve.listIterator(); while (entityToResolveIterator.hasNext()) { addUnresolvedEntitiesToStack(entityToResolveIterator.next()); } } if (((Resolvable) getCurrentEntityToResolveFromStack()).getResolvableStatus() != INTRA_FILE_RESOLVED && ((Resolvable) getCurrentEntityToResolveFromStack()).getResolvableStatus() != UNDEFINED) { ((Resolvable) getCurrentEntityToResolveFromStack()).setResolvableStatus(RESOLVED); } }
/** * Resolves the current entity in the stack. */
Resolves the current entity in the stack
resolveTopOfStack
{ "repo_name": "VinodKumarS-Huawei/ietf96yang", "path": "utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangResolutionInfoImpl.java", "license": "apache-2.0", "size": 80538 }
[ "java.util.Iterator", "java.util.List", "org.onosproject.yangutils.datamodel.Resolvable", "org.onosproject.yangutils.datamodel.exceptions.DataModelException", "org.onosproject.yangutils.linker.YangLinkingPhase" ]
import java.util.Iterator; import java.util.List; import org.onosproject.yangutils.datamodel.Resolvable; import org.onosproject.yangutils.datamodel.exceptions.DataModelException; import org.onosproject.yangutils.linker.YangLinkingPhase;
import java.util.*; import org.onosproject.yangutils.datamodel.*; import org.onosproject.yangutils.datamodel.exceptions.*; import org.onosproject.yangutils.linker.*;
[ "java.util", "org.onosproject.yangutils" ]
java.util; org.onosproject.yangutils;
751,313
private ScanOneSummaryRow getScanOneSummaryRow() { return this.scanOneSummary.getScanOneSummaryRows()[this.rowNumber]; } }
ScanOneSummaryRow function() { return this.scanOneSummary.getScanOneSummaryRows()[this.rowNumber]; } }
/** * The the summary row for this cell * @return * the summary row */
The the summary row for this cell
getScanOneSummaryRow
{ "repo_name": "churchill-lab/j-qtl", "path": "modules/main/src/java/org/jax/qtl/scan/gui/ScanOneSummaryPanel.java", "license": "gpl-3.0", "size": 37564 }
[ "org.jax.qtl.scan.ScanOneSummary" ]
import org.jax.qtl.scan.ScanOneSummary;
import org.jax.qtl.scan.*;
[ "org.jax.qtl" ]
org.jax.qtl;
2,854,340
public Object getReturnValue(Serializer serializer) { if (!success || resultType == null) { return null; } return deserializeResult(serializer); }
Object function(Serializer serializer) { if (!success resultType == null) { return null; } return deserializeResult(serializer); }
/** * Returns the returnValue of the command processing. If {@link #isSuccess()} return <code>false</code>, this * method returns <code>null</code>. This method also returns <code>null</code> if response processing returned * a <code>null</code> value. * * @param serializer The serializer to deserialize the result with * @return The return value of command processing */
Returns the returnValue of the command processing. If <code>#isSuccess()</code> return <code>false</code>, this method returns <code>null</code>. This method also returns <code>null</code> if response processing returned a <code>null</code> value
getReturnValue
{ "repo_name": "oiavorskyi/AxonFramework", "path": "distributed-commandbus/src/main/java/org/axonframework/commandhandling/distributed/jgroups/ReplyMessage.java", "license": "apache-2.0", "size": 6456 }
[ "org.axonframework.serializer.Serializer" ]
import org.axonframework.serializer.Serializer;
import org.axonframework.serializer.*;
[ "org.axonframework.serializer" ]
org.axonframework.serializer;
1,324,564
private void createPlaybackStateNotPlaying(long position) { PlaybackStateCompat.Builder playbackStateBuilder = new PlaybackStateCompat.Builder(); int playState = PlaybackStateCompat.STATE_PAUSED; long currentPosition = position; playbackStateBuilder.setState(playState, currentPosition, (float) 1.0).setActions( getPlaybackStateActions() ); mSession.setPlaybackState(playbackStateBuilder.build()); }
void function(long position) { PlaybackStateCompat.Builder playbackStateBuilder = new PlaybackStateCompat.Builder(); int playState = PlaybackStateCompat.STATE_PAUSED; long currentPosition = position; playbackStateBuilder.setState(playState, currentPosition, (float) 1.0).setActions( getPlaybackStateActions() ); mSession.setPlaybackState(playbackStateBuilder.build()); }
/** * Helper function to create playback state in the situation where media is paused. * * @param position current media item's playing position. */
Helper function to create playback state in the situation where media is paused
createPlaybackStateNotPlaying
{ "repo_name": "AndroidX/androidx", "path": "leanback/leanback/src/androidTest/java/androidx/leanback/media/MediaControllerAdapterTest.java", "license": "apache-2.0", "size": 36848 }
[ "android.support.v4.media.session.PlaybackStateCompat" ]
import android.support.v4.media.session.PlaybackStateCompat;
import android.support.v4.media.session.*;
[ "android.support" ]
android.support;
1,758,579
Observable<EventbusEvent> events();
Observable<EventbusEvent> events();
/** * A * <a href="https://github.com/Froussios/Intro-To-RxJava/blob/master/Part%203%20-%20Taming%20the%20sequence/6.%20Hot%20and%20Cold%20observables.md#hot-observables">hot observable</a> * that emits incoming events from mesh. Multiple subscriptions will not affect the websocket in any way. */
A hot observable that emits incoming events from mesh. Multiple subscriptions will not affect the websocket in any way
events
{ "repo_name": "gentics/mesh", "path": "rest-client/src/main/java/com/gentics/mesh/rest/client/MeshWebsocket.java", "license": "apache-2.0", "size": 3064 }
[ "io.reactivex.Observable" ]
import io.reactivex.Observable;
import io.reactivex.*;
[ "io.reactivex" ]
io.reactivex;
1,724,650
void onScrollingFinished(WheelView wheelView);
void onScrollingFinished(WheelView wheelView);
/** * Callback method to be invoked when scrolling ended. * @param wheel the wheel view whose state has changed. */
Callback method to be invoked when scrolling ended
onScrollingFinished
{ "repo_name": "CiLiNet-Android/AndroidProject-CndSteel_External", "path": "CndSteel_External/src/com/cndsteel/framework/views/dialogs/wheelpicker/listeners/OnWheelScrollListener.java", "license": "apache-2.0", "size": 1175 }
[ "com.cndsteel.framework.views.dialogs.wheelpicker.WheelView" ]
import com.cndsteel.framework.views.dialogs.wheelpicker.WheelView;
import com.cndsteel.framework.views.dialogs.wheelpicker.*;
[ "com.cndsteel.framework" ]
com.cndsteel.framework;
1,042,504
private void _lookForHints(){ if ( _hint != null ) // if someone set a hint, then don't do this return; if ( _collection._hintFields == null ) return; Set<String> mykeys = _query.keySet(); for ( DBObject o : _collection._hintFields ){ Set<String> hintKeys = o.keySet(); if ( ! mykeys.containsAll( hintKeys ) ) continue; hint( o ); return; } }
void function(){ if ( _hint != null ) return; if ( _collection._hintFields == null ) return; Set<String> mykeys = _query.keySet(); for ( DBObject o : _collection._hintFields ){ Set<String> hintKeys = o.keySet(); if ( ! mykeys.containsAll( hintKeys ) ) continue; hint( o ); return; } }
/** * if there is a hint to use, use it */
if there is a hint to use, use it
_lookForHints
{ "repo_name": "ezbake/ezmongo", "path": "ezmongo-java-driver/src/main/com/mongodb/DBCursor.java", "license": "apache-2.0", "size": 25000 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
221,066
byte[] sendUnbind(OutputStream os, int sequenceNumber) throws IOException; /** * Send generic non-acknowledge command. * * @param os is the {@link OutputStream}
byte[] sendUnbind(OutputStream os, int sequenceNumber) throws IOException; /** * Send generic non-acknowledge command. * * @param os is the {@link OutputStream}
/** * Send unbind command. * * @param os is the {@link OutputStream} . * @param sequenceNumber is the sequence_number. * @return the composed bytes. * @throws IOException if an IO error occur. */
Send unbind command
sendUnbind
{ "repo_name": "opentelecoms-org/jsmpp-svn-mirror", "path": "src/java/main/org/jsmpp/PDUSender.java", "license": "apache-2.0", "size": 15919 }
[ "java.io.IOException", "java.io.OutputStream" ]
import java.io.IOException; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
497,749
public BlobAuditingPolicyState state() { return this.state; }
BlobAuditingPolicyState function() { return this.state; }
/** * Get specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'. * * @return the state value */
Get specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled'
state
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/sql/mgmt-v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPolicyInner.java", "license": "mit", "size": 19666 }
[ "com.microsoft.azure.management.sql.v2017_03_01_preview.BlobAuditingPolicyState" ]
import com.microsoft.azure.management.sql.v2017_03_01_preview.BlobAuditingPolicyState;
import com.microsoft.azure.management.sql.v2017_03_01_preview.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
429,254
protected I_CmsResourceType getResourceType(CmsResource resource) { return OpenCms.getResourceManager().getResourceType(resource); }
I_CmsResourceType function(CmsResource resource) { return OpenCms.getResourceManager().getResourceType(resource); }
/** * Convenience method to get the initialized resource type instance for the given resource, * with a fall back to special "unknown" resource types in case the resource type is not configured.<p> * * @param resource the resource to get the type for * * @return the initialized resource type instance for the given resource * * @see org.opencms.loader.CmsResourceManager#getResourceType(int) */
Convenience method to get the initialized resource type instance for the given resource, with a fall back to special "unknown" resource types in case the resource type is not configured
getResourceType
{ "repo_name": "it-tavis/opencms-core", "path": "src/org/opencms/file/types/A_CmsResourceType.java", "license": "lgpl-2.1", "size": 48100 }
[ "org.opencms.file.CmsResource", "org.opencms.main.OpenCms" ]
import org.opencms.file.CmsResource; import org.opencms.main.OpenCms;
import org.opencms.file.*; import org.opencms.main.*;
[ "org.opencms.file", "org.opencms.main" ]
org.opencms.file; org.opencms.main;
2,096,070
private static float getPrimitivePromotionCost(final Class<?> srcClass, final Class<?> destClass) { float cost = 0.0f; Class<?> cls = srcClass; if (!cls.isPrimitive()) { // slight unwrapping penalty cost += 0.1f; cls = ClassUtils.wrapperToPrimitive(cls); } for (int i = 0; cls != destClass && i < ORDERED_PRIMITIVE_TYPES.length; i++) { if (cls == ORDERED_PRIMITIVE_TYPES[i]) { cost += 0.1f; if (i < ORDERED_PRIMITIVE_TYPES.length - 1) { cls = ORDERED_PRIMITIVE_TYPES[i + 1]; } } } return cost; }
static float function(final Class<?> srcClass, final Class<?> destClass) { float cost = 0.0f; Class<?> cls = srcClass; if (!cls.isPrimitive()) { cost += 0.1f; cls = ClassUtils.wrapperToPrimitive(cls); } for (int i = 0; cls != destClass && i < ORDERED_PRIMITIVE_TYPES.length; i++) { if (cls == ORDERED_PRIMITIVE_TYPES[i]) { cost += 0.1f; if (i < ORDERED_PRIMITIVE_TYPES.length - 1) { cls = ORDERED_PRIMITIVE_TYPES[i + 1]; } } } return cost; }
/** * Gets the number of steps required to promote a primitive number to another * type. * @param srcClass the (primitive) source class * @param destClass the (primitive) destination class * @return The cost of promoting the primitive */
Gets the number of steps required to promote a primitive number to another type
getPrimitivePromotionCost
{ "repo_name": "mureinik/commons-lang", "path": "src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java", "license": "apache-2.0", "size": 7338 }
[ "org.apache.commons.lang3.ClassUtils" ]
import org.apache.commons.lang3.ClassUtils;
import org.apache.commons.lang3.*;
[ "org.apache.commons" ]
org.apache.commons;
982,548
protected Transaction txnBegin() throws DatabaseException { return txnBegin(null, null); }
Transaction function() throws DatabaseException { return txnBegin(null, null); }
/** * Begin a txn if in TXN_USER mode; otherwise return null; */
Begin a txn if in TXN_USER mode; otherwise return null
txnBegin
{ "repo_name": "malin1993ml/h-store", "path": "third_party/cpp/berkeleydb/test/java/compat/src/com/sleepycat/util/test/TxnTestCase.java", "license": "gpl-3.0", "size": 7043 }
[ "com.sleepycat.db.DatabaseException", "com.sleepycat.db.Transaction" ]
import com.sleepycat.db.DatabaseException; import com.sleepycat.db.Transaction;
import com.sleepycat.db.*;
[ "com.sleepycat.db" ]
com.sleepycat.db;
2,300,630
public static KeyStore pem2Keystore(File pemFile) throws IOException, CertificateException, InvalidKeySpecException, NoSuchAlgorithmException, KeyStoreException { String certAndKey = FileUtils.readFileToString(pemFile, StandardCharsets.US_ASCII); byte[] certBytes = extractCertificate(certAndKey); byte[] keyBytes = extractPrivateKey(certAndKey); return pem2KeyStore(certBytes, keyBytes); }
static KeyStore function(File pemFile) throws IOException, CertificateException, InvalidKeySpecException, NoSuchAlgorithmException, KeyStoreException { String certAndKey = FileUtils.readFileToString(pemFile, StandardCharsets.US_ASCII); byte[] certBytes = extractCertificate(certAndKey); byte[] keyBytes = extractPrivateKey(certAndKey); return pem2KeyStore(certBytes, keyBytes); }
/** * Code c/o http://stackoverflow.com/questions/12501117/programmatically-obtain-keystore-from-pem * @param pemFile * @return * @throws IOException * @throws CertificateException * @throws InvalidKeySpecException * @throws NoSuchAlgorithmException * @throws KeyStoreException */
Code c/o HREF
pem2Keystore
{ "repo_name": "NVolcz/zaproxy", "path": "src/org/zaproxy/zap/extension/dynssl/SslCertificateUtils.java", "license": "apache-2.0", "size": 11917 }
[ "java.io.File", "java.io.IOException", "java.nio.charset.StandardCharsets", "java.security.KeyStore", "java.security.KeyStoreException", "java.security.NoSuchAlgorithmException", "java.security.cert.CertificateException", "java.security.spec.InvalidKeySpecException", "org.apache.commons.io.FileUtils" ]
import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.cert.CertificateException; import java.security.spec.InvalidKeySpecException; import org.apache.commons.io.FileUtils;
import java.io.*; import java.nio.charset.*; import java.security.*; import java.security.cert.*; import java.security.spec.*; import org.apache.commons.io.*;
[ "java.io", "java.nio", "java.security", "org.apache.commons" ]
java.io; java.nio; java.security; org.apache.commons;
401,506
List<Resource> getAllowedResources(PerunSession sess, User user) throws UserNotExistsException, PrivilegeException;
List<Resource> getAllowedResources(PerunSession sess, User user) throws UserNotExistsException, PrivilegeException;
/** * Get all resources which have the user access on. * * @param sess * @param user * @return list of resources which have the user acess on * * @throws UserNotExistsException * @throws PrivilegeException */
Get all resources which have the user access on
getAllowedResources
{ "repo_name": "CESNET/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/api/UsersManager.java", "license": "bsd-2-clause", "size": 59111 }
[ "cz.metacentrum.perun.core.api.exceptions.PrivilegeException", "cz.metacentrum.perun.core.api.exceptions.UserNotExistsException", "java.util.List" ]
import cz.metacentrum.perun.core.api.exceptions.PrivilegeException; import cz.metacentrum.perun.core.api.exceptions.UserNotExistsException; import java.util.List;
import cz.metacentrum.perun.core.api.exceptions.*; import java.util.*;
[ "cz.metacentrum.perun", "java.util" ]
cz.metacentrum.perun; java.util;
1,982,086
private void createAddContactSubForm() { add(new WHeading(HeadingLevel.H3, "Add a new contact"));
void function() { add(new WHeading(HeadingLevel.H3, STR));
/** * Create the UI artefacts for the "Add contact" sub form. */
Create the UI artefacts for the "Add contact" sub form
createAddContactSubForm
{ "repo_name": "Joshua-Barclay/wcomponents", "path": "wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/repeater/RepeaterExampleWithStaticIDs.java", "license": "gpl-3.0", "size": 14521 }
[ "com.github.bordertech.wcomponents.HeadingLevel", "com.github.bordertech.wcomponents.WHeading" ]
import com.github.bordertech.wcomponents.HeadingLevel; import com.github.bordertech.wcomponents.WHeading;
import com.github.bordertech.wcomponents.*;
[ "com.github.bordertech" ]
com.github.bordertech;
1,588,149
@SuppressWarnings("unchecked") Map<String, String> convertParams(HttpServerRequest request) { Map<String, String> map = new HashMap<>(); Iterator<Map.Entry<String, String>> iterator = request.params().iterator(); while (iterator.hasNext()) { Map.Entry<String, String> entry = iterator.next(); map.put(entry.getKey(), entry.getValue()); } return map; }
@SuppressWarnings(STR) Map<String, String> convertParams(HttpServerRequest request) { Map<String, String> map = new HashMap<>(); Iterator<Map.Entry<String, String>> iterator = request.params().iterator(); while (iterator.hasNext()) { Map.Entry<String, String> entry = iterator.next(); map.put(entry.getKey(), entry.getValue()); } return map; }
/** * Convert http request parameters to a map. */
Convert http request parameters to a map
convertParams
{ "repo_name": "sijie/bookkeeper", "path": "bookkeeper-http/vertx-http-server/src/main/java/org/apache/bookkeeper/http/vertx/VertxAbstractHandler.java", "license": "apache-2.0", "size": 3371 }
[ "io.vertx.core.http.HttpServerRequest", "java.util.HashMap", "java.util.Iterator", "java.util.Map" ]
import io.vertx.core.http.HttpServerRequest; import java.util.HashMap; import java.util.Iterator; import java.util.Map;
import io.vertx.core.http.*; import java.util.*;
[ "io.vertx.core", "java.util" ]
io.vertx.core; java.util;
1,921,297
@Override public Value evalArray(Env env) { return evalVar(env).toAutoArray(); }
Value function(Env env) { return evalVar(env).toAutoArray(); }
/** * Evaluates the expression as an array. * * @param env the calling environment. * * @return the expression value. */
Evaluates the expression as an array
evalArray
{ "repo_name": "dlitz/resin", "path": "modules/quercus/src/com/caucho/quercus/expr/AbstractVarExpr.java", "license": "gpl-2.0", "size": 5019 }
[ "com.caucho.quercus.env.Env", "com.caucho.quercus.env.Value" ]
import com.caucho.quercus.env.Env; import com.caucho.quercus.env.Value;
import com.caucho.quercus.env.*;
[ "com.caucho.quercus" ]
com.caucho.quercus;
917,049
public void setInteriorColor(PDColor ic) { getCOSObject().setItem(COSName.IC, ic.toCOSArray()); }
void function(PDColor ic) { getCOSObject().setItem(COSName.IC, ic.toCOSArray()); }
/** * This will set interior color of the drawn area color is in DeviceRGB colo rspace. * * @param ic color in the DeviceRGB color space. * */
This will set interior color of the drawn area color is in DeviceRGB colo rspace
setInteriorColor
{ "repo_name": "TomRoush/PdfBox-Android", "path": "library/src/main/java/com/tom_roush/pdfbox/pdmodel/interactive/annotation/PDAnnotationSquareCircle.java", "license": "apache-2.0", "size": 9475 }
[ "com.tom_roush.pdfbox.cos.COSName", "com.tom_roush.pdfbox.pdmodel.graphics.color.PDColor" ]
import com.tom_roush.pdfbox.cos.COSName; import com.tom_roush.pdfbox.pdmodel.graphics.color.PDColor;
import com.tom_roush.pdfbox.cos.*; import com.tom_roush.pdfbox.pdmodel.graphics.color.*;
[ "com.tom_roush.pdfbox" ]
com.tom_roush.pdfbox;
2,620,312
private Node tryMinimizeNot(Node n) { Preconditions.checkArgument(n.isNot()); Node parent = n.getParent(); Node notChild = n.getFirstChild(); // negative operator of the current one : == -> != for instance. Token complementOperator; switch (notChild.getToken()) { case EQ: complementOperator = Token.NE; break; case NE: complementOperator = Token.EQ; break; case SHEQ: complementOperator = Token.SHNE; break; case SHNE: complementOperator = Token.SHEQ; break; // GT, GE, LT, LE are not handled in this because !(x<NaN) != x>=NaN. default: return n; } Node newOperator = n.removeFirstChild(); newOperator.setToken(complementOperator); parent.replaceChild(n, newOperator); compiler.reportCodeChange(); return newOperator; }
Node function(Node n) { Preconditions.checkArgument(n.isNot()); Node parent = n.getParent(); Node notChild = n.getFirstChild(); Token complementOperator; switch (notChild.getToken()) { case EQ: complementOperator = Token.NE; break; case NE: complementOperator = Token.EQ; break; case SHEQ: complementOperator = Token.SHNE; break; case SHNE: complementOperator = Token.SHEQ; break; default: return n; } Node newOperator = n.removeFirstChild(); newOperator.setToken(complementOperator); parent.replaceChild(n, newOperator); compiler.reportCodeChange(); return newOperator; }
/** * Try to minimize NOT nodes such as !(x==y). * * Returns the replacement for n or the original if no change was made */
Try to minimize NOT nodes such as !(x==y). Returns the replacement for n or the original if no change was made
tryMinimizeNot
{ "repo_name": "brad4d/closure-compiler", "path": "src/com/google/javascript/jscomp/PeepholeMinimizeConditions.java", "license": "apache-2.0", "size": 43966 }
[ "com.google.common.base.Preconditions", "com.google.javascript.rhino.Node", "com.google.javascript.rhino.Token" ]
import com.google.common.base.Preconditions; import com.google.javascript.rhino.Node; import com.google.javascript.rhino.Token;
import com.google.common.base.*; import com.google.javascript.rhino.*;
[ "com.google.common", "com.google.javascript" ]
com.google.common; com.google.javascript;
1,567,276
public static final Product toProduct( Document d ) { ObjectId id = d.get( "_id", ObjectId.class ); Product p = new Product( id == null ? "" : id.toString( ), d.getString( "name" ), d.getDouble( "price" ) ); return p; }
static final Product function( Document d ) { ObjectId id = d.get( "_id", ObjectId.class ); Product p = new Product( id == null ? STRnameSTRprice" ) ); return p; }
/** * Map a Mongo Document object to a Product object. * * @param d Document * @return A Product object with all the information of the Document object. */
Map a Mongo Document object to a Product object
toProduct
{ "repo_name": "Seiferxx/e-commerce-rest-api", "path": "java/src/main/java/org/juanitodread/ecommercerest/model/domain/adapter/ProductAdapter.java", "license": "apache-2.0", "size": 2001 }
[ "org.bson.Document", "org.bson.types.ObjectId", "org.juanitodread.ecommercerest.model.domain.Product" ]
import org.bson.Document; import org.bson.types.ObjectId; import org.juanitodread.ecommercerest.model.domain.Product;
import org.bson.*; import org.bson.types.*; import org.juanitodread.ecommercerest.model.domain.*;
[ "org.bson", "org.bson.types", "org.juanitodread.ecommercerest" ]
org.bson; org.bson.types; org.juanitodread.ecommercerest;
579,812
boolean containsValue(@Nullable Object value);
boolean containsValue(@Nullable Object value);
/** * Returns {@code true} if the multimap contains the specified value for any * key. * * @param value value to search for in multimap */
Returns true if the multimap contains the specified value for any key
containsValue
{ "repo_name": "TimurMahammadov/google-collections", "path": "src/com/google/common/collect/Multimap.java", "license": "apache-2.0", "size": 9594 }
[ "javax.annotation.Nullable" ]
import javax.annotation.Nullable;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
57,566
Vo getVoById(PerunSession perunSession, int id) throws VoNotExistsException, InternalErrorException;
Vo getVoById(PerunSession perunSession, int id) throws VoNotExistsException, InternalErrorException;
/** * Finds existing VO by id. * * @param perunSession * @param id id of the VO you are looking for * @return found VO * @throws VoNotExistsException * @throws InternalErrorException */
Finds existing VO by id
getVoById
{ "repo_name": "licehammer/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/implApi/VosManagerImplApi.java", "license": "bsd-2-clause", "size": 6990 }
[ "cz.metacentrum.perun.core.api.PerunSession", "cz.metacentrum.perun.core.api.Vo", "cz.metacentrum.perun.core.api.exceptions.InternalErrorException", "cz.metacentrum.perun.core.api.exceptions.VoNotExistsException" ]
import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.Vo; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import cz.metacentrum.perun.core.api.exceptions.VoNotExistsException;
import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*;
[ "cz.metacentrum.perun" ]
cz.metacentrum.perun;
1,709,611
@Test public void testEquals() { SimpleHistogramDataset d1 = new SimpleHistogramDataset("Dataset 1"); SimpleHistogramDataset d2 = new SimpleHistogramDataset("Dataset 1"); assertTrue(d1.equals(d2)); d1.addBin(new SimpleHistogramBin(1.0, 2.0)); assertFalse(d1.equals(d2)); d2.addBin(new SimpleHistogramBin(1.0, 2.0)); assertTrue(d1.equals(d2)); }
void function() { SimpleHistogramDataset d1 = new SimpleHistogramDataset(STR); SimpleHistogramDataset d2 = new SimpleHistogramDataset(STR); assertTrue(d1.equals(d2)); d1.addBin(new SimpleHistogramBin(1.0, 2.0)); assertFalse(d1.equals(d2)); d2.addBin(new SimpleHistogramBin(1.0, 2.0)); assertTrue(d1.equals(d2)); }
/** * Ensure that the equals() method can distinguish all fields. */
Ensure that the equals() method can distinguish all fields
testEquals
{ "repo_name": "aaronc/jfreechart", "path": "tests/org/jfree/data/statistics/SimpleHistogramDatasetTest.java", "license": "lgpl-2.1", "size": 4307 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
30,029
public void terminate(UserInfo user, String id) throws UnauthorizedException, DatastoreException, NotFoundException;
void function(UserInfo user, String id) throws UnauthorizedException, DatastoreException, NotFoundException;
/** * Terminate an existing backup daemon. * @param user * @param id * @throws UnauthorizedException * @throws NotFoundException * @throws DatastoreException */
Terminate an existing backup daemon
terminate
{ "repo_name": "hhu94/Synapse-Repository-Services", "path": "services/repository-managers/src/main/java/org/sagebionetworks/repo/manager/backup/daemon/BackupDaemonLauncher.java", "license": "apache-2.0", "size": 1824 }
[ "org.sagebionetworks.repo.model.DatastoreException", "org.sagebionetworks.repo.model.UnauthorizedException", "org.sagebionetworks.repo.model.UserInfo", "org.sagebionetworks.repo.web.NotFoundException" ]
import org.sagebionetworks.repo.model.DatastoreException; import org.sagebionetworks.repo.model.UnauthorizedException; import org.sagebionetworks.repo.model.UserInfo; import org.sagebionetworks.repo.web.NotFoundException;
import org.sagebionetworks.repo.model.*; import org.sagebionetworks.repo.web.*;
[ "org.sagebionetworks.repo" ]
org.sagebionetworks.repo;
228,559
static void checkIdentifierListForDuplicates(List<SqlNode> columnList, SqlValidatorImpl.ValidationErrorFunction validationErrorFunction) { final List<List<String>> names = Lists.transform(columnList, o -> ((SqlIdentifier) o).names); final int i = Util.firstDuplicate(names); if (i >= 0) { throw validationErrorFunction.apply(columnList.get(i), RESOURCE.duplicateNameInColumnList(Util.last(names.get(i)))); } }
static void checkIdentifierListForDuplicates(List<SqlNode> columnList, SqlValidatorImpl.ValidationErrorFunction validationErrorFunction) { final List<List<String>> names = Lists.transform(columnList, o -> ((SqlIdentifier) o).names); final int i = Util.firstDuplicate(names); if (i >= 0) { throw validationErrorFunction.apply(columnList.get(i), RESOURCE.duplicateNameInColumnList(Util.last(names.get(i)))); } }
/** * Checks that there are no duplicates in a list of {@link SqlIdentifier}. */
Checks that there are no duplicates in a list of <code>SqlIdentifier</code>
checkIdentifierListForDuplicates
{ "repo_name": "arina-ielchiieva/calcite", "path": "core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorUtil.java", "license": "apache-2.0", "size": 42227 }
[ "com.google.common.collect.Lists", "java.util.List", "org.apache.calcite.sql.SqlIdentifier", "org.apache.calcite.sql.SqlNode", "org.apache.calcite.util.Static", "org.apache.calcite.util.Util" ]
import com.google.common.collect.Lists; import java.util.List; import org.apache.calcite.sql.SqlIdentifier; import org.apache.calcite.sql.SqlNode; import org.apache.calcite.util.Static; import org.apache.calcite.util.Util;
import com.google.common.collect.*; import java.util.*; import org.apache.calcite.sql.*; import org.apache.calcite.util.*;
[ "com.google.common", "java.util", "org.apache.calcite" ]
com.google.common; java.util; org.apache.calcite;
845,637
@SuppressWarnings("unchecked") public static <TYPE> List<TYPE> castList( List<?> list, Class<TYPE> type, @Nullable String description) throws EvalException { Object desc = description == null ? null : Printer.formattable("'%s' element", description); for (Object value : list) { SkylarkType.checkType(value, type, desc); } return (List<TYPE>) list; }
@SuppressWarnings(STR) static <TYPE> List<TYPE> function( List<?> list, Class<TYPE> type, @Nullable String description) throws EvalException { Object desc = description == null ? null : Printer.formattable(STR, description); for (Object value : list) { SkylarkType.checkType(value, type, desc); } return (List<TYPE>) list; }
/** * Cast a {@code List<?>} to a {@code List<T>} after checking its current contents. * @param list the List to cast * @param type the expected class of elements * @param description a description of the argument being converted, or null, for debugging */
Cast a List to a List after checking its current contents
castList
{ "repo_name": "mikelikespie/bazel", "path": "src/main/java/com/google/devtools/build/lib/syntax/SkylarkList.java", "license": "apache-2.0", "size": 20750 }
[ "java.util.List", "javax.annotation.Nullable" ]
import java.util.List; import javax.annotation.Nullable;
import java.util.*; import javax.annotation.*;
[ "java.util", "javax.annotation" ]
java.util; javax.annotation;
138,827
public static void applyFocus(final Item1PenSelection _selected) { _selected.setOpaque(true); _selected.setBackground(ViewSettings.GENERAL_CLR_BORDER); } public void mousePressed(final MouseEvent _event) { }
static void function(final Item1PenSelection _selected) { _selected.setOpaque(true); _selected.setBackground(ViewSettings.GENERAL_CLR_BORDER); } public void mousePressed(final MouseEvent _event) { }
/** * apply focus to selected item. * @param _selected the selected item */
apply focus to selected item
applyFocus
{ "repo_name": "juliusHuelsmann/paint", "path": "PaintNotes/src/main/java/control/forms/tabs/CTabTools.java", "license": "apache-2.0", "size": 40119 }
[ "java.awt.event.MouseEvent" ]
import java.awt.event.MouseEvent;
import java.awt.event.*;
[ "java.awt" ]
java.awt;
485,740
public void testGetStudySubjects() throws Exception { Participant participant = dao.getById(1000); List<StudySubject> studyPartIds = participant.getStudySubjects(); assertEquals("Wrong number of Study Participant Identifiers", 2, studyPartIds.size()); List<Integer> ids = collectIds(studyPartIds); assertContains("Missing expected Study Participant Identifier", ids, 1000); }
void function() throws Exception { Participant participant = dao.getById(1000); List<StudySubject> studyPartIds = participant.getStudySubjects(); assertEquals(STR, 2, studyPartIds.size()); List<Integer> ids = collectIds(studyPartIds); assertContains(STR, ids, 1000); }
/** * Test for retrieving all Participant Assignments associated with this Participant * * @throws Exception */
Test for retrieving all Participant Assignments associated with this Participant
testGetStudySubjects
{ "repo_name": "NCIP/c3pr", "path": "codebase/projects/core/test/src/java/edu/duke/cabig/c3pr/dao/StudySubjectDaoTest.java", "license": "bsd-3-clause", "size": 159170 }
[ "edu.duke.cabig.c3pr.domain.Participant", "edu.duke.cabig.c3pr.domain.StudySubject", "edu.nwu.bioinformatics.commons.testing.CoreTestCase", "java.util.List" ]
import edu.duke.cabig.c3pr.domain.Participant; import edu.duke.cabig.c3pr.domain.StudySubject; import edu.nwu.bioinformatics.commons.testing.CoreTestCase; import java.util.List;
import edu.duke.cabig.c3pr.domain.*; import edu.nwu.bioinformatics.commons.testing.*; import java.util.*;
[ "edu.duke.cabig", "edu.nwu.bioinformatics", "java.util" ]
edu.duke.cabig; edu.nwu.bioinformatics; java.util;
2,102,087
public GridTimeoutProcessor timeout();
GridTimeoutProcessor function();
/** * Gets timeout processor. * * @return Timeout processor. */
Gets timeout processor
timeout
{ "repo_name": "SomeFire/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java", "license": "apache-2.0", "size": 22514 }
[ "org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor" ]
import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
import org.apache.ignite.internal.processors.timeout.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,213,020
public void getRedirect(String page) { try { FacesContext.getCurrentInstance().getExternalContext().redirect(page); } catch (IOException e) { e.printStackTrace(); getMsgError(Conf.getProperty("msg.usernotpermission")); } }
void function(String page) { try { FacesContext.getCurrentInstance().getExternalContext().redirect(page); } catch (IOException e) { e.printStackTrace(); getMsgError(Conf.getProperty(STR)); } }
/** * Redirecionar pagina * * @param page */
Redirecionar pagina
getRedirect
{ "repo_name": "williamrodrigues/JCadApplication", "path": "web/src/main/java/br/cad/controller/AppController.java", "license": "apache-2.0", "size": 12068 }
[ "br.cad.util.Conf", "java.io.IOException", "javax.faces.context.FacesContext" ]
import br.cad.util.Conf; import java.io.IOException; import javax.faces.context.FacesContext;
import br.cad.util.*; import java.io.*; import javax.faces.context.*;
[ "br.cad.util", "java.io", "javax.faces" ]
br.cad.util; java.io; javax.faces;
266,605
@Override public void writeToThin(StreamOutput out) throws IOException { out.writeLong(version); if (currentNodeId != null) { out.writeBoolean(true); out.writeString(currentNodeId); } else { out.writeBoolean(false); } if (relocatingNodeId != null) { out.writeBoolean(true); out.writeString(relocatingNodeId); } else { out.writeBoolean(false); } out.writeBoolean(primary); out.writeByte(state.value()); if (restoreSource != null) { out.writeBoolean(true); restoreSource.writeTo(out); } else { out.writeBoolean(false); } }
void function(StreamOutput out) throws IOException { out.writeLong(version); if (currentNodeId != null) { out.writeBoolean(true); out.writeString(currentNodeId); } else { out.writeBoolean(false); } if (relocatingNodeId != null) { out.writeBoolean(true); out.writeString(relocatingNodeId); } else { out.writeBoolean(false); } out.writeBoolean(primary); out.writeByte(state.value()); if (restoreSource != null) { out.writeBoolean(true); restoreSource.writeTo(out); } else { out.writeBoolean(false); } }
/** * Writes shard information to {@link StreamOutput} without writing index name and shard id * * @param out {@link StreamOutput} to write shard information to * @throws IOException if something happens during write */
Writes shard information to <code>StreamOutput</code> without writing index name and shard id
writeToThin
{ "repo_name": "Flipkart/elasticsearch", "path": "src/main/java/org/elasticsearch/cluster/routing/ImmutableShardRouting.java", "license": "apache-2.0", "size": 11565 }
[ "java.io.IOException", "org.elasticsearch.common.io.stream.StreamOutput" ]
import java.io.IOException; import org.elasticsearch.common.io.stream.StreamOutput;
import java.io.*; import org.elasticsearch.common.io.stream.*;
[ "java.io", "org.elasticsearch.common" ]
java.io; org.elasticsearch.common;
1,605,816
private void addProteinFilterMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addProteinFilterMenuItemActionPerformed Filter newFilter = createProteinFilter(); if (newFilter != null) { proteinFilters.add(newFilter); ((DefaultTableModel) proteinTable.getModel()).fireTableDataChanged(); userInput = true; } }//GEN-LAST:event_addProteinFilterMenuItemActionPerformed
void function(java.awt.event.ActionEvent evt) { Filter newFilter = createProteinFilter(); if (newFilter != null) { proteinFilters.add(newFilter); ((DefaultTableModel) proteinTable.getModel()).fireTableDataChanged(); userInput = true; } }
/** * Add a new protein filter. * * @param evt */
Add a new protein filter
addProteinFilterMenuItemActionPerformed
{ "repo_name": "compomics/compomics-utilities", "path": "src/main/java/com/compomics/util/gui/parameters/identification/advanced/ValidationQCParametersDialog.java", "license": "apache-2.0", "size": 45986 }
[ "com.compomics.util.experiment.filtering.Filter", "javax.swing.table.DefaultTableModel" ]
import com.compomics.util.experiment.filtering.Filter; import javax.swing.table.DefaultTableModel;
import com.compomics.util.experiment.filtering.*; import javax.swing.table.*;
[ "com.compomics.util", "javax.swing" ]
com.compomics.util; javax.swing;
1,708,786
protected void onExchange(Exchange exchange) throws Exception { getExchanges().add(exchange); // lets fire any consumers loadBalancer.process(exchange); }
void function(Exchange exchange) throws Exception { getExchanges().add(exchange); loadBalancer.process(exchange); }
/** * Invoked on a message exchange being sent by a producer * * @param exchange the exchange * @throws Exception is thrown if failed to process the exchange */
Invoked on a message exchange being sent by a producer
onExchange
{ "repo_name": "cexbrayat/camel", "path": "camel-core/src/main/java/org/apache/camel/component/browse/BrowseEndpoint.java", "license": "apache-2.0", "size": 3329 }
[ "org.apache.camel.Exchange" ]
import org.apache.camel.Exchange;
import org.apache.camel.*;
[ "org.apache.camel" ]
org.apache.camel;
2,364,787
boolean addPartitions(String catName, String dbName, String tblName, PartitionSpecProxy partitionSpec, boolean ifNotExists) throws InvalidObjectException, MetaException;
boolean addPartitions(String catName, String dbName, String tblName, PartitionSpecProxy partitionSpec, boolean ifNotExists) throws InvalidObjectException, MetaException;
/** * Add a list of partitions to a table. * @param catName catalog name. * @param dbName database name. * @param tblName table name. * @param partitionSpec specification for the partition * @param ifNotExists whether it is in an error if the partition already exists. If true, then * it is not an error if the partition exists, if false, it is. * @return whether the partition was created. * @throws InvalidObjectException The passed in partition spec or table specification is invalid. * @throws MetaException error writing to RDBMS. */
Add a list of partitions to a table
addPartitions
{ "repo_name": "sankarh/hive", "path": "standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java", "license": "apache-2.0", "size": 95486 }
[ "org.apache.hadoop.hive.metastore.api.InvalidObjectException", "org.apache.hadoop.hive.metastore.api.MetaException", "org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy" ]
import org.apache.hadoop.hive.metastore.api.InvalidObjectException; import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy;
import org.apache.hadoop.hive.metastore.api.*; import org.apache.hadoop.hive.metastore.partition.spec.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,884,244
@Test public void testResolveStrings() throws IOException, TransformerException { ParserResult original = BibtexParser .parse(new StringReader("@string{ crow = \"Crowston, K.\"}\n" + "@string{ anna = \"Annabi, H.\"}\n" + "@string{ howi = \"Howison, J.\"}\n" + "@string{ masa = \"Masango, C.\"}\n" + "@article{canh05," + " author = {#crow# and #anna# and #howi# and #masa#}," + "\n" + " title = {Effective work practices for floss development: A model and propositions}," + "\n" + " booktitle = {Hawaii International Conference On System Sciences (HICSS)}," + "\n" + " year = {2005}," + "\n" + " owner = {oezbek}," + "\n" + " timestamp = {2006.05.29}," + "\n" + " url = {http://james.howison.name/publications.html}" + "\n" + "}"), importFormatPreferences); Collection<BibEntry> c = original.getDatabase().getEntries(); Assert.assertEquals(1, c.size()); BibEntry e = c.iterator().next(); XMPUtil.writeXMP(pdfFile, e, original.getDatabase(), xmpPreferences); List<BibEntry> l = XMPUtil.readXMP(pdfFile.getAbsoluteFile(), xmpPreferences); Assert.assertEquals(1, l.size()); BibEntry x = l.get(0); Assert.assertEquals(AuthorList.parse("Crowston, K. and Annabi, H. and Howison, J. and Masango, C."), AuthorList.parse(x.getField("author").get())); }
void function() throws IOException, TransformerException { ParserResult original = BibtexParser .parse(new StringReader(STRCrowston, K.\"}\n" + STRAnnabi, H.\"}\n" + STRHowison, J.\"}\n" + STRMasango, C.\"}\n" + STR + STR + "\n" + STR + "\n" + STR + "\n" + STR + "\n" + STR + "\n" + STR + "\n" + STRCrowston, K. and Annabi, H. and Howison, J. and Masango, C.STRauthor").get())); }
/** * Test that readXMP and writeXMP work together. * @throws IOException * @throws TransformerException * * @throws Exception */
Test that readXMP and writeXMP work together
testResolveStrings
{ "repo_name": "Mr-DLib/jabref", "path": "src/test/java/net/sf/jabref/logic/xmp/XMPUtilTest.java", "license": "mit", "size": 62507 }
[ "java.io.IOException", "java.io.StringReader", "javax.xml.transform.TransformerException", "net.sf.jabref.logic.importer.ParserResult", "net.sf.jabref.logic.importer.fileformat.BibtexParser" ]
import java.io.IOException; import java.io.StringReader; import javax.xml.transform.TransformerException; import net.sf.jabref.logic.importer.ParserResult; import net.sf.jabref.logic.importer.fileformat.BibtexParser;
import java.io.*; import javax.xml.transform.*; import net.sf.jabref.logic.importer.*; import net.sf.jabref.logic.importer.fileformat.*;
[ "java.io", "javax.xml", "net.sf.jabref" ]
java.io; javax.xml; net.sf.jabref;
6,976
protected void writeBody () { if (entry instanceof ValueBoxEntry) stream.println (" public " + holderType + " value;"); else Util.writeInitializer (" public ", "value", "", entry, stream); stream.println (); writeCtors (); writeRead (); writeWrite (); writeType (); } // writeBody
void function () { if (entry instanceof ValueBoxEntry) stream.println (STR + holderType + STR); else Util.writeInitializer (STR, "value", "", entry, stream); stream.println (); writeCtors (); writeRead (); writeWrite (); writeType (); }
/** * Generate members of this class. **/
Generate members of this class
writeBody
{ "repo_name": "TheTypoMaster/Scaper", "path": "openjdk/corba/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Holder.java", "license": "gpl-2.0", "size": 7571 }
[ "com.sun.tools.corba.se.idl.ValueBoxEntry" ]
import com.sun.tools.corba.se.idl.ValueBoxEntry;
import com.sun.tools.corba.se.idl.*;
[ "com.sun.tools" ]
com.sun.tools;
1,654,130
public long updateGoal (Goal goal) { if (database == null || !database.isOpen()) open(); if (database == null || !database.isOpen()){ // TODO - Error Opening Database } ContentValues values = new ContentValues(); values.put(DatabaseContract.GoalSchema.COLUMN_NAME_TEXT, goal.getText()); values.put(DatabaseContract.GoalSchema.COLUMN_NAME_DATE, DataTypeConversion.dateToString(goal.getDate())); values.put(DatabaseContract.GoalSchema.COLUMN_NAME_REWARD, goal.getReward()); values.put(DatabaseContract.GoalSchema.COLUMN_NAME_ACHIEVED, goal.isAchieved()); long updateId = database.update(DatabaseContract.GoalSchema.TABLE_NAME, values, DatabaseContract.GoalSchema.COLUMN_NAME_ID + " = ?", new String[] {String.valueOf(goal.getId())}); return updateId; }
long function (Goal goal) { if (database == null !database.isOpen()) open(); if (database == null !database.isOpen()){ } ContentValues values = new ContentValues(); values.put(DatabaseContract.GoalSchema.COLUMN_NAME_TEXT, goal.getText()); values.put(DatabaseContract.GoalSchema.COLUMN_NAME_DATE, DataTypeConversion.dateToString(goal.getDate())); values.put(DatabaseContract.GoalSchema.COLUMN_NAME_REWARD, goal.getReward()); values.put(DatabaseContract.GoalSchema.COLUMN_NAME_ACHIEVED, goal.isAchieved()); long updateId = database.update(DatabaseContract.GoalSchema.TABLE_NAME, values, DatabaseContract.GoalSchema.COLUMN_NAME_ID + STR, new String[] {String.valueOf(goal.getId())}); return updateId; }
/** * Updates the goal */
Updates the goal
updateGoal
{ "repo_name": "mattdietrich/Achieved", "path": "app/src/main/java/ca/mattdietrich/achieved/database/DatabaseAccessObject.java", "license": "apache-2.0", "size": 8243 }
[ "android.content.ContentValues", "ca.mattdietrich.achieved.model.Goal" ]
import android.content.ContentValues; import ca.mattdietrich.achieved.model.Goal;
import android.content.*; import ca.mattdietrich.achieved.model.*;
[ "android.content", "ca.mattdietrich.achieved" ]
android.content; ca.mattdietrich.achieved;
2,176,292
@Override public void close() { if (this.client != null) { this.client.close(); } if (this.ownsAllocator && allocator != null) { allocator.close(); } if (ownsZkConnection) { try { this.clusterCoordinator.close(); } catch (IOException e) { logger.warn("Error while closing Cluster Coordinator.", e); } } if (eventLoopGroup != null) { eventLoopGroup.shutdownGracefully(); } // TODO: Did DRILL-1735 changes cover this TODO?: // TODO: fix tests that fail when this is called. //allocator.close(); connected = false; }
void function() { if (this.client != null) { this.client.close(); } if (this.ownsAllocator && allocator != null) { allocator.close(); } if (ownsZkConnection) { try { this.clusterCoordinator.close(); } catch (IOException e) { logger.warn(STR, e); } } if (eventLoopGroup != null) { eventLoopGroup.shutdownGracefully(); } connected = false; }
/** * Closes this client's connection to the server */
Closes this client's connection to the server
close
{ "repo_name": "cwestin/incubator-drill", "path": "exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java", "license": "apache-2.0", "size": 14728 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,380,542
@Test void readObjectsFromForm() throws Exception { this.document = new XWikiDocument(new DocumentReference(DOCWIKI, DOCSPACE, DOCNAME)); this.oldcore.getSpyXWiki().saveDocument(this.document, "", true, this.oldcore.getXWikiContext()); HttpServletRequest request = mock(HttpServletRequest.class); MockitoComponentManager mocker = this.oldcore.getMocker(); XWikiContext context = this.oldcore.getXWikiContext(); DocumentReferenceResolver<String> documentReferenceResolverString = mocker.registerMockComponent(DocumentReferenceResolver.TYPE_STRING, "current"); // Entity Reference resolver is used in <BaseObject>.getXClass() DocumentReferenceResolver<EntityReference> documentReferenceResolverEntity = mocker.registerMockComponent(DocumentReferenceResolver.TYPE_REFERENCE, "current"); EntityReferenceSerializer<String> entityReferenceResolver = mocker.registerMockComponent(EntityReferenceSerializer.TYPE_STRING, "local"); Map<String, String[]> parameters = generateFakeRequestMap(); BaseClass baseClass = generateFakeClass(); generateFakeObjects(); when(request.getParameterMap()).thenReturn(parameters); DocumentReference documentReference = new DocumentReference("wiki", "space", "page"); // This entity resolver with this 'resolve' method is used in // <BaseCollection>.getXClassReference() when(documentReferenceResolverEntity.resolve(any(EntityReference.class), any(DocumentReference.class))) .thenReturn(this.document.getDocumentReference()); when(documentReferenceResolverString.resolve("space.page")).thenReturn(documentReference); when(entityReferenceResolver.serialize(any(EntityReference.class))).thenReturn("space.page"); EditForm eform = new EditForm(); eform.setRequest(request); document.readObjectsFromForm(eform, context); assertEquals(3, this.document.getXObjectSize(baseClass.getDocumentReference())); assertEquals("string", this.document.getXObject(baseClass.getDocumentReference(), 0).getStringValue("string")); assertEquals(42, this.document.getXObject(baseClass.getDocumentReference(), 0).getIntValue("int")); assertEquals("string2", this.document.getXObject(baseClass.getDocumentReference(), 1).getStringValue("string")); assertEquals(42, this.document.getXObject(baseClass.getDocumentReference(), 1).getIntValue("int")); assertEquals("string3", this.document.getXObject(baseClass.getDocumentReference(), 2).getStringValue("string")); assertEquals(42, this.document.getXObject(baseClass.getDocumentReference(), 2).getIntValue("int")); assertNull(this.document.getXObject(baseClass.getDocumentReference(), 3)); assertNull(this.document.getXObject(baseClass.getDocumentReference(), 42)); }
void readObjectsFromForm() throws Exception { this.document = new XWikiDocument(new DocumentReference(DOCWIKI, DOCSPACE, DOCNAME)); this.oldcore.getSpyXWiki().saveDocument(this.document, STRcurrentSTRcurrentSTRlocalSTRwikiSTRspaceSTRpageSTRspace.pageSTRspace.pageSTRstringSTRstringSTRintSTRstring2STRstringSTRintSTRstring3STRstringSTRint")); assertNull(this.document.getXObject(baseClass.getDocumentReference(), 3)); assertNull(this.document.getXObject(baseClass.getDocumentReference(), 42)); }
/** * Unit test for {@link XWikiDocument#readObjectsFromForm(EditForm, XWikiContext)}. */
Unit test for <code>XWikiDocument#readObjectsFromForm(EditForm, XWikiContext)</code>
readObjectsFromForm
{ "repo_name": "xwiki/xwiki-platform", "path": "xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/doc/XWikiDocumentMockitoTest.java", "license": "lgpl-2.1", "size": 79929 }
[ "org.junit.jupiter.api.Assertions", "org.xwiki.model.reference.DocumentReference" ]
import org.junit.jupiter.api.Assertions; import org.xwiki.model.reference.DocumentReference;
import org.junit.jupiter.api.*; import org.xwiki.model.reference.*;
[ "org.junit.jupiter", "org.xwiki.model" ]
org.junit.jupiter; org.xwiki.model;
1,460,563
public Datapoint updateHistory(long dpId, Datapoint dpoint, String token, String username){ try{ Datapoint u = service.path("measure").path("history").path(dpId+"").path("update").queryParam("access_token", token).queryParam("username", username).type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).put(Datapoint.class, dpoint); return u; }catch(UniformInterfaceException e){ ClientResponse response = e.getResponse(); System.out.println(response.getStatus()); return null; }catch(Exception e){ return null; } }
Datapoint function(long dpId, Datapoint dpoint, String token, String username){ try{ Datapoint u = service.path(STR).path(STR).path(dpId+STRupdateSTRaccess_tokenSTRusername", username).type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).put(Datapoint.class, dpoint); return u; }catch(UniformInterfaceException e){ ClientResponse response = e.getResponse(); System.out.println(response.getStatus()); return null; }catch(Exception e){ return null; } }
/** * updates measure history * * @param dpId * @param dpoint * @param username id of a user * @param token authentication token generated while the user logs in * @return {@link Datapoint} information if updated, Response 401 if not authenticated, Response 204 otherwise */
updates measure history
updateHistory
{ "repo_name": "keme686/LifeCoachService", "path": "it.unitn.lifecoach.service.process.selfmonitoring.adapter/src/it/unitn/lifecoach/service/process/selfmonitoring/adapter/SelfMonitoringProcessAdapter.java", "license": "gpl-2.0", "size": 17909 }
[ "com.sun.jersey.api.client.ClientResponse", "com.sun.jersey.api.client.UniformInterfaceException", "it.unitn.lifecoach.model.Datapoint", "javax.ws.rs.core.MediaType" ]
import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.UniformInterfaceException; import it.unitn.lifecoach.model.Datapoint; import javax.ws.rs.core.MediaType;
import com.sun.jersey.api.client.*; import it.unitn.lifecoach.model.*; import javax.ws.rs.core.*;
[ "com.sun.jersey", "it.unitn.lifecoach", "javax.ws" ]
com.sun.jersey; it.unitn.lifecoach; javax.ws;
1,834,416
public final Type visitUnaryExpression(final GNode n) { final Type type = (Type) dispatch(n.getGeneric(1)); if (type.isError()) return setType(n, type); String operator = n.getString(0); if ("++".equals(operator) || "--".equals(operator)) { if (JavaEntities.isGeneralLValueT(type)) { assrt(n, !hasModifier(type, "final"), "operand of %s must not be final", operator); final Type rValue = JavaEntities.dereference(type); final Type raw = JavaEntities.resolveToRawRValue(rValue); if (!assrt(n, raw.isNumber(), "operand of %s must be number", operator)) return setType(n, ErrorT.TYPE); return setType(n, rValue); } _runtime.error("operand of " + operator + " must be variable", n); return setType(n, type); } else { assert "+".equals(operator) || "-".equals(operator); final Type promoted = JavaTypeConverter.promoteUnaryNumeric(getRValue(type, n.getGeneric(1))); if (!assrt(n, null != promoted, "operand must be numeric")) return setType(n, ErrorT.TYPE); if (promoted.hasConstant()) { if ("+".equals(operator)) return setType(n, promoted); final NumberT typNum = (NumberT) JavaEntities.resolveToRawRValue(promoted); final Number valNum = (Number) promoted.getConstant().getValue(); switch (typNum.getKind()) { case INT: { final int valInt = valNum.intValue(); return typNum.annotate().constant(new Integer("-".equals(operator) ? -valInt : ~valInt)); } case LONG: { final long valLong = valNum.longValue(); return typNum.annotate().constant(new Long("-".equals(operator) ? -valLong : ~valLong)); } case FLOAT: { if (!assrt(n, "-".equals(operator), "operand must be an integral type")) return setType(n, ErrorT.TYPE); return typNum.annotate().constant(new Float(-valNum.floatValue())); } case DOUBLE: { if (!assrt(n, "-".equals(operator), "operand must be an integral type")) return setType(n, ErrorT.TYPE); return typNum.annotate().constant(new Double(-valNum.doubleValue())); } default: throw new Error(); } } else { return setType(n, promoted); } } }
final Type function(final GNode n) { final Type type = (Type) dispatch(n.getGeneric(1)); if (type.isError()) return setType(n, type); String operator = n.getString(0); if ("++".equals(operator) "--".equals(operator)) { if (JavaEntities.isGeneralLValueT(type)) { assrt(n, !hasModifier(type, "final"), STR, operator); final Type rValue = JavaEntities.dereference(type); final Type raw = JavaEntities.resolveToRawRValue(rValue); if (!assrt(n, raw.isNumber(), STR, operator)) return setType(n, ErrorT.TYPE); return setType(n, rValue); } _runtime.error(STR + operator + STR, n); return setType(n, type); } else { assert "+".equals(operator) "-".equals(operator); final Type promoted = JavaTypeConverter.promoteUnaryNumeric(getRValue(type, n.getGeneric(1))); if (!assrt(n, null != promoted, STR)) return setType(n, ErrorT.TYPE); if (promoted.hasConstant()) { if ("+".equals(operator)) return setType(n, promoted); final NumberT typNum = (NumberT) JavaEntities.resolveToRawRValue(promoted); final Number valNum = (Number) promoted.getConstant().getValue(); switch (typNum.getKind()) { case INT: { final int valInt = valNum.intValue(); return typNum.annotate().constant(new Integer("-".equals(operator) ? -valInt : ~valInt)); } case LONG: { final long valLong = valNum.longValue(); return typNum.annotate().constant(new Long("-".equals(operator) ? -valLong : ~valLong)); } case FLOAT: { if (!assrt(n, "-".equals(operator), STR)) return setType(n, ErrorT.TYPE); return typNum.annotate().constant(new Float(-valNum.floatValue())); } case DOUBLE: { if (!assrt(n, "-".equals(operator), STR)) return setType(n, ErrorT.TYPE); return typNum.annotate().constant(new Double(-valNum.doubleValue())); } default: throw new Error(); } } else { return setType(n, promoted); } } }
/** * Visit a UnaryExpression = ("+" / "-" / "++" / "--") Expression * (gosling_et_al_2000 <a * href="http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#4990">&sect;15.15</a>, * <a * href="http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#5313">&sect;15.28</a>). */
Visit a UnaryExpression = ("+" / "-" / "++" / "--") Expression (gosling_et_al_2000 &sect;15.15, &sect;15.28)
visitUnaryExpression
{ "repo_name": "wandoulabs/xtc-rats", "path": "xtc-core/src/main/java/xtc/lang/JavaAnalyzer.java", "license": "lgpl-2.1", "size": 108783 }
[ "xtc.tree.GNode", "xtc.type.ErrorT", "xtc.type.NumberT", "xtc.type.Type" ]
import xtc.tree.GNode; import xtc.type.ErrorT; import xtc.type.NumberT; import xtc.type.Type;
import xtc.tree.*; import xtc.type.*;
[ "xtc.tree", "xtc.type" ]
xtc.tree; xtc.type;
786,513
public AlipayObject getBizModel() { return this.bizModel; }
AlipayObject function() { return this.bizModel; }
/** * <p>Getter for the field <code>bizModel</code>.</p> * * @return a {@link cn.felord.wepay.ali.sdk.api.AlipayObject} object. */
Getter for the field <code>bizModel</code>
getBizModel
{ "repo_name": "NotFound403/WePay", "path": "src/main/java/cn/felord/wepay/ali/sdk/api/request/AlipayUserAccountUseridBatchqueryRequest.java", "license": "apache-2.0", "size": 4870 }
[ "cn.felord.wepay.ali.sdk.api.AlipayObject" ]
import cn.felord.wepay.ali.sdk.api.AlipayObject;
import cn.felord.wepay.ali.sdk.api.*;
[ "cn.felord.wepay" ]
cn.felord.wepay;
1,895,127
public static boolean isEnabled(Context context) { WifiManager manager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); return manager.isWifiEnabled(); }
static boolean function(Context context) { WifiManager manager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); return manager.isWifiEnabled(); }
/** * Check whether WiFi is enabled. * * @param context The Context * @return true if enabled, false otherwise */
Check whether WiFi is enabled
isEnabled
{ "repo_name": "hmatalonga/GreenHub", "path": "app/src/main/java/com/hmatalonga/greenhub/models/Wifi.java", "license": "apache-2.0", "size": 7395 }
[ "android.content.Context", "android.net.wifi.WifiManager" ]
import android.content.Context; import android.net.wifi.WifiManager;
import android.content.*; import android.net.wifi.*;
[ "android.content", "android.net" ]
android.content; android.net;
1,713,721
void onFidChanged(@NonNull String fid);
void onFidChanged(@NonNull String fid);
/** * This method gets invoked when a Fid changes. * * @param fid represents the newly generated installation id. */
This method gets invoked when a Fid changes
onFidChanged
{ "repo_name": "firebase/firebase-android-sdk", "path": "firebase-installations-interop/src/main/java/com/google/firebase/installations/internal/FidListener.java", "license": "apache-2.0", "size": 988 }
[ "androidx.annotation.NonNull" ]
import androidx.annotation.NonNull;
import androidx.annotation.*;
[ "androidx.annotation" ]
androidx.annotation;
1,109,133
private void removeDataInSession(final FacesContext facesContext, final String userStoredInSession) { final HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(true); //logger.debug("Removing value from session {} with session id [{}] with [{}]", session, session.getId(), userStoredInSession); session.removeAttribute(userStoredInSession); session.invalidate(); }
void function(final FacesContext facesContext, final String userStoredInSession) { final HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(true); session.removeAttribute(userStoredInSession); session.invalidate(); }
/** * Removes the data in session. * * @param ctx * the ctx * @param userStoredInSession * the user stored in session */
Removes the data in session
removeDataInSession
{ "repo_name": "aalva-gapsi/gapsieventos", "path": "src/main/java/mx/com/gapsi/eventos/bean/UserLoginView.java", "license": "apache-2.0", "size": 7043 }
[ "javax.faces.context.FacesContext", "javax.servlet.http.HttpSession" ]
import javax.faces.context.FacesContext; import javax.servlet.http.HttpSession;
import javax.faces.context.*; import javax.servlet.http.*;
[ "javax.faces", "javax.servlet" ]
javax.faces; javax.servlet;
559,930
@Test public void accessWithInvalidApiToken() throws Exception { // wrong token apiClient.setApiToken("wrongApiToken"); HttpResponse response = apiClient.listMailboxes(); RestApiTestUtils.validateStatusCode(response, 401); // Unauthorized // empty token apiClient.setApiToken(""); response = apiClient.listMailboxes(); RestApiTestUtils.validateStatusCode(response, 401); // Unauthorized // no token apiClient.setApiToken(null); response = apiClient.listMailboxes(); RestApiTestUtils.validateStatusCode(response, 401); // Unauthorized }
void function() throws Exception { apiClient.setApiToken(STR); HttpResponse response = apiClient.listMailboxes(); RestApiTestUtils.validateStatusCode(response, 401); apiClient.setApiToken(""); response = apiClient.listMailboxes(); RestApiTestUtils.validateStatusCode(response, 401); apiClient.setApiToken(null); response = apiClient.listMailboxes(); RestApiTestUtils.validateStatusCode(response, 401); }
/** * Checks that access to the API is not possible with an invalid API token. */
Checks that access to the API is not possible with an invalid API token
accessWithInvalidApiToken
{ "repo_name": "Xceptance/XCMailr", "path": "xcmailr-webapp/src/test/java/controllers/restapi/AbstractApiControllerTest.java", "license": "apache-2.0", "size": 2496 }
[ "org.apache.http.HttpResponse" ]
import org.apache.http.HttpResponse;
import org.apache.http.*;
[ "org.apache.http" ]
org.apache.http;
891,072
Collection<StoreFile> getStorefiles();
Collection<StoreFile> getStorefiles();
/** * Gets the snapshot of the store files currently in use. Can be used for things like metrics * and checks; should not assume anything about relations between store files in the list. * @return The list of StoreFiles. */
Gets the snapshot of the store files currently in use. Can be used for things like metrics and checks; should not assume anything about relations between store files in the list
getStorefiles
{ "repo_name": "Guavus/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileManager.java", "license": "apache-2.0", "size": 5284 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
240,556
protected String readString() throws IOException { skipSpaces(); StringBuilder buffer = new StringBuilder(); int c = source.read(); while( !isEndOfName((char)c) && c != -1 ) { buffer.append( (char)c ); c = source.read(); } if (c != -1) { source.rewind(1); } return buffer.toString(); }
String function() throws IOException { skipSpaces(); StringBuilder buffer = new StringBuilder(); int c = source.read(); while( !isEndOfName((char)c) && c != -1 ) { buffer.append( (char)c ); c = source.read(); } if (c != -1) { source.rewind(1); } return buffer.toString(); }
/** * This will read the next string from the stream. * * @return The string that was read from the stream, never null. * * @throws IOException If there is an error reading from the stream. */
This will read the next string from the stream
readString
{ "repo_name": "kalaspuffar/pdfbox", "path": "pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java", "license": "apache-2.0", "size": 42779 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,469,101
@Test(groups = { "AlfrescoOne", "IntermittentBugs"}) public void AONE_13974() throws Exception { String testName = getTestName(); String testUser = getUserNameForDomain(testName, siteDomain); String siteName = getSiteName(testName + System.currentTimeMillis()); String title = "!@#$%^&*()_+:\"|<>?;"; String text = "!@#$%^&*()_+:\"|<>?;"; // Login ShareUser.login(drone, testUser, DEFAULT_PASSWORD); // Create Site ShareUser.createSite(drone, siteName, SITE_VISIBILITY_PUBLIC); // Add SiteNotice Dashlet ShareUserDashboard.addDashlet(drone, siteName, Dashlets.SITE_NOTICE); // Get Site Notice Dashlet SiteNoticeDashlet siteNoticeDashlet = ShareUserDashboard.getSiteContentDashlet(drone, siteName); // Open Configure Site Notice dialog box and enter title and text as given, click ok. ShareUserDashboard.configureSiteNoticeDialogBox(siteNoticeDashlet, title, text, ConfigureSiteNoticeActions.OK); // Get Site Notice Dashlet siteNoticeDashlet = ShareUserDashboard.getSiteContentDashlet(drone, siteName); // Verify the title and text on Site Notice Dashlet. Assert.assertEquals(siteNoticeDashlet.getTitle(), title); Assert.assertEquals(siteNoticeDashlet.getContent(), text); siteNoticeDashlet = ShareUserDashboard.getSiteContentDashlet(drone, siteName); ConfigureSiteNoticeDialogBoxPage configureSiteNotice = siteNoticeDashlet.clickOnConfigureIcon().render(); ConfigureSiteNoticeTinyMceEditor siteNoticeEditor = configureSiteNotice.getContentTinyMceEditor(); Assert.assertEquals(configureSiteNotice.getTitle(), title, "It's bug ALF-18940."); Assert.assertEquals(siteNoticeEditor.getText(), text); }
@Test(groups = { STR, STR}) void function() throws Exception { String testName = getTestName(); String testUser = getUserNameForDomain(testName, siteDomain); String siteName = getSiteName(testName + System.currentTimeMillis()); String title = STR <>?;"; String text = STR <>?;"; ShareUser.login(drone, testUser, DEFAULT_PASSWORD); ShareUser.createSite(drone, siteName, SITE_VISIBILITY_PUBLIC); ShareUserDashboard.addDashlet(drone, siteName, Dashlets.SITE_NOTICE); SiteNoticeDashlet siteNoticeDashlet = ShareUserDashboard.getSiteContentDashlet(drone, siteName); ShareUserDashboard.configureSiteNoticeDialogBox(siteNoticeDashlet, title, text, ConfigureSiteNoticeActions.OK); siteNoticeDashlet = ShareUserDashboard.getSiteContentDashlet(drone, siteName); Assert.assertEquals(siteNoticeDashlet.getTitle(), title); Assert.assertEquals(siteNoticeDashlet.getContent(), text); siteNoticeDashlet = ShareUserDashboard.getSiteContentDashlet(drone, siteName); ConfigureSiteNoticeDialogBoxPage configureSiteNotice = siteNoticeDashlet.clickOnConfigureIcon().render(); ConfigureSiteNoticeTinyMceEditor siteNoticeEditor = configureSiteNotice.getContentTinyMceEditor(); Assert.assertEquals(configureSiteNotice.getTitle(), title, STR); Assert.assertEquals(siteNoticeEditor.getText(), text); }
/** * Test: * <ul> * <li>Login</li> * <li>Create Site: public</li> * <li>Open Site Dashboard</li> * <li>Click Customize Dashboard button</li> * <li>Add Site Notice Dashlet</li> * <li>Click the Configure icon</li> * <li>Configure Site Notice dialog box is opened</li> * <li>Type the title and text as wildcards</li> * <li>Click OK button.</li> * <li>The form is closed. All changes are applied;</li> * </ul> */
Test: Login Create Site: public Open Site Dashboard Click Customize Dashboard button Add Site Notice Dashlet Click the Configure icon Configure Site Notice dialog box is opened Type the title and text as wildcards Click OK button. The form is closed. All changes are applied;
AONE_13974
{ "repo_name": "nguyentienlong/community-edition", "path": "projects/qa-share/src/test/java/org/alfresco/share/dashlet/SiteNoticetDashletTest.java", "license": "lgpl-3.0", "size": 73073 }
[ "org.alfresco.po.share.dashlet.ConfigureSiteNoticeDialogBoxPage", "org.alfresco.po.share.dashlet.ConfigureSiteNoticeTinyMceEditor", "org.alfresco.po.share.dashlet.SiteNoticeDashlet", "org.alfresco.po.share.enums.Dashlets", "org.alfresco.share.util.ConfigureSiteNoticeActions", "org.alfresco.share.util.ShareUser", "org.alfresco.share.util.ShareUserDashboard", "org.testng.Assert", "org.testng.annotations.Test" ]
import org.alfresco.po.share.dashlet.ConfigureSiteNoticeDialogBoxPage; import org.alfresco.po.share.dashlet.ConfigureSiteNoticeTinyMceEditor; import org.alfresco.po.share.dashlet.SiteNoticeDashlet; import org.alfresco.po.share.enums.Dashlets; import org.alfresco.share.util.ConfigureSiteNoticeActions; import org.alfresco.share.util.ShareUser; import org.alfresco.share.util.ShareUserDashboard; import org.testng.Assert; import org.testng.annotations.Test;
import org.alfresco.po.share.dashlet.*; import org.alfresco.po.share.enums.*; import org.alfresco.share.util.*; import org.testng.*; import org.testng.annotations.*;
[ "org.alfresco.po", "org.alfresco.share", "org.testng", "org.testng.annotations" ]
org.alfresco.po; org.alfresco.share; org.testng; org.testng.annotations;
1,159,084
public ValueAnimator animateScroll(final int scrollY) { // create an instance of this animator that is shared between calls if (mManualScrollAnimator == null) { mManualScrollAnimator = ValueAnimator.ofFloat(.0F, 1.F); mManualScrollAnimator.setEvaluator(new FloatEvaluator()); mManualScrollAnimator.addListener(new SelfUpdateAnimationListener()); } else { // unregister our update listener if (mManualScrollUpdateListener != null) { mManualScrollAnimator.removeUpdateListener(mManualScrollUpdateListener); } // cancel if running if (mManualScrollAnimator.isRunning()) { mManualScrollAnimator.end(); } } final int y; if (scrollY < 0) { y = 0; } else if (scrollY > mMaxScrollY) { y = mMaxScrollY; } else { y = scrollY; } final int startY = getScrollY(); final int diff = y - startY;
ValueAnimator function(final int scrollY) { if (mManualScrollAnimator == null) { mManualScrollAnimator = ValueAnimator.ofFloat(.0F, 1.F); mManualScrollAnimator.setEvaluator(new FloatEvaluator()); mManualScrollAnimator.addListener(new SelfUpdateAnimationListener()); } else { if (mManualScrollUpdateListener != null) { mManualScrollAnimator.removeUpdateListener(mManualScrollUpdateListener); } if (mManualScrollAnimator.isRunning()) { mManualScrollAnimator.end(); } } final int y; if (scrollY < 0) { y = 0; } else if (scrollY > mMaxScrollY) { y = mMaxScrollY; } else { y = scrollY; } final int startY = getScrollY(); final int diff = y - startY;
/** * Helper method to animate scroll state of ScrollableLayout. * Please note, that returned {@link ValueAnimator} is not fully configured - * it needs at least `duration` property. * Also, there is no checks if the current scrollY is equal to the requested one. * @param scrollY the final scroll y to animate to * @return {@link ValueAnimator} configured to animate scroll state */
Helper method to animate scroll state of ScrollableLayout. Please note, that returned <code>ValueAnimator</code> is not fully configured - it needs at least `duration` property. Also, there is no checks if the current scrollY is equal to the requested one
animateScroll
{ "repo_name": "noties/Scrollable", "path": "library/src/main/java/ru/noties/scrollable/ScrollableLayout.java", "license": "apache-2.0", "size": 39886 }
[ "android.animation.FloatEvaluator", "android.animation.ValueAnimator" ]
import android.animation.FloatEvaluator; import android.animation.ValueAnimator;
import android.animation.*;
[ "android.animation" ]
android.animation;
2,178,305
Task<Void> addUncommitted(Transaction transaction, Chronology chronology);
Task<Void> addUncommitted(Transaction transaction, Chronology chronology);
/** * TODO remove and depend on transaction? Make it a private interface or service for transactions? * * @param transaction * @param chronology * @return */
TODO remove and depend on transaction? Make it a private interface or service for transactions
addUncommitted
{ "repo_name": "OSEHRA/ISAAC", "path": "core/api/src/main/java/sh/isaac/api/commit/CommitService.java", "license": "apache-2.0", "size": 10330 }
[ "sh.isaac.api.chronicle.Chronology", "sh.isaac.api.transaction.Transaction" ]
import sh.isaac.api.chronicle.Chronology; import sh.isaac.api.transaction.Transaction;
import sh.isaac.api.chronicle.*; import sh.isaac.api.transaction.*;
[ "sh.isaac.api" ]
sh.isaac.api;
994,859
@Test public void nonS3EndpointProvided_DoesNotUseVirtualAddressing() throws Exception { URI customEndpoint = URI.create("https://foobar.amazonaws.com"); mockHttpClient.stubNextResponse(mockListObjectsResponse()); S3Client s3Client = clientBuilder().endpointOverride(customEndpoint).build(); s3Client.listObjects(ListObjectsRequest.builder().bucket(BUCKET).build()); assertEndpointMatches(mockHttpClient.getLastRequest(), customEndpoint.toString() + "/" + BUCKET); }
void function() throws Exception { URI customEndpoint = URI.create(STR/" + BUCKET); }
/** * If a custom, non-s3 endpoint is used we revert to path style addressing. This is useful for alternative S3 implementations * like Ceph that do not support virtual style addressing. */
If a custom, non-s3 endpoint is used we revert to path style addressing. This is useful for alternative S3 implementations like Ceph that do not support virtual style addressing
nonS3EndpointProvided_DoesNotUseVirtualAddressing
{ "repo_name": "aws/aws-sdk-java-v2", "path": "services/s3/src/test/java/software/amazon/awssdk/services/s3/S3EndpointResolutionTest.java", "license": "apache-2.0", "size": 40014 }
[ "java.net.URI" ]
import java.net.URI;
import java.net.*;
[ "java.net" ]
java.net;
1,381,944
protected int addJarContent(Manifest manifest, Map entries) throws IOException { // load manifest // add it to the jar if (log.isTraceEnabled()) { if (manifest != null) log.trace("Adding MANIFEST.MF [" + manifest.getMainAttributes().entrySet() + "]"); log.trace("Adding entries:"); Set key = entries.keySet(); for (Iterator iter = key.iterator(); iter.hasNext();) { log.trace(iter.next()); } } return JarUtils.createJar(manifest, entries, storage.getOutputStream()); } /** * Create a jar using the current settings and return a {@link Resource}
int function(Manifest manifest, Map entries) throws IOException { if (log.isTraceEnabled()) { if (manifest != null) log.trace(STR + manifest.getMainAttributes().entrySet() + "]"); log.trace(STR); Set key = entries.keySet(); for (Iterator iter = key.iterator(); iter.hasNext();) { log.trace(iter.next()); } } return JarUtils.createJar(manifest, entries, storage.getOutputStream()); } /** * Create a jar using the current settings and return a {@link Resource}
/** * Actual jar creation. * * @param manifest to use * @param entries array of resource to include in the jar * @return the number of bytes written to the underlying stream. * * @throws IOException */
Actual jar creation
addJarContent
{ "repo_name": "glyn/Gemini-Blueprint", "path": "test-support/src/main/java/org/eclipse/gemini/blueprint/test/internal/util/jar/JarCreator.java", "license": "apache-2.0", "size": 9897 }
[ "java.io.IOException", "java.util.Iterator", "java.util.Map", "java.util.Set", "java.util.jar.Manifest", "org.springframework.core.io.Resource" ]
import java.io.IOException; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.jar.Manifest; import org.springframework.core.io.Resource;
import java.io.*; import java.util.*; import java.util.jar.*; import org.springframework.core.io.*;
[ "java.io", "java.util", "org.springframework.core" ]
java.io; java.util; org.springframework.core;
2,564,917
public void deregister(Object object) { List<EventHandlerBridge> deprecated = new ArrayList<EventHandlerBridge>(); for (EventHandlerBridge bridge : bridges) { if (bridge.method.getDeclaringClass().equals(object.getClass())) { deprecated.add(bridge); } } bridges.removeAll(deprecated); } private class EventHandlerBridge { private Object object; private Method method; public EventHandlerBridge(Object object, Method method) { this.object = object; this.method = method; }
void function(Object object) { List<EventHandlerBridge> deprecated = new ArrayList<EventHandlerBridge>(); for (EventHandlerBridge bridge : bridges) { if (bridge.method.getDeclaringClass().equals(object.getClass())) { deprecated.add(bridge); } } bridges.removeAll(deprecated); } private class EventHandlerBridge { private Object object; private Method method; public EventHandlerBridge(Object object, Method method) { this.object = object; this.method = method; }
/** * Deregister any EventHandlers of the object. * * @param object object to remove the listeners of. */
Deregister any EventHandlers of the object
deregister
{ "repo_name": "rvbiljouw/aurorabot", "path": "src/main/java/ms/aurora/api/event/EventBus.java", "license": "gpl-2.0", "size": 4257 }
[ "java.lang.reflect.Method", "java.util.ArrayList", "java.util.List" ]
import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List;
import java.lang.reflect.*; import java.util.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
1,225,638
public void propertyChange(PropertyChangeEvent pce) { String name = pce.getPropertyName(); if (name.equals(TreeViewer.FINDER_VISIBLE_PROPERTY)) model.setDisplay(((Boolean) pce.getNewValue()).booleanValue()); else if (name.equals(Finder.RETRIEVED_PROPERTY)) view.setMessage(((Integer) pce.getNewValue()).intValue()); else if (name.equals(HistoryDialog.SELECTION_PROPERTY)) view.setTextToFind((String) pce.getNewValue()); }
void function(PropertyChangeEvent pce) { String name = pce.getPropertyName(); if (name.equals(TreeViewer.FINDER_VISIBLE_PROPERTY)) model.setDisplay(((Boolean) pce.getNewValue()).booleanValue()); else if (name.equals(Finder.RETRIEVED_PROPERTY)) view.setMessage(((Integer) pce.getNewValue()).intValue()); else if (name.equals(HistoryDialog.SELECTION_PROPERTY)) view.setTextToFind((String) pce.getNewValue()); }
/** * Reacts to the {@link Finder#RETRIEVED_PROPERTY} and * {@link TreeViewer#FINDER_VISIBLE_PROPERTY} property changes. * @see PropertyChangeListener#propertyChange(PropertyChangeEvent) */
Reacts to the <code>Finder#RETRIEVED_PROPERTY</code> and <code>TreeViewer#FINDER_VISIBLE_PROPERTY</code> property changes
propertyChange
{ "repo_name": "dominikl/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/finder/FinderControl.java", "license": "gpl-2.0", "size": 5033 }
[ "java.beans.PropertyChangeEvent", "org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewer", "org.openmicroscopy.shoola.util.ui.HistoryDialog" ]
import java.beans.PropertyChangeEvent; import org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewer; import org.openmicroscopy.shoola.util.ui.HistoryDialog;
import java.beans.*; import org.openmicroscopy.shoola.agents.treeviewer.view.*; import org.openmicroscopy.shoola.util.ui.*;
[ "java.beans", "org.openmicroscopy.shoola" ]
java.beans; org.openmicroscopy.shoola;
366,233
@ServiceMethod(returns = ReturnType.SINGLE) Mono<ExpressRouteCrossConnectionInner> getByResourceGroupAsync( String resourceGroupName, String crossConnectionName);
@ServiceMethod(returns = ReturnType.SINGLE) Mono<ExpressRouteCrossConnectionInner> getByResourceGroupAsync( String resourceGroupName, String crossConnectionName);
/** * Gets details about the specified ExpressRouteCrossConnection. * * @param resourceGroupName The name of the resource group (peering location of the circuit). * @param crossConnectionName The name of the ExpressRouteCrossConnection (service key of the circuit). * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return details about the specified ExpressRouteCrossConnection. */
Gets details about the specified ExpressRouteCrossConnection
getByResourceGroupAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanagerhybrid/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/ExpressRouteCrossConnectionsClient.java", "license": "mit", "size": 45493 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.network.fluent.models.ExpressRouteCrossConnectionInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.network.fluent.models.ExpressRouteCrossConnectionInner;
import com.azure.core.annotation.*; import com.azure.resourcemanager.network.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
333,596
@Test public void failedAuthentication() throws Exception { DatabaseDescriptor.setInternodeAuthenticator(MessagingServiceTest.ALLOW_NOTHING_AUTHENTICATOR); InetAddressAndPort address = InetAddressAndPort.getByName("127.0.0.250"); //Should tolerate null returns by MS for the connection ReconnectableSnitchHelper.reconnect(address, address, null, null); }
void function() throws Exception { DatabaseDescriptor.setInternodeAuthenticator(MessagingServiceTest.ALLOW_NOTHING_AUTHENTICATOR); InetAddressAndPort address = InetAddressAndPort.getByName(STR); ReconnectableSnitchHelper.reconnect(address, address, null, null); }
/** * Make sure that if a node fails internode authentication and MessagingService returns a null * pool that ReconnectableSnitchHelper fails gracefully. */
Make sure that if a node fails internode authentication and MessagingService returns a null pool that ReconnectableSnitchHelper fails gracefully
failedAuthentication
{ "repo_name": "instaclustr/cassandra", "path": "test/unit/org/apache/cassandra/locator/ReconnectableSnitchHelperTest.java", "license": "apache-2.0", "size": 2270 }
[ "org.apache.cassandra.config.DatabaseDescriptor", "org.apache.cassandra.net.MessagingServiceTest" ]
import org.apache.cassandra.config.DatabaseDescriptor; import org.apache.cassandra.net.MessagingServiceTest;
import org.apache.cassandra.config.*; import org.apache.cassandra.net.*;
[ "org.apache.cassandra" ]
org.apache.cassandra;
2,410,981
public Map<Integer, ArmyDTO> getArmiesMap() { return armiesMap; }
Map<Integer, ArmyDTO> function() { return armiesMap; }
/** * Get map of armies. * * @return army objects mapped by id. */
Get map of armies
getArmiesMap
{ "repo_name": "EaW1805/www", "path": "src/main/java/com/eaw1805/www/controllers/remote/hotspot/army/ArmyApplyChangesProcessor.java", "license": "mit", "size": 25713 }
[ "com.eaw1805.data.dto.web.army.ArmyDTO", "java.util.Map" ]
import com.eaw1805.data.dto.web.army.ArmyDTO; import java.util.Map;
import com.eaw1805.data.dto.web.army.*; import java.util.*;
[ "com.eaw1805.data", "java.util" ]
com.eaw1805.data; java.util;
1,127,812
public Object next() throws IOException { if (prevPos <= 0) return null; long endOfThisRecord = prevPos; int thisLength = nextLength; long recordStart = prevPos - thisLength; // back up to the beginning of the next record prevPos = recordStart - 4; // back up 4 more to read the length of the next record if (prevPos <= 0) return null; // this record is the header long bufferPos = fis.getBufferPos(); if (prevPos >= bufferPos) { // nothing to do... we're within the current buffer } else { // Position buffer so that this record is at the end. // For small records, this will cause subsequent calls to next() to be within the buffer. long seekPos = endOfThisRecord - fis.getBufferSize(); seekPos = Math.min( seekPos, prevPos); // seek to the start of the record if it's larger then the block size. seekPos = Math.max(seekPos, 0); fis.seek(seekPos); fis.peek(); // cause buffer to be filled } fis.seek(prevPos); nextLength = fis.readInt(); // this is the length of the *next* record (i.e. closer to the beginning) // TODO: optionally skip document data Object o = codec.readVal(fis); // assert fis.position() == prevPos + 4 + thisLength; // this is only true if we read all the // data (and we currently skip reading SolrInputDocument return o; }
Object function() throws IOException { if (prevPos <= 0) return null; long endOfThisRecord = prevPos; int thisLength = nextLength; long recordStart = prevPos - thisLength; prevPos = recordStart - 4; if (prevPos <= 0) return null; long bufferPos = fis.getBufferPos(); if (prevPos >= bufferPos) { } else { long seekPos = endOfThisRecord - fis.getBufferSize(); seekPos = Math.min( seekPos, prevPos); seekPos = Math.max(seekPos, 0); fis.seek(seekPos); fis.peek(); } fis.seek(prevPos); nextLength = fis.readInt(); Object o = codec.readVal(fis); return o; }
/** * Returns the next object from the log, or null if none available. * * @return The log record, or null if EOF * @throws IOException If there is a low-level I/O error. */
Returns the next object from the log, or null if none available
next
{ "repo_name": "apache/solr", "path": "solr/modules/hdfs/src/java/org/apache/solr/hdfs/update/HdfsTransactionLog.java", "license": "apache-2.0", "size": 20210 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
808,547
protected String generateLockString(LockMode lockMode) { SimpleSelect select = new SimpleSelect( getFactory().getDialect() ) .setLockMode( lockMode ) .setTableName( getVersionedTableName() ) .addColumn( rootTableKeyColumnNames[0] ) .addCondition( rootTableKeyColumnNames, "=?" ); if ( isVersioned() ) { select.addCondition( getVersionColumnName(), "=?" ); } if ( getFactory().getSettings().isCommentsEnabled() ) { select.setComment( "lock " + getEntityName() ); } return select.toStatementString(); }
String function(LockMode lockMode) { SimpleSelect select = new SimpleSelect( getFactory().getDialect() ) .setLockMode( lockMode ) .setTableName( getVersionedTableName() ) .addColumn( rootTableKeyColumnNames[0] ) .addCondition( rootTableKeyColumnNames, "=?" ); if ( isVersioned() ) { select.addCondition( getVersionColumnName(), "=?" ); } if ( getFactory().getSettings().isCommentsEnabled() ) { select.setComment( STR + getEntityName() ); } return select.toStatementString(); }
/** * Generate the SQL that pessimistic locks a row by id (and version) */
Generate the SQL that pessimistic locks a row by id (and version)
generateLockString
{ "repo_name": "raedle/univis", "path": "lib/hibernate-3.1.3/src/org/hibernate/persister/entity/AbstractEntityPersister.java", "license": "lgpl-2.1", "size": 116750 }
[ "org.hibernate.LockMode", "org.hibernate.sql.SimpleSelect" ]
import org.hibernate.LockMode; import org.hibernate.sql.SimpleSelect;
import org.hibernate.*; import org.hibernate.sql.*;
[ "org.hibernate", "org.hibernate.sql" ]
org.hibernate; org.hibernate.sql;
1,542,793
public List getColumnFieldClasses() { if (columnFieldClasses == null) { columnFieldClasses = new ArrayList(); for (int i = 0; i < columnFieldDescriptors.size(); i++) { AttributeDescriptor ad = (AttributeDescriptor) columnFieldDescriptors.get(i); if (ad == null) { columnFieldClasses.add(null); } else { String className = ad.getType(); columnFieldClasses.add(TypeUtil.instantiate(className)); } } } return columnFieldClasses; }
List function() { if (columnFieldClasses == null) { columnFieldClasses = new ArrayList(); for (int i = 0; i < columnFieldDescriptors.size(); i++) { AttributeDescriptor ad = (AttributeDescriptor) columnFieldDescriptors.get(i); if (ad == null) { columnFieldClasses.add(null); } else { String className = ad.getType(); columnFieldClasses.add(TypeUtil.instantiate(className)); } } } return columnFieldClasses; }
/** * Return a List of Class objects corresponding to the fields returned by * getColumnFieldDescriptors(). * @return the Class objects */
Return a List of Class objects corresponding to the fields returned by getColumnFieldDescriptors()
getColumnFieldClasses
{ "repo_name": "JoeCarlson/intermine", "path": "intermine/integrate/main/src/org/intermine/task/DelimitedFileConfiguration.java", "license": "lgpl-2.1", "size": 6184 }
[ "java.util.ArrayList", "java.util.List", "org.intermine.metadata.AttributeDescriptor", "org.intermine.metadata.TypeUtil" ]
import java.util.ArrayList; import java.util.List; import org.intermine.metadata.AttributeDescriptor; import org.intermine.metadata.TypeUtil;
import java.util.*; import org.intermine.metadata.*;
[ "java.util", "org.intermine.metadata" ]
java.util; org.intermine.metadata;
2,239,943
public void setClientProperties(Map<String, Object> clientProperties) { this.clientProperties = clientProperties; }
void function(Map<String, Object> clientProperties) { this.clientProperties = clientProperties; }
/** * Connection client properties (client info used in negotiating with the server) */
Connection client properties (client info used in negotiating with the server)
setClientProperties
{ "repo_name": "NetNow/camel", "path": "components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java", "license": "apache-2.0", "size": 33832 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,065,188
@Nonnull @WithBridgeMethods(Label.class) public LabelAtom getSelfLabel() { return LabelAtom.get(getNodeName()); } /** * Called by the {@link Queue} to determine whether or not this node can * take the given task. The default checks include whether or not this node * is part of the task's assigned label, whether this node is in * {@link Mode#EXCLUSIVE} mode if it is not in the task's assigned label, * and whether or not any of this node's {@link NodeProperty}s say that the * task cannot be run. * * @since 1.360 * @deprecated as of 1.413 * Use {@link #canTake(Queue.BuildableItem)}
@WithBridgeMethods(Label.class) LabelAtom function() { return LabelAtom.get(getNodeName()); } /** * Called by the {@link Queue} to determine whether or not this node can * take the given task. The default checks include whether or not this node * is part of the task's assigned label, whether this node is in * {@link Mode#EXCLUSIVE} mode if it is not in the task's assigned label, * and whether or not any of this node's {@link NodeProperty}s say that the * task cannot be run. * * @since 1.360 * @deprecated as of 1.413 * Use {@link #canTake(Queue.BuildableItem)}
/** * Gets the special label that represents this node itself. */
Gets the special label that represents this node itself
getSelfLabel
{ "repo_name": "bkmeneguello/jenkins", "path": "core/src/main/java/hudson/model/Node.java", "license": "mit", "size": 21733 }
[ "com.infradna.tool.bridge_method_injector.WithBridgeMethods", "hudson.model.labels.LabelAtom", "hudson.slaves.NodeProperty" ]
import com.infradna.tool.bridge_method_injector.WithBridgeMethods; import hudson.model.labels.LabelAtom; import hudson.slaves.NodeProperty;
import com.infradna.tool.bridge_method_injector.*; import hudson.model.labels.*; import hudson.slaves.*;
[ "com.infradna.tool", "hudson.model.labels", "hudson.slaves" ]
com.infradna.tool; hudson.model.labels; hudson.slaves;
1,131,139
public static HasIpSpace hasIpSpace( @Nonnull String name, @Nonnull Matcher<? super IpSpace> subMatcher) { return new HasIpSpace(name, subMatcher); }
static HasIpSpace function( @Nonnull String name, @Nonnull Matcher<? super IpSpace> subMatcher) { return new HasIpSpace(name, subMatcher); }
/** * Provides a matcher that matches if the provided {@code subMatcher} matches the configuration's * IpSpace with specified name. */
Provides a matcher that matches if the provided subMatcher matches the configuration's IpSpace with specified name
hasIpSpace
{ "repo_name": "arifogel/batfish", "path": "projects/batfish-common-protocol/src/test/java/org/batfish/datamodel/matchers/ConfigurationMatchers.java", "license": "apache-2.0", "size": 10497 }
[ "javax.annotation.Nonnull", "org.batfish.datamodel.IpSpace", "org.batfish.datamodel.matchers.ConfigurationMatchersImpl", "org.hamcrest.Matcher" ]
import javax.annotation.Nonnull; import org.batfish.datamodel.IpSpace; import org.batfish.datamodel.matchers.ConfigurationMatchersImpl; import org.hamcrest.Matcher;
import javax.annotation.*; import org.batfish.datamodel.*; import org.batfish.datamodel.matchers.*; import org.hamcrest.*;
[ "javax.annotation", "org.batfish.datamodel", "org.hamcrest" ]
javax.annotation; org.batfish.datamodel; org.hamcrest;
1,991,411
public void setNumMatches(Integer numMatches) { if (this.numberMatchLabel != null) { this.numberMatchLabel.setText(Integer.toString(numMatches)); } } private class DummyNodeListener implements NodeListener { private static final String DUMMY_NODE_DISPLAY_NAME = "Please Wait..."; private volatile boolean load = true;
void function(Integer numMatches) { if (this.numberMatchLabel != null) { this.numberMatchLabel.setText(Integer.toString(numMatches)); } } private class DummyNodeListener implements NodeListener { private static final String DUMMY_NODE_DISPLAY_NAME = STR; private volatile boolean load = true;
/** * Set number of matches to be displayed in the top right * @param numMatches */
Set number of matches to be displayed in the top right
setNumMatches
{ "repo_name": "jgarman/autopsy", "path": "Core/src/org/sleuthkit/autopsy/corecomponents/DataResultPanel.java", "license": "apache-2.0", "size": 25172 }
[ "org.openide.nodes.NodeListener" ]
import org.openide.nodes.NodeListener;
import org.openide.nodes.*;
[ "org.openide.nodes" ]
org.openide.nodes;
1,647,911
public void hide() { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "hide"); ScriptSessions.addScript(script); }
void function() { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "hide"); ScriptSessions.addScript(script); }
/** * destorys the on-screen VIEW for the HW container; Hide() only affects the VIEW; this is not the same as setting visibility to "hidden", which doesn't actually destroy the VIEW */
destorys the on-screen VIEW for the HW container; Hide() only affects the VIEW; this is not the same as setting visibility to "hidden", which doesn't actually destroy the VIEW
hide
{ "repo_name": "burris/dwr", "path": "ui/gi/generated/java/jsx3/gui/Heavyweight.java", "license": "apache-2.0", "size": 32192 }
[ "org.directwebremoting.ScriptBuffer", "org.directwebremoting.ScriptSessions" ]
import org.directwebremoting.ScriptBuffer; import org.directwebremoting.ScriptSessions;
import org.directwebremoting.*;
[ "org.directwebremoting" ]
org.directwebremoting;
408,813
public Assertion createAssertion(final String uuid) { Assertion assertion = assertionBuilder.buildObject(Assertion.DEFAULT_ELEMENT_NAME, Assertion.TYPE_NAME); assertion.setID(uuid); assertion.setVersion(SAMLVersion.VERSION_20); assertion.setIssueInstant(new DateTime()); return assertion; }
Assertion function(final String uuid) { Assertion assertion = assertionBuilder.buildObject(Assertion.DEFAULT_ELEMENT_NAME, Assertion.TYPE_NAME); assertion.setID(uuid); assertion.setVersion(SAMLVersion.VERSION_20); assertion.setIssueInstant(new DateTime()); return assertion; }
/** * Creates the assertion. * * @param uuid the uuid * @return the assertion */
Creates the assertion
createAssertion
{ "repo_name": "healthreveal/CONNECT", "path": "Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/callback/openSAML/OpenSAML2ComponentBuilder.java", "license": "bsd-3-clause", "size": 32385 }
[ "org.joda.time.DateTime", "org.opensaml.common.SAMLVersion", "org.opensaml.saml2.core.Assertion" ]
import org.joda.time.DateTime; import org.opensaml.common.SAMLVersion; import org.opensaml.saml2.core.Assertion;
import org.joda.time.*; import org.opensaml.common.*; import org.opensaml.saml2.core.*;
[ "org.joda.time", "org.opensaml.common", "org.opensaml.saml2" ]
org.joda.time; org.opensaml.common; org.opensaml.saml2;
2,488,162
private Row getRow() { Row row; if (pool.isEmpty()) { row = new Row(); createRowForm(row); Canvas listItem = createRowWidget(row); row.setView(listItem); } else { row = pool.remove(0); row.clearErrors(true); row.getForm().clearValues(); } return row; }
Row function() { Row row; if (pool.isEmpty()) { row = new Row(); createRowForm(row); Canvas listItem = createRowWidget(row); row.setView(listItem); } else { row = pool.remove(0); row.clearErrors(true); row.getForm().clearValues(); } return row; }
/** * Gets available item from the pool or creates new one. */
Gets available item from the pool or creates new one
getRow
{ "repo_name": "proarc/proarc", "path": "proarc-webapp/src/main/java/cz/cas/lib/proarc/webapp/client/widget/mods/RepeatableForm.java", "license": "gpl-3.0", "size": 13928 }
[ "com.smartgwt.client.widgets.Canvas" ]
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.*;
[ "com.smartgwt.client" ]
com.smartgwt.client;
161,658
public void setBottomFragment(Fragment bottomFragment) { this.bottomFragment = bottomFragment; }
void function(Fragment bottomFragment) { this.bottomFragment = bottomFragment; }
/** * Configure the Fragment that will work as secondary element inside this custom view. This Fragment has to be * configured before initialize the view. * * @param bottomFragment used as secondary element. */
Configure the Fragment that will work as secondary element inside this custom view. This Fragment has to be configured before initialize the view
setBottomFragment
{ "repo_name": "tjose0101/Draggable-ui", "path": "draggablepanel/src/main/java/com/github/pedrovgs/DraggablePanel.java", "license": "apache-2.0", "size": 10418 }
[ "android.support.v4.app.Fragment" ]
import android.support.v4.app.Fragment;
import android.support.v4.app.*;
[ "android.support" ]
android.support;
2,567,128
public static long getMinutes(final Object object) { // whole number of minutes from the Epoch January 1, 1970, 00:00:00 GMT try { return TimeUnit.MINUTES.convert(Dates.getTime(object), TimeUnit.MILLISECONDS); } catch (final Exception e) { DominoUtils.handleException(e); } return 0; }
static long function(final Object object) { try { return TimeUnit.MINUTES.convert(Dates.getTime(object), TimeUnit.MILLISECONDS); } catch (final Exception e) { DominoUtils.handleException(e); } return 0; }
/** * Gets the number of minutes between the Epoch January 1, 1970, 00:00:00 GMT and the Date value for the passed in object. * * @param object * Object from which a Calendar object can be constructed. * * @return Minutes between the Epoch and the date value of the object. */
Gets the number of minutes between the Epoch January 1, 1970, 00:00:00 GMT and the Date value for the passed in object
getMinutes
{ "repo_name": "mariusj/org.openntf.domino", "path": "domino/core/src/main/java/org/openntf/domino/utils/Dates.java", "license": "apache-2.0", "size": 47491 }
[ "java.util.concurrent.TimeUnit" ]
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,455,723
public void setCurrentProject(Project currentProject) { this.currentProject = currentProject; } /*public void setCurrentRawDataSet( File file ) throws IOException, UserCancelException { RawDataSet dataSet = new FloatDataSet(); DataSetParser parser = new DataSetParser( dataSet ); parser.parseFile( file ); setCurrentRawDataSet( dataSet ); } public void setCurrentRawDataSet( File file, String fieldNames[] ) throws IOException, UserCancelException { RawDataSet dataSet = new FloatDataSet(); DataSetParser parser = new DataSetParser( dataSet ); parser.parseFile( file, fieldNames); setCurrentRawDataSet( dataSet );
void function(Project currentProject) { this.currentProject = currentProject; } /*public void setCurrentRawDataSet( File file ) throws IOException, UserCancelException { RawDataSet dataSet = new FloatDataSet(); DataSetParser parser = new DataSetParser( dataSet ); parser.parseFile( file ); setCurrentRawDataSet( dataSet ); } public void setCurrentRawDataSet( File file, String fieldNames[] ) throws IOException, UserCancelException { RawDataSet dataSet = new FloatDataSet(); DataSetParser parser = new DataSetParser( dataSet ); parser.parseFile( file, fieldNames); setCurrentRawDataSet( dataSet );
/** * Set the current project and enabled actions as necessary * @param currentProject The currentProject to set. */
Set the current project and enabled actions as necessary
setCurrentProject
{ "repo_name": "NCIP/visda", "path": "visda/VISDA-Developer/Month-8-yr1/visdaDev_V0.4/src/edu/vt/cbil/visda/data/DataManager.java", "license": "bsd-3-clause", "size": 14202 }
[ "edu.vt.cbil.visda.util.UserCancelException", "java.io.File", "java.io.IOException" ]
import edu.vt.cbil.visda.util.UserCancelException; import java.io.File; import java.io.IOException;
import edu.vt.cbil.visda.util.*; import java.io.*;
[ "edu.vt.cbil", "java.io" ]
edu.vt.cbil; java.io;
316,171
protected void finishInstance(L2PcInstance player, int delay) { final Instance inst = player.getInstanceWorld(); if (inst != null) { inst.finishInstance(delay); } } /** * This method is supposed to be used for validation of additional conditions that are too much specific to instance world (to avoid useless core conditions).<br> * These conditions are validated after conditions defined in XML template. * @param group group of players which wants to enter (first player inside list is player who make enter request) * @param npc NPC used for enter * @param template template of instance world which should be created * @return {@code true} when conditions are valid, otherwise {@code false}
void function(L2PcInstance player, int delay) { final Instance inst = player.getInstanceWorld(); if (inst != null) { inst.finishInstance(delay); } } /** * This method is supposed to be used for validation of additional conditions that are too much specific to instance world (to avoid useless core conditions).<br> * These conditions are validated after conditions defined in XML template. * @param group group of players which wants to enter (first player inside list is player who make enter request) * @param npc NPC used for enter * @param template template of instance world which should be created * @return {@code true} when conditions are valid, otherwise {@code false}
/** * Sets instance to finish state.<br> * See {@link Instance#finishInstance(int)} for more details. * @param player player used for determine current instance world * @param delay finish delay in minutes */
Sets instance to finish state. See <code>Instance#finishInstance(int)</code> for more details
finishInstance
{ "repo_name": "rubenswagner/L2J-Global", "path": "dist/game/data/scripts/instances/AbstractInstance.java", "license": "gpl-3.0", "size": 8776 }
[ "com.l2jglobal.gameserver.model.actor.instance.L2PcInstance", "com.l2jglobal.gameserver.model.instancezone.Instance" ]
import com.l2jglobal.gameserver.model.actor.instance.L2PcInstance; import com.l2jglobal.gameserver.model.instancezone.Instance;
import com.l2jglobal.gameserver.model.actor.instance.*; import com.l2jglobal.gameserver.model.instancezone.*;
[ "com.l2jglobal.gameserver" ]
com.l2jglobal.gameserver;
2,434,731
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_FLOAT, defaultValue = "" + DEFAULT_WHEEL_DIAMETER) @SimpleProperty public void WheelDiameter(double diameter) { wheelDiameter = diameter; }
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_FLOAT, defaultValue = "" + DEFAULT_WHEEL_DIAMETER) void function(double diameter) { wheelDiameter = diameter; }
/** * Specifies the diameter of the wheels attached on motors. */
Specifies the diameter of the wheels attached on motors
WheelDiameter
{ "repo_name": "ewpatton/appinventor-sources", "path": "appinventor/components/src/com/google/appinventor/components/runtime/Ev3Motors.java", "license": "apache-2.0", "size": 31217 }
[ "com.google.appinventor.components.annotations.DesignerProperty", "com.google.appinventor.components.common.PropertyTypeConstants" ]
import com.google.appinventor.components.annotations.DesignerProperty; import com.google.appinventor.components.common.PropertyTypeConstants;
import com.google.appinventor.components.annotations.*; import com.google.appinventor.components.common.*;
[ "com.google.appinventor" ]
com.google.appinventor;
1,227,573
public NodeProperty getProperty(String propertyName, NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String slideContextPath) throws SlideException, JDOMException { NodeProperty property = revisionDescriptor.getProperty( propertyName ); ResourceKind resourceKind = AbstractResourceKind.determineResourceKind(nsaToken, revisionDescriptors, revisionDescriptor); if (resourceKind.isSupportedLiveProperty(propertyName)) { if (AbstractResourceKind.isComputedProperty(propertyName)) { property = computeProperty(propertyName, revisionDescriptors, revisionDescriptor, slideContextPath); } } return property; }
NodeProperty function(String propertyName, NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String slideContextPath) throws SlideException, JDOMException { NodeProperty property = revisionDescriptor.getProperty( propertyName ); ResourceKind resourceKind = AbstractResourceKind.determineResourceKind(nsaToken, revisionDescriptors, revisionDescriptor); if (resourceKind.isSupportedLiveProperty(propertyName)) { if (AbstractResourceKind.isComputedProperty(propertyName)) { property = computeProperty(propertyName, revisionDescriptors, revisionDescriptor, slideContextPath); } } return property; }
/** * Returns the property of the resource described by * the resourcePath. * * @param propertyName the name of the property. * @param revisionDescriptors the NodeRevisionDescriptors of the resource. * @param revisionDescriptor the NodeRevisionDescriptor of the resource. * @param contextPath a String , the result of HttpRequest.getContextPath() * @param servletPath a String, the result of HttpRequest.getServletPath() * * @return the property. * * @throws SlideException * @throws JDOMException */
Returns the property of the resource described by the resourcePath
getProperty
{ "repo_name": "integrated/jakarta-slide-server", "path": "maven/jakarta-slide-webdavservlet/src/main/java/org/apache/slide/webdav/util/PropertyHelper.java", "license": "apache-2.0", "size": 102956 }
[ "org.apache.slide.common.SlideException", "org.apache.slide.content.NodeProperty", "org.apache.slide.content.NodeRevisionDescriptor", "org.apache.slide.content.NodeRevisionDescriptors", "org.apache.slide.webdav.util.resourcekind.AbstractResourceKind", "org.apache.slide.webdav.util.resourcekind.ResourceKind", "org.jdom.JDOMException" ]
import org.apache.slide.common.SlideException; import org.apache.slide.content.NodeProperty; import org.apache.slide.content.NodeRevisionDescriptor; import org.apache.slide.content.NodeRevisionDescriptors; import org.apache.slide.webdav.util.resourcekind.AbstractResourceKind; import org.apache.slide.webdav.util.resourcekind.ResourceKind; import org.jdom.JDOMException;
import org.apache.slide.common.*; import org.apache.slide.content.*; import org.apache.slide.webdav.util.resourcekind.*; import org.jdom.*;
[ "org.apache.slide", "org.jdom" ]
org.apache.slide; org.jdom;
417,340
public static Predicate<Target> testLangFilter(List<String> langFilterList, EventHandler reporter, Set<String> allRuleNames) { final Set<String> requiredLangs = new HashSet<>(); final Set<String> excludedLangs = new HashSet<>(); for (String lang : langFilterList) { if (lang.startsWith("-")) { lang = lang.substring(1); excludedLangs.add(lang); } else { requiredLangs.add(lang); } if (!allRuleNames.contains(lang + "_test")) { reporter.handle( Event.warn("Unknown language '" + lang + "' in --test_lang_filters option")); } }
static Predicate<Target> function(List<String> langFilterList, EventHandler reporter, Set<String> allRuleNames) { final Set<String> requiredLangs = new HashSet<>(); final Set<String> excludedLangs = new HashSet<>(); for (String lang : langFilterList) { if (lang.startsWith("-")) { lang = lang.substring(1); excludedLangs.add(lang); } else { requiredLangs.add(lang); } if (!allRuleNames.contains(lang + "_test")) { reporter.handle( Event.warn(STR + lang + STR)); } }
/** * Returns a predicate to be used for test language filtering, i.e., that only accepts tests of * the specified languages. The reporter and the list of rule names are only used to warn about * unknown languages. */
Returns a predicate to be used for test language filtering, i.e., that only accepts tests of the specified languages. The reporter and the list of rule names are only used to warn about unknown languages
testLangFilter
{ "repo_name": "mbrukman/bazel", "path": "src/main/java/com/google/devtools/build/lib/packages/TestTargetUtils.java", "license": "apache-2.0", "size": 14415 }
[ "com.google.common.base.Predicate", "com.google.devtools.build.lib.events.Event", "com.google.devtools.build.lib.events.EventHandler", "java.util.HashSet", "java.util.List", "java.util.Set" ]
import com.google.common.base.Predicate; import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.events.EventHandler; import java.util.HashSet; import java.util.List; import java.util.Set;
import com.google.common.base.*; import com.google.devtools.build.lib.events.*; import java.util.*;
[ "com.google.common", "com.google.devtools", "java.util" ]
com.google.common; com.google.devtools; java.util;
2,481,777
public ODTDocumentBuilder forUser(final UserDetail user) { this.user = user; return this; }
ODTDocumentBuilder function(final UserDetail user) { this.user = user; return this; }
/** * Informs this builder the build is for the specified user. If not set, then the builds will be * performed for the publication creator. * Only information the user is authorized to access will be rendered into the ODT documents. * @param user the user for which the build of the documents should be done. * @return itself. */
Informs this builder the build is for the specified user. If not set, then the builds will be performed for the publication creator. Only information the user is authorized to access will be rendered into the ODT documents
forUser
{ "repo_name": "NicolasEYSSERIC/Silverpeas-Components", "path": "kmelia/kmelia-war/src/main/java/com/silverpeas/kmelia/export/ODTDocumentBuilder.java", "license": "agpl-3.0", "size": 25467 }
[ "com.stratelia.webactiv.beans.admin.UserDetail" ]
import com.stratelia.webactiv.beans.admin.UserDetail;
import com.stratelia.webactiv.beans.admin.*;
[ "com.stratelia.webactiv" ]
com.stratelia.webactiv;
1,451,757
void addSegment(@Nonnull ImmutableSegment immutableSegment);
void addSegment(@Nonnull ImmutableSegment immutableSegment);
/** * Adds a loaded immutable segment into the table. */
Adds a loaded immutable segment into the table
addSegment
{ "repo_name": "fx19880617/pinot-1", "path": "pinot-core/src/main/java/com/linkedin/pinot/core/data/manager/TableDataManager.java", "license": "apache-2.0", "size": 4099 }
[ "com.linkedin.pinot.core.indexsegment.immutable.ImmutableSegment", "javax.annotation.Nonnull" ]
import com.linkedin.pinot.core.indexsegment.immutable.ImmutableSegment; import javax.annotation.Nonnull;
import com.linkedin.pinot.core.indexsegment.immutable.*; import javax.annotation.*;
[ "com.linkedin.pinot", "javax.annotation" ]
com.linkedin.pinot; javax.annotation;
1,664,584