method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
list | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
list | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
|---|---|---|---|---|---|---|---|---|---|---|---|
public boolean isTextChecked(String text){
waiter.waitForViews(CheckedTextView.class, CompoundButton.class);
if(viewFetcher.getCurrentViews(CheckedTextView.class).size() > 0 && checker.isCheckedTextChecked(text))
return true;
if(viewFetcher.getCurrentViews(CompoundButton.class).size() > 0 && checker.isButtonChecked(CompoundButton.class, text))
return true;
return false;
}
|
boolean function(String text){ waiter.waitForViews(CheckedTextView.class, CompoundButton.class); if(viewFetcher.getCurrentViews(CheckedTextView.class).size() > 0 && checker.isCheckedTextChecked(text)) return true; if(viewFetcher.getCurrentViews(CompoundButton.class).size() > 0 && checker.isButtonChecked(CompoundButton.class, text)) return true; return false; }
|
/**
* Checks if the given text is checked.
*
* @param text the text that the {@link CheckedTextView} or {@link CompoundButton} objects show
* @return {@code true} if the given text is checked and {@code false} if it is not checked
*/
|
Checks if the given text is checked
|
isTextChecked
|
{
"repo_name": "bghtrbb/robotium",
"path": "robotium-solo/src/main/java/com/jayway/android/robotium/solo/Solo.java",
"license": "apache-2.0",
"size": 58591
}
|
[
"android.widget.CheckedTextView",
"android.widget.CompoundButton"
] |
import android.widget.CheckedTextView; import android.widget.CompoundButton;
|
import android.widget.*;
|
[
"android.widget"
] |
android.widget;
| 557,254
|
public Invitation getInvitation(int senderId, int receiverId) {
Connection connection = null;
try {
connection = getConnection();
return invitationDao.getInvitation(connection, senderId, receiverId);
} catch (Exception ex) {
SilverTrace.error("Silverpeas.Bus.SocialNetwork.Invitation",
"InvitationService.ignoreInvitation", "", ex);
} finally {
DBUtil.close(connection);
}
return null;
}
|
Invitation function(int senderId, int receiverId) { Connection connection = null; try { connection = getConnection(); return invitationDao.getInvitation(connection, senderId, receiverId); } catch (Exception ex) { SilverTrace.error(STR, STR, "", ex); } finally { DBUtil.close(connection); } return null; }
|
/**
* rturn invitation between 2 users
* @param senderId
* @param receiverId
* @return Invitation
*/
|
rturn invitation between 2 users
|
getInvitation
|
{
"repo_name": "stephaneperry/Silverpeas-Core",
"path": "lib-core/src/main/java/com/silverpeas/socialNetwork/invitation/InvitationService.java",
"license": "agpl-3.0",
"size": 8774
}
|
[
"com.stratelia.silverpeas.silvertrace.SilverTrace",
"com.stratelia.webactiv.util.DBUtil",
"java.sql.Connection"
] |
import com.stratelia.silverpeas.silvertrace.SilverTrace; import com.stratelia.webactiv.util.DBUtil; import java.sql.Connection;
|
import com.stratelia.silverpeas.silvertrace.*; import com.stratelia.webactiv.util.*; import java.sql.*;
|
[
"com.stratelia.silverpeas",
"com.stratelia.webactiv",
"java.sql"
] |
com.stratelia.silverpeas; com.stratelia.webactiv; java.sql;
| 727,055
|
static Map<String, String> parseCommandLineArgs(String[] args) {
Map<String, String> result = new HashMap<>();
if (args.length > 0 && !args[0].startsWith("--")) {
result.put("input", args[0]);
}
for (int i = 1; i < args.length; i++) {
String arg = args[i];
if (arg.startsWith("--")) {
arg = arg.replaceAll("--", "");
if (args.length >= i + 1 && !args[i + 1].startsWith("--")) {
result.put(arg, args[i + 1]);
}
}
}
return result;
}
|
static Map<String, String> parseCommandLineArgs(String[] args) { Map<String, String> result = new HashMap<>(); if (args.length > 0 && !args[0].startsWith("--")) { result.put("input", args[0]); } for (int i = 1; i < args.length; i++) { String arg = args[i]; if (arg.startsWith("--")) { arg = arg.replaceAll("--", STR--")) { result.put(arg, args[i + 1]); } } } return result; }
|
/**
* parse command line args
* @param args
* @return Map<String,String> key/value
*/
|
parse command line args
|
parseCommandLineArgs
|
{
"repo_name": "aengus1/ride-sharing",
"path": "src/main/java/ridesharing/algorithm/Main.java",
"license": "gpl-3.0",
"size": 6719
}
|
[
"java.util.HashMap",
"java.util.Map"
] |
import java.util.HashMap; import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 811,878
|
public JpqlTreat createTreat(Path treatedSubpath, String treatingEntityName) {
JpqlTreat treat = new JpqlTreat(JpqlParserTreeConstants.JJTTREAT);
appendChildren(treat, createPath(treatedSubpath), createIdentificationVariable(treatingEntityName));
return treat;
}
|
JpqlTreat function(Path treatedSubpath, String treatingEntityName) { JpqlTreat treat = new JpqlTreat(JpqlParserTreeConstants.JJTTREAT); appendChildren(treat, createPath(treatedSubpath), createIdentificationVariable(treatingEntityName)); return treat; }
|
/**
* Creates a <tt>JpqlTreat</tt> node.
*/
|
Creates a JpqlTreat node
|
createTreat
|
{
"repo_name": "ArneLimburg/jpasecurity",
"path": "src/main/java/org/jpasecurity/jpql/compiler/QueryPreparator.java",
"license": "apache-2.0",
"size": 22348
}
|
[
"org.jpasecurity.Path",
"org.jpasecurity.jpql.parser.JpqlParserTreeConstants",
"org.jpasecurity.jpql.parser.JpqlTreat"
] |
import org.jpasecurity.Path; import org.jpasecurity.jpql.parser.JpqlParserTreeConstants; import org.jpasecurity.jpql.parser.JpqlTreat;
|
import org.jpasecurity.*; import org.jpasecurity.jpql.parser.*;
|
[
"org.jpasecurity",
"org.jpasecurity.jpql"
] |
org.jpasecurity; org.jpasecurity.jpql;
| 1,283,259
|
static QueryCompactor getQueryCompactor(Table table, HiveConf configuration, CompactionInfo compactionInfo)
throws HiveException {
if (!AcidUtils.isInsertOnlyTable(table.getParameters())
&& HiveConf.getBoolVar(configuration, HiveConf.ConfVars.COMPACTOR_CRUD_QUERY_BASED)) {
if (!"tez".equalsIgnoreCase(HiveConf.getVar(configuration, HiveConf.ConfVars.HIVE_EXECUTION_ENGINE))) {
LOG.info("Query-based compaction is only supported on tez. Falling back to MR compaction.");
return null;
}
if (compactionInfo.isMajorCompaction()) {
return new MajorQueryCompactor();
} else {
return new MinorQueryCompactor();
}
}
if (AcidUtils.isInsertOnlyTable(table.getParameters())) {
if (!configuration.getBoolVar(HiveConf.ConfVars.HIVE_COMPACTOR_COMPACT_MM)) {
throw new HiveException(
"Insert only compaction is disabled. Set hive.compactor.compact.insert.only to true to enable it.");
}
if (compactionInfo.isMajorCompaction()) {
return new MmMajorQueryCompactor();
} else {
return new MmMinorQueryCompactor();
}
}
return null;
}
|
static QueryCompactor getQueryCompactor(Table table, HiveConf configuration, CompactionInfo compactionInfo) throws HiveException { if (!AcidUtils.isInsertOnlyTable(table.getParameters()) && HiveConf.getBoolVar(configuration, HiveConf.ConfVars.COMPACTOR_CRUD_QUERY_BASED)) { if (!"tez".equalsIgnoreCase(HiveConf.getVar(configuration, HiveConf.ConfVars.HIVE_EXECUTION_ENGINE))) { LOG.info(STR); return null; } if (compactionInfo.isMajorCompaction()) { return new MajorQueryCompactor(); } else { return new MinorQueryCompactor(); } } if (AcidUtils.isInsertOnlyTable(table.getParameters())) { if (!configuration.getBoolVar(HiveConf.ConfVars.HIVE_COMPACTOR_COMPACT_MM)) { throw new HiveException( STR); } if (compactionInfo.isMajorCompaction()) { return new MmMajorQueryCompactor(); } else { return new MmMinorQueryCompactor(); } } return null; }
|
/**
* Get an instance of {@link QueryCompactor}. At the moment the following implementors can be fetched:
* <p>
* {@link MajorQueryCompactor} - handles query based major compaction
* <br>
* {@link MinorQueryCompactor} - handles query based minor compaction
* <br>
* {@link MmMajorQueryCompactor} - handles query based major compaction for micro-managed tables
* <br>
* {@link MmMinorQueryCompactor} - handles query based minor compaction for micro-managed tables
* <br>
* </p>
* @param table the table, on which the compaction should be running, must be not null.
* @param configuration the hive configuration, must be not null.
* @param compactionInfo provides insight about the type of compaction, must be not null.
* @return {@link QueryCompactor} or null.
*/
|
Get an instance of <code>QueryCompactor</code>. At the moment the following implementors can be fetched: <code>MajorQueryCompactor</code> - handles query based major compaction <code>MinorQueryCompactor</code> - handles query based minor compaction <code>MmMajorQueryCompactor</code> - handles query based major compaction for micro-managed tables <code>MmMinorQueryCompactor</code> - handles query based minor compaction for micro-managed tables
|
getQueryCompactor
|
{
"repo_name": "sankarh/hive",
"path": "ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/QueryCompactorFactory.java",
"license": "apache-2.0",
"size": 3499
}
|
[
"org.apache.hadoop.hive.conf.HiveConf",
"org.apache.hadoop.hive.metastore.api.Table",
"org.apache.hadoop.hive.metastore.txn.CompactionInfo",
"org.apache.hadoop.hive.ql.io.AcidUtils",
"org.apache.hadoop.hive.ql.metadata.HiveException"
] |
import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.metastore.api.Table; import org.apache.hadoop.hive.metastore.txn.CompactionInfo; import org.apache.hadoop.hive.ql.io.AcidUtils; import org.apache.hadoop.hive.ql.metadata.HiveException;
|
import org.apache.hadoop.hive.conf.*; import org.apache.hadoop.hive.metastore.api.*; import org.apache.hadoop.hive.metastore.txn.*; import org.apache.hadoop.hive.ql.io.*; import org.apache.hadoop.hive.ql.metadata.*;
|
[
"org.apache.hadoop"
] |
org.apache.hadoop;
| 2,488,728
|
public Closure<? super T> getClosure() {
return iClosure;
}
|
Closure<? super T> function() { return iClosure; }
|
/**
* Gets the closure.
*
* @return the closure
* @since 3.1
*/
|
Gets the closure
|
getClosure
|
{
"repo_name": "krivachy/compgs03_mutation_testing",
"path": "src/main/java/org/apache/commons/collections4/functors/ClosureTransformer.java",
"license": "apache-2.0",
"size": 2766
}
|
[
"org.apache.commons.collections4.Closure"
] |
import org.apache.commons.collections4.Closure;
|
import org.apache.commons.collections4.*;
|
[
"org.apache.commons"
] |
org.apache.commons;
| 2,530,222
|
Set<String> getConfigsForCluster(
@NotBlank(message = "No cluster id sent. Cannot retrieve configurations.")
final String id
) throws GenieException;
|
Set<String> getConfigsForCluster( @NotBlank(message = STR) final String id ) throws GenieException;
|
/**
* Get the set of configuration files associated with the cluster with given
* id.
*
* @param id The id of the cluster to get the configuration files for. Not
* null/empty/blank.
* @return The set of configuration files as paths
* @throws GenieException if there is an error
*/
|
Get the set of configuration files associated with the cluster with given id
|
getConfigsForCluster
|
{
"repo_name": "sensaid/genie",
"path": "genie-core/src/main/java/com/netflix/genie/core/services/ClusterConfigService.java",
"license": "apache-2.0",
"size": 12688
}
|
[
"com.netflix.genie.common.exceptions.GenieException",
"java.util.Set",
"org.hibernate.validator.constraints.NotBlank"
] |
import com.netflix.genie.common.exceptions.GenieException; import java.util.Set; import org.hibernate.validator.constraints.NotBlank;
|
import com.netflix.genie.common.exceptions.*; import java.util.*; import org.hibernate.validator.constraints.*;
|
[
"com.netflix.genie",
"java.util",
"org.hibernate.validator"
] |
com.netflix.genie; java.util; org.hibernate.validator;
| 850,271
|
boolean next() throws IOException;
|
boolean next() throws IOException;
|
/**
* Proceed to next record, returns false if there is no more records.
*
* @throws IOException if failure happens during disk/network IO like reading files.
*/
|
Proceed to next record, returns false if there is no more records
|
next
|
{
"repo_name": "jkbradley/spark",
"path": "sql/catalyst/src/main/java/org/apache/spark/sql/connector/read/PartitionReader.java",
"license": "apache-2.0",
"size": 1894
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 2,401,318
|
private boolean verifyAccessTokenRequest(final HttpServletRequest request, final HttpServletResponse response) {
// must have the right grant type
final String grantType = request.getParameter(OAuthConstants.GRANT_TYPE);
if (!checkGrantTypes(grantType, OAuth20GrantTypes.AUTHORIZATION_CODE, OAuth20GrantTypes.PASSWORD, OAuth20GrantTypes.REFRESH_TOKEN)) {
return false;
}
// must be authenticated (client or user)
final J2EContext context = new J2EContext(request, response);
final ProfileManager manager = new ProfileManager(context);
final Optional<UserProfile> profile = manager.get(true);
if (profile == null || !profile.isPresent()) {
return false;
}
final UserProfile uProfile = profile.get();
// authorization code grant type
if (isGrantType(grantType, OAuth20GrantTypes.AUTHORIZATION_CODE)) {
final String clientId = uProfile.getId();
final String redirectUri = request.getParameter(OAuthConstants.REDIRECT_URI);
final OAuthRegisteredService registeredService = OAuthUtils.getRegisteredOAuthService(getServicesManager(), clientId);
return uProfile instanceof OAuthClientProfile
&& getValidator().checkParameterExist(request, OAuthConstants.REDIRECT_URI)
&& getValidator().checkParameterExist(request, OAuthConstants.CODE)
&& getValidator().checkCallbackValid(registeredService, redirectUri);
} else if (isGrantType(grantType, OAuth20GrantTypes.REFRESH_TOKEN)) {
// refresh token grant type
return uProfile instanceof OAuthClientProfile
&& getValidator().checkParameterExist(request, OAuthConstants.REFRESH_TOKEN);
} else {
final String clientId = request.getParameter(OAuthConstants.CLIENT_ID);
final OAuthRegisteredService registeredService = OAuthUtils.getRegisteredOAuthService(getServicesManager(), clientId);
// resource owner password grant type
return uProfile instanceof OAuthUserProfile
&& getValidator().checkParameterExist(request, OAuthConstants.CLIENT_ID)
&& getValidator().checkServiceValid(registeredService);
}
}
|
boolean function(final HttpServletRequest request, final HttpServletResponse response) { final String grantType = request.getParameter(OAuthConstants.GRANT_TYPE); if (!checkGrantTypes(grantType, OAuth20GrantTypes.AUTHORIZATION_CODE, OAuth20GrantTypes.PASSWORD, OAuth20GrantTypes.REFRESH_TOKEN)) { return false; } final J2EContext context = new J2EContext(request, response); final ProfileManager manager = new ProfileManager(context); final Optional<UserProfile> profile = manager.get(true); if (profile == null !profile.isPresent()) { return false; } final UserProfile uProfile = profile.get(); if (isGrantType(grantType, OAuth20GrantTypes.AUTHORIZATION_CODE)) { final String clientId = uProfile.getId(); final String redirectUri = request.getParameter(OAuthConstants.REDIRECT_URI); final OAuthRegisteredService registeredService = OAuthUtils.getRegisteredOAuthService(getServicesManager(), clientId); return uProfile instanceof OAuthClientProfile && getValidator().checkParameterExist(request, OAuthConstants.REDIRECT_URI) && getValidator().checkParameterExist(request, OAuthConstants.CODE) && getValidator().checkCallbackValid(registeredService, redirectUri); } else if (isGrantType(grantType, OAuth20GrantTypes.REFRESH_TOKEN)) { return uProfile instanceof OAuthClientProfile && getValidator().checkParameterExist(request, OAuthConstants.REFRESH_TOKEN); } else { final String clientId = request.getParameter(OAuthConstants.CLIENT_ID); final OAuthRegisteredService registeredService = OAuthUtils.getRegisteredOAuthService(getServicesManager(), clientId); return uProfile instanceof OAuthUserProfile && getValidator().checkParameterExist(request, OAuthConstants.CLIENT_ID) && getValidator().checkServiceValid(registeredService); } }
|
/**
* Verify the access token request.
*
* @param request the HTTP request
* @param response the HTTP response
* @return true, if successful
*/
|
Verify the access token request
|
verifyAccessTokenRequest
|
{
"repo_name": "gabedwrds/cas",
"path": "support/cas-server-support-oauth/src/main/java/org/apereo/cas/support/oauth/web/endpoints/OAuth20AccessTokenEndpointController.java",
"license": "apache-2.0",
"size": 13850
}
|
[
"java.util.Optional",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.apereo.cas.support.oauth.OAuth20GrantTypes",
"org.apereo.cas.support.oauth.OAuthConstants",
"org.apereo.cas.support.oauth.profile.OAuthClientProfile",
"org.apereo.cas.support.oauth.profile.OAuthUserProfile",
"org.apereo.cas.support.oauth.services.OAuthRegisteredService",
"org.apereo.cas.support.oauth.util.OAuthUtils",
"org.pac4j.core.context.J2EContext",
"org.pac4j.core.profile.ProfileManager",
"org.pac4j.core.profile.UserProfile"
] |
import java.util.Optional; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apereo.cas.support.oauth.OAuth20GrantTypes; import org.apereo.cas.support.oauth.OAuthConstants; import org.apereo.cas.support.oauth.profile.OAuthClientProfile; import org.apereo.cas.support.oauth.profile.OAuthUserProfile; import org.apereo.cas.support.oauth.services.OAuthRegisteredService; import org.apereo.cas.support.oauth.util.OAuthUtils; import org.pac4j.core.context.J2EContext; import org.pac4j.core.profile.ProfileManager; import org.pac4j.core.profile.UserProfile;
|
import java.util.*; import javax.servlet.http.*; import org.apereo.cas.support.oauth.*; import org.apereo.cas.support.oauth.profile.*; import org.apereo.cas.support.oauth.services.*; import org.apereo.cas.support.oauth.util.*; import org.pac4j.core.context.*; import org.pac4j.core.profile.*;
|
[
"java.util",
"javax.servlet",
"org.apereo.cas",
"org.pac4j.core"
] |
java.util; javax.servlet; org.apereo.cas; org.pac4j.core;
| 60,438
|
public void setRequiredModules(List<String> requiredModules) {
if (requiredModulesMap == null) {
requiredModulesMap = new HashMap<String, String>();
}
for (String module : requiredModules) {
requiredModulesMap.put(module, null);
}
}
|
void function(List<String> requiredModules) { if (requiredModulesMap == null) { requiredModulesMap = new HashMap<String, String>(); } for (String module : requiredModules) { requiredModulesMap.put(module, null); } }
|
/**
* This is a convenience method to set all the required modules without any version requirements
*
* @param requiredModules the requiredModules to set for this module
* @should set modules when there is a null required modules map
*/
|
This is a convenience method to set all the required modules without any version requirements
|
setRequiredModules
|
{
"repo_name": "Winbobob/openmrs-core",
"path": "api/src/main/java/org/openmrs/module/Module.java",
"license": "mpl-2.0",
"size": 21311
}
|
[
"java.util.HashMap",
"java.util.List"
] |
import java.util.HashMap; import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 687,304
|
Timestamp getTimestamp(String columnLabel, Calendar cal) throws InvalidResultSetAccessException;
|
Timestamp getTimestamp(String columnLabel, Calendar cal) throws InvalidResultSetAccessException;
|
/**
* Retrieves the value of the indicated column in the current row as
* a Timestamp object.
* @param columnLabel the column label
* @param cal the Calendar to use in constructing the Date
* @return a Timestamp object representing the column value
* @see java.sql.ResultSet#getTimestamp(java.lang.String, java.util.Calendar)
*/
|
Retrieves the value of the indicated column in the current row as a Timestamp object
|
getTimestamp
|
{
"repo_name": "ftomassetti/effectivejava",
"path": "test-resources/sample-codebases/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSet.java",
"license": "apache-2.0",
"size": 17476
}
|
[
"java.sql.Timestamp",
"java.util.Calendar",
"org.springframework.jdbc.InvalidResultSetAccessException"
] |
import java.sql.Timestamp; import java.util.Calendar; import org.springframework.jdbc.InvalidResultSetAccessException;
|
import java.sql.*; import java.util.*; import org.springframework.jdbc.*;
|
[
"java.sql",
"java.util",
"org.springframework.jdbc"
] |
java.sql; java.util; org.springframework.jdbc;
| 445,410
|
@SimpleEvent(description = "The user long-pressed on a map feature.")
public void FeatureLongClick(MapFactory.MapFeature feature) {
EventDispatcher.dispatchEvent(this, "FeatureLongClick", feature);
if (getMap() != this) {
getMap().FeatureLongClick(feature);
}
}
|
@SimpleEvent(description = STR) void function(MapFactory.MapFeature feature) { EventDispatcher.dispatchEvent(this, STR, feature); if (getMap() != this) { getMap().FeatureLongClick(feature); } }
|
/**
* When a feature is long-clicked, the parent `%type%` will also receive a `FeatureLongClick`
* event. The `feature` parameter indicates which child feature was long-clicked. This event is
* run *after* the `LongClick` event on the corresponding feature and after the
* `when any ... LongClick` event if one is provided.
*
* @param feature the long-clicked feature
*/
|
When a feature is long-clicked, the parent `%type%` will also receive a `FeatureLongClick` event. The `feature` parameter indicates which child feature was long-clicked. This event is run *after* the `LongClick` event on the corresponding feature and after the `when any ... LongClick` event if one is provided
|
FeatureLongClick
|
{
"repo_name": "kkashi01/appinventor-sources",
"path": "appinventor/components/src/com/google/appinventor/components/runtime/MapFeatureContainerBase.java",
"license": "apache-2.0",
"size": 19871
}
|
[
"com.google.appinventor.components.annotations.SimpleEvent",
"com.google.appinventor.components.runtime.util.MapFactory"
] |
import com.google.appinventor.components.annotations.SimpleEvent; import com.google.appinventor.components.runtime.util.MapFactory;
|
import com.google.appinventor.components.annotations.*; import com.google.appinventor.components.runtime.util.*;
|
[
"com.google.appinventor"
] |
com.google.appinventor;
| 1,639,306
|
@POST
@Path("/getDomains")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response getDomains(@Context final HttpServletRequest hsr,
@FormParam(PARAM_CONNECTIONCONTEXT) final String contextBytes) throws RemoteException {
nameTheThread(hsr, "/getDomains", "anonymous");
try {
final ConnectionContext connectionContext = Converter.deserialiseFromString(
contextBytes,
ConnectionContext.class,
isCompressionEnabled());
return createResponse(getCallserver().getDomains(
ConnectionContextBackend.getInstance().addOriginToConnectionContext(hsr, connectionContext)));
} catch (final Exception ex) {
final String message = "could not get domains"; // NOI18N
throw createRemoteException(ex, message);
}
}
|
@Path(STR) @Produces(MediaType.APPLICATION_OCTET_STREAM) Response function(@Context final HttpServletRequest hsr, @FormParam(PARAM_CONNECTIONCONTEXT) final String contextBytes) throws RemoteException { nameTheThread(hsr, STR, STR); try { final ConnectionContext connectionContext = Converter.deserialiseFromString( contextBytes, ConnectionContext.class, isCompressionEnabled()); return createResponse(getCallserver().getDomains( ConnectionContextBackend.getInstance().addOriginToConnectionContext(hsr, connectionContext))); } catch (final Exception ex) { final String message = STR; throw createRemoteException(ex, message); } }
|
/**
* DOCUMENT ME!
*
* @param hsr DOCUMENT ME!
* @param contextBytes DOCUMENT ME!
*
* @return DOCUMENT ME!
*
* @throws RemoteException WebApplicationException RemoteException DOCUMENT ME!
*/
|
DOCUMENT ME
|
getDomains
|
{
"repo_name": "cismet/cids-server",
"path": "src/main/java/de/cismet/cids/server/ws/rest/RESTfulSerialInterface.java",
"license": "lgpl-3.0",
"size": 98607
}
|
[
"de.cismet.cids.server.connectioncontext.ConnectionContextBackend",
"de.cismet.connectioncontext.ConnectionContext",
"de.cismet.tools.Converter",
"java.rmi.RemoteException",
"javax.servlet.http.HttpServletRequest",
"javax.ws.rs.FormParam",
"javax.ws.rs.Path",
"javax.ws.rs.Produces",
"javax.ws.rs.core.Context",
"javax.ws.rs.core.MediaType",
"javax.ws.rs.core.Response"
] |
import de.cismet.cids.server.connectioncontext.ConnectionContextBackend; import de.cismet.connectioncontext.ConnectionContext; import de.cismet.tools.Converter; import java.rmi.RemoteException; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.FormParam; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response;
|
import de.cismet.cids.server.connectioncontext.*; import de.cismet.connectioncontext.*; import de.cismet.tools.*; import java.rmi.*; import javax.servlet.http.*; import javax.ws.rs.*; import javax.ws.rs.core.*;
|
[
"de.cismet.cids",
"de.cismet.connectioncontext",
"de.cismet.tools",
"java.rmi",
"javax.servlet",
"javax.ws"
] |
de.cismet.cids; de.cismet.connectioncontext; de.cismet.tools; java.rmi; javax.servlet; javax.ws;
| 2,296,779
|
Pair<List<Edge>, List<Edge>> findPathInNetwork(AvailableNetwork network,
SwitchId startSwitchId, SwitchId endSwitchId,
WeightFunction weightFunction)
throws UnroutableFlowException;
|
Pair<List<Edge>, List<Edge>> findPathInNetwork(AvailableNetwork network, SwitchId startSwitchId, SwitchId endSwitchId, WeightFunction weightFunction) throws UnroutableFlowException;
|
/**
* Find a path from the start to the end switch.
*
* @return a pair of ordered lists that represents the path from start to end, or an empty list if no path found.
*/
|
Find a path from the start to the end switch
|
findPathInNetwork
|
{
"repo_name": "jonvestal/open-kilda",
"path": "src-java/kilda-pce/src/main/java/org/openkilda/pce/finder/PathFinder.java",
"license": "apache-2.0",
"size": 2468
}
|
[
"java.util.List",
"org.apache.commons.lang3.tuple.Pair",
"org.openkilda.model.SwitchId",
"org.openkilda.pce.exception.UnroutableFlowException",
"org.openkilda.pce.impl.AvailableNetwork",
"org.openkilda.pce.model.Edge",
"org.openkilda.pce.model.WeightFunction"
] |
import java.util.List; import org.apache.commons.lang3.tuple.Pair; import org.openkilda.model.SwitchId; import org.openkilda.pce.exception.UnroutableFlowException; import org.openkilda.pce.impl.AvailableNetwork; import org.openkilda.pce.model.Edge; import org.openkilda.pce.model.WeightFunction;
|
import java.util.*; import org.apache.commons.lang3.tuple.*; import org.openkilda.model.*; import org.openkilda.pce.exception.*; import org.openkilda.pce.impl.*; import org.openkilda.pce.model.*;
|
[
"java.util",
"org.apache.commons",
"org.openkilda.model",
"org.openkilda.pce"
] |
java.util; org.apache.commons; org.openkilda.model; org.openkilda.pce;
| 615,610
|
@BeanTagAttribute
public List<String> getErrors() {
return this.errors;
}
|
List<String> function() { return this.errors; }
|
/**
* The list of error messages found for the keys that were matched on this
* ValidationMessages This is generated and cannot be set
*
* @return the errors
*/
|
The list of error messages found for the keys that were matched on this ValidationMessages This is generated and cannot be set
|
getErrors
|
{
"repo_name": "ricepanda/rice-git3",
"path": "rice-framework/krad-web-framework/src/main/java/org/kuali/rice/krad/uif/element/ValidationMessages.java",
"license": "apache-2.0",
"size": 16455
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 237,979
|
@Test
public void testSimpleMethodWrongArg(){
Method method = getMethod("method1");
assertNotNull("Method for test wasn't retrieved", method);
assertNull(MethodUtils.validateInvocationAndConvertParams(method, 22));
}
|
void function(){ Method method = getMethod(STR); assertNotNull(STR, method); assertNull(MethodUtils.validateInvocationAndConvertParams(method, 22)); }
|
/**
* Test a simple method with a single argument, but
* supply arguments that should cause it to fail.
*/
|
Test a simple method with a single argument, but supply arguments that should cause it to fail
|
testSimpleMethodWrongArg
|
{
"repo_name": "craigmiller160/CM160-Utils",
"path": "src/test/java/io/craigmiller160/utils/reflect/MethodUtilsTest.java",
"license": "apache-2.0",
"size": 9724
}
|
[
"java.lang.reflect.Method",
"org.junit.Assert"
] |
import java.lang.reflect.Method; import org.junit.Assert;
|
import java.lang.reflect.*; import org.junit.*;
|
[
"java.lang",
"org.junit"
] |
java.lang; org.junit;
| 322,984
|
public static Class<?> noNonFinalStatic(@Nonnull final Class<?> clazz) {
final Field[] fields = clazz.getDeclaredFields();
for (final Field f : fields) {
if (!f.isSynthetic() && isStaticAndNotFinal(f)) {
throw new IllegalNonFinalStaticException(clazz.getName(), f.getName());
}
}
return clazz;
}
|
static Class<?> function(@Nonnull final Class<?> clazz) { final Field[] fields = clazz.getDeclaredFields(); for (final Field f : fields) { if (!f.isSynthetic() && isStaticAndNotFinal(f)) { throw new IllegalNonFinalStaticException(clazz.getName(), f.getName()); } } return clazz; }
|
/**
* Check if a class contains a non-final static variable. Non-final static fields are dangerous in multi-threaded
* environments and should therefore not be used.
*
* This method only checks the passed class and not any super-classes.
*
* @param clazz
* A class which is checked for non-final statics.
* @return clazz The class that was passed to this method.
*
* @throws IllegalNonFinalStaticException
* If the passed class contains and non-final static field.
*/
|
Check if a class contains a non-final static variable. Non-final static fields are dangerous in multi-threaded environments and should therefore not be used. This method only checks the passed class and not any super-classes
|
noNonFinalStatic
|
{
"repo_name": "before/quality-check",
"path": "modules/quality-test/src/main/java/net/sf/qualitytest/StaticCheck.java",
"license": "apache-2.0",
"size": 6703
}
|
[
"java.lang.reflect.Field",
"javax.annotation.Nonnull",
"net.sf.qualitytest.exception.IllegalNonFinalStaticException"
] |
import java.lang.reflect.Field; import javax.annotation.Nonnull; import net.sf.qualitytest.exception.IllegalNonFinalStaticException;
|
import java.lang.reflect.*; import javax.annotation.*; import net.sf.qualitytest.exception.*;
|
[
"java.lang",
"javax.annotation",
"net.sf.qualitytest"
] |
java.lang; javax.annotation; net.sf.qualitytest;
| 604,467
|
public void documentLoadingStarted(SVGDocumentLoaderEvent e) {
String msg = resources.getString("Message.documentLoad");
if (debug) {
System.out.println(msg);
time = System.currentTimeMillis();
}
statusBar.setMainMessage(msg);
stopAction.update(true);
svgCanvas.setCursor(WAIT_CURSOR);
}
|
void function(SVGDocumentLoaderEvent e) { String msg = resources.getString(STR); if (debug) { System.out.println(msg); time = System.currentTimeMillis(); } statusBar.setMainMessage(msg); stopAction.update(true); svgCanvas.setCursor(WAIT_CURSOR); }
|
/**
* Called when the loading of a document was started.
*/
|
Called when the loading of a document was started
|
documentLoadingStarted
|
{
"repo_name": "srnsw/xena",
"path": "plugins/image/ext/src/batik-1.7/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java",
"license": "gpl-3.0",
"size": 110665
}
|
[
"org.apache.batik.swing.svg.SVGDocumentLoaderEvent"
] |
import org.apache.batik.swing.svg.SVGDocumentLoaderEvent;
|
import org.apache.batik.swing.svg.*;
|
[
"org.apache.batik"
] |
org.apache.batik;
| 430,693
|
public static void onStartFailed(EventData eventData) {
Player player = eventData.getOwner();
if(eventData.getClz() != null) {
EventDescription eventDescription = EventFunctions.getDescriptionForEvent(eventData.getClz());
if (eventDescription != null) {
if(EventFunctions.getAllPlayers(eventData).size() > eventDescription.playerValueMax() && eventDescription.playerValueMax() != -1
|| EventFunctions.getAllPlayers(eventData).size() < eventDescription.playerValueMin() && eventDescription.playerValueMin() != -1) {
if(eventData.getPlayerList().isEmpty() && eventDescription.playerValueMin() > 1) {
MsgboxDialog.create(player, EventSystem.getInstance().getEventManagerInstance())
.caption("{FF8A05}" + localizedStringSet.get(player, "Event.Member.Memberlist"))
.message("{FF0000}" + localizedStringSet.get(player, "Event.Member.NoMembers"))
.buttonCancel(localizedStringSet.get(player, "Dialog.Cancel"))
.buttonOk(localizedStringSet.get(player, "Dialog.Okay"))
.onClickOk((handler) -> dialog(player))
.onClickCancel((handler) -> dialog(player))
.build()
.show();
}
else if(eventDescription.playerValueMin() > eventData.getPlayerList().size()+1 && eventDescription.playerValueMin() != -1) {
MsgboxDialog.create(player, EventSystem.getInstance().getEventManagerInstance())
.caption("{FF8A05}" + localizedStringSet.get(player, "Event.Member.Memberlist"))
.message("{FF0000}" + localizedStringSet.get(player, "Event.Member.NotEnoughMembers"))
.buttonCancel(localizedStringSet.get(player, "Dialog.Cancel"))
.buttonOk(localizedStringSet.get(player, "Dialog.Okay"))
.onClickOk((handler) -> dialog(player))
.onClickCancel((handler) -> dialog(player))
.build()
.show();
}
else if(eventDescription.playerValueMax() < eventData.getPlayerList().size()+1 && eventDescription.playerValueMax() != -1) {
MsgboxDialog.create(player, EventSystem.getInstance().getEventManagerInstance())
.caption("{FF8A05}" + localizedStringSet.get(player, "Event.Member.Memberlist"))
.message("{FF0000}" + localizedStringSet.get(player, "Event.Member.TooManyMembers"))
.buttonCancel(localizedStringSet.get(player, "Dialog.Cancel"))
.buttonOk(localizedStringSet.get(player, "Dialog.Okay"))
.onClickOk((handler) -> dialog(player))
.onClickCancel((handler) -> dialog(player))
.build()
.show();
}
}
else if(eventData.getLocation() == null) {
player.sendMessage(Color.YELLOW, localizedStringSet.get(player, "Event.Start.Failed.NoSpawn"));
}
else {
try {
if(eventData.getMap() == null && ((Event) eventData.getClz().newInstance()).dependsOnMaps()) {
player.sendMessage(Color.YELLOW, localizedStringSet.get(player, "Event.Start.Failed.NoMap"));
}
else {
((Event) eventData.getClz().newInstance()).onStartFailed(eventData);
}
} catch (InstantiationException | IllegalAccessException e) {
System.out.println(e);
e.printStackTrace();
}
}
}
}
}
|
static void function(EventData eventData) { Player player = eventData.getOwner(); if(eventData.getClz() != null) { EventDescription eventDescription = EventFunctions.getDescriptionForEvent(eventData.getClz()); if (eventDescription != null) { if(EventFunctions.getAllPlayers(eventData).size() > eventDescription.playerValueMax() && eventDescription.playerValueMax() != -1 EventFunctions.getAllPlayers(eventData).size() < eventDescription.playerValueMin() && eventDescription.playerValueMin() != -1) { if(eventData.getPlayerList().isEmpty() && eventDescription.playerValueMin() > 1) { MsgboxDialog.create(player, EventSystem.getInstance().getEventManagerInstance()) .caption(STR + localizedStringSet.get(player, STR)) .message(STR + localizedStringSet.get(player, STR)) .buttonCancel(localizedStringSet.get(player, STR)) .buttonOk(localizedStringSet.get(player, STR)) .onClickOk((handler) -> dialog(player)) .onClickCancel((handler) -> dialog(player)) .build() .show(); } else if(eventDescription.playerValueMin() > eventData.getPlayerList().size()+1 && eventDescription.playerValueMin() != -1) { MsgboxDialog.create(player, EventSystem.getInstance().getEventManagerInstance()) .caption(STR + localizedStringSet.get(player, STR)) .message(STR + localizedStringSet.get(player, STR)) .buttonCancel(localizedStringSet.get(player, STR)) .buttonOk(localizedStringSet.get(player, STR)) .onClickOk((handler) -> dialog(player)) .onClickCancel((handler) -> dialog(player)) .build() .show(); } else if(eventDescription.playerValueMax() < eventData.getPlayerList().size()+1 && eventDescription.playerValueMax() != -1) { MsgboxDialog.create(player, EventSystem.getInstance().getEventManagerInstance()) .caption(STR + localizedStringSet.get(player, STR)) .message(STR + localizedStringSet.get(player, STR)) .buttonCancel(localizedStringSet.get(player, STR)) .buttonOk(localizedStringSet.get(player, STR)) .onClickOk((handler) -> dialog(player)) .onClickCancel((handler) -> dialog(player)) .build() .show(); } } else if(eventData.getLocation() == null) { player.sendMessage(Color.YELLOW, localizedStringSet.get(player, STR)); } else { try { if(eventData.getMap() == null && ((Event) eventData.getClz().newInstance()).dependsOnMaps()) { player.sendMessage(Color.YELLOW, localizedStringSet.get(player, STR)); } else { ((Event) eventData.getClz().newInstance()).onStartFailed(eventData); } } catch (InstantiationException IllegalAccessException e) { System.out.println(e); e.printStackTrace(); } } } } }
|
/**
* do something if event is not able to start / the start fails
* @param eventData the event
*/
|
do something if event is not able to start / the start fails
|
onStartFailed
|
{
"repo_name": "Alf21/event-system",
"path": "src/main/java/me/alf21/eventsystem/EventBase.java",
"license": "gpl-3.0",
"size": 88807
}
|
[
"net.gtaun.shoebill.common.dialog.MsgboxDialog",
"net.gtaun.shoebill.data.Color",
"net.gtaun.shoebill.object.Player"
] |
import net.gtaun.shoebill.common.dialog.MsgboxDialog; import net.gtaun.shoebill.data.Color; import net.gtaun.shoebill.object.Player;
|
import net.gtaun.shoebill.common.dialog.*; import net.gtaun.shoebill.data.*; import net.gtaun.shoebill.object.*;
|
[
"net.gtaun.shoebill"
] |
net.gtaun.shoebill;
| 791,682
|
public EReference getAltTieMeas_AnalogValue() {
return (EReference)getAltTieMeas().getEStructuralFeatures().get(0);
}
|
EReference function() { return (EReference)getAltTieMeas().getEStructuralFeatures().get(0); }
|
/**
* Returns the meta object for the reference '{@link CIM15.IEC61970.ControlArea.AltTieMeas#getAnalogValue <em>Analog Value</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>Analog Value</em>'.
* @see CIM15.IEC61970.ControlArea.AltTieMeas#getAnalogValue()
* @see #getAltTieMeas()
* @generated
*/
|
Returns the meta object for the reference '<code>CIM15.IEC61970.ControlArea.AltTieMeas#getAnalogValue Analog Value</code>'.
|
getAltTieMeas_AnalogValue
|
{
"repo_name": "SES-fortiss/SmartGridCoSimulation",
"path": "core/cim15/src/CIM15/IEC61970/ControlArea/ControlAreaPackage.java",
"license": "apache-2.0",
"size": 60222
}
|
[
"org.eclipse.emf.ecore.EReference"
] |
import org.eclipse.emf.ecore.EReference;
|
import org.eclipse.emf.ecore.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 1,764,896
|
public static ExpectedCondition<Boolean> attributeToBeNotEmpty(final WebElement element,
final String attribute) {
return driver -> getAttributeOrCssValue(element, attribute).isPresent();
}
|
static ExpectedCondition<Boolean> function(final WebElement element, final String attribute) { return driver -> getAttributeOrCssValue(element, attribute).isPresent(); }
|
/**
* An expectation for checking WebElement any non empty value for given attribute
*
* @param element used to check it's parameters
* @param attribute used to define css or html attribute
* @return Boolean true when element has css or html attribute with non empty value
*/
|
An expectation for checking WebElement any non empty value for given attribute
|
attributeToBeNotEmpty
|
{
"repo_name": "dibagga/selenium",
"path": "java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java",
"license": "apache-2.0",
"size": 50698
}
|
[
"org.openqa.selenium.WebElement"
] |
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.*;
|
[
"org.openqa.selenium"
] |
org.openqa.selenium;
| 535,259
|
public void testConstructor2() {
try {
new PriorityQueue(0);
shouldThrow();
} catch (IllegalArgumentException success) {}
}
|
void function() { try { new PriorityQueue(0); shouldThrow(); } catch (IllegalArgumentException success) {} }
|
/**
* Constructor throws IAE if capacity argument nonpositive
*/
|
Constructor throws IAE if capacity argument nonpositive
|
testConstructor2
|
{
"repo_name": "debian-pkg-android-tools/android-platform-libcore",
"path": "jsr166-tests/src/test/java/jsr166/PriorityQueueTest.java",
"license": "gpl-2.0",
"size": 14297
}
|
[
"java.util.PriorityQueue"
] |
import java.util.PriorityQueue;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 504,105
|
private void sortResultList(final List<Map<String, AttributeValue>> retItems,
final String sortFieldName, final Boolean scanIndexForward) {
|
void function(final List<Map<String, AttributeValue>> retItems, final String sortFieldName, final Boolean scanIndexForward) {
|
/**
* Sort the given list by the given field.
* @param retItems
* @param sortFieldName
* @param scanIndexForward
*/
|
Sort the given list by the given field
|
sortResultList
|
{
"repo_name": "gregfitz23/dynamock",
"path": "src/main/java/com/bizo/aws/dynamock/DynamockDBClient.java",
"license": "apache-2.0",
"size": 19974
}
|
[
"com.amazonaws.services.dynamodb.model.AttributeValue",
"java.util.List",
"java.util.Map"
] |
import com.amazonaws.services.dynamodb.model.AttributeValue; import java.util.List; import java.util.Map;
|
import com.amazonaws.services.dynamodb.model.*; import java.util.*;
|
[
"com.amazonaws.services",
"java.util"
] |
com.amazonaws.services; java.util;
| 92,871
|
public boolean endRun(MatrixRun run) throws InterruptedException, IOException {
return true;
}
|
boolean function(MatrixRun run) throws InterruptedException, IOException { return true; }
|
/**
* Called whenever one run is completed.
*
* @param run
* The completed {@link MatrixRun} object. Always non-null.
* @return
* See {@link #startBuild()} for the return value semantics.
*/
|
Called whenever one run is completed
|
endRun
|
{
"repo_name": "fujibee/hudson",
"path": "core/src/main/java/hudson/matrix/MatrixAggregator.java",
"license": "mit",
"size": 3587
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 1,575,413
|
private Map getArgumentValues() throws ProcessException{
Map vals=new HashMap();
Iterator<String> itr = argumentsHolder.keySet().iterator();
while(itr.hasNext()){
String paramName = itr.next();
Expression opnd=argumentsHolder.get(paramName);
vals.put(paramName, opnd.getValue());
}
return vals;
}
|
Map function() throws ProcessException{ Map vals=new HashMap(); Iterator<String> itr = argumentsHolder.keySet().iterator(); while(itr.hasNext()){ String paramName = itr.next(); Expression opnd=argumentsHolder.get(paramName); vals.put(paramName, opnd.getValue()); } return vals; }
|
/**
* function to extract the actual parameters required to pass in the execution
* the parameter definitions will be used to extract data.
*
* @return object map containing actual data
* @throws com.krawler.br.ProcessException if the actual data cannot be extracted
* because of mismatch in hashmap and parameter definition.
*/
|
function to extract the actual parameters required to pass in the execution the parameter definitions will be used to extract data
|
getArgumentValues
|
{
"repo_name": "ufoe/Deskera-CRM",
"path": "bpm-app/bpm-bizlogic/src/main/java/com/krawler/br/decorators/ArgsSupportedFlowNode.java",
"license": "gpl-3.0",
"size": 2407
}
|
[
"com.krawler.br.ProcessException",
"com.krawler.br.exp.Expression",
"java.util.HashMap",
"java.util.Iterator",
"java.util.Map"
] |
import com.krawler.br.ProcessException; import com.krawler.br.exp.Expression; import java.util.HashMap; import java.util.Iterator; import java.util.Map;
|
import com.krawler.br.*; import com.krawler.br.exp.*; import java.util.*;
|
[
"com.krawler.br",
"java.util"
] |
com.krawler.br; java.util;
| 2,823,209
|
public static String createSignedUrl(String method, String bucketName, String objectKey,
String specialParamName, Map headersMap, AWSCredentials awsCredentials,
long secondsSinceEpoch, boolean isVirtualHost)
throws S3ServiceException
{
boolean isHttps = Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME)
.getBoolProperty("s3service.https-only", true);
return createSignedUrl(method, bucketName, objectKey, specialParamName,
headersMap, awsCredentials, secondsSinceEpoch, isVirtualHost, isHttps);
}
|
static String function(String method, String bucketName, String objectKey, String specialParamName, Map headersMap, AWSCredentials awsCredentials, long secondsSinceEpoch, boolean isVirtualHost) throws S3ServiceException { boolean isHttps = Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME) .getBoolProperty(STR, true); return createSignedUrl(method, bucketName, objectKey, specialParamName, headersMap, awsCredentials, secondsSinceEpoch, isVirtualHost, isHttps); }
|
/**
* Generates a signed URL string that will grant access to an S3 resource (bucket or object)
* to whoever uses the URL up until the time specified. The URL will use the HTTP or
* HTTPS protocol depending on the value of the <code>s3service.https-only</code> property
* in the default jets3t.properties file.
*
* @param method
* the HTTP method to sign, such as GET or PUT (note that S3 does not support POST requests).
* @param bucketName
* the name of the bucket to include in the URL, must be a valid bucket name.
* @param objectKey
* the name of the object to include in the URL, if null only the bucket name is used.
* @param specialParamName
* the name of a request parameter to add to the URL generated by this method. 'Special'
* parameters may include parameters that specify the kind of S3 resource that the URL
* will refer to, such as 'acl', 'torrent', 'logging' or 'location'.
* @param headersMap
* headers to add to the signed URL, may be null.
* Headers that <b>must</b> match between the signed URL and the actual request include:
* content-md5, content-type, and any header starting with 'x-amz-'.
* @param awsCredentials
* the credentials of someone with sufficient privileges to grant access to the bucket/object
* @param secondsSinceEpoch
* the time after which URL's signature will no longer be valid. This time cannot be null.
* <b>Note:</b> This time is specified in seconds since the epoch, not milliseconds.
* @param isVirtualHost
* if this parameter is true, the bucket name is treated as a virtual host name. To use
* this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket.
*
* @return
* a URL signed in such a way as to grant access to an S3 resource to whoever uses it.
*
* @throws S3ServiceException
*/
|
Generates a signed URL string that will grant access to an S3 resource (bucket or object) to whoever uses the URL up until the time specified. The URL will use the HTTP or HTTPS protocol depending on the value of the <code>s3service.https-only</code> property in the default jets3t.properties file
|
createSignedUrl
|
{
"repo_name": "ridvandongelci/jets3t",
"path": "src/org/jets3t/service/S3Service.java",
"license": "apache-2.0",
"size": 110321
}
|
[
"java.util.Map",
"org.jets3t.service.security.AWSCredentials"
] |
import java.util.Map; import org.jets3t.service.security.AWSCredentials;
|
import java.util.*; import org.jets3t.service.security.*;
|
[
"java.util",
"org.jets3t.service"
] |
java.util; org.jets3t.service;
| 2,017,527
|
protected void addTransportVFSActionAfterProcessPropertyDescriptor(Object object) {
itemPropertyDescriptors.add(createItemPropertyDescriptor(
((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_InboundEndpoint_transportVFSActionAfterProcess_feature"),
getString("_UI_PropertyDescriptor_description",
"_UI_InboundEndpoint_transportVFSActionAfterProcess_feature", "_UI_InboundEndpoint_type"),
EsbPackage.Literals.INBOUND_ENDPOINT__TRANSPORT_VFS_ACTION_AFTER_PROCESS, true, false, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, "Parameters", null));
}
|
void function(Object object) { itemPropertyDescriptors.add(createItemPropertyDescriptor( ((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), EsbPackage.Literals.INBOUND_ENDPOINT__TRANSPORT_VFS_ACTION_AFTER_PROCESS, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, STR, null)); }
|
/**
* This adds a property descriptor for the Transport VFS Action After
* Process feature. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
|
This adds a property descriptor for the Transport VFS Action After Process feature.
|
addTransportVFSActionAfterProcessPropertyDescriptor
|
{
"repo_name": "nwnpallewela/developer-studio",
"path": "esb/plugins/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/InboundEndpointItemProvider.java",
"license": "apache-2.0",
"size": 156993
}
|
[
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor",
"org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage"
] |
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage;
|
import org.eclipse.emf.edit.provider.*; import org.wso2.developerstudio.eclipse.gmf.esb.*;
|
[
"org.eclipse.emf",
"org.wso2.developerstudio"
] |
org.eclipse.emf; org.wso2.developerstudio;
| 7,259
|
public final void testRSAOtherPrimeInfo04() {
try {
new RSAOtherPrimeInfo(BigInteger.valueOf(1L),
BigInteger.valueOf(2L),
null);
fail("Expected NPE not thrown");
} catch (NullPointerException e) {
}
}
|
final void function() { try { new RSAOtherPrimeInfo(BigInteger.valueOf(1L), BigInteger.valueOf(2L), null); fail(STR); } catch (NullPointerException e) { } }
|
/**
* Test #4 for <code>RSAOtherPrimeInfo(BigInteger,BigInteger,BigInteger)</code> ctor
* Assertion: NullPointerException if crtCoefficient is null
*/
|
Test #4 for <code>RSAOtherPrimeInfo(BigInteger,BigInteger,BigInteger)</code> ctor Assertion: NullPointerException if crtCoefficient is null
|
testRSAOtherPrimeInfo04
|
{
"repo_name": "AdmireTheDistance/android_libcore",
"path": "luni/src/test/java/tests/security/spec/RSAOtherPrimeInfoTest.java",
"license": "gpl-2.0",
"size": 4919
}
|
[
"java.math.BigInteger",
"java.security.spec.RSAOtherPrimeInfo"
] |
import java.math.BigInteger; import java.security.spec.RSAOtherPrimeInfo;
|
import java.math.*; import java.security.spec.*;
|
[
"java.math",
"java.security"
] |
java.math; java.security;
| 137,616
|
protected Set<Resource> doFindPathMatchingJarResources(Resource rootDirResource, String subPattern)
throws IOException {
URLConnection con = rootDirResource.getURL().openConnection();
JarFile jarFile;
String jarFileUrl;
String rootEntryPath;
boolean newJarFile = false;
if (con instanceof JarURLConnection) {
// Should usually be the case for traditional JAR files.
JarURLConnection jarCon = (JarURLConnection) con;
UrlUtils.useCachesIfNecessary(jarCon);
jarFile = jarCon.getJarFile();
jarFileUrl = jarCon.getJarFileURL().toExternalForm();
JarEntry jarEntry = jarCon.getJarEntry();
rootEntryPath = (jarEntry != null ? jarEntry.getName() : "");
}
else {
// No JarURLConnection -> need to resort to URL file parsing.
// We'll assume URLs of the format "jar:path!/entry", with the protocol
// being arbitrary as long as following the entry format.
// We'll also handle paths with and without leading "file:" prefix.
String urlFile = rootDirResource.getURL().getFile();
int separatorIndex = urlFile.indexOf(UrlUtils.JAR_URL_SEPARATOR);
if (separatorIndex != -1) {
jarFileUrl = urlFile.substring(0, separatorIndex);
rootEntryPath = urlFile.substring(separatorIndex + UrlUtils.JAR_URL_SEPARATOR.length());
jarFile = getJarFile(jarFileUrl);
}
else {
jarFile = new JarFile(urlFile);
jarFileUrl = urlFile;
rootEntryPath = "";
}
newJarFile = true;
}
try {
if (logger.isDebugEnabled()) {
logger.debug("Looking for matching resources in jar file [" + jarFileUrl + "]");
}
if (!"".equals(rootEntryPath) && !rootEntryPath.endsWith("/")) {
// Root entry path must end with slash to allow for proper matching.
// The Sun JRE does not return a slash here, but BEA JRockit does.
rootEntryPath = rootEntryPath + "/";
}
Set<Resource> result = new LinkedHashSet<Resource>(8);
for (Enumeration<JarEntry> entries = jarFile.entries(); entries.hasMoreElements();) {
JarEntry entry = entries.nextElement();
String entryPath = entry.getName();
if (entryPath.startsWith(rootEntryPath)) {
String relativePath = entryPath.substring(rootEntryPath.length());
if (getPathMatcher().match(subPattern, relativePath)) {
result.add(rootDirResource.createRelative(relativePath));
}
}
}
return result;
}
finally {
// Close jar file, but only if freshly obtained -
// not from JarURLConnection, which might cache the file reference.
if (newJarFile) {
jarFile.close();
}
}
}
|
Set<Resource> function(Resource rootDirResource, String subPattern) throws IOException { URLConnection con = rootDirResource.getURL().openConnection(); JarFile jarFile; String jarFileUrl; String rootEntryPath; boolean newJarFile = false; if (con instanceof JarURLConnection) { JarURLConnection jarCon = (JarURLConnection) con; UrlUtils.useCachesIfNecessary(jarCon); jarFile = jarCon.getJarFile(); jarFileUrl = jarCon.getJarFileURL().toExternalForm(); JarEntry jarEntry = jarCon.getJarEntry(); rootEntryPath = (jarEntry != null ? jarEntry.getName() : STRSTRLooking for matching resources in jar file [STR]STRSTR/STR/"; } Set<Resource> result = new LinkedHashSet<Resource>(8); for (Enumeration<JarEntry> entries = jarFile.entries(); entries.hasMoreElements();) { JarEntry entry = entries.nextElement(); String entryPath = entry.getName(); if (entryPath.startsWith(rootEntryPath)) { String relativePath = entryPath.substring(rootEntryPath.length()); if (getPathMatcher().match(subPattern, relativePath)) { result.add(rootDirResource.createRelative(relativePath)); } } } return result; } finally { if (newJarFile) { jarFile.close(); } } }
|
/**
* Find all resources in jar files that match the given location pattern
* via the Ant-style PathMatcher.
* @param rootDirResource the root directory as Resource
* @param subPattern the sub pattern to match (below the root directory)
* @return the Set of matching Resource instances
* @throws IOException in case of I/O errors
* @see java.net.JarURLConnection
* @see org.springframework.util.PathMatcher
*/
|
Find all resources in jar files that match the given location pattern via the Ant-style PathMatcher
|
doFindPathMatchingJarResources
|
{
"repo_name": "jretty-org/jretty-util",
"path": "jretty-util/src/main/java/org/jretty/util/resource/support/PathMatchingResourcePatternResolver.java",
"license": "apache-2.0",
"size": 31774
}
|
[
"java.io.IOException",
"java.net.JarURLConnection",
"java.net.URLConnection",
"java.util.Enumeration",
"java.util.LinkedHashSet",
"java.util.Set",
"java.util.jar.JarEntry",
"java.util.jar.JarFile",
"org.jretty.util.UrlUtils",
"org.jretty.util.resource.Resource"
] |
import java.io.IOException; import java.net.JarURLConnection; import java.net.URLConnection; import java.util.Enumeration; import java.util.LinkedHashSet; import java.util.Set; import java.util.jar.JarEntry; import java.util.jar.JarFile; import org.jretty.util.UrlUtils; import org.jretty.util.resource.Resource;
|
import java.io.*; import java.net.*; import java.util.*; import java.util.jar.*; import org.jretty.util.*; import org.jretty.util.resource.*;
|
[
"java.io",
"java.net",
"java.util",
"org.jretty.util"
] |
java.io; java.net; java.util; org.jretty.util;
| 251,446
|
private void readAllAccounts() {
File accountFile = VEnvironment.getAccountConfigFile();
refreshAuthenticatorCache(null);
if (accountFile.exists()) {
accountsByUserId.clear();
Parcel dest = Parcel.obtain();
try {
FileInputStream is = new FileInputStream(accountFile);
byte[] bytes = new byte[(int) accountFile.length()];
int readLength = is.read(bytes);
is.close();
if (readLength != bytes.length) {
throw new IOException(String.format(Locale.ENGLISH, "Expect length %d, but got %d.", bytes.length, readLength));
}
dest.unmarshall(bytes, 0, bytes.length);
dest.setDataPosition(0);
dest.readInt(); // skip the magic
int size = dest.readInt(); // the VAccount's size we need to read
boolean invalid = false;
while (size-- > 0) {
VAccount account = new VAccount(dest);
VLog.d(TAG, "Reading account : " + account.type);
AuthenticatorInfo info = cache.authenticators.get(account.type);
if (info != null) {
List<VAccount> accounts = accountsByUserId.get(account.userId);
if (accounts == null) {
accounts = new ArrayList<>();
accountsByUserId.put(account.userId, accounts);
}
accounts.add(account);
} else {
invalid = true;
}
}
lastAccountChangeTime = dest.readLong();
if (invalid) {
saveAllAccounts();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
dest.recycle();
}
}
}
|
void function() { File accountFile = VEnvironment.getAccountConfigFile(); refreshAuthenticatorCache(null); if (accountFile.exists()) { accountsByUserId.clear(); Parcel dest = Parcel.obtain(); try { FileInputStream is = new FileInputStream(accountFile); byte[] bytes = new byte[(int) accountFile.length()]; int readLength = is.read(bytes); is.close(); if (readLength != bytes.length) { throw new IOException(String.format(Locale.ENGLISH, STR, bytes.length, readLength)); } dest.unmarshall(bytes, 0, bytes.length); dest.setDataPosition(0); dest.readInt(); int size = dest.readInt(); boolean invalid = false; while (size-- > 0) { VAccount account = new VAccount(dest); VLog.d(TAG, STR + account.type); AuthenticatorInfo info = cache.authenticators.get(account.type); if (info != null) { List<VAccount> accounts = accountsByUserId.get(account.userId); if (accounts == null) { accounts = new ArrayList<>(); accountsByUserId.put(account.userId, accounts); } accounts.add(account); } else { invalid = true; } } lastAccountChangeTime = dest.readLong(); if (invalid) { saveAllAccounts(); } } catch (Exception e) { e.printStackTrace(); } finally { dest.recycle(); } } }
|
/**
* Read all accounts from file.
*/
|
Read all accounts from file
|
readAllAccounts
|
{
"repo_name": "247321453/VirtualApp",
"path": "VirtualApp/lib/src/main/java/com/lody/virtual/server/accounts/VAccountManagerService.java",
"license": "gpl-3.0",
"size": 59619
}
|
[
"android.os.Parcel",
"com.lody.virtual.helper.utils.VLog",
"com.lody.virtual.os.VEnvironment",
"java.io.File",
"java.io.FileInputStream",
"java.io.IOException",
"java.util.ArrayList",
"java.util.List",
"java.util.Locale"
] |
import android.os.Parcel; import com.lody.virtual.helper.utils.VLog; import com.lody.virtual.os.VEnvironment; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Locale;
|
import android.os.*; import com.lody.virtual.helper.utils.*; import com.lody.virtual.os.*; import java.io.*; import java.util.*;
|
[
"android.os",
"com.lody.virtual",
"java.io",
"java.util"
] |
android.os; com.lody.virtual; java.io; java.util;
| 1,270,263
|
public static Integer getNumericIdentifier(String identifier) {
if (StringUtils.isBlank(identifier))
throw new IllegalArgumentException("identifier cannot be null");
if (!identifier.startsWith(IDENTIFIER_PREFIX))
return null;
try {
return Integer.valueOf(identifier.substring(IDENTIFIER_PREFIX.length()));
}
catch (NumberFormatException ex) {
log.error("invalid unique identifier for Drug:" + identifier, ex);
}
return null;
}
|
static Integer function(String identifier) { if (StringUtils.isBlank(identifier)) throw new IllegalArgumentException(STR); if (!identifier.startsWith(IDENTIFIER_PREFIX)) return null; try { return Integer.valueOf(identifier.substring(IDENTIFIER_PREFIX.length())); } catch (NumberFormatException ex) { log.error(STR + identifier, ex); } return null; }
|
/**
* Gets a numeric identifier from a string identifier.
*
* @param identifier
* the string identifier.
* @return the numeric identifier if it is a valid one, else null
* @should return numeric identifier of valid string identifier
* @should return null for an invalid string identifier
* @should fail if null or empty passed in
* @since 1.10
*/
|
Gets a numeric identifier from a string identifier
|
getNumericIdentifier
|
{
"repo_name": "Bhamni/openmrs-core",
"path": "api/src/main/java/org/openmrs/Drug.java",
"license": "mpl-2.0",
"size": 6581
}
|
[
"org.apache.commons.lang3.StringUtils"
] |
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.*;
|
[
"org.apache.commons"
] |
org.apache.commons;
| 2,397,670
|
@Test(expected = RuntimeException.class)
public void testExecuteWithWrongType() {
executor.execute("2 + 2", message, Boolean.class);
}
|
@Test(expected = RuntimeException.class) void function() { executor.execute(STR, message, Boolean.class); }
|
/**
* An exception is expected if an expression results in an unexpected type.
*/
|
An exception is expected if an expression results in an unexpected type
|
testExecuteWithWrongType
|
{
"repo_name": "dlyle65535/metron",
"path": "metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/common/DefaultStellarStatefulExecutorTest.java",
"license": "apache-2.0",
"size": 5822
}
|
[
"org.junit.Test"
] |
import org.junit.Test;
|
import org.junit.*;
|
[
"org.junit"
] |
org.junit;
| 2,109,862
|
protected final IndexResponse index(String index, String type, String id, Map<String, Object> source) {
return client().prepareIndex(index, type, id).setSource(source).execute().actionGet();
}
|
final IndexResponse function(String index, String type, String id, Map<String, Object> source) { return client().prepareIndex(index, type, id).setSource(source).execute().actionGet(); }
|
/**
* Syntactic sugar for:
* <pre>
* client().prepareIndex(index, type).setSource(source).execute().actionGet();
* </pre>
*/
|
Syntactic sugar for: <code> client().prepareIndex(index, type).setSource(source).execute().actionGet(); </code>
|
index
|
{
"repo_name": "fernandozhu/elasticsearch",
"path": "test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java",
"license": "apache-2.0",
"size": 103624
}
|
[
"java.util.Map",
"org.elasticsearch.action.index.IndexResponse"
] |
import java.util.Map; import org.elasticsearch.action.index.IndexResponse;
|
import java.util.*; import org.elasticsearch.action.index.*;
|
[
"java.util",
"org.elasticsearch.action"
] |
java.util; org.elasticsearch.action;
| 2,569,791
|
public boolean isImportedFromCCodeSource() throws RemoteException;
|
boolean function() throws RemoteException;
|
/**
* Was this scheduling item imported from the sources or manually added
*
* @return Was this scheduling item imported from the sources
*
* @throws RemoteException
* remote communication problem
*/
|
Was this scheduling item imported from the sources or manually added
|
isImportedFromCCodeSource
|
{
"repo_name": "jenkinsci/piketec-tpt-plugin",
"path": "src/main/java/com/piketec/tpt/api/cplatform/FunctionSchedulingItem.java",
"license": "mit",
"size": 4010
}
|
[
"java.rmi.RemoteException"
] |
import java.rmi.RemoteException;
|
import java.rmi.*;
|
[
"java.rmi"
] |
java.rmi;
| 826,586
|
protected void updatePreviewFont() {
final String name = (String) fontName.getSelectedItem();
final boolean bold = fontBold.isSelected();
final boolean ital = fontItalic.isSelected();
int size;
try {
String tempFontSize = fontSize.getText().trim();
if (tempFontSize.length() > 0) {
size = Integer.parseInt(fontSize.getText());
} else {
size = DEFAULT_FONT_SIZE;
}
} catch (Throwable throwable) {
size = DEFAULT_FONT_SIZE;
LOGGER.warn("Cannot parse request font size", throwable);
}
// Bold and italic don't work properly in beta 4.
final Font f = new Font(name, (bold ? Font.BOLD : 0)
| (ital ? Font.ITALIC : 0), size);
newFont = f;
LOGGER.debug("New font created: " + newFont);
}
|
void function() { final String name = (String) fontName.getSelectedItem(); final boolean bold = fontBold.isSelected(); final boolean ital = fontItalic.isSelected(); int size; try { String tempFontSize = fontSize.getText().trim(); if (tempFontSize.length() > 0) { size = Integer.parseInt(fontSize.getText()); } else { size = DEFAULT_FONT_SIZE; } } catch (Throwable throwable) { size = DEFAULT_FONT_SIZE; LOGGER.warn(STR, throwable); } final Font f = new Font(name, (bold ? Font.BOLD : 0) (ital ? Font.ITALIC : 0), size); newFont = f; LOGGER.debug(STR + newFont); }
|
/**
* Get the appropriate font from our attributes object and update
* the preview label
*/
|
Get the appropriate font from our attributes object and update the preview label
|
updatePreviewFont
|
{
"repo_name": "DaveRead/semantic_workbench",
"path": "Source/Java/com/monead/semantic/workbench/utilities/FontChooser.java",
"license": "agpl-3.0",
"size": 11219
}
|
[
"java.awt.Font"
] |
import java.awt.Font;
|
import java.awt.*;
|
[
"java.awt"
] |
java.awt;
| 270,570
|
public void testDocOrderIndexedNotation() throws Exception {
String path = testRoot + "/" + nodeName1 + "[2]";
StringBuffer tmp = new StringBuffer("/");
tmp.append(jcrRoot).append(path);
docOrderTest(new Statement(tmp.toString(), Query.XPATH), path);
}
//-----------------------------< internal >---------------------------------
|
void function() throws Exception { String path = testRoot + "/" + nodeName1 + "[2]"; StringBuffer tmp = new StringBuffer("/"); tmp.append(jcrRoot).append(path); docOrderTest(new Statement(tmp.toString(), Query.XPATH), path); }
|
/**
* Test if the indexed notation is supported.
* <p/>
* For configuration description see {@link XPathPosIndexTest}.
*/
|
Test if the indexed notation is supported. For configuration description see <code>XPathPosIndexTest</code>
|
testDocOrderIndexedNotation
|
{
"repo_name": "jalkanen/Priha",
"path": "tests/tck/org/apache/jackrabbit/test/api/query/XPathPosIndexTest.java",
"license": "apache-2.0",
"size": 3545
}
|
[
"javax.jcr.query.Query"
] |
import javax.jcr.query.Query;
|
import javax.jcr.query.*;
|
[
"javax.jcr"
] |
javax.jcr;
| 2,671,452
|
List<OtherTSLPointer> getTlOtherPointers();
|
List<OtherTSLPointer> getTlOtherPointers();
|
/**
* Gets TL other TSL pointers
*
* @return a list of {@link OtherTSLPointer}s
*/
|
Gets TL other TSL pointers
|
getTlOtherPointers
|
{
"repo_name": "esig/dss",
"path": "dss-spi/src/main/java/eu/europa/esig/dss/spi/tsl/ParsingInfoRecord.java",
"license": "lgpl-2.1",
"size": 2821
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 393,684
|
private static String removeBeginEnd(String pem) {
pem = pem.replace(PemUtils.BEGIN_CERT, "");
pem = pem.replace(PemUtils.END_CERT, "");
pem = pem.replace("\r\n", "");
pem = pem.replace("\n", "");
return pem.trim();
}
|
static String function(String pem) { pem = pem.replace(PemUtils.BEGIN_CERT, STRSTR\r\nSTRSTR\nSTR"); return pem.trim(); }
|
/**
* Removing PEM Headers and end of lines
*
* @param pem
* @return
*/
|
Removing PEM Headers and end of lines
|
removeBeginEnd
|
{
"repo_name": "keycloak/keycloak",
"path": "services/src/main/java/org/keycloak/services/x509/NginxProxySslClientCertificateLookup.java",
"license": "apache-2.0",
"size": 10770
}
|
[
"org.keycloak.common.util.PemUtils"
] |
import org.keycloak.common.util.PemUtils;
|
import org.keycloak.common.util.*;
|
[
"org.keycloak.common"
] |
org.keycloak.common;
| 2,411,089
|
UnitModule unitModule();
|
UnitModule unitModule();
|
/**
* Return an object that will contains the dependency injection definitions. Mostly a Guice module but
* it can be other dependency injection object from other DI frameworks : Spring, Tapestry, Jodd, etc.
* The kernel must have a {@link DependencyInjectionProvider} that handle it.
*
* @return the unit module
*/
|
Return an object that will contains the dependency injection definitions. Mostly a Guice module but it can be other dependency injection object from other DI frameworks : Spring, Tapestry, Jodd, etc. The kernel must have a <code>DependencyInjectionProvider</code> that handle it
|
unitModule
|
{
"repo_name": "nuun-io/kernel",
"path": "specs/src/main/java/io/nuun/kernel/api/Plugin.java",
"license": "lgpl-3.0",
"size": 5962
}
|
[
"io.nuun.kernel.api.di.UnitModule"
] |
import io.nuun.kernel.api.di.UnitModule;
|
import io.nuun.kernel.api.di.*;
|
[
"io.nuun.kernel"
] |
io.nuun.kernel;
| 149,168
|
@Timed
@GET
@Path(value = "/{id}")
public Book get(@PathParam("id") String id){
final Book book = bookRepository.get(Key.create(id));
super.throwNotFoundIfNull(book, String.format("BookId: %s not found", id));
return book;
}
|
@Path(value = "/{id}") Book function(@PathParam("id") String id){ final Book book = bookRepository.get(Key.create(id)); super.throwNotFoundIfNull(book, String.format(STR, id)); return book; }
|
/**
* Get the item by it's id
* @param id
* @return book
*/
|
Get the item by it's id
|
get
|
{
"repo_name": "shagwood/micro-genie",
"path": "examples/dropwizard-example/src/main/java/io/microgenie/example/resources/BookResource.java",
"license": "apache-2.0",
"size": 2367
}
|
[
"io.microgenie.application.database.EntityDatabusRepository",
"io.microgenie.example.models.Book",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam"
] |
import io.microgenie.application.database.EntityDatabusRepository; import io.microgenie.example.models.Book; import javax.ws.rs.Path; import javax.ws.rs.PathParam;
|
import io.microgenie.application.database.*; import io.microgenie.example.models.*; import javax.ws.rs.*;
|
[
"io.microgenie.application",
"io.microgenie.example",
"javax.ws"
] |
io.microgenie.application; io.microgenie.example; javax.ws;
| 2,720,781
|
public void setStroke(Stroke s) {
if (s != null) {
stroke = s;
} else {
stroke = BASIC_STROKE;
}
}
|
void function(Stroke s) { if (s != null) { stroke = s; } else { stroke = BASIC_STROKE; } }
|
/**
* Set the Stroke that should be used for the graphic edges. Using a
* BasicStroke, you can set a stroke that defines the line width, the dash
* interval and phase. If a null value is passed in, a default BasicStroke
* will be used.
*
* @param s the stroke to use for the graphic edge.
* @see java.awt.Stroke
* @see java.awt.BasicStroke
*/
|
Set the Stroke that should be used for the graphic edges. Using a BasicStroke, you can set a stroke that defines the line width, the dash interval and phase. If a null value is passed in, a default BasicStroke will be used
|
setStroke
|
{
"repo_name": "d2fn/passage",
"path": "src/main/java/com/bbn/openmap/omGraphics/OMGraphicAdapter.java",
"license": "mit",
"size": 35876
}
|
[
"java.awt.Stroke"
] |
import java.awt.Stroke;
|
import java.awt.*;
|
[
"java.awt"
] |
java.awt;
| 2,153,850
|
public void setDirection(final Direction dir) {
if (dir == this.direction) {
return;
}
this.direction = dir;
put("dir", direction.get());
}
|
void function(final Direction dir) { if (dir == this.direction) { return; } this.direction = dir; put("dir", direction.get()); }
|
/**
* Set the facing direction.
*
* @param dir
* The facing direction.
*/
|
Set the facing direction
|
setDirection
|
{
"repo_name": "sourceress-project/archestica",
"path": "src/games/stendhal/server/entity/ActiveEntity.java",
"license": "gpl-2.0",
"size": 9014
}
|
[
"games.stendhal.common.Direction"
] |
import games.stendhal.common.Direction;
|
import games.stendhal.common.*;
|
[
"games.stendhal.common"
] |
games.stendhal.common;
| 833,306
|
protected void doRegister() throws Exception {
// NOOP
}
/**
* Bind the {@link Channel} to the {@link SocketAddress}
|
void function() throws Exception { } /** * Bind the {@link Channel} to the {@link SocketAddress}
|
/**
* Is called after the {@link Channel} is registered with its {@link EventLoop} as part of the register process.
*
* Sub-classes may override this method
*/
|
Is called after the <code>Channel</code> is registered with its <code>EventLoop</code> as part of the register process. Sub-classes may override this method
|
doRegister
|
{
"repo_name": "Techcable/netty",
"path": "transport/src/main/java/io/netty/channel/AbstractChannel.java",
"license": "apache-2.0",
"size": 36987
}
|
[
"java.net.SocketAddress"
] |
import java.net.SocketAddress;
|
import java.net.*;
|
[
"java.net"
] |
java.net;
| 1,302,113
|
RequestReportRecordContractInner innerModel();
|
RequestReportRecordContractInner innerModel();
|
/**
* Gets the inner com.azure.resourcemanager.apimanagement.fluent.models.RequestReportRecordContractInner object.
*
* @return the inner object.
*/
|
Gets the inner com.azure.resourcemanager.apimanagement.fluent.models.RequestReportRecordContractInner object
|
innerModel
|
{
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/apimanagement/azure-resourcemanager-apimanagement/src/main/java/com/azure/resourcemanager/apimanagement/models/RequestReportRecordContract.java",
"license": "mit",
"size": 4104
}
|
[
"com.azure.resourcemanager.apimanagement.fluent.models.RequestReportRecordContractInner"
] |
import com.azure.resourcemanager.apimanagement.fluent.models.RequestReportRecordContractInner;
|
import com.azure.resourcemanager.apimanagement.fluent.models.*;
|
[
"com.azure.resourcemanager"
] |
com.azure.resourcemanager;
| 2,368,415
|
public void execAndPrint(String s) {
ResultSet results = null;
try {
results = execute(s);
} catch (SQLException sqlE) {
LoggingUtils.logAll(LOG, "Error executing statement: ", sqlE);
release();
return;
}
PrintWriter pw = new PrintWriter(System.out, true);
try {
formatAndPrintResultSet(results, pw);
} finally {
pw.close();
}
}
|
void function(String s) { ResultSet results = null; try { results = execute(s); } catch (SQLException sqlE) { LoggingUtils.logAll(LOG, STR, sqlE); release(); return; } PrintWriter pw = new PrintWriter(System.out, true); try { formatAndPrintResultSet(results, pw); } finally { pw.close(); } }
|
/**
* Poor man's SQL query interface; used for debugging.
* @param s the SQL statement to execute.
*/
|
Poor man's SQL query interface; used for debugging
|
execAndPrint
|
{
"repo_name": "bonnetb/sqoop",
"path": "src/java/org/apache/sqoop/manager/SqlManager.java",
"license": "apache-2.0",
"size": 36408
}
|
[
"java.io.PrintWriter",
"java.sql.ResultSet",
"java.sql.SQLException",
"org.apache.sqoop.util.LoggingUtils"
] |
import java.io.PrintWriter; import java.sql.ResultSet; import java.sql.SQLException; import org.apache.sqoop.util.LoggingUtils;
|
import java.io.*; import java.sql.*; import org.apache.sqoop.util.*;
|
[
"java.io",
"java.sql",
"org.apache.sqoop"
] |
java.io; java.sql; org.apache.sqoop;
| 133,838
|
public int getCheckedInResourceCount() {
int count = 0;
for(Entry<K, Pool<V>> entry: this.resourcePoolMap.entrySet())
count += entry.getValue().queue.size();
return count;
}
|
int function() { int count = 0; for(Entry<K, Pool<V>> entry: this.resourcePoolMap.entrySet()) count += entry.getValue().queue.size(); return count; }
|
/**
* Count the total number of checked in (idle) resources across all pools.
* The result is "approximate" in the face of concurrency since individual
* pools can have resources checked in, or out, during the aggregate count.
*
* @return The (approximate) aggregate count of checked in resources.
*/
|
Count the total number of checked in (idle) resources across all pools. The result is "approximate" in the face of concurrency since individual pools can have resources checked in, or out, during the aggregate count
|
getCheckedInResourceCount
|
{
"repo_name": "dallasmarlow/voldemort",
"path": "src/java/voldemort/utils/pool/KeyedResourcePool.java",
"license": "apache-2.0",
"size": 23907
}
|
[
"java.util.Map"
] |
import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,054,541
|
public static ByteBuffer getShaderSource(InputStream is) throws IOException {
ReadableByteChannel readChannel = Channels.newChannel(is);
int bufferSize = 4096;
ByteBuffer target = directByteBuffer(bufferSize);
while (readChannel.read(target) > 0) {
// If target is not full we reached an EOF
if (target.hasRemaining())
break;
// Else increase the buffer size
bufferSize += 4096;
target.flip();
target = directByteBuffer(bufferSize).put(target);
}
target.flip();
return target;
}
/**
* Compiles a new shader of tpye shaderTpye using the {@link InputStream} as shader source and returns the name of
* the newly created shader.<br>
* Returning 0 means that no shader could be created.
*
* @param shaderType
* the GL_TYPE of the shader like {@link GL20#GL_VERTEX_SHADER}
|
static ByteBuffer function(InputStream is) throws IOException { ReadableByteChannel readChannel = Channels.newChannel(is); int bufferSize = 4096; ByteBuffer target = directByteBuffer(bufferSize); while (readChannel.read(target) > 0) { if (target.hasRemaining()) break; bufferSize += 4096; target.flip(); target = directByteBuffer(bufferSize).put(target); } target.flip(); return target; } /** * Compiles a new shader of tpye shaderTpye using the {@link InputStream} as shader source and returns the name of * the newly created shader.<br> * Returning 0 means that no shader could be created. * * @param shaderType * the GL_TYPE of the shader like {@link GL20#GL_VERTEX_SHADER}
|
/**
* Gets the source in the {@link InputStream} as a direct byte buffer which can be supplied to OpenGL in
* {@link GL20#glShaderSource(int, ByteBuffer)} to compile a shader. The inputStream will be read as long as it has
* at least one byte. The read will behave as a blocking-read.
*
* @param is
* the {@link InputStream} to read the shader source from
* @return a direct {@link ByteBuffer} containing the source
* @throws IOException
*/
|
Gets the source in the <code>InputStream</code> as a direct byte buffer which can be supplied to OpenGL in <code>GL20#glShaderSource(int, ByteBuffer)</code> to compile a shader. The inputStream will be read as long as it has at least one byte. The read will behave as a blocking-read
|
getShaderSource
|
{
"repo_name": "WorldSEnder/MCAnm",
"path": "src/main/java/com/github/worldsender/mcanm/common/Utils.java",
"license": "gpl-2.0",
"size": 13067
}
|
[
"java.io.IOException",
"java.io.InputStream",
"java.nio.ByteBuffer",
"java.nio.channels.Channels",
"java.nio.channels.ReadableByteChannel"
] |
import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel;
|
import java.io.*; import java.nio.*; import java.nio.channels.*;
|
[
"java.io",
"java.nio"
] |
java.io; java.nio;
| 976,498
|
public void paintDesktopIconBackground(SynthContext context, Graphics g, int x, int y, int w, int h) {
paintBackground(context, g, x, y, w, h, null);
}
|
void function(SynthContext context, Graphics g, int x, int y, int w, int h) { paintBackground(context, g, x, y, w, h, null); }
|
/**
* Paints the background of a desktop icon.
*
* @param context SynthContext identifying the <code>JComponent</code> and
* <code>Region</code> to paint to
* @param g <code>Graphics</code> to paint to
* @param x X coordinate of the area to paint to
* @param y Y coordinate of the area to paint to
* @param w Width of the area to paint to
* @param h Height of the area to paint to
*/
|
Paints the background of a desktop icon
|
paintDesktopIconBackground
|
{
"repo_name": "anhtu1995ok/seaglass",
"path": "src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java",
"license": "apache-2.0",
"size": 119406
}
|
[
"java.awt.Graphics",
"javax.swing.plaf.synth.SynthContext"
] |
import java.awt.Graphics; import javax.swing.plaf.synth.SynthContext;
|
import java.awt.*; import javax.swing.plaf.synth.*;
|
[
"java.awt",
"javax.swing"
] |
java.awt; javax.swing;
| 1,401,347
|
void loadRelations(File relationFile) throws FileNotFoundException,
XMLStreamException {
InputStream in = new FileInputStream(relationFile);
XMLInputFactory factory = XMLInputFactory.newInstance();
XMLStreamReader parser = factory.createXMLStreamReader(in);
int event;
String nodeName;
//Parse entire file, looking for lex- and con- relations
while (parser.hasNext()) {
event = parser.getEventType();
switch (event) {
case XMLStreamConstants.START_DOCUMENT:
namespace = parser.getNamespaceURI();
break;
case XMLStreamConstants.START_ELEMENT:
nodeName = parser.getLocalName();
if (nodeName.equals(GermaNet.XML_LEX_REL)) {
processLexRel(parser);
} else if (nodeName.equals(GermaNet.XML_CON_REL)) {
processConRel(parser);
}
break;
}
parser.next();
}
parser.close();
}
|
void loadRelations(File relationFile) throws FileNotFoundException, XMLStreamException { InputStream in = new FileInputStream(relationFile); XMLInputFactory factory = XMLInputFactory.newInstance(); XMLStreamReader parser = factory.createXMLStreamReader(in); int event; String nodeName; while (parser.hasNext()) { event = parser.getEventType(); switch (event) { case XMLStreamConstants.START_DOCUMENT: namespace = parser.getNamespaceURI(); break; case XMLStreamConstants.START_ELEMENT: nodeName = parser.getLocalName(); if (nodeName.equals(GermaNet.XML_LEX_REL)) { processLexRel(parser); } else if (nodeName.equals(GermaNet.XML_CON_REL)) { processConRel(parser); } break; } parser.next(); } parser.close(); }
|
/**
* Loads relations from the specified file into this
* <code>RelationLoader</code>'s <code>GermaNet</code> object.
* @param relationFile file containing GermaNet relation data
* @throws java.io.FileNotFoundException
* @throws javax.xml.stream.XMLStreamException
*/
|
Loads relations from the specified file into this <code>RelationLoader</code>'s <code>GermaNet</code> object
|
loadRelations
|
{
"repo_name": "jgrivolla/dkpro-wsd-gpl",
"path": "de.tudarmstadt.ukp.dkpro.wsd.si.germanet-gpl/src/main/java/de/tuebingen/uni/sfs/germanet/api/RelationLoader.java",
"license": "gpl-3.0",
"size": 7556
}
|
[
"java.io.File",
"java.io.FileInputStream",
"java.io.FileNotFoundException",
"java.io.InputStream",
"javax.xml.stream.XMLInputFactory",
"javax.xml.stream.XMLStreamConstants",
"javax.xml.stream.XMLStreamException",
"javax.xml.stream.XMLStreamReader"
] |
import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader;
|
import java.io.*; import javax.xml.stream.*;
|
[
"java.io",
"javax.xml"
] |
java.io; javax.xml;
| 103,569
|
public static void closeJMSSession(final Session session) {
if (session != null) {
try {
session.close();
} catch (JMSException ignore) {
ignore.printStackTrace();
}
}
}
|
static void function(final Session session) { if (session != null) { try { session.close(); } catch (JMSException ignore) { ignore.printStackTrace(); } } }
|
/**
* Closes the passed-in {@link Session}.
*
* @param session the {@link Session} instance to close.
*/
|
Closes the passed-in <code>Session</code>
|
closeJMSSession
|
{
"repo_name": "cunningt/switchyard",
"path": "components/test/mixins/hornetq/src/main/java/org/switchyard/component/test/mixins/hornetq/HornetQMixIn.java",
"license": "apache-2.0",
"size": 23810
}
|
[
"javax.jms.JMSException",
"javax.jms.Session"
] |
import javax.jms.JMSException; import javax.jms.Session;
|
import javax.jms.*;
|
[
"javax.jms"
] |
javax.jms;
| 2,276,556
|
public static <K, V> MapStream<V, K> flip(MapStream<K, V> original) {
return MapStream.fromStream(
original,
Map.Entry::getValue,
Map.Entry::getKey
);
}
|
static <K, V> MapStream<V, K> function(MapStream<K, V> original) { return MapStream.fromStream( original, Map.Entry::getValue, Map.Entry::getKey ); }
|
/**
* Produces a new MapStream by flipping the specified one so that keys
* become values and values become keys. This will consume the supplied
* stream.
*
* @param <K> original key type
* @param <V> original value type
* @param original original MapStream
* @return new MapStream with keys and values flipped
*/
|
Produces a new MapStream by flipping the specified one so that keys become values and values become keys. This will consume the supplied stream
|
flip
|
{
"repo_name": "Pyknic/MapStream",
"path": "src/main/java/com/speedment/stream/MapStream.java",
"license": "apache-2.0",
"size": 99760
}
|
[
"java.util.Map"
] |
import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,398,144
|
protected boolean sameCardOnOtherStack(Card card, Stack otherStack, testMode2 mode) {
Stack origin = card.getStack();
if (card.getIndexOnStack() > 0 && origin.getCard(card.getIndexOnStack() - 1).isUp() && otherStack.getSize() > 0) {
Card cardBelow = origin.getCard(card.getIndexOnStack() - 1);
if (mode == SAME_VALUE_AND_COLOR) {
if (cardBelow.getValue() == otherStack.getTopCard().getValue() && cardBelow.getColor() % 2 == otherStack.getTopCard().getColor() % 2) {
return true;
}
} else if (mode == SAME_VALUE_AND_FAMILY) {
if (cardBelow.getValue() == otherStack.getTopCard().getValue() && cardBelow.getColor() == otherStack.getTopCard().getColor()) {
return true;
}
} else if (mode == SAME_VALUE) {
if (cardBelow.getValue() == otherStack.getTopCard().getValue()) {
return true;
}
}
}
return false;
}
|
boolean function(Card card, Stack otherStack, testMode2 mode) { Stack origin = card.getStack(); if (card.getIndexOnStack() > 0 && origin.getCard(card.getIndexOnStack() - 1).isUp() && otherStack.getSize() > 0) { Card cardBelow = origin.getCard(card.getIndexOnStack() - 1); if (mode == SAME_VALUE_AND_COLOR) { if (cardBelow.getValue() == otherStack.getTopCard().getValue() && cardBelow.getColor() % 2 == otherStack.getTopCard().getColor() % 2) { return true; } } else if (mode == SAME_VALUE_AND_FAMILY) { if (cardBelow.getValue() == otherStack.getTopCard().getValue() && cardBelow.getColor() == otherStack.getTopCard().getColor()) { return true; } } else if (mode == SAME_VALUE) { if (cardBelow.getValue() == otherStack.getTopCard().getValue()) { return true; } } } return false; }
|
/**
* Tests if the given card is above the same card as the top card on the other stack.
* "Same card" means same value and depending on the mode: Same color or same family.
*
* @param card The card to test
* @param otherStack The stack to test
* @param mode Shows which color the other card should have
* @return True if it is the same card (under the given conditions), false otherwise
*/
|
Tests if the given card is above the same card as the top card on the other stack. "Same card" means same value and depending on the mode: Same color or same family
|
sameCardOnOtherStack
|
{
"repo_name": "NicolasNolmans/Simple-Solitaire-master",
"path": "app/src/main/java/be/kuleuven/drsolitaire/games/Game.java",
"license": "gpl-3.0",
"size": 34064
}
|
[
"be.kuleuven.drsolitaire.classes.Card",
"be.kuleuven.drsolitaire.classes.Stack"
] |
import be.kuleuven.drsolitaire.classes.Card; import be.kuleuven.drsolitaire.classes.Stack;
|
import be.kuleuven.drsolitaire.classes.*;
|
[
"be.kuleuven.drsolitaire"
] |
be.kuleuven.drsolitaire;
| 861,796
|
@StringRes
private int getBleLocMessageResource(Set<ExposureNotificationStatus> statusSet) {
if (statusSet.contains(ExposureNotificationStatus.LOCATION_DISABLED)
&& (statusSet.contains(ExposureNotificationStatus.BLUETOOTH_DISABLED)
|| statusSet.contains(ExposureNotificationStatus.BLUETOOTH_SUPPORT_UNKNOWN))) {
return R.string.updated_bluetooth_location_state_notification;
} else if (statusSet.contains(ExposureNotificationStatus.BLUETOOTH_DISABLED)
|| statusSet.contains(ExposureNotificationStatus.BLUETOOTH_SUPPORT_UNKNOWN)) {
return R.string.updated_bluetooth_state_notification;
} else if (statusSet.contains(ExposureNotificationStatus.LOCATION_DISABLED)) {
return R.string.updated_location_state_notification;
} else {
return ResourcesCompat.ID_NULL;
}
}
|
int function(Set<ExposureNotificationStatus> statusSet) { if (statusSet.contains(ExposureNotificationStatus.LOCATION_DISABLED) && (statusSet.contains(ExposureNotificationStatus.BLUETOOTH_DISABLED) statusSet.contains(ExposureNotificationStatus.BLUETOOTH_SUPPORT_UNKNOWN))) { return R.string.updated_bluetooth_location_state_notification; } else if (statusSet.contains(ExposureNotificationStatus.BLUETOOTH_DISABLED) statusSet.contains(ExposureNotificationStatus.BLUETOOTH_SUPPORT_UNKNOWN)) { return R.string.updated_bluetooth_state_notification; } else if (statusSet.contains(ExposureNotificationStatus.LOCATION_DISABLED)) { return R.string.updated_location_state_notification; } else { return ResourcesCompat.ID_NULL; } }
|
/**
* Return the correct edge-case string resource id depending on the current statusSet
*/
|
Return the correct edge-case string resource id depending on the current statusSet
|
getBleLocMessageResource
|
{
"repo_name": "google/exposure-notifications-android",
"path": "app/src/main/java/com/google/android/apps/exposurenotification/nearby/StateUpdatedWorker.java",
"license": "apache-2.0",
"size": 18891
}
|
[
"androidx.core.content.res.ResourcesCompat",
"com.google.android.gms.nearby.exposurenotification.ExposureNotificationStatus",
"java.util.Set"
] |
import androidx.core.content.res.ResourcesCompat; import com.google.android.gms.nearby.exposurenotification.ExposureNotificationStatus; import java.util.Set;
|
import androidx.core.content.res.*; import com.google.android.gms.nearby.exposurenotification.*; import java.util.*;
|
[
"androidx.core",
"com.google.android",
"java.util"
] |
androidx.core; com.google.android; java.util;
| 2,662,827
|
public static List<Tag> convertToList(Collection<TagDto> tagDtos) {
if (tagDtos == null) {
return new ArrayList<>();
}
return tagDtos.stream().map(TagConverter::convert).collect(Collectors.toList());
}
|
static List<Tag> function(Collection<TagDto> tagDtos) { if (tagDtos == null) { return new ArrayList<>(); } return tagDtos.stream().map(TagConverter::convert).collect(Collectors.toList()); }
|
/**
* Converts a List of TagDtos to a List of Tags
*
* @param tagDtos
* @return tags
*/
|
Converts a List of TagDtos to a List of Tags
|
convertToList
|
{
"repo_name": "chr-krenn/chr-krenn-fhj-ws2016-sd14-pse",
"path": "backend/backend-impl/src/main/java/at/fhj/swd14/pse/tag/TagConverter.java",
"license": "mit",
"size": 1487
}
|
[
"java.util.ArrayList",
"java.util.Collection",
"java.util.List",
"java.util.stream.Collectors"
] |
import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.stream.Collectors;
|
import java.util.*; import java.util.stream.*;
|
[
"java.util"
] |
java.util;
| 2,536,006
|
public final void testGetAlgParameters01() throws IOException {
boolean performed = false;
for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
try {
EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
EncryptedPrivateKeyInfoData
.getValidEncryptedPrivateKeyInfoEncoding(
EncryptedPrivateKeyInfoData.algName0[i][0]));
AlgorithmParameters apar = epki.getAlgParameters();
if (apar == null) {
continue;
}
// check that method under test returns
// parameters with the same encoded form
assertTrue(Arrays
.equals(
EncryptedPrivateKeyInfoData
.getParametersEncoding(EncryptedPrivateKeyInfoData.algName0[i][0]),
apar.getEncoded()));
performed = true;
} catch (NoSuchAlgorithmException allowedFailure) {
}
}
assertTrue("Test not performed", performed);
}
|
final void function() throws IOException { boolean performed = false; for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) { try { EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo( EncryptedPrivateKeyInfoData .getValidEncryptedPrivateKeyInfoEncoding( EncryptedPrivateKeyInfoData.algName0[i][0])); AlgorithmParameters apar = epki.getAlgParameters(); if (apar == null) { continue; } assertTrue(Arrays .equals( EncryptedPrivateKeyInfoData .getParametersEncoding(EncryptedPrivateKeyInfoData.algName0[i][0]), apar.getEncoded())); performed = true; } catch (NoSuchAlgorithmException allowedFailure) { } } assertTrue(STR, performed); }
|
/**
* Test #1 for <code>getAlgParameters()</code> method <br>
* Assertion: returns the algorithm parameters <br>
* Test preconditions: test object created using ctor which takes encoded
* form as the only parameter; encoded form passed contains algorithm
* parameters encoding <br>
* Expected: corresponding algorithm parameters must be returned
*
* @throws IOException
*/
|
Test #1 for <code>getAlgParameters()</code> method Assertion: returns the algorithm parameters Test preconditions: test object created using ctor which takes encoded form as the only parameter; encoded form passed contains algorithm parameters encoding Expected: corresponding algorithm parameters must be returned
|
testGetAlgParameters01
|
{
"repo_name": "skyHALud/codenameone",
"path": "Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/classlib/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/EncryptedPrivateKeyInfoTest.java",
"license": "gpl-2.0",
"size": 87618
}
|
[
"java.io.IOException",
"java.security.AlgorithmParameters",
"java.security.NoSuchAlgorithmException",
"java.util.Arrays",
"javax.crypto.EncryptedPrivateKeyInfo",
"org.apache.harmony.crypto.tests.support.EncryptedPrivateKeyInfoData"
] |
import java.io.IOException; import java.security.AlgorithmParameters; import java.security.NoSuchAlgorithmException; import java.util.Arrays; import javax.crypto.EncryptedPrivateKeyInfo; import org.apache.harmony.crypto.tests.support.EncryptedPrivateKeyInfoData;
|
import java.io.*; import java.security.*; import java.util.*; import javax.crypto.*; import org.apache.harmony.crypto.tests.support.*;
|
[
"java.io",
"java.security",
"java.util",
"javax.crypto",
"org.apache.harmony"
] |
java.io; java.security; java.util; javax.crypto; org.apache.harmony;
| 1,913,377
|
public String getDPI(String fileName) throws Exception {
FileImageInputStream in = new FileImageInputStream(new File(fileName));
Iterator<ImageReader> iterator = ImageIO.getImageReaders(in);
ImageReader reader = iterator.next();
reader.setInput(in);
IIOMetadata data = reader.getImageMetadata(0);
// metadata format names are: javax_imageio_jpeg_image_1.0 or
// javax_imageio_1.0
Element tree = (Element) data.getAsTree("javax_imageio_jpeg_image_1.0");
Element jfif = (Element) tree.getElementsByTagName("app0JFIF").item(0);
String dpiX = jfif.getAttribute("Xdensity");
// String dpiY = jfif.getAttribute("Ydensity");
return dpiX;
}
public static class PictureResizer {
final Picture _picture;
final Sheet _sheet;
final float _pw;
final float _ph;
int col, row;
CreationHelper helper;
int dpi;
public PictureResizer(Sheet sheet, Picture picture, int row, int col, CreationHelper helper) {
this(sheet, picture, row, col, null, helper);
}
public PictureResizer(Sheet sheet, Picture picture, int row, int col, String _dpi, CreationHelper helper) {
_picture = picture;
_sheet = sheet;
this.dpi = _dpi != null ? StringUtils.toInt(_dpi) : 96;
this.row = row;
this.col = col;
this.helper = helper;
org.apache.poi.ss.usermodel.Font defaultFont = sheet.getWorkbook().getFontAt((short) 0);
Font font = new Font(defaultFont.getFontName(), Font.PLAIN, defaultFont.getFontHeightInPoints());
FontMetrics fontMetrics = new Label().getFontMetrics(font);
int div = dpi == 96 ? 72 : 40;
// width of the default character in pixels at 96 dpi
_pw = (float) fontMetrics.charWidth('0') * dpi / div;
// height of the default character in pixels at 96 dpi
// (if the row has a medium or thick top border, or if any
// the current row has a thick bottom border then the row
_ph = (float) (fontMetrics.getMaxAscent() + fontMetrics.getMaxDescent() + 0.75) * dpi / div;
}
// private float getColumnWidthInPixels(int column) {
//
// int cw = _sheet.getColumnWidth(column);
// return _pw * cw / 256;
// }
// @SuppressWarnings("unused")
// private float getRowHeightInPixels(int i) {
//
// Row row = _sheet.getRow(i);
// float height;
// if (row != null)
// height = row.getHeight();
// else
// height = _sheet.getDefaultRowHeight();
//
// return height / 255 * _ph;
// }
|
String function(String fileName) throws Exception { FileImageInputStream in = new FileImageInputStream(new File(fileName)); Iterator<ImageReader> iterator = ImageIO.getImageReaders(in); ImageReader reader = iterator.next(); reader.setInput(in); IIOMetadata data = reader.getImageMetadata(0); Element tree = (Element) data.getAsTree(STR); Element jfif = (Element) tree.getElementsByTagName(STR).item(0); String dpiX = jfif.getAttribute(STR); return dpiX; } public static class PictureResizer { final Picture _picture; final Sheet _sheet; final float _pw; final float _ph; int col, row; CreationHelper helper; int dpi; public PictureResizer(Sheet sheet, Picture picture, int row, int col, CreationHelper helper) { this(sheet, picture, row, col, null, helper); } public PictureResizer(Sheet sheet, Picture picture, int row, int col, String _dpi, CreationHelper helper) { _picture = picture; _sheet = sheet; this.dpi = _dpi != null ? StringUtils.toInt(_dpi) : 96; this.row = row; this.col = col; this.helper = helper; org.apache.poi.ss.usermodel.Font defaultFont = sheet.getWorkbook().getFontAt((short) 0); Font font = new Font(defaultFont.getFontName(), Font.PLAIN, defaultFont.getFontHeightInPoints()); FontMetrics fontMetrics = new Label().getFontMetrics(font); int div = dpi == 96 ? 72 : 40; _pw = (float) fontMetrics.charWidth('0') * dpi / div; _ph = (float) (fontMetrics.getMaxAscent() + fontMetrics.getMaxDescent() + 0.75) * dpi / div; }
|
/**
* Obtener el DPI de una imagen
*
* @param fileName
* @return
* @throws Exception
*/
|
Obtener el DPI de una imagen
|
getDPI
|
{
"repo_name": "rranz/meccano4j_vaadin",
"path": "javalego/javalego_office/src/main/java/com/javalego/poi/report/ExcelWorkbookXSSF.java",
"license": "gpl-3.0",
"size": 58313
}
|
[
"com.javalego.util.StringUtils",
"java.awt.Font",
"java.awt.FontMetrics",
"java.awt.Label",
"java.io.File",
"java.util.Iterator",
"javax.imageio.ImageIO",
"javax.imageio.ImageReader",
"javax.imageio.metadata.IIOMetadata",
"javax.imageio.stream.FileImageInputStream",
"org.apache.poi.ss.usermodel.CreationHelper",
"org.apache.poi.ss.usermodel.Picture",
"org.apache.poi.ss.usermodel.Sheet",
"org.w3c.dom.Element"
] |
import com.javalego.util.StringUtils; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Label; import java.io.File; import java.util.Iterator; import javax.imageio.ImageIO; import javax.imageio.ImageReader; import javax.imageio.metadata.IIOMetadata; import javax.imageio.stream.FileImageInputStream; import org.apache.poi.ss.usermodel.CreationHelper; import org.apache.poi.ss.usermodel.Picture; import org.apache.poi.ss.usermodel.Sheet; import org.w3c.dom.Element;
|
import com.javalego.util.*; import java.awt.*; import java.io.*; import java.util.*; import javax.imageio.*; import javax.imageio.metadata.*; import javax.imageio.stream.*; import org.apache.poi.ss.usermodel.*; import org.w3c.dom.*;
|
[
"com.javalego.util",
"java.awt",
"java.io",
"java.util",
"javax.imageio",
"org.apache.poi",
"org.w3c.dom"
] |
com.javalego.util; java.awt; java.io; java.util; javax.imageio; org.apache.poi; org.w3c.dom;
| 1,876,986
|
public Color getSundayForeground() {
return dayChooser.getSundayForeground();
}
|
Color function() { return dayChooser.getSundayForeground(); }
|
/**
* Returns the Sunday foreground.
*
* @return Color the Sunday foreground.
*/
|
Returns the Sunday foreground
|
getSundayForeground
|
{
"repo_name": "freeplane/freeplane",
"path": "freeplane/src/main/java/org/freeplane/core/ui/components/calendar/JCalendar.java",
"license": "gpl-2.0",
"size": 17605
}
|
[
"java.awt.Color"
] |
import java.awt.Color;
|
import java.awt.*;
|
[
"java.awt"
] |
java.awt;
| 94,510
|
@Override
public String getGroupSecurityName(String uniqueGroupId) throws CustomRegistryException, EntryNotFoundException {
String s, grpSecName = null;
BufferedReader in = null;
try {
in = fileOpen(GROUPFILENAME);
while ((s = in.readLine()) != null) {
if (!(s.startsWith("#") || s.trim().length() <= 0)) {
int index = s.indexOf(":");
int index1 = s.indexOf(":", index + 1);
if ((s.substring(index + 1, index1)).equals(uniqueGroupId)) {
grpSecName = s.substring(0, index);
break;
}
}
}
} catch (Exception ex) {
throw new CustomRegistryException(ex.getMessage(), ex);
} finally {
fileClose(in);
}
if (grpSecName == null) {
EntryNotFoundException ex = new EntryNotFoundException("Cannot obtain the group security name for:" + uniqueGroupId);
throw ex;
}
return grpSecName;
}
|
String function(String uniqueGroupId) throws CustomRegistryException, EntryNotFoundException { String s, grpSecName = null; BufferedReader in = null; try { in = fileOpen(GROUPFILENAME); while ((s = in.readLine()) != null) { if (!(s.startsWith("#") s.trim().length() <= 0)) { int index = s.indexOf(":"); int index1 = s.indexOf(":", index + 1); if ((s.substring(index + 1, index1)).equals(uniqueGroupId)) { grpSecName = s.substring(0, index); break; } } } } catch (Exception ex) { throw new CustomRegistryException(ex.getMessage(), ex); } finally { fileClose(in); } if (grpSecName == null) { EntryNotFoundException ex = new EntryNotFoundException(STR + uniqueGroupId); throw ex; } return grpSecName; }
|
/**
* Returns the name for a group given its unique ID.
*
* @param uniqueGroupId the unique ID of the group.
* @return The name of the group.
* @exception EntryNotFoundException if the uniqueGroupId does
* not exist.
* @exception CustomRegistryException if there is any registry-
* specific problem
**/
|
Returns the name for a group given its unique ID
|
getGroupSecurityName
|
{
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.security.registry_test.custom/src/com/ibm/ws/security/registry/custom/sample/FileRegistrySample.java",
"license": "epl-1.0",
"size": 41525
}
|
[
"com.ibm.websphere.security.CustomRegistryException",
"com.ibm.websphere.security.EntryNotFoundException",
"java.io.BufferedReader"
] |
import com.ibm.websphere.security.CustomRegistryException; import com.ibm.websphere.security.EntryNotFoundException; import java.io.BufferedReader;
|
import com.ibm.websphere.security.*; import java.io.*;
|
[
"com.ibm.websphere",
"java.io"
] |
com.ibm.websphere; java.io;
| 764,821
|
public WebhookCreateParameters withCustomHeaders(Map<String, String> customHeaders) {
if (this.innerProperties() == null) {
this.innerProperties = new WebhookPropertiesCreateParameters();
}
this.innerProperties().withCustomHeaders(customHeaders);
return this;
}
|
WebhookCreateParameters function(Map<String, String> customHeaders) { if (this.innerProperties() == null) { this.innerProperties = new WebhookPropertiesCreateParameters(); } this.innerProperties().withCustomHeaders(customHeaders); return this; }
|
/**
* Set the customHeaders property: Custom headers that will be added to the webhook notifications.
*
* @param customHeaders the customHeaders value to set.
* @return the WebhookCreateParameters object itself.
*/
|
Set the customHeaders property: Custom headers that will be added to the webhook notifications
|
withCustomHeaders
|
{
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-containerregistry/src/main/java/com/azure/resourcemanager/containerregistry/models/WebhookCreateParameters.java",
"license": "mit",
"size": 7710
}
|
[
"com.azure.resourcemanager.containerregistry.fluent.models.WebhookPropertiesCreateParameters",
"java.util.Map"
] |
import com.azure.resourcemanager.containerregistry.fluent.models.WebhookPropertiesCreateParameters; import java.util.Map;
|
import com.azure.resourcemanager.containerregistry.fluent.models.*; import java.util.*;
|
[
"com.azure.resourcemanager",
"java.util"
] |
com.azure.resourcemanager; java.util;
| 342,538
|
Element createDomImpl(Renderable element);
|
Element createDomImpl(Renderable element);
|
/**
* Creates a blank DOMImpl corresponding this node.
*
* @param element the implementor of this method may optionally call some of
* the setters
*/
|
Creates a blank DOMImpl corresponding this node
|
createDomImpl
|
{
"repo_name": "gburd/wave",
"path": "src/org/waveprotocol/wave/client/editor/content/Renderer.java",
"license": "apache-2.0",
"size": 3133
}
|
[
"com.google.gwt.dom.client.Element"
] |
import com.google.gwt.dom.client.Element;
|
import com.google.gwt.dom.client.*;
|
[
"com.google.gwt"
] |
com.google.gwt;
| 1,653,654
|
public TimelineDomains getDomains(String owner,
UserGroupInformation callerUGI) throws YarnException, IOException {
long startTime = Time.monotonicNow();
metrics.incrGetDomainsOps();
try {
TimelineDomains domains = doGetDomains(owner, callerUGI);
metrics.incrGetDomainsTotal(domains.getDomains().size());
return domains;
} finally {
metrics.addGetDomainsTime(Time.monotonicNow() - startTime);
}
}
|
TimelineDomains function(String owner, UserGroupInformation callerUGI) throws YarnException, IOException { long startTime = Time.monotonicNow(); metrics.incrGetDomainsOps(); try { TimelineDomains domains = doGetDomains(owner, callerUGI); metrics.incrGetDomainsTotal(domains.getDomains().size()); return domains; } finally { metrics.addGetDomainsTime(Time.monotonicNow() - startTime); } }
|
/**
* Get all the domains that belong to the given owner. If callerUGI is not
* the owner or the admin of the domain, empty list is going to be returned.
*/
|
Get all the domains that belong to the given owner. If callerUGI is not the owner or the admin of the domain, empty list is going to be returned
|
getDomains
|
{
"repo_name": "apurtell/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/TimelineDataManager.java",
"license": "apache-2.0",
"size": 17328
}
|
[
"java.io.IOException",
"org.apache.hadoop.security.UserGroupInformation",
"org.apache.hadoop.util.Time",
"org.apache.hadoop.yarn.api.records.timeline.TimelineDomains",
"org.apache.hadoop.yarn.exceptions.YarnException"
] |
import java.io.IOException; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.util.Time; import org.apache.hadoop.yarn.api.records.timeline.TimelineDomains; import org.apache.hadoop.yarn.exceptions.YarnException;
|
import java.io.*; import org.apache.hadoop.security.*; import org.apache.hadoop.util.*; import org.apache.hadoop.yarn.api.records.timeline.*; import org.apache.hadoop.yarn.exceptions.*;
|
[
"java.io",
"org.apache.hadoop"
] |
java.io; org.apache.hadoop;
| 1,865,424
|
public static boolean hasPermissions(@NonNull Context context,
@Size(min = 1) @NonNull String... perms) {
// Always return true for SDK < M, let the system deal with the permissions
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
Log.w(TAG, "hasPermissions: API version < M, returning true by default");
// DANGER ZONE!!! Changing this will break the library.
return true;
}
// Null context may be passed if we have detected Low API (less than M) so getting
// to this point with a null context should not be possible.
if (context == null) {
throw new IllegalArgumentException("Can't check permissions for null context");
}
for (String perm : perms) {
if (ContextCompat.checkSelfPermission(context, perm)
!= PackageManager.PERMISSION_GRANTED) {
return false;
}
}
return true;
}
|
static boolean function(@NonNull Context context, @Size(min = 1) @NonNull String... perms) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { Log.w(TAG, STR); return true; } if (context == null) { throw new IllegalArgumentException(STR); } for (String perm : perms) { if (ContextCompat.checkSelfPermission(context, perm) != PackageManager.PERMISSION_GRANTED) { return false; } } return true; }
|
/**
* Check if the calling context has a set of permissions.
*
* @param context the calling context.
* @param perms one ore more permissions, such as {@link Manifest.permission#CAMERA}.
* @return true if all permissions are already granted, false if at least one permission is not
* yet granted.
* @see Manifest.permission
*/
|
Check if the calling context has a set of permissions
|
hasPermissions
|
{
"repo_name": "SUPERCILEX/easypermissions",
"path": "easypermissions/src/main/java/pub/devrel/easypermissions/EasyPermissions.java",
"license": "apache-2.0",
"size": 18907
}
|
[
"android.content.Context",
"android.content.pm.PackageManager",
"android.os.Build",
"android.support.annotation.NonNull",
"android.support.annotation.Size",
"android.support.v4.content.ContextCompat",
"android.util.Log"
] |
import android.content.Context; import android.content.pm.PackageManager; import android.os.Build; import android.support.annotation.NonNull; import android.support.annotation.Size; import android.support.v4.content.ContextCompat; import android.util.Log;
|
import android.content.*; import android.content.pm.*; import android.os.*; import android.support.annotation.*; import android.support.v4.content.*; import android.util.*;
|
[
"android.content",
"android.os",
"android.support",
"android.util"
] |
android.content; android.os; android.support; android.util;
| 273,557
|
public static Map<String, String> toMap(final String[] values, final String separator,
final boolean allowValuelessKeys, final String defaultValue,
final boolean allowMultipleSeparators) {
final Map<String, String> map = new LinkedHashMap<String, String>();
if (values == null || values.length < 1) {
return map;
}
for (final String value : values) {
final String[] tmp = StringUtils.split(value, separator, allowMultipleSeparators ? 2 : -1);
if(tmp.length == 1 && allowValuelessKeys) {
if(StringUtils.startsWith(value, separator)) {
// Skip keyless values
continue;
}
map.put(tmp[0], defaultValue);
} else if (tmp.length == 2) {
map.put(tmp[0], tmp[1]);
}
}
return map;
}
|
static Map<String, String> function(final String[] values, final String separator, final boolean allowValuelessKeys, final String defaultValue, final boolean allowMultipleSeparators) { final Map<String, String> map = new LinkedHashMap<String, String>(); if (values == null values.length < 1) { return map; } for (final String value : values) { final String[] tmp = StringUtils.split(value, separator, allowMultipleSeparators ? 2 : -1); if(tmp.length == 1 && allowValuelessKeys) { if(StringUtils.startsWith(value, separator)) { continue; } map.put(tmp[0], defaultValue); } else if (tmp.length == 2) { map.put(tmp[0], tmp[1]); } } return map; }
|
/**
* Util for parsing Arrays of Service properties in the form >value<>separator<>value<
*
* If a value is missing from a key/value pair, the entry is rejected only if allowValuelessKyes is false.
* To keep the valueless keys pass in allowValuelessKeys => true
*
* *
* @param values Array of key/value pairs in the format => [ a<separator>b, x<separator>y ] ... ex. ["dog:woof", "cat:meow"]
* @param separator separator between the values
* @param allowValuelessKeys true is keys are allowed without associated values
* @param defaultValue default value to use if a value for a key is not present and allowValuelessKeys is true
* @param allowMultipleSeparators if true, multiple separators are allowed per entry in which case only the first is considered.
* If false, entries with multiple separators are considered invalid
* @return
*/
|
Util for parsing Arrays of Service properties in the form >value<>separator<>value< If a value is missing from a key/value pair, the entry is rejected only if allowValuelessKyes is false. To keep the valueless keys pass in allowValuelessKeys => true
|
toMap
|
{
"repo_name": "TKELuke/acs-aem-commons",
"path": "bundle/src/main/java/com/adobe/acs/commons/util/OsgiPropertyUtil.java",
"license": "apache-2.0",
"size": 6626
}
|
[
"java.util.LinkedHashMap",
"java.util.Map",
"org.apache.commons.lang.StringUtils"
] |
import java.util.LinkedHashMap; import java.util.Map; import org.apache.commons.lang.StringUtils;
|
import java.util.*; import org.apache.commons.lang.*;
|
[
"java.util",
"org.apache.commons"
] |
java.util; org.apache.commons;
| 1,021,787
|
private String createJobInfo(CalendarEventEntry event, JobDetail job) {
if (job == null) {
return "SchedulerJob [null]";
}
StringBuffer sb = new StringBuffer();
sb.append("SchedulerJob [jobKey=").append(job.getKey().getName());
sb.append(", jobGroup=").append(job.getKey().getGroup());
try {
List<? extends Trigger> triggers = scheduler.getTriggersOfJob(job.getKey());
sb.append(", ").append(triggers.size()).append(" triggers=[");
int maxTriggerLogs = 24;
for (int triggerIndex = 0; triggerIndex < triggers.size() && triggerIndex < maxTriggerLogs; triggerIndex++) {
Trigger trigger = triggers.get(triggerIndex);
sb.append(trigger.getStartTime());
if (triggerIndex < triggers.size() - 1 && triggerIndex < maxTriggerLogs - 1) {
sb.append(", ");
}
}
if (triggers.size() >= maxTriggerLogs) {
sb.append(" and ").append(triggers.size() - maxTriggerLogs).append(" more ...");
}
if (triggers.size() == 0) {
sb.append("there are no triggers - probably the event lies in the past");
}
}
catch (SchedulerException e) {
}
sb.append("], content=").append(event.getPlainTextContent());
return sb.toString();
}
class CalendarEventContent {
String startCommands = "";
String endCommands = "";
String modifiedByEvent = "";
}
|
String function(CalendarEventEntry event, JobDetail job) { if (job == null) { return STR; } StringBuffer sb = new StringBuffer(); sb.append(STR).append(job.getKey().getName()); sb.append(STR).append(job.getKey().getGroup()); try { List<? extends Trigger> triggers = scheduler.getTriggersOfJob(job.getKey()); sb.append(STR).append(triggers.size()).append(STR); int maxTriggerLogs = 24; for (int triggerIndex = 0; triggerIndex < triggers.size() && triggerIndex < maxTriggerLogs; triggerIndex++) { Trigger trigger = triggers.get(triggerIndex); sb.append(trigger.getStartTime()); if (triggerIndex < triggers.size() - 1 && triggerIndex < maxTriggerLogs - 1) { sb.append(STR); } } if (triggers.size() >= maxTriggerLogs) { sb.append(STR).append(triggers.size() - maxTriggerLogs).append(STR); } if (triggers.size() == 0) { sb.append(STR); } } catch (SchedulerException e) { } sb.append(STR).append(event.getPlainTextContent()); return sb.toString(); } class CalendarEventContent { String startCommands = STRSTR"; }
|
/**
* Creates a detailed description of a <code>job</code> for logging purpose.
*
* @param job the job to create a detailed description for
* @return a detailed description of the new <code>job</code>
*/
|
Creates a detailed description of a <code>job</code> for logging purpose
|
createJobInfo
|
{
"repo_name": "abrenk/openhab",
"path": "bundles/io/org.openhab.io.gcal/src/main/java/org/openhab/io/gcal/internal/GCalEventDownloader.java",
"license": "epl-1.0",
"size": 19174
}
|
[
"com.google.gdata.data.calendar.CalendarEventEntry",
"java.util.List",
"org.quartz.JobDetail",
"org.quartz.SchedulerException",
"org.quartz.Trigger"
] |
import com.google.gdata.data.calendar.CalendarEventEntry; import java.util.List; import org.quartz.JobDetail; import org.quartz.SchedulerException; import org.quartz.Trigger;
|
import com.google.gdata.data.calendar.*; import java.util.*; import org.quartz.*;
|
[
"com.google.gdata",
"java.util",
"org.quartz"
] |
com.google.gdata; java.util; org.quartz;
| 2,027,867
|
private List<Project.NameKey> getChildrenForReparenting(ProjectState parent) throws Exception {
final List<Project.NameKey> childProjects = new ArrayList<>();
final List<Project.NameKey> excluded = new ArrayList<>(excludedChildren.size());
for (ProjectState excludedChild : excludedChildren) {
excluded.add(excludedChild.getProject().getNameKey());
}
final List<Project.NameKey> automaticallyExcluded = new ArrayList<>(excludedChildren.size());
if (newParentKey != null) {
automaticallyExcluded.addAll(getAllParents(newParentKey));
}
for (ProjectInfo child : listChildProjects.apply(new ProjectResource(parent, user)).value()) {
final Project.NameKey childName = Project.nameKey(child.name);
if (!excluded.contains(childName)) {
if (!automaticallyExcluded.contains(childName)) {
childProjects.add(childName);
} else {
stdout.println(
"Automatically excluded '"
+ childName
+ "' "
+ "from reparenting because it is in the parent "
+ "line of the new parent '"
+ newParentKey
+ "'.");
}
}
}
return childProjects;
}
|
List<Project.NameKey> function(ProjectState parent) throws Exception { final List<Project.NameKey> childProjects = new ArrayList<>(); final List<Project.NameKey> excluded = new ArrayList<>(excludedChildren.size()); for (ProjectState excludedChild : excludedChildren) { excluded.add(excludedChild.getProject().getNameKey()); } final List<Project.NameKey> automaticallyExcluded = new ArrayList<>(excludedChildren.size()); if (newParentKey != null) { automaticallyExcluded.addAll(getAllParents(newParentKey)); } for (ProjectInfo child : listChildProjects.apply(new ProjectResource(parent, user)).value()) { final Project.NameKey childName = Project.nameKey(child.name); if (!excluded.contains(childName)) { if (!automaticallyExcluded.contains(childName)) { childProjects.add(childName); } else { stdout.println( STR + childName + STR + STR + STR + newParentKey + "'."); } } } return childProjects; }
|
/**
* Returns the children of the specified parent project that should be reparented. The returned
* list of child projects does not contain projects that were specified to be excluded from
* reparenting.
*/
|
Returns the children of the specified parent project that should be reparented. The returned list of child projects does not contain projects that were specified to be excluded from reparenting
|
getChildrenForReparenting
|
{
"repo_name": "GerritCodeReview/gerrit",
"path": "java/com/google/gerrit/sshd/commands/SetParentCommand.java",
"license": "apache-2.0",
"size": 7047
}
|
[
"com.google.gerrit.entities.Project",
"com.google.gerrit.extensions.common.ProjectInfo",
"com.google.gerrit.server.project.ProjectResource",
"com.google.gerrit.server.project.ProjectState",
"java.util.ArrayList",
"java.util.List"
] |
import com.google.gerrit.entities.Project; import com.google.gerrit.extensions.common.ProjectInfo; import com.google.gerrit.server.project.ProjectResource; import com.google.gerrit.server.project.ProjectState; import java.util.ArrayList; import java.util.List;
|
import com.google.gerrit.entities.*; import com.google.gerrit.extensions.common.*; import com.google.gerrit.server.project.*; import java.util.*;
|
[
"com.google.gerrit",
"java.util"
] |
com.google.gerrit; java.util;
| 480,996
|
public boolean isSubclassOf(@NonNull ClassNode classNode, @NonNull String superClassName) {
if (superClassName.equals(classNode.superName)) {
return true;
}
if (mCurrentProject != null) {
Boolean isSub = mClient.isSubclassOf(mCurrentProject, classNode.name, superClassName);
if (isSub != null) {
return isSub;
}
}
String className = classNode.name;
while (className != null) {
if (className.equals(superClassName)) {
return true;
}
className = getSuperClass(className);
}
return false;
}
|
boolean function(@NonNull ClassNode classNode, @NonNull String superClassName) { if (superClassName.equals(classNode.superName)) { return true; } if (mCurrentProject != null) { Boolean isSub = mClient.isSubclassOf(mCurrentProject, classNode.name, superClassName); if (isSub != null) { return isSub; } } String className = classNode.name; while (className != null) { if (className.equals(superClassName)) { return true; } className = getSuperClass(className); } return false; }
|
/**
* Returns true if the given class is a subclass of the given super class.
*
* @param classNode the class to check whether it is a subclass of the given
* super class name
* @param superClassName the fully qualified super class name (in VM format,
* e.g. java/lang/Integer, not java.lang.Integer.
* @return true if the given class is a subclass of the given super class
*/
|
Returns true if the given class is a subclass of the given super class
|
isSubclassOf
|
{
"repo_name": "consulo/consulo-android",
"path": "tools-base/lint/libs/lint-api/src/main/java/com/android/tools/lint/client/api/LintDriver.java",
"license": "apache-2.0",
"size": 97510
}
|
[
"com.android.annotations.NonNull",
"org.objectweb.asm.tree.ClassNode"
] |
import com.android.annotations.NonNull; import org.objectweb.asm.tree.ClassNode;
|
import com.android.annotations.*; import org.objectweb.asm.tree.*;
|
[
"com.android.annotations",
"org.objectweb.asm"
] |
com.android.annotations; org.objectweb.asm;
| 353,591
|
@Override
public int getBootLoaderState() {
try {
Log.v(TAG, "Getting bootloader lock state with " + queryCommand);
int lockResult = superUserCommandWithByteResult(queryCommand);
Log.v(TAG, "Got lock value " + lockResult);
Log.v(TAG, "Getting bootloader tamper flag with " + queryTamperCommand);
int tamperResult = superUserCommandWithByteResult(queryTamperCommand);
Log.v(TAG, "Got tamper flag " + tamperResult);
if (lockResult == 0) {
if (tamperResult == 0) {
return BL_LOCKED;
} else {
return BL_TAMPERED_LOCKED;
}
} else if (lockResult == 1) {
if (tamperResult == 0) {
return BL_UNLOCKED;
} else {
return BL_TAMPERED_UNLOCKED;
}
} else {
return BL_UNKNOWN;
}
} catch (IOException e) {
Log.v(TAG, "Caught IOException while querying: " + e);
return BL_UNKNOWN;
}
}
|
int function() { try { Log.v(TAG, STR + queryCommand); int lockResult = superUserCommandWithByteResult(queryCommand); Log.v(TAG, STR + lockResult); Log.v(TAG, STR + queryTamperCommand); int tamperResult = superUserCommandWithByteResult(queryTamperCommand); Log.v(TAG, STR + tamperResult); if (lockResult == 0) { if (tamperResult == 0) { return BL_LOCKED; } else { return BL_TAMPERED_LOCKED; } } else if (lockResult == 1) { if (tamperResult == 0) { return BL_UNLOCKED; } else { return BL_TAMPERED_UNLOCKED; } } else { return BL_UNKNOWN; } } catch (IOException e) { Log.v(TAG, STR + e); return BL_UNKNOWN; } }
|
/**
* Finds out if the bootloader is unlocked and if the tamper flag is set
*/
|
Finds out if the bootloader is unlocked and if the tamper flag is set
|
getBootLoaderState
|
{
"repo_name": "segv11/boot-unlocker",
"path": "app/src/main/java/net/segv11/bootunlocker/bootLoader_OnePlusX.java",
"license": "apache-2.0",
"size": 4853
}
|
[
"android.util.Log",
"java.io.IOException"
] |
import android.util.Log; import java.io.IOException;
|
import android.util.*; import java.io.*;
|
[
"android.util",
"java.io"
] |
android.util; java.io;
| 464,732
|
@XWalkAPI
public boolean onNewIntent(Intent intent) {
if (mContent == null) return false;
if (mExternalExtensionManager != null) {
mExternalExtensionManager.onNewIntent(intent);
}
return mContent.onNewIntent(intent);
}
|
boolean function(Intent intent) { if (mContent == null) return false; if (mExternalExtensionManager != null) { mExternalExtensionManager.onNewIntent(intent); } return mContent.onNewIntent(intent); }
|
/**
* Pass through intents to XWalkViewInternal. Many internal facilities need this
* to receive the intents like web notification. See
* <a href="http://developer.android.com/reference/android/app/Activity.html">
* android.app.Activity.onNewIntent()</a>.
* @param intent passed from android.app.Activity.onNewIntent().
* @since 1.0
*/
|
Pass through intents to XWalkViewInternal. Many internal facilities need this to receive the intents like web notification. See android.app.Activity.onNewIntent()
|
onNewIntent
|
{
"repo_name": "marcuspridham/crosswalk",
"path": "runtime/android/core_internal/src/org/xwalk/core/internal/XWalkViewInternal.java",
"license": "bsd-3-clause",
"size": 52802
}
|
[
"android.content.Intent"
] |
import android.content.Intent;
|
import android.content.*;
|
[
"android.content"
] |
android.content;
| 751,768
|
public ServiceFuture<ManagedClusterUpgradeProfileInner> getUpgradeProfileAsync(String resourceGroupName, String resourceName, final ServiceCallback<ManagedClusterUpgradeProfileInner> serviceCallback) {
return ServiceFuture.fromResponse(getUpgradeProfileWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback);
}
|
ServiceFuture<ManagedClusterUpgradeProfileInner> function(String resourceGroupName, String resourceName, final ServiceCallback<ManagedClusterUpgradeProfileInner> serviceCallback) { return ServiceFuture.fromResponse(getUpgradeProfileWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); }
|
/**
* Gets upgrade profile for a managed cluster.
* Gets the details of the upgrade profile for a managed cluster with a specified resource group and name.
*
* @param resourceGroupName The name of the resource group.
* @param resourceName The name of the managed cluster resource.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
|
Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name
|
getUpgradeProfileAsync
|
{
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/containerservice/mgmt-v2020_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2020_02_01/implementation/ManagedClustersInner.java",
"license": "mit",
"size": 143043
}
|
[
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] |
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
|
import com.microsoft.rest.*;
|
[
"com.microsoft.rest"
] |
com.microsoft.rest;
| 1,719,393
|
public KeyListener getKeyListener() {
return super.getKeyListeners()[0];
}
|
KeyListener function() { return super.getKeyListeners()[0]; }
|
/**
* Gets main key listener
* @return
*/
|
Gets main key listener
|
getKeyListener
|
{
"repo_name": "redpois0n/swing-terminal",
"path": "src/com/redpois0n/terminal/JTerminal.java",
"license": "gpl-3.0",
"size": 7630
}
|
[
"java.awt.event.KeyListener"
] |
import java.awt.event.KeyListener;
|
import java.awt.event.*;
|
[
"java.awt"
] |
java.awt;
| 708,824
|
public FadeAnimationTarget createFadeInTarget() {
transparentPanel.setSize(GlassPane.this.getSize());
return transparencyDecorator.createFadeIn(transparentPanel, fadeGlassPanePercent);
}
|
FadeAnimationTarget function() { transparentPanel.setSize(GlassPane.this.getSize()); return transparencyDecorator.createFadeIn(transparentPanel, fadeGlassPanePercent); }
|
/**
* create the fade in target
* @return
*/
|
create the fade in target
|
createFadeInTarget
|
{
"repo_name": "drichan/xito",
"path": "modules/dazzle/src/main/java/org/xito/dazzle/dialog/SheetDialog.java",
"license": "apache-2.0",
"size": 22240
}
|
[
"org.xito.dazzle.widget.TransparencyDecorator"
] |
import org.xito.dazzle.widget.TransparencyDecorator;
|
import org.xito.dazzle.widget.*;
|
[
"org.xito.dazzle"
] |
org.xito.dazzle;
| 2,354,728
|
public static void addPermission(Permission perm)
{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
addPermission(perm, loader);
}
|
static void function(Permission perm) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); addPermission(perm, loader); }
|
/**
* Adds a permission to the current environment.
*
* @param perm the permission to add.
*
* @return the old attribute value
*/
|
Adds a permission to the current environment
|
addPermission
|
{
"repo_name": "dwango/quercus",
"path": "src/main/java/com/caucho/loader/Environment.java",
"license": "gpl-2.0",
"size": 25883
}
|
[
"java.security.Permission"
] |
import java.security.Permission;
|
import java.security.*;
|
[
"java.security"
] |
java.security;
| 2,852,985
|
private static String nextBase64String(UniformRandomProvider rng, char[] out) {
// Process blocks of 6 bits as an index in the range 0-63
// for each base64 character.
// There are 16 samples per 3 ints (16 * 6 = 3 * 32 = 96 bits).
final int length = out.length;
// Run the loop without checking index i by producing characters
// up to the size below the desired length.
int index = 0;
for (int loopLimit = length / 16; loopLimit-- > 0;) {
final int i1 = rng.nextInt();
final int i2 = rng.nextInt();
final int i3 = rng.nextInt();
// 0x3F == 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20
// Extract 4 6-bit samples from the first 24 bits of each int
out[index++] = TABLE64[(i1 >>> 18) & 0x3F];
out[index++] = TABLE64[(i1 >>> 12) & 0x3F];
out[index++] = TABLE64[(i1 >>> 6) & 0x3F];
out[index++] = TABLE64[i1 & 0x3F];
out[index++] = TABLE64[(i2 >>> 18) & 0x3F];
out[index++] = TABLE64[(i2 >>> 12) & 0x3F];
out[index++] = TABLE64[(i2 >>> 6) & 0x3F];
out[index++] = TABLE64[i2 & 0x3F];
out[index++] = TABLE64[(i3 >>> 18) & 0x3F];
out[index++] = TABLE64[(i3 >>> 12) & 0x3F];
out[index++] = TABLE64[(i3 >>> 6) & 0x3F];
out[index++] = TABLE64[i3 & 0x3F];
// Combine the remaining 8-bits from each int
// to get 4 more samples
final int i4 = (i1 >>> 24) | ((i2 >>> 24) << 8) | ((i3 >>> 24) << 16);
out[index++] = TABLE64[(i4 >>> 18) & 0x3F];
out[index++] = TABLE64[(i4 >>> 12) & 0x3F];
out[index++] = TABLE64[(i4 >>> 6) & 0x3F];
out[index++] = TABLE64[i4 & 0x3F];
}
// The final characters
// For simplicity there are 5 samples per int (with two unused bits).
while (index < length) {
int i1 = rng.nextInt();
out[index++] = TABLE64[i1 & 0x3F];
for (int j = 0; j < 4 && index < length; j++) {
i1 >>>= 6;
out[index++] = TABLE64[i1 & 0x3F];
}
}
return new String(out);
}
|
static String function(UniformRandomProvider rng, char[] out) { final int length = out.length; int index = 0; for (int loopLimit = length / 16; loopLimit-- > 0;) { final int i1 = rng.nextInt(); final int i2 = rng.nextInt(); final int i3 = rng.nextInt(); out[index++] = TABLE64[(i1 >>> 18) & 0x3F]; out[index++] = TABLE64[(i1 >>> 12) & 0x3F]; out[index++] = TABLE64[(i1 >>> 6) & 0x3F]; out[index++] = TABLE64[i1 & 0x3F]; out[index++] = TABLE64[(i2 >>> 18) & 0x3F]; out[index++] = TABLE64[(i2 >>> 12) & 0x3F]; out[index++] = TABLE64[(i2 >>> 6) & 0x3F]; out[index++] = TABLE64[i2 & 0x3F]; out[index++] = TABLE64[(i3 >>> 18) & 0x3F]; out[index++] = TABLE64[(i3 >>> 12) & 0x3F]; out[index++] = TABLE64[(i3 >>> 6) & 0x3F]; out[index++] = TABLE64[i3 & 0x3F]; final int i4 = (i1 >>> 24) ((i2 >>> 24) << 8) ((i3 >>> 24) << 16); out[index++] = TABLE64[(i4 >>> 18) & 0x3F]; out[index++] = TABLE64[(i4 >>> 12) & 0x3F]; out[index++] = TABLE64[(i4 >>> 6) & 0x3F]; out[index++] = TABLE64[i4 & 0x3F]; } while (index < length) { int i1 = rng.nextInt(); out[index++] = TABLE64[i1 & 0x3F]; for (int j = 0; j < 4 && index < length; j++) { i1 >>>= 6; out[index++] = TABLE64[i1 & 0x3F]; } } return new String(out); }
|
/**
* Generate a random Base64 string of the given length.
*
* <p>The string uses MIME's Base64 table (A-Z, a-z, 0-9, +, /).
*
* @param rng Generator of uniformly distributed random numbers.
* @param out The output buffer.
* @return A random Base64 string.
* @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>
*/
|
Generate a random Base64 string of the given length. The string uses MIME's Base64 table (A-Z, a-z, 0-9, +, /)
|
nextBase64String
|
{
"repo_name": "aherbert/GDSC-Core",
"path": "src/main/java/uk/ac/sussex/gdsc/core/utils/rng/RadixStringSampler.java",
"license": "gpl-3.0",
"size": 17837
}
|
[
"org.apache.commons.rng.UniformRandomProvider"
] |
import org.apache.commons.rng.UniformRandomProvider;
|
import org.apache.commons.rng.*;
|
[
"org.apache.commons"
] |
org.apache.commons;
| 1,686,528
|
public void getSubBlocks(Item itemIn, CreativeTabs tab, List list)
{
BlockPlanks.EnumType[] var4 = BlockPlanks.EnumType.values();
int var5 = var4.length;
for (int var6 = 0; var6 < var5; ++var6)
{
BlockPlanks.EnumType var7 = var4[var6];
list.add(new ItemStack(itemIn, 1, var7.func_176839_a()));
}
}
|
void function(Item itemIn, CreativeTabs tab, List list) { BlockPlanks.EnumType[] var4 = BlockPlanks.EnumType.values(); int var5 = var4.length; for (int var6 = 0; var6 < var5; ++var6) { BlockPlanks.EnumType var7 = var4[var6]; list.add(new ItemStack(itemIn, 1, var7.func_176839_a())); } }
|
/**
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
*/
|
returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
|
getSubBlocks
|
{
"repo_name": "Hexeption/Youtube-Hacked-Client-1.8",
"path": "minecraft/net/minecraft/block/BlockPlanks.java",
"license": "mit",
"size": 4449
}
|
[
"java.util.List",
"net.minecraft.creativetab.CreativeTabs",
"net.minecraft.item.Item",
"net.minecraft.item.ItemStack"
] |
import java.util.List; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack;
|
import java.util.*; import net.minecraft.creativetab.*; import net.minecraft.item.*;
|
[
"java.util",
"net.minecraft.creativetab",
"net.minecraft.item"
] |
java.util; net.minecraft.creativetab; net.minecraft.item;
| 2,025,643
|
public void setDrawersCard(List<? extends Canvas> items);
|
void function(List<? extends Canvas> items);
|
/**
* Reassigns the set of canvases that this explorer controls.
* Though the collection of canvas mnay be empty, it may not be null.
* @param items
*
* @requires items != null &&
* for each element in item, element!= null
*/
|
Reassigns the set of canvases that this explorer controls. Though the collection of canvas mnay be empty, it may not be null
|
setDrawersCard
|
{
"repo_name": "dwengovzw/Ardublock-for-Dwenguino",
"path": "openblocks-master/src/main/java/edu/mit/blocks/codeblockutil/Explorer.java",
"license": "gpl-3.0",
"size": 2956
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 880,234
|
@Variability(id = { AnnotationConstants.VAR_ARBITRARY_PROCESS_DATA,
AnnotationConstants.VAR_ALL_PROCESSES_DATA,
AnnotationConstants.VAR_IO_DATA }, op = Operation.AND)
@Override
public boolean isFileIoDataIncluded(boolean forAll) {
return isFileIoDataIncluded0(forAll);
}
|
@Variability(id = { AnnotationConstants.VAR_ARBITRARY_PROCESS_DATA, AnnotationConstants.VAR_ALL_PROCESSES_DATA, AnnotationConstants.VAR_IO_DATA }, op = Operation.AND) boolean function(boolean forAll) { return isFileIoDataIncluded0(forAll); }
|
/**
* Returns weather native file I/O statistics are included, i.e.
* weather the system provides required capabilities to access the
* statistics.
*
* @param forAll query this information for all processes, or
* otherways for a single process
*
* @return <code>true</code> if the information is provided,
* <code>false</code> else
*
* @since 1.00
*/
|
Returns weather native file I/O statistics are included, i.e. weather the system provides required capabilities to access the statistics
|
isFileIoDataIncluded
|
{
"repo_name": "SSEHUB/spassMeter",
"path": "gearsBridgeJ/src/de/uni_hildesheim/sse/system/deflt/ProcessDataGatherer.java",
"license": "apache-2.0",
"size": 10008
}
|
[
"de.uni_hildesheim.sse.codeEraser.annotations.Operation",
"de.uni_hildesheim.sse.codeEraser.annotations.Variability",
"de.uni_hildesheim.sse.system.AnnotationConstants"
] |
import de.uni_hildesheim.sse.codeEraser.annotations.Operation; import de.uni_hildesheim.sse.codeEraser.annotations.Variability; import de.uni_hildesheim.sse.system.AnnotationConstants;
|
import de.uni_hildesheim.sse.*; import de.uni_hildesheim.sse.system.*;
|
[
"de.uni_hildesheim.sse"
] |
de.uni_hildesheim.sse;
| 2,457,968
|
public void seekToBeginning(TopicPartition... partitions) {
acquire();
try {
Collection<TopicPartition> parts = partitions.length == 0 ? this.subscriptions.assignedPartitions()
: Arrays.asList(partitions);
for (TopicPartition tp : parts) {
log.debug("Seeking to beginning of partition {}", tp);
subscriptions.needOffsetReset(tp, OffsetResetStrategy.EARLIEST);
}
} finally {
release();
}
}
|
void function(TopicPartition... partitions) { acquire(); try { Collection<TopicPartition> parts = partitions.length == 0 ? this.subscriptions.assignedPartitions() : Arrays.asList(partitions); for (TopicPartition tp : parts) { log.debug(STR, tp); subscriptions.needOffsetReset(tp, OffsetResetStrategy.EARLIEST); } } finally { release(); } }
|
/**
* Seek to the first offset for each of the given partitions
*/
|
Seek to the first offset for each of the given partitions
|
seekToBeginning
|
{
"repo_name": "vadimbobrov/kafka",
"path": "clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java",
"license": "apache-2.0",
"size": 61433
}
|
[
"java.util.Arrays",
"java.util.Collection",
"org.apache.kafka.common.TopicPartition"
] |
import java.util.Arrays; import java.util.Collection; import org.apache.kafka.common.TopicPartition;
|
import java.util.*; import org.apache.kafka.common.*;
|
[
"java.util",
"org.apache.kafka"
] |
java.util; org.apache.kafka;
| 794,084
|
String joinLRA(LRAParticipant participant, LRAParticipantDeserializer deserializer,
URL lraId, Long timeLimit, TimeUnit unit) throws JoinLRAException;
|
String joinLRA(LRAParticipant participant, LRAParticipantDeserializer deserializer, URL lraId, Long timeLimit, TimeUnit unit) throws JoinLRAException;
|
/**
* Join an existing LRA
*
* @param participant an instance of a {@link LRAParticipant} that will be notified when the target LRA ends
* @param deserializer a mechanism for recreating participants during recovery.
* If the parameter is null then standard Java object deserialization will be used
* @param lraId the LRA that the join request pertains to
* @param timeLimit the time for which the participant should remain valid. When this time limit is exceeded
* the participant may longer be able to fulfil the protocol guarantees.
* @param unit the unit that the timeLimit parameter is expressed in
*/
|
Join an existing LRA
|
joinLRA
|
{
"repo_name": "jbosstm/microprofile-sandbox",
"path": "proposals/0009-LRA/lra-annotations/src/main/java/org/eclipse/microprofile/lra/participant/LRAManagement.java",
"license": "apache-2.0",
"size": 3430
}
|
[
"java.util.concurrent.TimeUnit"
] |
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.*;
|
[
"java.util"
] |
java.util;
| 215,560
|
@Test
public void testCalcPerimeter() {
double ab = triangle.distance(a, b);
double ac = triangle.distance(a, c);
double bc = triangle.distance(b, c);
double result = triangle.perimeter(ab, ac, bc);
double expected = 13.5;
assertThat(result, is(closeTo(expected, 0.07)));
}
|
void function() { double ab = triangle.distance(a, b); double ac = triangle.distance(a, c); double bc = triangle.distance(b, c); double result = triangle.perimeter(ab, ac, bc); double expected = 13.5; assertThat(result, is(closeTo(expected, 0.07))); }
|
/**
* Test calculating triangle perimeter.
*/
|
Test calculating triangle perimeter
|
testCalcPerimeter
|
{
"repo_name": "LuxCore/dkitrish",
"path": "1.Trainee/001.BasicSyntax/src/test/java/ru/job4j/condition/TriangleTest.java",
"license": "apache-2.0",
"size": 1310
}
|
[
"org.hamcrest.core.Is",
"org.junit.Assert"
] |
import org.hamcrest.core.Is; import org.junit.Assert;
|
import org.hamcrest.core.*; import org.junit.*;
|
[
"org.hamcrest.core",
"org.junit"
] |
org.hamcrest.core; org.junit;
| 2,791,515
|
public BoxedQueryRequest to(Ordinal end) {
to = end;
timestampRange.lte(end != null ? end.timestamp().toString() : null);
return this;
}
|
BoxedQueryRequest function(Ordinal end) { to = end; timestampRange.lte(end != null ? end.timestamp().toString() : null); return this; }
|
/**
* Sets the upper boundary for the query (inclusive).
* Can be removed through null.
*/
|
Sets the upper boundary for the query (inclusive). Can be removed through null
|
to
|
{
"repo_name": "ern/elasticsearch",
"path": "x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/execution/assembler/BoxedQueryRequest.java",
"license": "apache-2.0",
"size": 6716
}
|
[
"org.elasticsearch.xpack.eql.execution.search.Ordinal"
] |
import org.elasticsearch.xpack.eql.execution.search.Ordinal;
|
import org.elasticsearch.xpack.eql.execution.search.*;
|
[
"org.elasticsearch.xpack"
] |
org.elasticsearch.xpack;
| 376,156
|
public String getSchemaInput(String parameterID) {
for(InputType input : this.getPOSTRequest().getExecute().getExecute().getDataInputs().getInputArray()) {
if(input.getIdentifier().getStringValue().equals(parameterID)) {
if(input.isSetReference()) {
return input.getReference().getSchema();
}
else if(input.isSetData()) {
return input.getData().getComplexData().getSchema();
}
}
}
return null;
}
|
String function(String parameterID) { for(InputType input : this.getPOSTRequest().getExecute().getExecute().getDataInputs().getInputArray()) { if(input.getIdentifier().getStringValue().equals(parameterID)) { if(input.isSetReference()) { return input.getReference().getSchema(); } else if(input.isSetData()) { return input.getData().getComplexData().getSchema(); } } } return null; }
|
/** Convenience method, returns the schema for a specific complexData input of the process's execute request
*
* @return
*/
|
Convenience method, returns the schema for a specific complexData input of the process's execute request
|
getSchemaInput
|
{
"repo_name": "52North/uDig-WPS-plugin",
"path": "src/org/n52/wps/client/udig/WPSProcess.java",
"license": "gpl-2.0",
"size": 16270
}
|
[
"net.opengis.wps.x100.InputType"
] |
import net.opengis.wps.x100.InputType;
|
import net.opengis.wps.x100.*;
|
[
"net.opengis.wps"
] |
net.opengis.wps;
| 366,629
|
@Override
protected Void doInBackground(CellBroadcastOperation... params) {
ContentProviderClient cpc = mContentResolver.acquireContentProviderClient(
CellBroadcastContentProvider.CB_AUTHORITY);
CellBroadcastContentProvider provider = (CellBroadcastContentProvider)
cpc.getLocalContentProvider();
if (provider != null) {
try {
boolean changed = params[0].execute(provider);
if (changed) {
Log.d(TAG, "database changed: notifying observers...");
mContentResolver.notifyChange(CONTENT_URI, null, false);
}
} finally {
cpc.release();
}
} else {
Log.e(TAG, "getLocalContentProvider() returned null");
}
mContentResolver = null; // free reference to content resolver
return null;
}
}
|
Void function(CellBroadcastOperation... params) { ContentProviderClient cpc = mContentResolver.acquireContentProviderClient( CellBroadcastContentProvider.CB_AUTHORITY); CellBroadcastContentProvider provider = (CellBroadcastContentProvider) cpc.getLocalContentProvider(); if (provider != null) { try { boolean changed = params[0].execute(provider); if (changed) { Log.d(TAG, STR); mContentResolver.notifyChange(CONTENT_URI, null, false); } } finally { cpc.release(); } } else { Log.e(TAG, STR); } mContentResolver = null; return null; } }
|
/**
* Perform a generic operation on the CellBroadcastContentProvider.
* @param params the CellBroadcastOperation object to call for this provider
* @return void
*/
|
Perform a generic operation on the CellBroadcastContentProvider
|
doInBackground
|
{
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "packages/apps/CellBroadcastReceiver/src/com/android/cellbroadcastreceiver/CellBroadcastContentProvider.java",
"license": "gpl-3.0",
"size": 12853
}
|
[
"android.content.ContentProviderClient",
"android.util.Log"
] |
import android.content.ContentProviderClient; import android.util.Log;
|
import android.content.*; import android.util.*;
|
[
"android.content",
"android.util"
] |
android.content; android.util;
| 1,882,916
|
public FloatPoint get_current_mouse_position()
{
return this.current_mouse_position;
}
|
FloatPoint function() { return this.current_mouse_position; }
|
/**
* Returns the current position of the mouse pointer.
*/
|
Returns the current position of the mouse pointer
|
get_current_mouse_position
|
{
"repo_name": "andrasfuchs/BioBalanceDetector",
"path": "Tools/KiCad_FreeRouting/FreeRouting-miho-master/freerouting-master/src/main/java/eu/mihosoft/freerouting/interactive/BoardHandling.java",
"license": "gpl-3.0",
"size": 57907
}
|
[
"eu.mihosoft.freerouting.geometry.planar.FloatPoint"
] |
import eu.mihosoft.freerouting.geometry.planar.FloatPoint;
|
import eu.mihosoft.freerouting.geometry.planar.*;
|
[
"eu.mihosoft.freerouting"
] |
eu.mihosoft.freerouting;
| 245,664
|
void registerForMmiComplete(Handler h, int what, Object obj);
|
void registerForMmiComplete(Handler h, int what, Object obj);
|
/**
* Register for notifications that an MMI request has completed
* its network activity and is in its final state. This may mean a state
* of COMPLETE, FAILED, or CANCELLED.
*
* <code>Message.obj</code> will contain an AsyncResult.
* <code>obj.result</code> will be an "MmiCode" object
*/
|
Register for notifications that an MMI request has completed its network activity and is in its final state. This may mean a state of COMPLETE, FAILED, or CANCELLED. <code>Message.obj</code> will contain an AsyncResult. <code>obj.result</code> will be an "MmiCode" object
|
registerForMmiComplete
|
{
"repo_name": "rex-xxx/mt6572_x201",
"path": "frameworks/opt/telephony/src/java/com/android/internal/telephony/Phone.java",
"license": "gpl-2.0",
"size": 87022
}
|
[
"android.os.Handler"
] |
import android.os.Handler;
|
import android.os.*;
|
[
"android.os"
] |
android.os;
| 1,805,915
|
@Override
public void sceneTransformChanged(Transform3D newTransform) {
applyRotationFromTranslation(newTransform);
}
|
void function(Transform3D newTransform) { applyRotationFromTranslation(newTransform); }
|
/**
* Fired when scene transform has changed, e.g. scene was moved or rotated.
* <p/>
* @param newTransform
*/
|
Fired when scene transform has changed, e.g. scene was moved or rotated.
|
sceneTransformChanged
|
{
"repo_name": "IcmVis/VisNow-Pro",
"path": "src/pl/edu/icm/visnow/geometries/viewer3d/ObjReper.java",
"license": "gpl-3.0",
"size": 4341
}
|
[
"javax.media.j3d.Transform3D"
] |
import javax.media.j3d.Transform3D;
|
import javax.media.j3d.*;
|
[
"javax.media"
] |
javax.media;
| 878,942
|
@Nullable
public Room patch(@Nonnull final Room sourceRoom) throws ClientException {
return send(HttpMethod.PATCH, sourceRoom);
}
|
Room function(@Nonnull final Room sourceRoom) throws ClientException { return send(HttpMethod.PATCH, sourceRoom); }
|
/**
* Patches this Room with a source
*
* @param sourceRoom the source object with updates
* @return the updated Room
* @throws ClientException this exception occurs if the request was unable to complete for any reason
*/
|
Patches this Room with a source
|
patch
|
{
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/RoomRequest.java",
"license": "mit",
"size": 5331
}
|
[
"com.microsoft.graph.core.ClientException",
"com.microsoft.graph.http.HttpMethod",
"com.microsoft.graph.models.Room",
"javax.annotation.Nonnull"
] |
import com.microsoft.graph.core.ClientException; import com.microsoft.graph.http.HttpMethod; import com.microsoft.graph.models.Room; import javax.annotation.Nonnull;
|
import com.microsoft.graph.core.*; import com.microsoft.graph.http.*; import com.microsoft.graph.models.*; import javax.annotation.*;
|
[
"com.microsoft.graph",
"javax.annotation"
] |
com.microsoft.graph; javax.annotation;
| 980,499
|
// ---------------------------------------------------------------------
private boolean checkRepeatAnalysis(DatabaseRegistryEntry dbre) {
boolean result = true;
Connection con = dbre.getConnection();
String[] repeatAnalyses = DBUtils.getColumnValues(con, "SELECT meta_value FROM meta LEFT JOIN analysis ON meta_value = logic_name WHERE meta_key = 'repeat.analysis' AND analysis_id IS NULL");
if (repeatAnalyses.length > 0) {
result = false;
ReportManager.problem(this, con, "The following values for meta_key repeat.analysis don't have a corresponding logic_name entry in the analysis table: " + Utils.arrayToString(repeatAnalyses,",") );
} else {
ReportManager.correct(this, con, "All values for meta_key repeat.analysis have a corresponding logic_name entry in the analysis table");
}
if (dbre.getType() == DatabaseType.CORE) {
int repeatMask = DBUtils.getRowCount(con, "SELECT count(*) FROM meta WHERE meta_key = 'repeat.analysis' AND (meta_value like 'repeatmask_repbase%' or meta_value = 'repeatmask')");
if (repeatMask == 0) {
result = false;
ReportManager.problem(this, con, "There is no entry in meta for repeatmask repeat.analysis");
} else {
ReportManager.correct(this, con, "Repeatmask is present in meta table for repeat.analysis");
}
}
return result;
}
|
boolean function(DatabaseRegistryEntry dbre) { boolean result = true; Connection con = dbre.getConnection(); String[] repeatAnalyses = DBUtils.getColumnValues(con, STR); if (repeatAnalyses.length > 0) { result = false; ReportManager.problem(this, con, STR + Utils.arrayToString(repeatAnalyses,",") ); } else { ReportManager.correct(this, con, STR); } if (dbre.getType() == DatabaseType.CORE) { int repeatMask = DBUtils.getRowCount(con, STR); if (repeatMask == 0) { result = false; ReportManager.problem(this, con, STR); } else { ReportManager.correct(this, con, STR); } } return result; }
|
/**
* Check that all meta_values with meta_key 'repeat.analysis' reference analysis.logic_name
* Also check that repeatmask is one of them
*/
|
Check that all meta_values with meta_key 'repeat.analysis' reference analysis.logic_name Also check that repeatmask is one of them
|
checkRepeatAnalysis
|
{
"repo_name": "dbolser-ebi/ensj-healthcheck",
"path": "src/org/ensembl/healthcheck/testcase/generic/MetaValues.java",
"license": "apache-2.0",
"size": 32095
}
|
[
"java.sql.Connection",
"org.ensembl.healthcheck.DatabaseRegistryEntry",
"org.ensembl.healthcheck.DatabaseType",
"org.ensembl.healthcheck.ReportManager",
"org.ensembl.healthcheck.util.DBUtils",
"org.ensembl.healthcheck.util.Utils"
] |
import java.sql.Connection; import org.ensembl.healthcheck.DatabaseRegistryEntry; import org.ensembl.healthcheck.DatabaseType; import org.ensembl.healthcheck.ReportManager; import org.ensembl.healthcheck.util.DBUtils; import org.ensembl.healthcheck.util.Utils;
|
import java.sql.*; import org.ensembl.healthcheck.*; import org.ensembl.healthcheck.util.*;
|
[
"java.sql",
"org.ensembl.healthcheck"
] |
java.sql; org.ensembl.healthcheck;
| 1,040,125
|
@Test
public void testPage () {
ResultActions result = null;
_given: {
}
_then: try {
result = mockMvc.perform(get("/index.html"));
} catch (Exception e) {
fail(e.getMessage());
}
_expect: try {
result.andExpect(status().isOk()).andExpect(view().name("index"));
} catch (Exception e) {
fail(e.getMessage());
}
}
|
void function () { ResultActions result = null; _given: { } _then: try { result = mockMvc.perform(get(STR)); } catch (Exception e) { fail(e.getMessage()); } _expect: try { result.andExpect(status().isOk()).andExpect(view().name("index")); } catch (Exception e) { fail(e.getMessage()); } }
|
/**
* Test the template caller.
*
* @see HomeController#page(String)
*/
|
Test the template caller
|
testPage
|
{
"repo_name": "juazugas/grooshella",
"path": "src/test/java/com/defimak47/grooshella/web/HomeControllerTest.java",
"license": "mit",
"size": 2007
}
|
[
"org.junit.Assert",
"org.springframework.test.web.servlet.ResultActions"
] |
import org.junit.Assert; import org.springframework.test.web.servlet.ResultActions;
|
import org.junit.*; import org.springframework.test.web.servlet.*;
|
[
"org.junit",
"org.springframework.test"
] |
org.junit; org.springframework.test;
| 1,227,998
|
void paintHighlight(Graphics gfx, int line, int y);
|
void paintHighlight(Graphics gfx, int line, int y);
|
/**
* This should paint the highlight and delgate to the next highlight painter.
*
* @param gfx
* The graphics context
* @param line
* The line number
* @param y
* The y co-ordinate of the line
*/
|
This should paint the highlight and delgate to the next highlight painter
|
paintHighlight
|
{
"repo_name": "aborg0/rapidminer-studio",
"path": "src/main/java/com/rapidminer/gui/tools/syntax/TextAreaPainter.java",
"license": "agpl-3.0",
"size": 19492
}
|
[
"java.awt.Graphics"
] |
import java.awt.Graphics;
|
import java.awt.*;
|
[
"java.awt"
] |
java.awt;
| 1,145,924
|
private static String validateMosaic(String address, String mosaicName, String mosaicQuantity, MosaicFeeInformation mosaicFeeInformation) {
String queryResult = HttpClientUtils.get(Constants.URL_ACCOUNT_MOSAIC_OWNED + "?address=" + address);
JSONObject json = JSONObject.fromObject(queryResult);
JSONArray array = json.getJSONArray("data");
for(int i=0;i<array.size();i++){
JSONObject item = array.getJSONObject(i);
// get mosaic id
JSONObject mosaicId = item.getJSONObject("mosaicId");
String namespaceId = mosaicId.getString("namespaceId");
String name = mosaicId.getString("name");
// get mosaic quantity
long quantity = item.getLong("quantity");
if(mosaicName.equals(namespaceId+":"+name)){
Double mQuantity = Double.valueOf(mosaicQuantity).doubleValue() * Math.pow(10, mosaicFeeInformation.getDivisibility());
if(mQuantity.longValue()>quantity){
return "insufficient mosaic quantity";
} else {
return null;
}
}
}
return "there is no mosaic ["+mosaicName+"] in the account";
}
|
static String function(String address, String mosaicName, String mosaicQuantity, MosaicFeeInformation mosaicFeeInformation) { String queryResult = HttpClientUtils.get(Constants.URL_ACCOUNT_MOSAIC_OWNED + STR + address); JSONObject json = JSONObject.fromObject(queryResult); JSONArray array = json.getJSONArray("data"); for(int i=0;i<array.size();i++){ JSONObject item = array.getJSONObject(i); JSONObject mosaicId = item.getJSONObject(STR); String namespaceId = mosaicId.getString(STR); String name = mosaicId.getString("name"); long quantity = item.getLong(STR); if(mosaicName.equals(namespaceId+":"+name)){ Double mQuantity = Double.valueOf(mosaicQuantity).doubleValue() * Math.pow(10, mosaicFeeInformation.getDivisibility()); if(mQuantity.longValue()>quantity){ return STR; } else { return null; } } } return STR+mosaicName+STR; }
|
/**
* validate the mosaic and quantity
* @param address
* @param mosaicName
* @param mosaicQuantity
* @param mosaicFeeInformation
* @return
*/
|
validate the mosaic and quantity
|
validateMosaic
|
{
"repo_name": "NEMChina/nem-apps",
"path": "src/com/dfintech/nem/apps/ImplInitMultisigTransaction.java",
"license": "mit",
"size": 9793
}
|
[
"com.dfintech.nem.apps.utils.Constants",
"com.dfintech.nem.apps.utils.HttpClientUtils",
"net.sf.json.JSONArray",
"net.sf.json.JSONObject",
"org.nem.core.model.mosaic.MosaicFeeInformation"
] |
import com.dfintech.nem.apps.utils.Constants; import com.dfintech.nem.apps.utils.HttpClientUtils; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.nem.core.model.mosaic.MosaicFeeInformation;
|
import com.dfintech.nem.apps.utils.*; import net.sf.json.*; import org.nem.core.model.mosaic.*;
|
[
"com.dfintech.nem",
"net.sf.json",
"org.nem.core"
] |
com.dfintech.nem; net.sf.json; org.nem.core;
| 2,346,960
|
@Override
public String runTest() throws SQLException, InterruptedException {
// Perform the following steps:
// 1. Start an ACID Transaction Txn1 for a randomly selected O_KEY,
// L_KEY, and DELTA.
// 2. Suspend Txn1 immediately prior to COMMIT.
params1 = new TransactionParams();
AcidTransaction txn1 = new AcidTransaction(driver, params1);
txn1.startAcidTransaction();
// 3. Start an ACID Query Txn2 for the same O_KEY as in Step 1.
// (Txn2 attempts to read the data that has just been updated by Txn1.)
Thread txn2Thr = new Thread(this);
txn2Thr.start();
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
txn1.commitTransaction(false);
txn2Thr.interrupt();
throw e;
}
// 4. Verify that Txn2 does not see Txn1's updates.
int step = txn2.step;
if (step != 0) {
txn1.commitTransaction(false);
txn2Thr.interrupt();
txn2Thr.join(3000);
return "Txn2 advanced to step " + step;
}
// 5. Allow Txn1 to complete.
txn1.commitTransaction(true);
// 6. Txn2 should now have completed.
txn2Thr.join(3000);
if (txn2Thr.isAlive()) {
step = txn2.step;
txn2Thr.interrupt();
txn2Thr.join();
return "Txn2 hangs on step " + step;
}
if (txn2Exception != null) {
return "Txn2 threw " + txn2Exception;
}
return null;
}
|
String function() throws SQLException, InterruptedException { params1 = new TransactionParams(); AcidTransaction txn1 = new AcidTransaction(driver, params1); txn1.startAcidTransaction(); Thread txn2Thr = new Thread(this); txn2Thr.start(); try { Thread.sleep(3000); } catch (InterruptedException e) { txn1.commitTransaction(false); txn2Thr.interrupt(); throw e; } int step = txn2.step; if (step != 0) { txn1.commitTransaction(false); txn2Thr.interrupt(); txn2Thr.join(3000); return STR + step; } txn1.commitTransaction(true); txn2Thr.join(3000); if (txn2Thr.isAlive()) { step = txn2.step; txn2Thr.interrupt(); txn2Thr.join(); return STR + step; } if (txn2Exception != null) { return STR + txn2Exception; } return null; }
|
/**
* This test demonstrates isolation for the read-write conflict of a
* read-write transaction and a read-only transaction when the
* read-write transaction is committed.
*
* @return error string, or null if the test passed
* @throws SQLException
* @throws InterruptedException
*/
|
This test demonstrates isolation for the read-write conflict of a read-write transaction and a read-only transaction when the read-write transaction is committed
|
runTest
|
{
"repo_name": "kimajakobsen/bibm-sesame",
"path": "src/com/openlinksw/bibm/tpchAcid/IsolationTest1.java",
"license": "gpl-2.0",
"size": 2801
}
|
[
"java.sql.SQLException"
] |
import java.sql.SQLException;
|
import java.sql.*;
|
[
"java.sql"
] |
java.sql;
| 1,841,843
|
public static void assertValuesEqualsResultSet(ResultSet rs, List<List<Object>> expectedResults) throws SQLException {
int expectedCount = expectedResults.size();
int count = 0;
List<List<Object>> actualResults = Lists.newArrayList();
List<Object> errorResult = null;
while (rs.next() && errorResult == null) {
List<Object> result = Lists.newArrayList();
for (int i = 0; i < rs.getMetaData().getColumnCount(); i++) {
result.add(rs.getObject(i+1));
}
if (!expectedResults.contains(result)) {
errorResult = result;
}
actualResults.add(result);
count++;
}
assertTrue("Could not find " + errorResult + " in expected results: " + expectedResults + " with actual results: " + actualResults, errorResult == null);
assertEquals(expectedCount, count);
}
|
static void function(ResultSet rs, List<List<Object>> expectedResults) throws SQLException { int expectedCount = expectedResults.size(); int count = 0; List<List<Object>> actualResults = Lists.newArrayList(); List<Object> errorResult = null; while (rs.next() && errorResult == null) { List<Object> result = Lists.newArrayList(); for (int i = 0; i < rs.getMetaData().getColumnCount(); i++) { result.add(rs.getObject(i+1)); } if (!expectedResults.contains(result)) { errorResult = result; } actualResults.add(result); count++; } assertTrue(STR + errorResult + STR + expectedResults + STR + actualResults, errorResult == null); assertEquals(expectedCount, count); }
|
/**
* Asserts that we find the expected values in the result set. We don't know the order, since we don't always
* have an order by and we're going through indexes, but we assert that each expected result occurs once as
* expected (in any order).
*/
|
Asserts that we find the expected values in the result set. We don't know the order, since we don't always have an order by and we're going through indexes, but we assert that each expected result occurs once as expected (in any order)
|
assertValuesEqualsResultSet
|
{
"repo_name": "elilevine/apache-phoenix",
"path": "phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java",
"license": "apache-2.0",
"size": 79271
}
|
[
"com.google.common.collect.Lists",
"java.sql.ResultSet",
"java.sql.SQLException",
"java.util.List",
"org.junit.Assert"
] |
import com.google.common.collect.Lists; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import org.junit.Assert;
|
import com.google.common.collect.*; import java.sql.*; import java.util.*; import org.junit.*;
|
[
"com.google.common",
"java.sql",
"java.util",
"org.junit"
] |
com.google.common; java.sql; java.util; org.junit;
| 587,440
|
RdfStream getTriples(final IdentifierConverter<Resource, FedoraResource> idTranslator,
final Set<? extends TripleCategory> contexts);
|
RdfStream getTriples(final IdentifierConverter<Resource, FedoraResource> idTranslator, final Set<? extends TripleCategory> contexts);
|
/**
* Return the RDF properties of this object using the provided contexts
* @param idTranslator the property of idTranslator
* @param contexts the provided contexts
* @return the rdf properties of this object
*/
|
Return the RDF properties of this object using the provided contexts
|
getTriples
|
{
"repo_name": "bbranan/fcrepo4",
"path": "fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/models/FedoraResource.java",
"license": "apache-2.0",
"size": 7824
}
|
[
"java.util.Set",
"org.apache.jena.rdf.model.Resource",
"org.fcrepo.kernel.api.RdfStream",
"org.fcrepo.kernel.api.TripleCategory",
"org.fcrepo.kernel.api.identifiers.IdentifierConverter"
] |
import java.util.Set; import org.apache.jena.rdf.model.Resource; import org.fcrepo.kernel.api.RdfStream; import org.fcrepo.kernel.api.TripleCategory; import org.fcrepo.kernel.api.identifiers.IdentifierConverter;
|
import java.util.*; import org.apache.jena.rdf.model.*; import org.fcrepo.kernel.api.*; import org.fcrepo.kernel.api.identifiers.*;
|
[
"java.util",
"org.apache.jena",
"org.fcrepo.kernel"
] |
java.util; org.apache.jena; org.fcrepo.kernel;
| 1,964,526
|
public void marshal( JAXBElement<?> rootElement, Writer writer, boolean asFragment )
throws JAXBException
{
Marshaller marshaller = jaxb.createMarshaller();
marshaller.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );
if ( asFragment )
marshaller.setProperty( Marshaller.JAXB_FRAGMENT, Boolean.TRUE );
marshaller.marshal( rootElement, writer );
}
|
void function( JAXBElement<?> rootElement, Writer writer, boolean asFragment ) throws JAXBException { Marshaller marshaller = jaxb.createMarshaller(); marshaller.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE ); if ( asFragment ) marshaller.setProperty( Marshaller.JAXB_FRAGMENT, Boolean.TRUE ); marshaller.marshal( rootElement, writer ); }
|
/**
* Marshals the specified JAXB root element into the specified writer.
*
* @param rootElement a JAXB root element.
* @param writer a writer.
* @param asFragment a flag indicating if the created XML document is a fragment (e.g.
* it should not contain the XML preambule).
* @throws JAXBException if an error occurs unmarshalling the job list.
* @see JAXBContext
*/
|
Marshals the specified JAXB root element into the specified writer
|
marshal
|
{
"repo_name": "quartzdesk/quartzdesk-executor",
"path": "quartzdesk-executor-domain/src/main/java/com/quartzdesk/executor/domain/jaxb/JaxbHelper.java",
"license": "mit",
"size": 16324
}
|
[
"java.io.Writer",
"javax.xml.bind.JAXBElement",
"javax.xml.bind.JAXBException",
"javax.xml.bind.Marshaller"
] |
import java.io.Writer; import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller;
|
import java.io.*; import javax.xml.bind.*;
|
[
"java.io",
"javax.xml"
] |
java.io; javax.xml;
| 379,035
|
void setLastSettingsRef(int index)
{
Renderer rnd = metadataViewer.getRenderer();
if (rnd == null) return;
switch (index) {
case ImViewer.GRID_INDEX:
case ImViewer.PROJECTION_INDEX:
lastMainDef = rnd.getRndSettingsCopy();
break;
case ImViewer.VIEW_INDEX:
//lastProjDef = rnd.getRndSettingsCopy();
}
}
|
void setLastSettingsRef(int index) { Renderer rnd = metadataViewer.getRenderer(); if (rnd == null) return; switch (index) { case ImViewer.GRID_INDEX: case ImViewer.PROJECTION_INDEX: lastMainDef = rnd.getRndSettingsCopy(); break; case ImViewer.VIEW_INDEX: } }
|
/**
* Sets the settings before turning on/off channels in the grid view.
*
* @param index The index specified.
*/
|
Sets the settings before turning on/off channels in the grid view
|
setLastSettingsRef
|
{
"repo_name": "MontpellierRessourcesImagerie/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerModel.java",
"license": "gpl-2.0",
"size": 85080
}
|
[
"org.openmicroscopy.shoola.agents.metadata.rnd.Renderer"
] |
import org.openmicroscopy.shoola.agents.metadata.rnd.Renderer;
|
import org.openmicroscopy.shoola.agents.metadata.rnd.*;
|
[
"org.openmicroscopy.shoola"
] |
org.openmicroscopy.shoola;
| 2,881,884
|
public void testInterruptibleOperationsThrowInterruptedExceptionWriteLockedInterrupted() {
final StampedLock lock = new StampedLock();
long s = lock.writeLock();
Action[] interruptibleLockBlockingActions = {
() -> lock.writeLockInterruptibly(),
() -> lock.tryWriteLock(Long.MAX_VALUE, DAYS),
() -> lock.readLockInterruptibly(),
() -> lock.tryReadLock(Long.MAX_VALUE, DAYS),
() -> lock.asWriteLock().lockInterruptibly(),
() -> lock.asWriteLock().tryLock(Long.MAX_VALUE, DAYS),
() -> lock.asReadLock().lockInterruptibly(),
() -> lock.asReadLock().tryLock(Long.MAX_VALUE, DAYS),
};
shuffle(interruptibleLockBlockingActions);
assertThrowInterruptedExceptionWhenInterrupted(interruptibleLockBlockingActions);
}
|
void function() { final StampedLock lock = new StampedLock(); long s = lock.writeLock(); Action[] interruptibleLockBlockingActions = { () -> lock.writeLockInterruptibly(), () -> lock.tryWriteLock(Long.MAX_VALUE, DAYS), () -> lock.readLockInterruptibly(), () -> lock.tryReadLock(Long.MAX_VALUE, DAYS), () -> lock.asWriteLock().lockInterruptibly(), () -> lock.asWriteLock().tryLock(Long.MAX_VALUE, DAYS), () -> lock.asReadLock().lockInterruptibly(), () -> lock.asReadLock().tryLock(Long.MAX_VALUE, DAYS), }; shuffle(interruptibleLockBlockingActions); assertThrowInterruptedExceptionWhenInterrupted(interruptibleLockBlockingActions); }
|
/**
* interruptible operations throw InterruptedException when write locked and interrupted
*/
|
interruptible operations throw InterruptedException when write locked and interrupted
|
testInterruptibleOperationsThrowInterruptedExceptionWriteLockedInterrupted
|
{
"repo_name": "md-5/jdk10",
"path": "test/jdk/java/util/concurrent/tck/StampedLockTest.java",
"license": "gpl-2.0",
"size": 57159
}
|
[
"java.util.concurrent.locks.StampedLock"
] |
import java.util.concurrent.locks.StampedLock;
|
import java.util.concurrent.locks.*;
|
[
"java.util"
] |
java.util;
| 846,463
|
public FrontierSiliconRadioApiResult doRequest(String requestString, String params) throws IOException {
// 3 retries upon failure
for (int i = 0; i < 2; i++) {
if (!isLoggedIn && !doLogin()) {
continue; // not logged in and login was not successful - try again!
}
final String url = "http://" + hostname + ":" + port + "/fsapi/" + requestString + "?pin=" + pin + "&sid="
+ sessionId + (params == null || params.trim().length() == 0 ? "" : "&" + params);
logger.trace("calling url: '{}'", url);
// HttpClient can not be null, instance is created in doLogin() method
startHttpClient(httpClient);
Request request = httpClient.newRequest(url).method(HttpMethod.GET).timeout(SOCKET_TIMEOUT,
TimeUnit.MILLISECONDS);
try {
ContentResponse response = request.send();
final int statusCode = response.getStatus();
if (statusCode != HttpStatus.OK_200) {
String reason = response.getReason();
logger.warn("Method failed: {} {}", statusCode, reason);
isLoggedIn = false;
continue;
}
final String responseBody = response.getContentAsString();
if (!responseBody.isEmpty()) {
logger.trace("got result: {}", responseBody);
} else {
logger.debug("got empty result");
isLoggedIn = false;
continue;
}
final FrontierSiliconRadioApiResult result = new FrontierSiliconRadioApiResult(responseBody);
if (result.isStatusOk()) {
return result;
}
isLoggedIn = false;
continue; // try again
} catch (Exception e) {
logger.error("Fatal transport error: {}", e.toString());
throw new IOException(e);
} finally {
stopHttpClient(httpClient);
}
}
isLoggedIn = false; // 3 tries failed. log in again next time, maybe our session went invalid (radio restarted?)
return null;
}
|
FrontierSiliconRadioApiResult function(String requestString, String params) throws IOException { for (int i = 0; i < 2; i++) { if (!isLoggedIn && !doLogin()) { continue; } final String url = STRSTR&STRcalling url: '{}'STRMethod failed: {} {}STRgot result: {}STRgot empty resultSTRFatal transport error: {}", e.toString()); throw new IOException(e); } finally { stopHttpClient(httpClient); } } isLoggedIn = false; return null; }
|
/**
* Performs a request to the radio with addition parameters.
*
* Typically used for changing parameters.
*
* @param REST
* API requestString, e.g. "SET/netRemote.sys.power"
* @param params
* , e.g. "value=1"
* @return request result
* @throws IOException if the request failed.
*/
|
Performs a request to the radio with addition parameters. Typically used for changing parameters
|
doRequest
|
{
"repo_name": "dvanherbergen/smarthome",
"path": "extensions/binding/org.eclipse.smarthome.binding.fsinternetradio/src/main/java/org/eclipse/smarthome/binding/fsinternetradio/internal/radio/FrontierSiliconRadioConnection.java",
"license": "epl-1.0",
"size": 7913
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 237,814
|
public OpenIDLoginConfigurer<H> consumer(OpenIDConsumer consumer) {
this.openIDConsumer = consumer;
return this;
}
|
OpenIDLoginConfigurer<H> function(OpenIDConsumer consumer) { this.openIDConsumer = consumer; return this; }
|
/**
* Allows specifying the {@link OpenIDConsumer} to be used. The default is using an
* {@link OpenID4JavaConsumer}.
* @param consumer the {@link OpenIDConsumer} to be used
* @return the {@link OpenIDLoginConfigurer} for further customizations
*/
|
Allows specifying the <code>OpenIDConsumer</code> to be used. The default is using an <code>OpenID4JavaConsumer</code>
|
consumer
|
{
"repo_name": "fhanik/spring-security",
"path": "config/src/main/java/org/springframework/security/config/annotation/web/configurers/openid/OpenIDLoginConfigurer.java",
"license": "apache-2.0",
"size": 20858
}
|
[
"org.springframework.security.openid.OpenIDConsumer"
] |
import org.springframework.security.openid.OpenIDConsumer;
|
import org.springframework.security.openid.*;
|
[
"org.springframework.security"
] |
org.springframework.security;
| 2,846,191
|
public void validateOrgAdminCredentials(User user) {
if (!user.hasRole(RoleFactory.ORG_ADMIN)) {
String msg = "The desired operation cannot be performed since the user" +
"[" + user + "] does not have the Org Admin role";
throw new PermissionException(msg);
}
}
|
void function(User user) { if (!user.hasRole(RoleFactory.ORG_ADMIN)) { String msg = STR + "[" + user + STR; throw new PermissionException(msg); } }
|
/**
* validates that the given user can administer
* or lookup an entitled server group.
* Raises a permission exception if administering
* is Not possible
* @param user the user to authenticate
*/
|
validates that the given user can administer or lookup an entitled server group. Raises a permission exception if administering is Not possible
|
validateOrgAdminCredentials
|
{
"repo_name": "xkollar/spacewalk",
"path": "java/code/src/com/redhat/rhn/manager/system/ServerGroupManager.java",
"license": "gpl-2.0",
"size": 17838
}
|
[
"com.redhat.rhn.common.security.PermissionException",
"com.redhat.rhn.domain.role.RoleFactory",
"com.redhat.rhn.domain.user.User"
] |
import com.redhat.rhn.common.security.PermissionException; import com.redhat.rhn.domain.role.RoleFactory; import com.redhat.rhn.domain.user.User;
|
import com.redhat.rhn.common.security.*; import com.redhat.rhn.domain.role.*; import com.redhat.rhn.domain.user.*;
|
[
"com.redhat.rhn"
] |
com.redhat.rhn;
| 2,372,849
|
byte[] getReadMe(Plugin plugin);
|
byte[] getReadMe(Plugin plugin);
|
/**
* Get ReadMe.md content
*/
|
Get ReadMe.md content
|
getReadMe
|
{
"repo_name": "FlowCI/flow-platform",
"path": "core/src/main/java/com/flowci/core/plugin/service/PluginService.java",
"license": "apache-2.0",
"size": 1522
}
|
[
"com.flowci.core.plugin.domain.Plugin"
] |
import com.flowci.core.plugin.domain.Plugin;
|
import com.flowci.core.plugin.domain.*;
|
[
"com.flowci.core"
] |
com.flowci.core;
| 1,262,924
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.