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 static java.util.List extractOrganisationList(ims.domain.ILightweightDomainFactory domainFactory, ims.careuk.vo.OrganisationConfigVoCollection voCollection)
{
return extractOrganisationList(domainFactory, voCollection, null, new HashMap());
}
| static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.careuk.vo.OrganisationConfigVoCollection voCollection) { return extractOrganisationList(domainFactory, voCollection, null, new HashMap()); } | /**
* Create the ims.core.resource.place.domain.objects.Organisation list from the value object collection.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param voCollection - the collection of value objects
*/ | Create the ims.core.resource.place.domain.objects.Organisation list from the value object collection | extractOrganisationList | {
"repo_name": "open-health-hub/openmaxims-linux",
"path": "openmaxims_workspace/ValueObjects/src/ims/careuk/vo/domain/OrganisationConfigVoAssembler.java",
"license": "agpl-3.0",
"size": 20778
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 209,650 |
public Observable<ServiceResponseWithHeaders<ProductInner, LROsPutAsyncNoHeaderInRetryHeadersInner>> putAsyncNoHeaderInRetryWithServiceResponseAsync() {
final ProductInner product = null;
Observable<Response<ResponseBody>> observable = service.putAsyncNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent());
return client.getAzureClient().getPutOrPatchResultWithHeadersAsync(observable, new TypeToken<ProductInner>() { }.getType(), LROsPutAsyncNoHeaderInRetryHeadersInner.class);
} | Observable<ServiceResponseWithHeaders<ProductInner, LROsPutAsyncNoHeaderInRetryHeadersInner>> function() { final ProductInner product = null; Observable<Response<ResponseBody>> observable = service.putAsyncNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultWithHeadersAsync(observable, new TypeToken<ProductInner>() { }.getType(), LROsPutAsyncNoHeaderInRetryHeadersInner.class); } | /**
* Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header.
*
* @return the observable for the request
*/ | Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header | putAsyncNoHeaderInRetryWithServiceResponseAsync | {
"repo_name": "yugangw-msft/autorest",
"path": "src/generator/AutoRest.Java.Azure.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsInner.java",
"license": "mit",
"size": 366932
} | [
"com.google.common.reflect.TypeToken",
"com.microsoft.rest.ServiceResponseWithHeaders"
] | import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceResponseWithHeaders; | import com.google.common.reflect.*; import com.microsoft.rest.*; | [
"com.google.common",
"com.microsoft.rest"
] | com.google.common; com.microsoft.rest; | 1,681,183 |
public Map<String, List<String>> getProperties() {
return properties;
} | Map<String, List<String>> function() { return properties; } | /**
* Returns the properties of this module.
*
* @return the properties of this module
*/ | Returns the properties of this module | getProperties | {
"repo_name": "checkstyle/contribution",
"path": "patch-diff-report-tool/src/main/java/com/github/checkstyle/parser/ConfigurationModule.java",
"license": "lgpl-2.1",
"size": 3400
} | [
"java.util.List",
"java.util.Map"
] | import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,570,552 |
@Override
public final void dump( DataOutputStream file ) throws IOException {
file.writeByte(tag);
file.writeShort(name_index);
} | final void function( DataOutputStream file ) throws IOException { file.writeByte(tag); file.writeShort(name_index); } | /**
* Dump constant class to file stream in binary format.
*
* @param file Output file stream
* @throws IOException
*/ | Dump constant class to file stream in binary format | dump | {
"repo_name": "WhiteBearSolutions/WBSAirback",
"path": "packages/wbsairback-tomcat/wbsairback-tomcat-7.0.22/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java",
"license": "apache-2.0",
"size": 2683
} | [
"java.io.DataOutputStream",
"java.io.IOException"
] | import java.io.DataOutputStream; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 452,188 |
public PersistenceOperationType getOperationType() {
return this.operationType;
}
| PersistenceOperationType function() { return this.operationType; } | /**
* Type of the persistence operation
*
* @return the PersistenceOperationType.
*/ | Type of the persistence operation | getOperationType | {
"repo_name": "NABUCCO/org.nabucco.framework.base",
"path": "org.nabucco.framework.base.facade.datatype/src/main/gen/org/nabucco/framework/base/facade/datatype/monitor/PersistenceMonitorEntry.java",
"license": "epl-1.0",
"size": 12391
} | [
"org.nabucco.framework.base.facade.datatype.monitor.PersistenceOperationType"
] | import org.nabucco.framework.base.facade.datatype.monitor.PersistenceOperationType; | import org.nabucco.framework.base.facade.datatype.monitor.*; | [
"org.nabucco.framework"
] | org.nabucco.framework; | 2,593,568 |
Set<? extends ClassSource> getExcludedClassSources(); | Set<? extends ClassSource> getExcludedClassSources(); | /**
* <p>Answer the subset of excluded class sources of this aggregate.</p>
*
* @return The subset of excluded class sources of this aggregate.
*/ | Answer the subset of excluded class sources of this aggregate | getExcludedClassSources | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.anno/src/com/ibm/wsspi/annocache/classsource/ClassSource_Aggregate.java",
"license": "epl-1.0",
"size": 23466
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,045,500 |
public Double getLatitudeDegrees() {
Object value = getParameters(KEY_LAT_DEGREES);
return SdlDataTypeConverter.objectToDouble(value);
} | Double function() { Object value = getParameters(KEY_LAT_DEGREES); return SdlDataTypeConverter.objectToDouble(value); } | /**
* Getter for latitude of the location to send.
*
* <p><b>IMPORTANT NOTE:</b> </p><p>A previous version of this method call returned a Float
* value, however, it has been changed to return a Double.</p> This will compile,
* but cause a ClassCastException if your value is not also a Double type.
*
* @return The latitude of the location
* @since SmartDeviceLink v4.0
*/ | Getter for latitude of the location to send. value, however, it has been changed to return a Double. This will compile, but cause a ClassCastException if your value is not also a Double type | getLatitudeDegrees | {
"repo_name": "smartdevicelink/sdl_android",
"path": "base/src/main/java/com/smartdevicelink/proxy/rpc/SendLocation.java",
"license": "bsd-3-clause",
"size": 8280
} | [
"com.smartdevicelink.util.SdlDataTypeConverter"
] | import com.smartdevicelink.util.SdlDataTypeConverter; | import com.smartdevicelink.util.*; | [
"com.smartdevicelink.util"
] | com.smartdevicelink.util; | 406,432 |
protected void fillItemProviderFactories(List<AdapterFactory> factories) {
factories.add(new GeometryItemProviderAdapterFactory());
factories.add(new ResourceItemProviderAdapterFactory());
factories.add(new ReflectiveItemProviderAdapterFactory());
}
| void function(List<AdapterFactory> factories) { factories.add(new GeometryItemProviderAdapterFactory()); factories.add(new ResourceItemProviderAdapterFactory()); factories.add(new ReflectiveItemProviderAdapterFactory()); } | /**
* Fill item provider factories.
*
* @param factories the factories
* @generated
*/ | Fill item provider factories | fillItemProviderFactories | {
"repo_name": "albertfdp/petrinet",
"path": "src/dk.dtu.se2.geometry.diagram/src/geometry/diagram/part/GeometryDiagramEditorPlugin.java",
"license": "mit",
"size": 9055
} | [
"java.util.List",
"org.eclipse.emf.common.notify.AdapterFactory",
"org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory",
"org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory"
] | import java.util.List; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; | import java.util.*; import org.eclipse.emf.common.notify.*; import org.eclipse.emf.edit.provider.*; import org.eclipse.emf.edit.provider.resource.*; | [
"java.util",
"org.eclipse.emf"
] | java.util; org.eclipse.emf; | 1,162,002 |
public Element prependChild(Node child) {
Validate.notNull(child);
addChildren(0, child);
return this;
}
/**
Insert the given nodes to the start of this Element's children. | Element function(Node child) { Validate.notNull(child); addChildren(0, child); return this; } /** Insert the given nodes to the start of this Element's children. | /**
* Add a node to the start of this element's children.
*
* @param child node to add.
* @return this element, so that you can add more child nodes or elements.
*/ | Add a node to the start of this element's children | prependChild | {
"repo_name": "jhy/jsoup",
"path": "src/main/java/org/jsoup/nodes/Element.java",
"license": "mit",
"size": 65844
} | [
"org.jsoup.helper.Validate"
] | import org.jsoup.helper.Validate; | import org.jsoup.helper.*; | [
"org.jsoup.helper"
] | org.jsoup.helper; | 787,622 |
public List<ItemStack> remove(Inventory inventory, ItemStack itemStack, ItemStackMatcher comparer, int qty) {
return InventoryUtils.removeAmount(inventory, itemStack, comparer, qty);
} | List<ItemStack> function(Inventory inventory, ItemStack itemStack, ItemStackMatcher comparer, int qty) { return InventoryUtils.removeAmount(inventory, itemStack, comparer, qty); } | /**
* Remove items from the specified inventory that match the specified
* item stack in the specified quantity.
*
* @param inventory The inventory to check.
* @param itemStack The item stack to check.
* @param comparer The {@link ItemStackMatcher} to use.
* @param qty The quantity to remove.
*/ | Remove items from the specified inventory that match the specified item stack in the specified quantity | remove | {
"repo_name": "JCThePants/NucleusFramework",
"path": "src/com/jcwhatever/nucleus/internal/managed/scripting/api/SAPI_Inventory.java",
"license": "mit",
"size": 7966
} | [
"com.jcwhatever.nucleus.utils.inventory.InventoryUtils",
"com.jcwhatever.nucleus.utils.items.ItemStackMatcher",
"java.util.List",
"org.bukkit.inventory.Inventory",
"org.bukkit.inventory.ItemStack"
] | import com.jcwhatever.nucleus.utils.inventory.InventoryUtils; import com.jcwhatever.nucleus.utils.items.ItemStackMatcher; import java.util.List; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; | import com.jcwhatever.nucleus.utils.inventory.*; import com.jcwhatever.nucleus.utils.items.*; import java.util.*; import org.bukkit.inventory.*; | [
"com.jcwhatever.nucleus",
"java.util",
"org.bukkit.inventory"
] | com.jcwhatever.nucleus; java.util; org.bukkit.inventory; | 1,097,760 |
public long[] getLongs(IndexReader reader, String field)
throws IOException; | long[] function(IndexReader reader, String field) throws IOException; | /**
* Checks the internal cache for an appropriate entry, and if none is
* found, reads the terms in <code>field</code> as longs and returns an array
* of size <code>reader.maxDoc()</code> of the value each document
* has in the given field.
*
* @param reader Used to get field values.
* @param field Which field contains the longs.
* @return The values in the given field for each document.
* @throws java.io.IOException If any error occurs.
*/ | Checks the internal cache for an appropriate entry, and if none is found, reads the terms in <code>field</code> as longs and returns an array of size <code>reader.maxDoc()</code> of the value each document has in the given field | getLongs | {
"repo_name": "chrishumphreys/provocateur",
"path": "provocateur-thirdparty/src/main/java/org/targettest/org/apache/lucene/search/FieldCache.java",
"license": "apache-2.0",
"size": 22995
} | [
"java.io.IOException",
"org.targettest.org.apache.lucene.index.IndexReader"
] | import java.io.IOException; import org.targettest.org.apache.lucene.index.IndexReader; | import java.io.*; import org.targettest.org.apache.lucene.index.*; | [
"java.io",
"org.targettest.org"
] | java.io; org.targettest.org; | 1,045,131 |
if (!Config.get().getBoolean(ConfigDefaults.TAKE_SNAPSHOTS)) {
return;
}
// If the server is null or doesn't have the snapshotting feature, don't bother.
if (server == null || !serverHasFeature(server.getId(), "ftr_snapshotting")) {
return;
}
CallableMode m = ModeFactory.getCallableMode("System_queries", "snapshot_server");
Map<String, Object> in = new HashMap<String, Object>();
in.put("server_id", server.getId());
in.put("reason", reason);
m.execute(in, new HashMap<String, Integer>());
} | if (!Config.get().getBoolean(ConfigDefaults.TAKE_SNAPSHOTS)) { return; } if (server == null !serverHasFeature(server.getId(), STR)) { return; } CallableMode m = ModeFactory.getCallableMode(STR, STR); Map<String, Object> in = new HashMap<String, Object>(); in.put(STR, server.getId()); in.put(STR, reason); m.execute(in, new HashMap<String, Integer>()); } | /**
* Takes a snapshot for a server by calling the snapshot_server stored proc.
* @param server The server to snapshot
* @param reason The reason for the snapshotting.
*/ | Takes a snapshot for a server by calling the snapshot_server stored proc | snapshotServer | {
"repo_name": "renner/spacewalk",
"path": "java/code/src/com/redhat/rhn/manager/system/SystemManager.java",
"license": "gpl-2.0",
"size": 132498
} | [
"com.redhat.rhn.common.conf.Config",
"com.redhat.rhn.common.conf.ConfigDefaults",
"com.redhat.rhn.common.db.datasource.CallableMode",
"com.redhat.rhn.common.db.datasource.ModeFactory",
"java.util.HashMap",
"java.util.Map"
] | import com.redhat.rhn.common.conf.Config; import com.redhat.rhn.common.conf.ConfigDefaults; import com.redhat.rhn.common.db.datasource.CallableMode; import com.redhat.rhn.common.db.datasource.ModeFactory; import java.util.HashMap; import java.util.Map; | import com.redhat.rhn.common.conf.*; import com.redhat.rhn.common.db.datasource.*; import java.util.*; | [
"com.redhat.rhn",
"java.util"
] | com.redhat.rhn; java.util; | 1,058,328 |
static void logE(String message) {
if (!ShapeRipple.DEBUG) {
return;
}
Log.e(ShapeRipple.TAG, message);
} | static void logE(String message) { if (!ShapeRipple.DEBUG) { return; } Log.e(ShapeRipple.TAG, message); } | /**
* Log ERROR with message
*/ | Log ERROR with message | logE | {
"repo_name": "poldz123/ShapeRipple",
"path": "ShapeRippleLibrary/src/main/java/com/rodolfonavalon/shaperipplelibrary/DebugLogger.java",
"license": "apache-2.0",
"size": 491
} | [
"android.util.Log"
] | import android.util.Log; | import android.util.*; | [
"android.util"
] | android.util; | 2,729,896 |
private void handleConnectionFailure(MethodInvocation paramMethodInvocation, Throwable t) {
CmrRepositoryDefinition cmrRepositoryDefinition = InterceptorUtils.getRepositoryDefinition(paramMethodInvocation);
if (null != cmrRepositoryDefinition) {
if (cmrRepositoryDefinition.getOnlineStatus() == OnlineStatus.ONLINE) {
InspectIT.getDefault().getCmrRepositoryManager().forceCmrRepositoryOnlineStatusUpdate(cmrRepositoryDefinition);
InspectIT.getDefault().log(IStatus.WARNING, "The server: '" + cmrRepositoryDefinition.getIp() + ":" + cmrRepositoryDefinition.getPort() + "' is currently unavailable.");
}
} else {
throw new RuntimeException("Service proxy not bounded to the CMR repository definition", t);
}
} | void function(MethodInvocation paramMethodInvocation, Throwable t) { CmrRepositoryDefinition cmrRepositoryDefinition = InterceptorUtils.getRepositoryDefinition(paramMethodInvocation); if (null != cmrRepositoryDefinition) { if (cmrRepositoryDefinition.getOnlineStatus() == OnlineStatus.ONLINE) { InspectIT.getDefault().getCmrRepositoryManager().forceCmrRepositoryOnlineStatusUpdate(cmrRepositoryDefinition); InspectIT.getDefault().log(IStatus.WARNING, STR + cmrRepositoryDefinition.getIp() + ":" + cmrRepositoryDefinition.getPort() + STR); } } else { throw new RuntimeException(STR, t); } } | /**
* Handles the connection failure.
*
* @param paramMethodInvocation
* {@link MethodInvocation}.
* @param t
* {@link Throwable}.
*/ | Handles the connection failure | handleConnectionFailure | {
"repo_name": "inspectIT/inspectIT",
"path": "inspectit.ui.rcp/src/main/java/rocks/inspectit/ui/rcp/repository/service/cmr/proxy/ServiceMethodInterceptor.java",
"license": "agpl-3.0",
"size": 2834
} | [
"org.aopalliance.intercept.MethodInvocation",
"org.eclipse.core.runtime.IStatus",
"rocks.inspectit.ui.rcp.InspectIT",
"rocks.inspectit.ui.rcp.repository.CmrRepositoryDefinition"
] | import org.aopalliance.intercept.MethodInvocation; import org.eclipse.core.runtime.IStatus; import rocks.inspectit.ui.rcp.InspectIT; import rocks.inspectit.ui.rcp.repository.CmrRepositoryDefinition; | import org.aopalliance.intercept.*; import org.eclipse.core.runtime.*; import rocks.inspectit.ui.rcp.*; import rocks.inspectit.ui.rcp.repository.*; | [
"org.aopalliance.intercept",
"org.eclipse.core",
"rocks.inspectit.ui"
] | org.aopalliance.intercept; org.eclipse.core; rocks.inspectit.ui; | 321,083 |
protected void sequence_AssertionOrDefinition(ISerializationContext context, Assertion semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
| void function(ISerializationContext context, Assertion semanticObject) { genericSequencer.createSequence(context, semanticObject); } | /**
* Contexts:
* Statement returns Assertion
* AssertionOrDefinition returns Assertion
*
* Constraint:
* (expression=AssertionOrDefinition_Assertion_1_0_0 range=Expression?)
*/ | Contexts: Statement returns Assertion AssertionOrDefinition returns Assertion Constraint: (expression=AssertionOrDefinition_Assertion_1_0_0 range=Expression?) | sequence_AssertionOrDefinition | {
"repo_name": "viatra/VIATRA-Generator",
"path": "Application/org.eclipse.viatra.solver.language/src-gen/org/eclipse/viatra/solver/language/serializer/SolverLanguageSemanticSequencer.java",
"license": "epl-1.0",
"size": 90825
} | [
"org.eclipse.viatra.solver.language.solverLanguage.Assertion",
"org.eclipse.xtext.serializer.ISerializationContext"
] | import org.eclipse.viatra.solver.language.solverLanguage.Assertion; import org.eclipse.xtext.serializer.ISerializationContext; | import org.eclipse.viatra.solver.language.*; import org.eclipse.xtext.serializer.*; | [
"org.eclipse.viatra",
"org.eclipse.xtext"
] | org.eclipse.viatra; org.eclipse.xtext; | 192,555 |
private String[] splitLine(String str, int autoCol) {
ArrayList<String> tmpRows = new ArrayList<>(5);
int lastPos = 0;
int pos = lastPos + autoCol;
final int strLen = str.length();
while (pos < strLen) {
while (pos > lastPos && !Character.isWhitespace(str.charAt(pos))) {
pos--;
}
if (pos == lastPos) { // no whitespace found: hard cut
tmpRows.add(str.substring(lastPos, lastPos + autoCol));
lastPos = lastPos + autoCol;
}
else {
tmpRows.add(str.substring(lastPos, pos));
lastPos = pos + 1;
}
pos = lastPos + autoCol;
}
if (lastPos < strLen-1) {
tmpRows.add(str.substring(lastPos));
}
return (String[]) tmpRows.toArray(new String[ tmpRows.size() ]);
} | String[] function(String str, int autoCol) { ArrayList<String> tmpRows = new ArrayList<>(5); int lastPos = 0; int pos = lastPos + autoCol; final int strLen = str.length(); while (pos < strLen) { while (pos > lastPos && !Character.isWhitespace(str.charAt(pos))) { pos--; } if (pos == lastPos) { tmpRows.add(str.substring(lastPos, lastPos + autoCol)); lastPos = lastPos + autoCol; } else { tmpRows.add(str.substring(lastPos, pos)); lastPos = pos + 1; } pos = lastPos + autoCol; } if (lastPos < strLen-1) { tmpRows.add(str.substring(lastPos)); } return (String[]) tmpRows.toArray(new String[ tmpRows.size() ]); } | /**
* Split a line at the nearest whitespace.
*/ | Split a line at the nearest whitespace | splitLine | {
"repo_name": "CustomizedTools/CustomizedTools-jar",
"path": "core/src/main/java/com/customized/tools/renderer/Column.java",
"license": "apache-2.0",
"size": 5639
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 2,599,078 |
public void validate(Object cf, String user, String password, LinkedHashMap<String, Object> result) throws Exception; | void function(Object cf, String user, String password, LinkedHashMap<String, Object> result) throws Exception; | /**
* Validates a JMS connection factory.
*
* @param cf a JMS ConnectionFactory, QueueConnectionFactory, or TopicConnectionFactory.
* @param user user name, if any, for application authentication.
* @param password password, if any, for application authentication.
* @param result key/value pairs to include in the validation result.
* @throws Exception if an error occurs
*/ | Validates a JMS connection factory | validate | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.rest.handler.validator.jca/src/com/ibm/ws/rest/handler/validator/jca/JMSValidator.java",
"license": "epl-1.0",
"size": 1986
} | [
"java.util.LinkedHashMap"
] | import java.util.LinkedHashMap; | import java.util.*; | [
"java.util"
] | java.util; | 180,128 |
public SessionKey registerSession(IoSession session, User user, SessionKey existSessionKey) {
SessionKey sessionKey = null;
if ( existSessionKey != null ) {
sessionKey = existSessionKey;
logger.debug("Create session from existing session hex string {}", sessionKey);
} else {
sessionKey = SessionKey.createSessionKeyFromRandomString(SESSION_KEY_PREFIX);
}
//Try to clean existing session
if ( !user.isProxy() && user.get_id() != null ) {
SessionKey oldSessionKey = findSessionKeyByUserId(user.get_id());
if ( oldSessionKey != null ) {
Jedis jedis = JedisFactory.getJedis();
jedis.del(oldSessionKey.toString());
logger.debug("Clean old sessionKey {} for user {}", oldSessionKey, user.getRoleName());
}
}
user.setSessionKey(sessionKey);
user.setSession(session);
user.setStatus(UserStatus.NORMAL);
//Try to get user's locale
Locale userLocale = user.getUserLocale();
if ( Constant.I18N_ENABLE ) {
ThreadLocal<Locale> localeLocal = new ThreadLocal<Locale>();
localeLocal.set(userLocale);
}
logger.debug("Register user '{}' with sessionKey: {}",
user.getRoleName(), sessionKey.toString());
//1. Store it with machineid to redis
String userMachineId = this.machineId;
if ( user.isAI() ) {
userMachineId = this.aiServerId;
} else {
user.setGameserverId(gameServerId);
if ( session != null ) {
if ( user.isProxy() ) {
ArrayList<SessionKey> proxySessionKeys = (ArrayList<SessionKey>)session.getAttribute(PROXY_SESSION_KEYS);
if ( proxySessionKeys == null ) {
proxySessionKeys = new ArrayList<SessionKey>();
session.setAttribute(PROXY_SESSION_KEYS, proxySessionKeys);
}
proxySessionKeys.add(user.getSessionKey());
} else {
session.setAttribute(Constant.SESSION_KEY, sessionKey);
session.setAttribute(LOCALE_SESSION_KEY, userLocale);
}
}
}
Jedis jedis = JedisFactory.getJedis();
Pipeline pipeline = jedis.pipelined();
//Disable the timeout if exist
pipeline.hset(sessionKey.toString(), H_MACHINE_KEY, userMachineId);
pipeline.hset(sessionKey.toString(), H_RPCSERVER_KEY, rpcServerId);
pipeline.hset(sessionKey.toString(), H_GAMESERVER_KEY, gameServerId);
pipeline.hset(sessionKey.toString(), H_LOCALE_KEY, userLocale.toString());
if ( user.get_id() != null ) {
pipeline.hset(sessionKey.toString(), H_USERID_KEY, user.get_id().toString());
}
if ( user.isAI() ) {
pipeline.hset(sessionKey.toString(), H_ISAI, V_TRUE);
}
if ( user.isProxy() ) {
pipeline.hset(sessionKey.toString(), H_ISPROXY, V_TRUE);
}
pipeline.expire(sessionKey.toString(), Constant.QUARTER_DAY_SECONDS);
//2. Store the userId with sessionKey
String userKey = null;
if ( user.get_id() != null ) {
//Disable the timeout if exist
if ( user.isProxy() ) {
userKey = getProxyUserIdKey(user.get_id());
pipeline.hset(userKey, H_MACHINE_KEY, userMachineId);
pipeline.hset(userKey, H_RPCSERVER_KEY, rpcServerId);
pipeline.hset(userKey, H_GAMESERVER_KEY, gameServerId);
pipeline.hset(userKey, H_SESSION_KEY, sessionKey.toString());
pipeline.hset(userKey, H_LOCALE_KEY, userLocale.toString());
pipeline.expire(userKey, Constant.QUARTER_DAY_SECONDS);
} else {
userKey = user.get_id().toString();
pipeline.hset(userKey, H_MACHINE_KEY, userMachineId);
pipeline.hset(userKey, H_RPCSERVER_KEY, rpcServerId);
pipeline.hset(userKey, H_GAMESERVER_KEY, gameServerId);
pipeline.hset(userKey, H_SESSION_KEY, sessionKey.toString());
pipeline.hset(userKey, H_LOCALE_KEY, userLocale.toString());
pipeline.expire(userKey, Constant.QUARTER_DAY_SECONDS);
}
}
//3. Keep a local traceable key of user session
pipeline.set(localSessionPrefix.concat(user.getSessionKey().toString()), user.get_id().toString());
pipeline.expire(localSessionPrefix.concat(user.getSessionKey().toString()), Constant.QUARTER_DAY_SECONDS);
pipeline.sync();
return sessionKey;
}
| SessionKey function(IoSession session, User user, SessionKey existSessionKey) { SessionKey sessionKey = null; if ( existSessionKey != null ) { sessionKey = existSessionKey; logger.debug(STR, sessionKey); } else { sessionKey = SessionKey.createSessionKeyFromRandomString(SESSION_KEY_PREFIX); } if ( !user.isProxy() && user.get_id() != null ) { SessionKey oldSessionKey = findSessionKeyByUserId(user.get_id()); if ( oldSessionKey != null ) { Jedis jedis = JedisFactory.getJedis(); jedis.del(oldSessionKey.toString()); logger.debug(STR, oldSessionKey, user.getRoleName()); } } user.setSessionKey(sessionKey); user.setSession(session); user.setStatus(UserStatus.NORMAL); Locale userLocale = user.getUserLocale(); if ( Constant.I18N_ENABLE ) { ThreadLocal<Locale> localeLocal = new ThreadLocal<Locale>(); localeLocal.set(userLocale); } logger.debug(STR, user.getRoleName(), sessionKey.toString()); String userMachineId = this.machineId; if ( user.isAI() ) { userMachineId = this.aiServerId; } else { user.setGameserverId(gameServerId); if ( session != null ) { if ( user.isProxy() ) { ArrayList<SessionKey> proxySessionKeys = (ArrayList<SessionKey>)session.getAttribute(PROXY_SESSION_KEYS); if ( proxySessionKeys == null ) { proxySessionKeys = new ArrayList<SessionKey>(); session.setAttribute(PROXY_SESSION_KEYS, proxySessionKeys); } proxySessionKeys.add(user.getSessionKey()); } else { session.setAttribute(Constant.SESSION_KEY, sessionKey); session.setAttribute(LOCALE_SESSION_KEY, userLocale); } } } Jedis jedis = JedisFactory.getJedis(); Pipeline pipeline = jedis.pipelined(); pipeline.hset(sessionKey.toString(), H_MACHINE_KEY, userMachineId); pipeline.hset(sessionKey.toString(), H_RPCSERVER_KEY, rpcServerId); pipeline.hset(sessionKey.toString(), H_GAMESERVER_KEY, gameServerId); pipeline.hset(sessionKey.toString(), H_LOCALE_KEY, userLocale.toString()); if ( user.get_id() != null ) { pipeline.hset(sessionKey.toString(), H_USERID_KEY, user.get_id().toString()); } if ( user.isAI() ) { pipeline.hset(sessionKey.toString(), H_ISAI, V_TRUE); } if ( user.isProxy() ) { pipeline.hset(sessionKey.toString(), H_ISPROXY, V_TRUE); } pipeline.expire(sessionKey.toString(), Constant.QUARTER_DAY_SECONDS); String userKey = null; if ( user.get_id() != null ) { if ( user.isProxy() ) { userKey = getProxyUserIdKey(user.get_id()); pipeline.hset(userKey, H_MACHINE_KEY, userMachineId); pipeline.hset(userKey, H_RPCSERVER_KEY, rpcServerId); pipeline.hset(userKey, H_GAMESERVER_KEY, gameServerId); pipeline.hset(userKey, H_SESSION_KEY, sessionKey.toString()); pipeline.hset(userKey, H_LOCALE_KEY, userLocale.toString()); pipeline.expire(userKey, Constant.QUARTER_DAY_SECONDS); } else { userKey = user.get_id().toString(); pipeline.hset(userKey, H_MACHINE_KEY, userMachineId); pipeline.hset(userKey, H_RPCSERVER_KEY, rpcServerId); pipeline.hset(userKey, H_GAMESERVER_KEY, gameServerId); pipeline.hset(userKey, H_SESSION_KEY, sessionKey.toString()); pipeline.hset(userKey, H_LOCALE_KEY, userLocale.toString()); pipeline.expire(userKey, Constant.QUARTER_DAY_SECONDS); } } pipeline.set(localSessionPrefix.concat(user.getSessionKey().toString()), user.get_id().toString()); pipeline.expire(localSessionPrefix.concat(user.getSessionKey().toString()), Constant.QUARTER_DAY_SECONDS); pipeline.sync(); return sessionKey; } | /**
* Register an login user with a new session key. If the given sessionHexString is not null,
* create a session from it.
*
* Redis:
* <sessionKey>: hashtable
* <machine_key>: <user's machine id>
* <user_id> : <user's id>
*
* <user_id>: hashtable
* <machine_key>: <user's machine id>
* <sessionKey> : <user's session key>
*
* LSESS_<machineid>_sessionKey: <user_id>
*
* @param session
* @param user
* @return
*/ | Register an login user with a new session key. If the given sessionHexString is not null, create a session from it. Redis: : hashtable : : : hashtable : : LSESS__sessionKey: | registerSession | {
"repo_name": "wangqi/gameserver",
"path": "server/src/main/java/com/xinqihd/sns/gameserver/session/SessionManager.java",
"license": "apache-2.0",
"size": 17163
} | [
"com.xinqihd.sns.gameserver.config.Constant",
"com.xinqihd.sns.gameserver.entity.user.User",
"com.xinqihd.sns.gameserver.entity.user.UserStatus",
"com.xinqihd.sns.gameserver.jedis.Jedis",
"com.xinqihd.sns.gameserver.jedis.JedisFactory",
"java.util.ArrayList",
"java.util.Locale",
"org.apache.mina.core.session.IoSession",
"redis.clients.jedis.Pipeline"
] | import com.xinqihd.sns.gameserver.config.Constant; import com.xinqihd.sns.gameserver.entity.user.User; import com.xinqihd.sns.gameserver.entity.user.UserStatus; import com.xinqihd.sns.gameserver.jedis.Jedis; import com.xinqihd.sns.gameserver.jedis.JedisFactory; import java.util.ArrayList; import java.util.Locale; import org.apache.mina.core.session.IoSession; import redis.clients.jedis.Pipeline; | import com.xinqihd.sns.gameserver.config.*; import com.xinqihd.sns.gameserver.entity.user.*; import com.xinqihd.sns.gameserver.jedis.*; import java.util.*; import org.apache.mina.core.session.*; import redis.clients.jedis.*; | [
"com.xinqihd.sns",
"java.util",
"org.apache.mina",
"redis.clients.jedis"
] | com.xinqihd.sns; java.util; org.apache.mina; redis.clients.jedis; | 1,874,535 |
public void get(int page, int countByPage, ITApiCallback<ITPartList> callback) {
mService.getBySiteRef(null, null, page, countByPage, Locale.getDefault().getLanguage()).enqueue(new ProxyCallback<>(callback));
} | void function(int page, int countByPage, ITApiCallback<ITPartList> callback) { mService.getBySiteRef(null, null, page, countByPage, Locale.getDefault().getLanguage()).enqueue(new ProxyCallback<>(callback)); } | /**
* Retrieves the parts of the user's domain.
*
* @param page the results are paginated, you need to precise the page you want to load (page index starts at 1)
* @param countByPage the results are paginated, you need to precise the number of results you want by page (max 50)
*/ | Retrieves the parts of the user's domain | get | {
"repo_name": "INTENT-TECHNOLOGIES/SDK-Android",
"path": "sdk/android-sdk/src/main/java/eu/intent/sdk/api/ITPartApi.java",
"license": "apache-2.0",
"size": 4475
} | [
"eu.intent.sdk.api.internal.ProxyCallback",
"eu.intent.sdk.model.ITPartList",
"java.util.Locale"
] | import eu.intent.sdk.api.internal.ProxyCallback; import eu.intent.sdk.model.ITPartList; import java.util.Locale; | import eu.intent.sdk.api.internal.*; import eu.intent.sdk.model.*; import java.util.*; | [
"eu.intent.sdk",
"java.util"
] | eu.intent.sdk; java.util; | 613,421 |
public JCodeModel getCodeModel() {
return codeModel;
} | JCodeModel function() { return codeModel; } | /**
* <p>Getter for the field <code>codeModel</code>.</p>
*
* @return a {@link com.sun.codemodel.JCodeModel} object.
*/ | Getter for the field <code>codeModel</code> | getCodeModel | {
"repo_name": "OnPositive/aml",
"path": "raml-to-jaxrs/core/src/main/java/org/raml/jaxrs/codegen/core/Context.java",
"license": "apache-2.0",
"size": 17925
} | [
"com.sun.codemodel.JCodeModel"
] | import com.sun.codemodel.JCodeModel; | import com.sun.codemodel.*; | [
"com.sun.codemodel"
] | com.sun.codemodel; | 1,968,882 |
private String readAppNamespace(String xmlContent) throws CoordinatorJobException {
try {
Element coordXmlElement = XmlUtils.parseXml(xmlContent);
Namespace ns = coordXmlElement.getNamespace();
if (ns != null && bundleId != null && ns.getURI().equals(SchemaService.COORDINATOR_NAMESPACE_URI_1)) {
throw new CoordinatorJobException(ErrorCode.E1319, "bundle app can not submit coordinator namespace "
+ SchemaService.COORDINATOR_NAMESPACE_URI_1 + ", please use 0.2 or later");
}
if (ns != null) {
return ns.getURI();
}
else {
throw new CoordinatorJobException(ErrorCode.E0700, "the application xml namespace is not given");
}
}
catch (JDOMException ex) {
LOG.warn("JDOMException :", ex);
throw new CoordinatorJobException(ErrorCode.E0700, ex.getMessage(), ex);
}
} | String function(String xmlContent) throws CoordinatorJobException { try { Element coordXmlElement = XmlUtils.parseXml(xmlContent); Namespace ns = coordXmlElement.getNamespace(); if (ns != null && bundleId != null && ns.getURI().equals(SchemaService.COORDINATOR_NAMESPACE_URI_1)) { throw new CoordinatorJobException(ErrorCode.E1319, STR + SchemaService.COORDINATOR_NAMESPACE_URI_1 + STR); } if (ns != null) { return ns.getURI(); } else { throw new CoordinatorJobException(ErrorCode.E0700, STR); } } catch (JDOMException ex) { LOG.warn(STR, ex); throw new CoordinatorJobException(ErrorCode.E0700, ex.getMessage(), ex); } } | /**
* Read the application XML schema namespace
*
* @param xmlContent input coordinator xml
* @return app xml namespace
* @throws CoordinatorJobException
*/ | Read the application XML schema namespace | readAppNamespace | {
"repo_name": "sunmeng007/oozie",
"path": "core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java",
"license": "apache-2.0",
"size": 44340
} | [
"org.apache.oozie.ErrorCode",
"org.apache.oozie.coord.CoordinatorJobException",
"org.apache.oozie.service.SchemaService",
"org.apache.oozie.util.XmlUtils",
"org.jdom.Element",
"org.jdom.JDOMException",
"org.jdom.Namespace"
] | import org.apache.oozie.ErrorCode; import org.apache.oozie.coord.CoordinatorJobException; import org.apache.oozie.service.SchemaService; import org.apache.oozie.util.XmlUtils; import org.jdom.Element; import org.jdom.JDOMException; import org.jdom.Namespace; | import org.apache.oozie.*; import org.apache.oozie.coord.*; import org.apache.oozie.service.*; import org.apache.oozie.util.*; import org.jdom.*; | [
"org.apache.oozie",
"org.jdom"
] | org.apache.oozie; org.jdom; | 2,075,188 |
Map<String, String> getRequestParameters();
| Map<String, String> getRequestParameters(); | /**
* Answers parameters as a map. For multi-value parameters, first value is returned.
* @return
*/ | Answers parameters as a map. For multi-value parameters, first value is returned | getRequestParameters | {
"repo_name": "CloverETL/CloverETL-Engine",
"path": "cloveretl.engine/src/org/jetel/graph/runtime/HttpContext.java",
"license": "lgpl-2.1",
"size": 5490
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,128,350 |
public static Hkdf getInstance(final String algorithm, final String provider)
throws NoSuchAlgorithmException, NoSuchProviderException {
// Constructed specifically to sanity-test arguments.
Mac mac = Mac.getInstance(algorithm, provider);
return new Hkdf(algorithm, mac.getProvider());
} | static Hkdf function(final String algorithm, final String provider) throws NoSuchAlgorithmException, NoSuchProviderException { Mac mac = Mac.getInstance(algorithm, provider); return new Hkdf(algorithm, mac.getProvider()); } | /**
* Returns an <code>Hkdf</code> object using the specified algorithm.
*
* @param algorithm
* the standard name of the requested MAC algorithm. See the Mac
* section in the <a href=
* "http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#Mac"
* > Java Cryptography Architecture Standard Algorithm Name
* Documentation</a> for information about standard algorithm
* names.
* @param provider
* the name of the provider
* @return the new <code>Hkdf</code> object
* @throws NoSuchAlgorithmException
* if a MacSpi implementation for the specified algorithm is not
* available from the specified provider.
* @throws NoSuchProviderException
* if the specified provider is not registered in the security
* provider list.
*/ | Returns an <code>Hkdf</code> object using the specified algorithm | getInstance | {
"repo_name": "smartpcr/aws-dynamodb-encryption-java",
"path": "src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/internal/Hkdf.java",
"license": "apache-2.0",
"size": 12591
} | [
"java.security.NoSuchAlgorithmException",
"java.security.NoSuchProviderException",
"javax.crypto.Mac"
] | import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import javax.crypto.Mac; | import java.security.*; import javax.crypto.*; | [
"java.security",
"javax.crypto"
] | java.security; javax.crypto; | 620,688 |
public final Quaternion plus( final Real3 im) {
return new Quaternion(re, x+im.x, y+im.y, z+im.z);
} | final Quaternion function( final Real3 im) { return new Quaternion(re, x+im.x, y+im.y, z+im.z); } | /**
* Creates sum of this and purley imaginary quaternion given by <code>im</code>.
*/ | Creates sum of this and purley imaginary quaternion given by <code>im</code> | plus | {
"repo_name": "jupsal/schmies-jTEM",
"path": "libUnzipped/de/jtem/mfc/field/Quaternion.java",
"license": "bsd-2-clause",
"size": 43415
} | [
"de.jtem.mfc.vector.Real3"
] | import de.jtem.mfc.vector.Real3; | import de.jtem.mfc.vector.*; | [
"de.jtem.mfc"
] | de.jtem.mfc; | 2,243,674 |
public static void forceUpdate(Context context) {
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
ComponentName thisAppWidget = new ComponentName(context.getPackageName(),
CoolItWidget.class.getName());
int[] appWidgetIds = appWidgetManager.getAppWidgetIds(thisAppWidget);
for (int appWidgetId : appWidgetIds) {
CoolItWidget.updateAppWidget(context, appWidgetManager, appWidgetId);
}
} | static void function(Context context) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); ComponentName thisAppWidget = new ComponentName(context.getPackageName(), CoolItWidget.class.getName()); int[] appWidgetIds = appWidgetManager.getAppWidgetIds(thisAppWidget); for (int appWidgetId : appWidgetIds) { CoolItWidget.updateAppWidget(context, appWidgetManager, appWidgetId); } } | /**
* Initiate update of widgets with current temperature
*
* @param context Application context.
*/ | Initiate update of widgets with current temperature | forceUpdate | {
"repo_name": "beegee-tokyo/coolit",
"path": "app/src/main/java/tk/giesecke/coolit/CoolItWidget.java",
"license": "gpl-2.0",
"size": 7392
} | [
"android.appwidget.AppWidgetManager",
"android.content.ComponentName",
"android.content.Context"
] | import android.appwidget.AppWidgetManager; import android.content.ComponentName; import android.content.Context; | import android.appwidget.*; import android.content.*; | [
"android.appwidget",
"android.content"
] | android.appwidget; android.content; | 2,457,319 |
private static
void setTimerForTokenRenewal(DelegationTokenToRenew token,
boolean firstTime) throws IOException {
// calculate timer time
long now = System.currentTimeMillis();
long renewIn;
if(firstTime) {
renewIn = now;
} else {
long expiresIn = (token.expirationDate - now);
renewIn = now + expiresIn - expiresIn/10; // little bit before the expiration
}
// need to create new task every time
TimerTask tTask = new RenewalTimerTask(token);
token.setTimerTask(tTask); // keep reference to the timer
renewalTimer.schedule(token.timerTask, new Date(renewIn));
} | static void function(DelegationTokenToRenew token, boolean firstTime) throws IOException { long now = System.currentTimeMillis(); long renewIn; if(firstTime) { renewIn = now; } else { long expiresIn = (token.expirationDate - now); renewIn = now + expiresIn - expiresIn/10; } TimerTask tTask = new RenewalTimerTask(token); token.setTimerTask(tTask); renewalTimer.schedule(token.timerTask, new Date(renewIn)); } | /**
* set task to renew the token
*/ | set task to renew the token | setTimerForTokenRenewal | {
"repo_name": "dianping/cosmos-hadoop",
"path": "src/mapred/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java",
"license": "apache-2.0",
"size": 9502
} | [
"java.io.IOException",
"java.util.Date",
"java.util.TimerTask"
] | import java.io.IOException; import java.util.Date; import java.util.TimerTask; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 943,882 |
public static void downto(Float self, Number to, @ClosureParams(FirstParam.class) Closure closure) {
float to1 = to.floatValue();
if (self >= to1) {
for (float i = self; i >= to1; i--) {
closure.call(i);
}
} else
throw new GroovyRuntimeException("The argument (" + to +
") to downto() cannot be greater than the value (" + self + ") it's called on."); } | static void function(Float self, Number to, @ClosureParams(FirstParam.class) Closure closure) { float to1 = to.floatValue(); if (self >= to1) { for (float i = self; i >= to1; i--) { closure.call(i); } } else throw new GroovyRuntimeException(STR + to + STR + self + STR); } | /**
* Iterates from this number down to the given number, inclusive,
* decrementing by one each time.
*
* @param self a Float
* @param to the end number
* @param closure the code to execute for each number
* @since 1.0
*/ | Iterates from this number down to the given number, inclusive, decrementing by one each time | downto | {
"repo_name": "armsargis/groovy",
"path": "src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java",
"license": "apache-2.0",
"size": 698233
} | [
"groovy.lang.Closure",
"groovy.lang.GroovyRuntimeException",
"groovy.transform.stc.ClosureParams",
"groovy.transform.stc.FirstParam"
] | import groovy.lang.Closure; import groovy.lang.GroovyRuntimeException; import groovy.transform.stc.ClosureParams; import groovy.transform.stc.FirstParam; | import groovy.lang.*; import groovy.transform.stc.*; | [
"groovy.lang",
"groovy.transform.stc"
] | groovy.lang; groovy.transform.stc; | 2,497,345 |
@Override
public int compareTo(RDotTxtEntry that) {
if (this == that) {
return 0;
}
ComparisonChain comparisonChain =
ComparisonChain.start()
.compare(this.type, that.type)
.compare(this.parent, that.parent)
.compare(this.name, that.name);
return comparisonChain.result();
} | int function(RDotTxtEntry that) { if (this == that) { return 0; } ComparisonChain comparisonChain = ComparisonChain.start() .compare(this.type, that.type) .compare(this.parent, that.parent) .compare(this.name, that.name); return comparisonChain.result(); } | /**
* A collection of Resources should be sorted such that Resources of the same type should be
* grouped together, and should be alphabetized within that group.
*/ | A collection of Resources should be sorted such that Resources of the same type should be grouped together, and should be alphabetized within that group | compareTo | {
"repo_name": "facebook/buck",
"path": "src/com/facebook/buck/android/aapt/RDotTxtEntry.java",
"license": "apache-2.0",
"size": 9750
} | [
"com.google.common.collect.ComparisonChain"
] | import com.google.common.collect.ComparisonChain; | import com.google.common.collect.*; | [
"com.google.common"
] | com.google.common; | 643,912 |
@PostConstruct
public void initConfig() throws IOException {
String fileName = null;
this.load(fileName);
} | void function() throws IOException { String fileName = null; this.load(fileName); } | /**
* Called when the bean is created and does the actual config loading
* @throws IOException
*/ | Called when the bean is created and does the actual config loading | initConfig | {
"repo_name": "trentontrees/dawg",
"path": "libraries/dawg-pound/src/main/java/com/comcast/video/dawg/controller/pound/DawgPoundConfiguration.java",
"license": "apache-2.0",
"size": 1443
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,088,408 |
GraphCanvas.showLoading("Loading...");
filler.init(this, cb);
} | GraphCanvas.showLoading(STR); filler.init(this, cb); } | /**
* Starts the filling with a given remote filler. Calls
* GraphManipulationCallback after filling has ended
*
* @param filler
* the filler to use
* @param cb
* the GraphManipulationCallback to call
*/ | Starts the filling with a given remote filler. Calls GraphManipulationCallback after filling has ended | fill | {
"repo_name": "patrickbr/ferryleaks",
"path": "src/com/algebraweb/editor/client/graphcanvas/remotefiller/GraphCanvasRemoteFillingMachine.java",
"license": "gpl-2.0",
"size": 1895
} | [
"com.algebraweb.editor.client.graphcanvas.GraphCanvas"
] | import com.algebraweb.editor.client.graphcanvas.GraphCanvas; | import com.algebraweb.editor.client.graphcanvas.*; | [
"com.algebraweb.editor"
] | com.algebraweb.editor; | 845,120 |
public synchronized void connect(BluetoothDevice device, boolean secure) {
Log.d(TAG, "connect to: " + device);
// Cancel any thread attempting to make a connection
if (mState == STATE_CONNECTING) {
if (mConnectThread != null) {
mConnectThread.cancel();
mConnectThread = null;
}
}
// Cancel any thread currently running a connection
if (mConnectedThread != null) {
mConnectedThread.cancel();
mConnectedThread = null;
}
// Start the thread to connect with the given device
mConnectThread = new ConnectThread(device, secure);
mConnectThread.start();
setState(STATE_CONNECTING);
} | synchronized void function(BluetoothDevice device, boolean secure) { Log.d(TAG, STR + device); if (mState == STATE_CONNECTING) { if (mConnectThread != null) { mConnectThread.cancel(); mConnectThread = null; } } if (mConnectedThread != null) { mConnectedThread.cancel(); mConnectedThread = null; } mConnectThread = new ConnectThread(device, secure); mConnectThread.start(); setState(STATE_CONNECTING); } | /**
* Start the ConnectThread to initiate a connection to a remote device.
*
* @param device The BluetoothDevice to connect
* @param secure Socket Security type - Secure (true) , Insecure (false)
*/ | Start the ConnectThread to initiate a connection to a remote device | connect | {
"repo_name": "saggafarsyad/ArduinoAndroidBluetoothSerialComm",
"path": "android/Application/src/main/java/com/example/android/bluetoothchat/BluetoothChatService.java",
"license": "mit",
"size": 19033
} | [
"android.bluetooth.BluetoothDevice",
"com.example.android.common.logger.Log"
] | import android.bluetooth.BluetoothDevice; import com.example.android.common.logger.Log; | import android.bluetooth.*; import com.example.android.common.logger.*; | [
"android.bluetooth",
"com.example.android"
] | android.bluetooth; com.example.android; | 1,908,014 |
@Override
public void prepareWrite(final int recordCount, final int inputSize,
final int idealSize) {
try {
this.inputCount = inputSize;
this.idealCount = idealSize;
this.output = new PrintStream(new FileOutputStream(this.file));
} catch (final IOException ex) {
throw new BufferedDataError(ex);
}
} | void function(final int recordCount, final int inputSize, final int idealSize) { try { this.inputCount = inputSize; this.idealCount = idealSize; this.output = new PrintStream(new FileOutputStream(this.file)); } catch (final IOException ex) { throw new BufferedDataError(ex); } } | /**
* Prepare to write to a CSV file.
*
* @param recordCount
* The total record count, that will be written.
* @param inputSize
* The input size.
* @param idealSize
* The ideal size.
*/ | Prepare to write to a CSV file | prepareWrite | {
"repo_name": "Crespo911/encog-java-core",
"path": "src/main/java/org/encog/ml/data/buffer/codec/CSVDataCODEC.java",
"license": "apache-2.0",
"size": 6728
} | [
"java.io.FileOutputStream",
"java.io.IOException",
"java.io.PrintStream",
"org.encog.ml.data.buffer.BufferedDataError"
] | import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; import org.encog.ml.data.buffer.BufferedDataError; | import java.io.*; import org.encog.ml.data.buffer.*; | [
"java.io",
"org.encog.ml"
] | java.io; org.encog.ml; | 1,235,400 |
default void checkCanDropView(Identity identity, CatalogSchemaTableName view)
{
denyDropView(view.toString());
} | default void checkCanDropView(Identity identity, CatalogSchemaTableName view) { denyDropView(view.toString()); } | /**
* Check if identity is allowed to drop the specified view in a catalog.
*
* @throws com.facebook.presto.spi.security.AccessDeniedException if not allowed
*/ | Check if identity is allowed to drop the specified view in a catalog | checkCanDropView | {
"repo_name": "RobinUS2/presto",
"path": "presto-spi/src/main/java/com/facebook/presto/spi/security/SystemAccessControl.java",
"license": "apache-2.0",
"size": 11691
} | [
"com.facebook.presto.spi.CatalogSchemaTableName",
"com.facebook.presto.spi.security.AccessDeniedException"
] | import com.facebook.presto.spi.CatalogSchemaTableName; import com.facebook.presto.spi.security.AccessDeniedException; | import com.facebook.presto.spi.*; import com.facebook.presto.spi.security.*; | [
"com.facebook.presto"
] | com.facebook.presto; | 596,053 |
public void setAllCases(List<FeatureTerm> allCases) {
this.allCases = allCases;
} | void function(List<FeatureTerm> allCases) { this.allCases = allCases; } | /**
* Sets the all cases.
*
* @param allCases
* the new all cases
*/ | Sets the all cases | setAllCases | {
"repo_name": "santiontanon/fterm",
"path": "src/ftl/base/bridges/NOOSToWeka.java",
"license": "bsd-3-clause",
"size": 10722
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,591,403 |
public EAttribute getCustomer_Vip() {
return (EAttribute)getCustomer().getEStructuralFeatures().get(1);
} | EAttribute function() { return (EAttribute)getCustomer().getEStructuralFeatures().get(1); } | /**
* Returns the meta object for the attribute '{@link CIM15.IEC61968.Customers.Customer#isVip <em>Vip</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Vip</em>'.
* @see CIM15.IEC61968.Customers.Customer#isVip()
* @see #getCustomer()
* @generated
*/ | Returns the meta object for the attribute '<code>CIM15.IEC61968.Customers.Customer#isVip Vip</code>'. | getCustomer_Vip | {
"repo_name": "SES-fortiss/SmartGridCoSimulation",
"path": "core/cim15/src/CIM15/IEC61968/Customers/CustomersPackage.java",
"license": "apache-2.0",
"size": 145849
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 60,308 |
@Test(groups = { "unit" }, timeOut = TIMEOUT)
public void shouldRetryWithGenericException() {
RxDocumentServiceRequest request = RxDocumentServiceRequest.create(
mockDiagnosticsClientContext(),
OperationType.Read,
ResourceType.Document);
GoneAndRetryWithRetryPolicy goneAndRetryWithRetryPolicy = new GoneAndRetryWithRetryPolicy(request, 30);
Mono<ShouldRetryResult> singleShouldRetry = goneAndRetryWithRetryPolicy
.shouldRetry(new BadRequestException());
ShouldRetryResult shouldRetryResult = singleShouldRetry.block();
assertThat(shouldRetryResult.shouldRetry).isFalse();
} | @Test(groups = { "unit" }, timeOut = TIMEOUT) void function() { RxDocumentServiceRequest request = RxDocumentServiceRequest.create( mockDiagnosticsClientContext(), OperationType.Read, ResourceType.Document); GoneAndRetryWithRetryPolicy goneAndRetryWithRetryPolicy = new GoneAndRetryWithRetryPolicy(request, 30); Mono<ShouldRetryResult> singleShouldRetry = goneAndRetryWithRetryPolicy .shouldRetry(new BadRequestException()); ShouldRetryResult shouldRetryResult = singleShouldRetry.block(); assertThat(shouldRetryResult.shouldRetry).isFalse(); } | /**
* No retry on bad request exception
*/ | No retry on bad request exception | shouldRetryWithGenericException | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/implementation/directconnectivity/GoneAndRetryWithRetryPolicyTest.java",
"license": "mit",
"size": 20105
} | [
"com.azure.cosmos.implementation.BadRequestException",
"com.azure.cosmos.implementation.OperationType",
"com.azure.cosmos.implementation.ResourceType",
"com.azure.cosmos.implementation.RxDocumentServiceRequest",
"com.azure.cosmos.implementation.ShouldRetryResult",
"com.azure.cosmos.implementation.TestUtils",
"org.assertj.core.api.Assertions",
"org.testng.annotations.Test"
] | import com.azure.cosmos.implementation.BadRequestException; import com.azure.cosmos.implementation.OperationType; import com.azure.cosmos.implementation.ResourceType; import com.azure.cosmos.implementation.RxDocumentServiceRequest; import com.azure.cosmos.implementation.ShouldRetryResult; import com.azure.cosmos.implementation.TestUtils; import org.assertj.core.api.Assertions; import org.testng.annotations.Test; | import com.azure.cosmos.implementation.*; import org.assertj.core.api.*; import org.testng.annotations.*; | [
"com.azure.cosmos",
"org.assertj.core",
"org.testng.annotations"
] | com.azure.cosmos; org.assertj.core; org.testng.annotations; | 1,317,621 |
@SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Class key) {
if (key.equals(IContentOutlinePage.class)) {
return showOutlineView() ? getContentOutlinePage() : null;
}
else if (key.equals(IPropertySheetPage.class)) {
return getPropertySheetPage();
}
else if (key.equals(IGotoMarker.class)) {
return this;
}
else {
return super.getAdapter(key);
}
}
| @SuppressWarnings(STR) Object function(Class key) { if (key.equals(IContentOutlinePage.class)) { return showOutlineView() ? getContentOutlinePage() : null; } else if (key.equals(IPropertySheetPage.class)) { return getPropertySheetPage(); } else if (key.equals(IGotoMarker.class)) { return this; } else { return super.getAdapter(key); } } | /**
* This is how the framework determines which interfaces we implement.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This is how the framework determines which interfaces we implement. | getAdapter | {
"repo_name": "7xMatthx2/E4Training",
"path": "com.sii.airline.editor/src/com/sii/airline/airline/presentation/AirlineEditor.java",
"license": "epl-1.0",
"size": 55870
} | [
"org.eclipse.ui.ide.IGotoMarker",
"org.eclipse.ui.views.contentoutline.IContentOutlinePage",
"org.eclipse.ui.views.properties.IPropertySheetPage"
] | import org.eclipse.ui.ide.IGotoMarker; import org.eclipse.ui.views.contentoutline.IContentOutlinePage; import org.eclipse.ui.views.properties.IPropertySheetPage; | import org.eclipse.ui.ide.*; import org.eclipse.ui.views.contentoutline.*; import org.eclipse.ui.views.properties.*; | [
"org.eclipse.ui"
] | org.eclipse.ui; | 966,829 |
public void testConflation()
{
try {
HARegionQueue regionqueue = createHARegionQueue("testing");
EventID ev1 = new EventID(new byte[] { 1 }, 1, 1);
EventID ev2 = new EventID(new byte[] { 1 }, 2, 2);
Conflatable cf1 = new ConflatableObject("key", "value", ev1, true,
"testing");
Conflatable cf2 = new ConflatableObject("key", "value2", ev2, true,
"testing");
regionqueue.put(cf1);
Map conflationMap = regionqueue
.getConflationMapForTesting();
Assert.assertTrue(((Map)(conflationMap.get("testing"))).get("key")
.equals(new Long(1)));
regionqueue.put(cf2);
//verify the conflation map has recorded the new key
Assert.assertTrue(((Map)(conflationMap.get("testing"))).get("key")
.equals(new Long(2)));
//the old key should not be present
Assert.assertTrue(!regionqueue.getRegion().containsKey(new Long(1)));
//available ids should not contain the old id (the old position)
Assert.assertTrue(!regionqueue.getAvalaibleIds().contains(new Long(1)));
// available id should have the new id (the new position)
Assert.assertTrue(regionqueue.getAvalaibleIds().contains(new Long(2)));
// events map should not contain the old position
Assert.assertTrue(regionqueue.getCurrentCounterSet(ev1).isEmpty());
// events map should contain the new position
Assert.assertTrue(regionqueue.getCurrentCounterSet(ev2).contains(
new Long(2)));
}
catch (Exception e) {
e.printStackTrace();
fail("Exception occured in test due to " + e);
}
} | void function() { try { HARegionQueue regionqueue = createHARegionQueue(STR); EventID ev1 = new EventID(new byte[] { 1 }, 1, 1); EventID ev2 = new EventID(new byte[] { 1 }, 2, 2); Conflatable cf1 = new ConflatableObject("key", "value", ev1, true, STR); Conflatable cf2 = new ConflatableObject("key", STR, ev2, true, STR); regionqueue.put(cf1); Map conflationMap = regionqueue .getConflationMapForTesting(); Assert.assertTrue(((Map)(conflationMap.get(STR))).get("key") .equals(new Long(1))); regionqueue.put(cf2); Assert.assertTrue(((Map)(conflationMap.get(STR))).get("key") .equals(new Long(2))); Assert.assertTrue(!regionqueue.getRegion().containsKey(new Long(1))); Assert.assertTrue(!regionqueue.getAvalaibleIds().contains(new Long(1))); Assert.assertTrue(regionqueue.getAvalaibleIds().contains(new Long(2))); Assert.assertTrue(regionqueue.getCurrentCounterSet(ev1).isEmpty()); Assert.assertTrue(regionqueue.getCurrentCounterSet(ev2).contains( new Long(2))); } catch (Exception e) { e.printStackTrace(); fail(STR + e); } } | /**
* test to verify conflation happens as expected
*
*/ | test to verify conflation happens as expected | testConflation | {
"repo_name": "papicella/snappy-store",
"path": "gemfire-junit/src/main/java/com/gemstone/gemfire/internal/cache/ha/HARegionQueueJUnitTest.java",
"license": "apache-2.0",
"size": 72282
} | [
"com.gemstone.gemfire.internal.cache.Conflatable",
"com.gemstone.gemfire.internal.cache.EventID",
"java.util.Map",
"junit.framework.Assert"
] | import com.gemstone.gemfire.internal.cache.Conflatable; import com.gemstone.gemfire.internal.cache.EventID; import java.util.Map; import junit.framework.Assert; | import com.gemstone.gemfire.internal.cache.*; import java.util.*; import junit.framework.*; | [
"com.gemstone.gemfire",
"java.util",
"junit.framework"
] | com.gemstone.gemfire; java.util; junit.framework; | 450,326 |
public RGBValues getBackgroundColor() {
return backgroundColor;
} | RGBValues function() { return backgroundColor; } | /**
* Get the background color of this header.
*
* @return the background color
*/ | Get the background color of this header | getBackgroundColor | {
"repo_name": "FTSRG/iq-sirius-integration",
"path": "host/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/api/diagramtype/HeaderData.java",
"license": "epl-1.0",
"size": 3319
} | [
"org.eclipse.sirius.viewpoint.RGBValues"
] | import org.eclipse.sirius.viewpoint.RGBValues; | import org.eclipse.sirius.viewpoint.*; | [
"org.eclipse.sirius"
] | org.eclipse.sirius; | 2,322,966 |
public SELF isBeforeOrEqualTo(Instant other) {
dates.assertIsBeforeOrEqualTo(info, actual, Date.from(other));
return myself;
}
/**
* Same assertion as {@link #isBeforeOrEqualsTo(Date)} but given date is represented as String either with one of the
* supported defaults date format or a user custom date format (set with method {@link #withDateFormat(DateFormat)}).
* <p>
* User custom date format take precedence over the default ones.
* <p>
* Unless specified otherwise, beware that the default formats are expressed in the current local timezone.
* <p>
* Example:
* <pre><code class='java'> // assertion will pass
* // theTwoTowers release date : 2002-12-18
* assertThat(theTwoTowers.getReleaseDate()).isBeforeOrEqualsTo("2002-12-19");
* assertThat(theTwoTowers.getReleaseDate()).isBeforeOrEqualsTo("2002-12-18");
*
* // assertion will fail
* assertThat(theTwoTowers.getReleaseDate()).isBeforeOrEqualsTo("2002-12-17")</code></pre>
* <p>
* Defaults date format (expressed in the local time zone unless specified otherwise) are:
* <ul>
* <li><code>yyyy-MM-dd'T'HH:mm:ss.SSSX</code> (in ISO Time zone)</li>
* <li><code>yyyy-MM-dd'T'HH:mm:ss.SSS</code></li>
* <li><code>yyyy-MM-dd HH:mm:ss.SSS</code></li>
* <li><code>yyyy-MM-dd'T'HH:mm:ssX</code> (in ISO Time zone)</li>
* <li><code>yyyy-MM-dd'T'HH:mm:ss</code></li>
* <li><code>yyyy-MM-dd</code></li>
* </ul>
* <p>
* Example of valid string date representations:
* <ul>
* <li><code>2003-04-26T03:01:02.758+00:00</code></li>
* <li><code>2003-04-26T03:01:02.999</code></li>
* <li><code>2003-04-26 03:01:02.999</code></li>
* <li><code>2003-04-26T03:01:02+00:00</code></li>
* <li><code>2003-04-26T13:01:02</code></li>
* <li><code>2003-04-26</code></li>
* </ul>
* <p>
* If you are getting an {@code IllegalArgumentException} with <i>"Unknown pattern character 'X'"</i> message (some Android versions don't support it),
* you can explicitly specify the date format to use so that the default ones are bypassed.
*
* @param dateAsString the given Date represented as String in default or custom date format.
* @return this assertion object.
* @throws AssertionError if the actual {@code Date} is {@code null}.
* @throws NullPointerException if given date as String is {@code null}.
* @throws AssertionError if the actual {@code Date} is not before or equals to the given Date represented as
* String.
* @throws AssertionError if the given date as String could not be converted to a Date.
* @deprecated prefer calling {@link #isBeforeOrEqualTo(String)} | SELF function(Instant other) { dates.assertIsBeforeOrEqualTo(info, actual, Date.from(other)); return myself; } /** * Same assertion as {@link #isBeforeOrEqualsTo(Date)} but given date is represented as String either with one of the * supported defaults date format or a user custom date format (set with method {@link #withDateFormat(DateFormat)}). * <p> * User custom date format take precedence over the default ones. * <p> * Unless specified otherwise, beware that the default formats are expressed in the current local timezone. * <p> * Example: * <pre><code class='java'> * * assertThat(theTwoTowers.getReleaseDate()).isBeforeOrEqualsTo(STR); * assertThat(theTwoTowers.getReleaseDate()).isBeforeOrEqualsTo(STR); * * * assertThat(theTwoTowers.getReleaseDate()).isBeforeOrEqualsTo(STR)</code></pre> * <p> * Defaults date format (expressed in the local time zone unless specified otherwise) are: * <ul> * <li><code>yyyy-MM-dd'T'HH:mm:ss.SSSX</code> (in ISO Time zone)</li> * <li><code>yyyy-MM-dd'T'HH:mm:ss.SSS</code></li> * <li><code>yyyy-MM-dd HH:mm:ss.SSS</code></li> * <li><code>yyyy-MM-dd'T'HH:mm:ssX</code> (in ISO Time zone)</li> * <li><code>yyyy-MM-dd'T'HH:mm:ss</code></li> * <li><code>yyyy-MM-dd</code></li> * </ul> * <p> * Example of valid string date representations: * <ul> * <li><code>2003-04-26T03:01:02.758+00:00</code></li> * <li><code>2003-04-26T03:01:02.999</code></li> * <li><code>2003-04-26 03:01:02.999</code></li> * <li><code>2003-04-26T03:01:02+00:00</code></li> * <li><code>2003-04-26T13:01:02</code></li> * <li><code>2003-04-26</code></li> * </ul> * <p> * If you are getting an {@code IllegalArgumentException} with <i>STR</i> message (some Android versions don't support it), * you can explicitly specify the date format to use so that the default ones are bypassed. * * @param dateAsString the given Date represented as String in default or custom date format. * @return this assertion object. * @throws AssertionError if the actual {@code Date} is {@code null}. * @throws NullPointerException if given date as String is {@code null}. * @throws AssertionError if the actual {@code Date} is not before or equals to the given Date represented as * String. * @throws AssertionError if the given date as String could not be converted to a Date. * @deprecated prefer calling {@link #isBeforeOrEqualTo(String)} | /**
* Verifies that the actual {@code Date} is before or equal to the given {@link Instant}.
* <p>
* Example:
* <pre><code class='java'> // assertions succeed
* // theTwoTowers release date : 2002-12-18
* assertThat(theTwoTowers.getReleaseDate()).isBeforeOrEqualTo(Instant.parse("2002-12-19T00:00:00.00Z"));
* assertThat(theTwoTowers.getReleaseDate()).isBeforeOrEqualTo(Instant.parse("2002-12-18T00:00:00.00Z"));
*
* // assertion fails
* assertThat(theTwoTowers.getReleaseDate()).isBeforeOrEqualTo(Instant.parse("2002-12-17T00:00:00.00Z"));</code></pre>
*
* @param other the given {@code Instant}.
* @return this assertion object.
* @throws AssertionError if the actual {@code Date} is {@code null}.
* @throws NullPointerException if other {@code Instant} is {@code null}.
* @throws AssertionError if the actual {@code Date} is not before or equal to the given {@code Instant}.
* @since 3.19.0
*/ | Verifies that the actual Date is before or equal to the given <code>Instant</code>. Example: <code> // assertions succeed theTwoTowers release date : 2002-12-18 assertThat(theTwoTowers.getReleaseDate()).isBeforeOrEqualTo(Instant.parse("2002-12-19T00:00:00.00Z")); assertThat(theTwoTowers.getReleaseDate()).isBeforeOrEqualTo(Instant.parse("2002-12-18T00:00:00.00Z")); assertion fails assertThat(theTwoTowers.getReleaseDate()).isBeforeOrEqualTo(Instant.parse("2002-12-17T00:00:00.00Z"));</code></code> | isBeforeOrEqualTo | {
"repo_name": "joel-costigliola/assertj-core",
"path": "src/main/java/org/assertj/core/api/AbstractDateAssert.java",
"license": "apache-2.0",
"size": 167024
} | [
"java.text.DateFormat",
"java.time.Instant",
"java.util.Date"
] | import java.text.DateFormat; import java.time.Instant; import java.util.Date; | import java.text.*; import java.time.*; import java.util.*; | [
"java.text",
"java.time",
"java.util"
] | java.text; java.time; java.util; | 1,175,088 |
public Write<T> withCassandraService(CassandraService<T> cassandraService) {
checkArgument(cassandraService != null, "CassandraIO.write().withCassandraService"
+ "(service) called with null service");
return builder().setCassandraService(cassandraService).build();
} | Write<T> function(CassandraService<T> cassandraService) { checkArgument(cassandraService != null, STR + STR); return builder().setCassandraService(cassandraService).build(); } | /**
* Specify the {@link CassandraService} used to connect and write into the Cassandra database.
*/ | Specify the <code>CassandraService</code> used to connect and write into the Cassandra database | withCassandraService | {
"repo_name": "shakamunyi/beam",
"path": "sdks/java/io/cassandra/src/main/java/org/apache/beam/sdk/io/cassandra/CassandraIO.java",
"license": "apache-2.0",
"size": 17622
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 2,105,349 |
private static Map<String, File> copyClassFilesLocally(ClassFileManifest.Diff manifestDiff)
throws ExecutionException {
File tempDir = new File(System.getProperty("java.io.tmpdir"));
String suffix = UUID.randomUUID().toString().substring(0, 8);
File localDir = new File(tempDir, "class_files_" + suffix);
if (!localDir.mkdir()) {
throw new ExecutionException(
String.format("Cannot create temp output directory '%s'", localDir.getPath()));
}
localDir.deleteOnExit();
Map<String, File> map = new HashMap<>();
for (File jar : manifestDiff.perJarModifiedClasses.keySet()) {
Collection<String> classes = manifestDiff.perJarModifiedClasses.get(jar);
map.putAll(copyClassFilesLocally(localDir, jar, classes));
}
return ImmutableMap.copyOf(map);
} | static Map<String, File> function(ClassFileManifest.Diff manifestDiff) throws ExecutionException { File tempDir = new File(System.getProperty(STR)); String suffix = UUID.randomUUID().toString().substring(0, 8); File localDir = new File(tempDir, STR + suffix); if (!localDir.mkdir()) { throw new ExecutionException( String.format(STR, localDir.getPath())); } localDir.deleteOnExit(); Map<String, File> map = new HashMap<>(); for (File jar : manifestDiff.perJarModifiedClasses.keySet()) { Collection<String> classes = manifestDiff.perJarModifiedClasses.get(jar); map.putAll(copyClassFilesLocally(localDir, jar, classes)); } return ImmutableMap.copyOf(map); } | /**
* Given a per-jar map of .class files, extracts them locally and returns a map from qualified
* class name to File, suitable for {@link HotSwapManager}.
*
* @throws ExecutionException if operation failed
*/ | Given a per-jar map of .class files, extracts them locally and returns a map from qualified class name to File, suitable for <code>HotSwapManager</code> | copyClassFilesLocally | {
"repo_name": "bazelbuild/intellij",
"path": "java/src/com/google/idea/blaze/java/run/hotswap/BlazeHotSwapManager.java",
"license": "apache-2.0",
"size": 8494
} | [
"com.google.common.collect.ImmutableMap",
"com.intellij.execution.ExecutionException",
"java.io.File",
"java.util.Collection",
"java.util.HashMap",
"java.util.Map",
"java.util.UUID"
] | import com.google.common.collect.ImmutableMap; import com.intellij.execution.ExecutionException; import java.io.File; import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.UUID; | import com.google.common.collect.*; import com.intellij.execution.*; import java.io.*; import java.util.*; | [
"com.google.common",
"com.intellij.execution",
"java.io",
"java.util"
] | com.google.common; com.intellij.execution; java.io; java.util; | 167,005 |
public void put(@NonNull final String key, final Drawable value) {
put(key, value, -1);
} | void function(@NonNull final String key, final Drawable value) { put(key, value, -1); } | /**
* Put drawable in cache.
*
* @param key The key of cache.
* @param value The value of cache.
*/ | Put drawable in cache | put | {
"repo_name": "Blankj/AndroidUtilCode",
"path": "lib/utilcode/src/main/java/com/blankj/utilcode/util/CacheDiskUtils.java",
"license": "apache-2.0",
"size": 30297
} | [
"android.graphics.drawable.Drawable",
"androidx.annotation.NonNull"
] | import android.graphics.drawable.Drawable; import androidx.annotation.NonNull; | import android.graphics.drawable.*; import androidx.annotation.*; | [
"android.graphics",
"androidx.annotation"
] | android.graphics; androidx.annotation; | 2,519,725 |
@Override
public Preferences rename(Name name) {
return new Preferences(name, null);
}
// -------------------------------------------------------------------------
// Row8 type methods
// ------------------------------------------------------------------------- | Preferences function(Name name) { return new Preferences(name, null); } | /**
* Rename this table
*/ | Rename this table | rename | {
"repo_name": "gchq/stroom",
"path": "stroom-config/stroom-config-global-impl-db-jooq/src/main/java/stroom/config/impl/db/jooq/tables/Preferences.java",
"license": "apache-2.0",
"size": 5521
} | [
"org.jooq.Name"
] | import org.jooq.Name; | import org.jooq.*; | [
"org.jooq"
] | org.jooq; | 2,836,944 |
//@VisibleForTesting
long readGranuleOfLastPage(ExtractorInput input)
throws IOException, InterruptedException {
skipToNextPage(input);
pageHeader.reset();
while ((pageHeader.type & 0x04) != 0x04 && input.getPosition() < endPosition) {
pageHeader.populate(input, false);
input.skipFully(pageHeader.headerSize + pageHeader.bodySize);
}
return pageHeader.granulePosition;
} | throws IOException, InterruptedException { skipToNextPage(input); pageHeader.reset(); while ((pageHeader.type & 0x04) != 0x04 && input.getPosition() < endPosition) { pageHeader.populate(input, false); input.skipFully(pageHeader.headerSize + pageHeader.bodySize); } return pageHeader.granulePosition; } | /**
* Skips to the last Ogg page in the stream and reads the header's granule field which is the
* total number of samples per channel.
*
* @param input The {@link ExtractorInput} to read from.
* @return the total number of samples of this input.
* @throws IOException thrown if reading from the input fails.
* @throws InterruptedException thrown if interrupted while reading from the input.
*/ | Skips to the last Ogg page in the stream and reads the header's granule field which is the total number of samples per channel | readGranuleOfLastPage | {
"repo_name": "anudeep3998/cse630",
"path": "library/src/main/java/com/google/android/exoplayer2/extractor/ogg/DefaultOggSeeker.java",
"license": "apache-2.0",
"size": 11798
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,003,595 |
public void trace(@Nullable final String event, @Nullable final String message, @Nullable final Throwable throwable) {
log(LogLevel.TRACE, event, message, EMPTY_STRING_ARRAY, EMPTY_OBJECT_ARRAY, throwable);
} | void function(@Nullable final String event, @Nullable final String message, @Nullable final Throwable throwable) { log(LogLevel.TRACE, event, message, EMPTY_STRING_ARRAY, EMPTY_OBJECT_ARRAY, throwable); } | /**
* Log a message for a canonical event with a {@link Throwable} at the
* trace level. Default values are used for all other parameters.
*
* @since 1.3.0
*
* @param event The canonical event that occurred.
* @param message The message to be logged.
* @param throwable The exception ({@link Throwable}) to be logged.
*/ | Log a message for a canonical event with a <code>Throwable</code> at the trace level. Default values are used for all other parameters | trace | {
"repo_name": "ArpNetworking/logback-steno",
"path": "src/main/java/com/arpnetworking/steno/Logger.java",
"license": "apache-2.0",
"size": 68020
} | [
"javax.annotation.Nullable"
] | import javax.annotation.Nullable; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 2,208,196 |
public Builder addAll(Collection<Long> values) {
ensureRoomFor(values.size());
for (Long value : values) {
array[count++] = value;
}
return this;
} | Builder function(Collection<Long> values) { ensureRoomFor(values.size()); for (Long value : values) { array[count++] = value; } return this; } | /**
* Appends {@code values}, in order, to the end of the values the built {@link
* ImmutableLongArray} will contain.
*/ | Appends values, in order, to the end of the values the built <code>ImmutableLongArray</code> will contain | addAll | {
"repo_name": "typetools/guava",
"path": "android/guava/src/com/google/common/primitives/ImmutableLongArray.java",
"license": "apache-2.0",
"size": 19385
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 1,614,099 |
public synchronized int assignBuildNumber() throws IOException {
int r = nextBuildNumber++;
saveNextBuildNumber();
return r;
} | synchronized int function() throws IOException { int r = nextBuildNumber++; saveNextBuildNumber(); return r; } | /**
* Allocates a new buildCommand number.
*/ | Allocates a new buildCommand number | assignBuildNumber | {
"repo_name": "lilyJi/jenkins",
"path": "core/src/main/java/hudson/model/Job.java",
"license": "mit",
"size": 53225
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,158,512 |
public static Event[] getEventsForInterface(int nodeId, String ipAddress, SortStyle sortStyle, AcknowledgeType ackType, int throttle, int offset, ServletContext servletContext) throws SQLException {
if (ipAddress == null || sortStyle == null || ackType == null) {
throw new IllegalArgumentException("Cannot take null parameters.");
}
Filter[] filters = new Filter[] { new NodeFilter(nodeId, servletContext), new InterfaceFilter(ipAddress) };
return getEvents(sortStyle, ackType, filters, throttle, offset);
} | static Event[] function(int nodeId, String ipAddress, SortStyle sortStyle, AcknowledgeType ackType, int throttle, int offset, ServletContext servletContext) throws SQLException { if (ipAddress == null sortStyle == null ackType == null) { throw new IllegalArgumentException(STR); } Filter[] filters = new Filter[] { new NodeFilter(nodeId, servletContext), new InterfaceFilter(ipAddress) }; return getEvents(sortStyle, ackType, filters, throttle, offset); } | /**
* Return some maximum number of events or less (optionally only
* unacknowledged events) sorted by the given sort style for the given node
* and IP address.
*
* @param throttle
* a value less than one means no throttling
* @param offset
* which row to start on in the result list
* @param nodeId a int.
* @param ipAddress a {@link java.lang.String} object.
* @param sortStyle a {@link org.opennms.web.event.SortStyle} object.
* @param ackType a {@link org.opennms.web.event.AcknowledgeType} object.
* @return an array of {@link org.opennms.web.event.Event} objects.
* @throws java.sql.SQLException if any.
*/ | Return some maximum number of events or less (optionally only unacknowledged events) sorted by the given sort style for the given node and IP address | getEventsForInterface | {
"repo_name": "rfdrake/opennms",
"path": "opennms-webapp/src/main/java/org/opennms/web/event/EventFactory.java",
"license": "gpl-2.0",
"size": 52155
} | [
"java.sql.SQLException",
"javax.servlet.ServletContext",
"org.opennms.web.event.filter.InterfaceFilter",
"org.opennms.web.event.filter.NodeFilter",
"org.opennms.web.filter.Filter"
] | import java.sql.SQLException; import javax.servlet.ServletContext; import org.opennms.web.event.filter.InterfaceFilter; import org.opennms.web.event.filter.NodeFilter; import org.opennms.web.filter.Filter; | import java.sql.*; import javax.servlet.*; import org.opennms.web.event.filter.*; import org.opennms.web.filter.*; | [
"java.sql",
"javax.servlet",
"org.opennms.web"
] | java.sql; javax.servlet; org.opennms.web; | 1,354,279 |
private void sendBack(final String payload, final DatagramPacket pack) throws IOException {
final byte[] buf = payload.getBytes();
final DatagramPacket res = new DatagramPacket(buf, buf.length, pack.getAddress(), pack.getPort());
sock.send(res);
} | void function(final String payload, final DatagramPacket pack) throws IOException { final byte[] buf = payload.getBytes(); final DatagramPacket res = new DatagramPacket(buf, buf.length, pack.getAddress(), pack.getPort()); sock.send(res); } | /**
* Send as a datagram packet the given content.
*
* @param payload
* the payload to send.
* @param pack
* the datagram packet received.
* @throws IOException
*/ | Send as a datagram packet the given content | sendBack | {
"repo_name": "spyrosg/VISION-Cloud-Monitoring",
"path": "vismo-core/src/main/java/gr/ntua/vision/monitoring/udp/UDPServer.java",
"license": "agpl-3.0",
"size": 4111
} | [
"java.io.IOException",
"java.net.DatagramPacket"
] | import java.io.IOException; import java.net.DatagramPacket; | import java.io.*; import java.net.*; | [
"java.io",
"java.net"
] | java.io; java.net; | 1,868,760 |
public MediaData[] loadMediaDataFromRMS(String recordName)
throws PersistenceMechanismException, InvalidImageDataException {
Vector mediaVector = new Vector();
try {
String infoStoreName = info_label + recordName;
RecordStore infoStore = RecordStore.openRecordStore(infoStoreName,
false);
RecordEnumeration isEnum = infoStore.enumerateRecords(null, null,
false);
while (isEnum.hasNextElement()) {
// Get next record
int currentId = isEnum.nextRecordId();
byte[] data = infoStore.getRecord(currentId);
// Convert the data from a byte array into our ImageData
// (metadata) object
MediaData iiObject = getMediaFromBytes(data);
// Add the info to the metadata hashtable
String label = iiObject.getMediaLabel();
mediaVector.addElement(iiObject);
getMediaInfoTable().put(label, iiObject);
}
infoStore.closeRecordStore();
}catch (RecordStoreException rse) {
throw new PersistenceMechanismException(rse);
}
// Re-copy the contents into a smaller array
MediaData[] labelArray = new MediaData[mediaVector.size()];
mediaVector.copyInto(labelArray);
return labelArray;
} | MediaData[] function(String recordName) throws PersistenceMechanismException, InvalidImageDataException { Vector mediaVector = new Vector(); try { String infoStoreName = info_label + recordName; RecordStore infoStore = RecordStore.openRecordStore(infoStoreName, false); RecordEnumeration isEnum = infoStore.enumerateRecords(null, null, false); while (isEnum.hasNextElement()) { int currentId = isEnum.nextRecordId(); byte[] data = infoStore.getRecord(currentId); MediaData iiObject = getMediaFromBytes(data); String label = iiObject.getMediaLabel(); mediaVector.addElement(iiObject); getMediaInfoTable().put(label, iiObject); } infoStore.closeRecordStore(); }catch (RecordStoreException rse) { throw new PersistenceMechanismException(rse); } MediaData[] labelArray = new MediaData[mediaVector.size()]; mediaVector.copyInto(labelArray); return labelArray; } | /**
* This will populate the imageInfo hashtable with the ImageInfo object,
* referenced by label name and populate the imageTable hashtable with Image
* objects referenced by the RMS record Id
*
* @throws PersistenceMechanismException
*/ | This will populate the imageInfo hashtable with the ImageInfo object, referenced by label name and populate the imageTable hashtable with Image objects referenced by the RMS record Id | loadMediaDataFromRMS | {
"repo_name": "ckaestne/LEADT",
"path": "workspace/MobileMedia_Benchmark/src/lancs/mobilemedia/core/ui/datamodel/MediaAccessor.java",
"license": "gpl-3.0",
"size": 13547
} | [
"java.util.Vector",
"javax.microedition.rms.RecordEnumeration",
"javax.microedition.rms.RecordStore",
"javax.microedition.rms.RecordStoreException"
] | import java.util.Vector; import javax.microedition.rms.RecordEnumeration; import javax.microedition.rms.RecordStore; import javax.microedition.rms.RecordStoreException; | import java.util.*; import javax.microedition.rms.*; | [
"java.util",
"javax.microedition"
] | java.util; javax.microedition; | 1,698,668 |
@GET
@Path("contexts/{context}/directives/reload")
@TransactionPolicy(value = TransactionControl.EXPLICIT)
public void directivesReload(HttpServiceRequest request, HttpServiceResponder responder,
@PathParam("context") String namespace) {
respond(request, responder, namespace, ns -> {
composite.reload(namespace);
return new ServiceResponse<Void>("Successfully reloaded all user defined directives.");
});
} | @Path(STR) @TransactionPolicy(value = TransactionControl.EXPLICIT) void function(HttpServiceRequest request, HttpServiceResponder responder, @PathParam(STR) String namespace) { respond(request, responder, namespace, ns -> { composite.reload(namespace); return new ServiceResponse<Void>(STR); }); } | /**
* This HTTP endpoint is used to reload the plugins that are
* of type <code>Directive.Type</code> (directive). Artifact will be reported
* if it atleast has one plugin that is of type "directive".
*/ | This HTTP endpoint is used to reload the plugins that are of type <code>Directive.Type</code> (directive). Artifact will be reported if it atleast has one plugin that is of type "directive" | directivesReload | {
"repo_name": "data-integrations/wrangler",
"path": "wrangler-service/src/main/java/io/cdap/wrangler/service/directive/DirectivesHandler.java",
"license": "apache-2.0",
"size": 44484
} | [
"io.cdap.cdap.api.annotation.TransactionControl",
"io.cdap.cdap.api.annotation.TransactionPolicy",
"io.cdap.cdap.api.service.http.HttpServiceRequest",
"io.cdap.cdap.api.service.http.HttpServiceResponder",
"io.cdap.wrangler.proto.ServiceResponse",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam"
] | import io.cdap.cdap.api.annotation.TransactionControl; import io.cdap.cdap.api.annotation.TransactionPolicy; import io.cdap.cdap.api.service.http.HttpServiceRequest; import io.cdap.cdap.api.service.http.HttpServiceResponder; import io.cdap.wrangler.proto.ServiceResponse; import javax.ws.rs.Path; import javax.ws.rs.PathParam; | import io.cdap.cdap.api.annotation.*; import io.cdap.cdap.api.service.http.*; import io.cdap.wrangler.proto.*; import javax.ws.rs.*; | [
"io.cdap.cdap",
"io.cdap.wrangler",
"javax.ws"
] | io.cdap.cdap; io.cdap.wrangler; javax.ws; | 963,346 |
public List<SubResource> publicIPAddresses() {
return this.publicIPAddresses;
} | List<SubResource> function() { return this.publicIPAddresses; } | /**
* Get the list of public IPs associated with the DDoS custom policy resource. This list is read-only.
*
* @return the publicIPAddresses value
*/ | Get the list of public IPs associated with the DDoS custom policy resource. This list is read-only | publicIPAddresses | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2018_12_01/src/main/java/com/microsoft/azure/management/network/v2018_12_01/implementation/DdosCustomPolicyInner.java",
"license": "mit",
"size": 4424
} | [
"com.microsoft.azure.SubResource",
"java.util.List"
] | import com.microsoft.azure.SubResource; import java.util.List; | import com.microsoft.azure.*; import java.util.*; | [
"com.microsoft.azure",
"java.util"
] | com.microsoft.azure; java.util; | 2,490,419 |
public static boolean supportsRefCursors(DatabaseMetaData meta) {
// Standard JDBC REF_CURSOR support was not added until Java 8, so we need to use reflection to attempt to
// access these fields/methods...
try {
return (Boolean) meta.getClass().getMethod( "supportsRefCursors" ).invoke( meta );
}
catch (NoSuchMethodException e) {
log.trace( "JDBC DatabaseMetaData class does not define supportsRefCursors method..." );
}
catch (Exception e) {
log.debug( "Unexpected error trying to gauge level of JDBC REF_CURSOR support : " + e.getMessage() );
}
return false;
} | static boolean function(DatabaseMetaData meta) { try { return (Boolean) meta.getClass().getMethod( STR ).invoke( meta ); } catch (NoSuchMethodException e) { log.trace( STR ); } catch (Exception e) { log.debug( STR + e.getMessage() ); } return false; } | /**
* Does this JDBC metadata indicate that the driver defines REF_CURSOR support?
*
* @param meta The JDBC metadata
*
* @return {@code true} if the metadata indicates that the driver defines REF_CURSOR support
*/ | Does this JDBC metadata indicate that the driver defines REF_CURSOR support | supportsRefCursors | {
"repo_name": "lamsfoundation/lams",
"path": "3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/cursor/internal/StandardRefCursorSupport.java",
"license": "gpl-2.0",
"size": 7121
} | [
"java.sql.DatabaseMetaData"
] | import java.sql.DatabaseMetaData; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,841,908 |
public void sendReplyableMessage(ChipsterMessage message, TempTopicMessagingListener replyListener) throws JMSException {
sendReplyableMessage(message, replyListener, null);
}
| void function(ChipsterMessage message, TempTopicMessagingListener replyListener) throws JMSException { sendReplyableMessage(message, replyListener, null); } | /**
* Sends the message and creates a temporary topic for replying.
* Not multithread safe.
*
* @param replyListener receives replies (if any) through hidden temporary topic
*/ | Sends the message and creates a temporary topic for replying. Not multithread safe | sendReplyableMessage | {
"repo_name": "ilarischeinin/chipster",
"path": "src/main/java/fi/csc/microarray/messaging/MessagingTopic.java",
"license": "gpl-3.0",
"size": 4463
} | [
"fi.csc.microarray.messaging.message.ChipsterMessage",
"javax.jms.JMSException"
] | import fi.csc.microarray.messaging.message.ChipsterMessage; import javax.jms.JMSException; | import fi.csc.microarray.messaging.message.*; import javax.jms.*; | [
"fi.csc.microarray",
"javax.jms"
] | fi.csc.microarray; javax.jms; | 537,147 |
public Enumeration listOptions() {
Vector result;
result = new Vector();
result.addElement(
new Option(
"\tSet type of SVM (default: 0)\n"
+ "\t\t 0 = C-SVC\n"
+ "\t\t 1 = nu-SVC\n"
+ "\t\t 2 = one-class SVM\n"
+ "\t\t 3 = epsilon-SVR\n"
+ "\t\t 4 = nu-SVR",
"S", 1, "-S <int>"));
result.addElement(
new Option(
"\tSet type of kernel function (default: 2)\n"
+ "\t\t 0 = linear: u'*v\n"
+ "\t\t 1 = polynomial: (gamma*u'*v + coef0)^degree\n"
+ "\t\t 2 = radial basis function: exp(-gamma*|u-v|^2)\n"
+ "\t\t 3 = sigmoid: tanh(gamma*u'*v + coef0)",
"K", 1, "-K <int>"));
result.addElement(
new Option(
"\tSet degree in kernel function (default: 3)",
"D", 1, "-D <int>"));
result.addElement(
new Option(
"\tSet gamma in kernel function (default: 1/k)",
"G", 1, "-G <double>"));
result.addElement(
new Option(
"\tSet coef0 in kernel function (default: 0)",
"R", 1, "-R <double>"));
result.addElement(
new Option(
"\tSet the parameter C of C-SVC, epsilon-SVR, and nu-SVR\n"
+ "\t (default: 1)",
"C", 1, "-C <double>"));
result.addElement(
new Option(
"\tSet the parameter nu of nu-SVC, one-class SVM, and nu-SVR\n"
+ "\t (default: 0.5)",
"N", 1, "-N <double>"));
result.addElement(
new Option(
"\tTurns on normalization of input data (default: off)",
"Z", 0, "-Z"));
result.addElement(
new Option("\tTurn off nominal to binary conversion."
+ "\n\tWARNING: use only if your data is all numeric!",
"J", 0, "-J"));
result.addElement(
new Option("\tTurn off missing value replacement."
+ "\n\tWARNING: use only if your data has no missing "
+ "values.", "V", 0, "-V"));
result.addElement(
new Option(
"\tSet the epsilon in loss function of epsilon-SVR (default: 0.1)",
"P", 1, "-P <double>"));
result.addElement(
new Option(
"\tSet cache memory size in MB (default: 40)",
"M", 1, "-M <double>"));
result.addElement(
new Option(
"\tSet tolerance of termination criterion (default: 0.001)",
"E", 1, "-E <double>"));
result.addElement(
new Option(
"\tTurns the shrinking heuristics off (default: on)",
"H", 0, "-H"));
result.addElement(
new Option(
"\tSet the parameters C of class i to weight[i]*C, for C-SVC.\n"
+ "\tE.g., for a 3-class problem, you could use \"1 1 1\" for equally\n"
+ "\tweighted classes.\n"
+ "\t(default: 1 for all classes)",
"W", 1, "-W <double>"));
result.addElement(
new Option(
"\tTrains a SVC model instead of a SVR one (default: SVR)",
"B", 0, "-B"));
result.addElement(
new Option(
"\tSpecifies the filename to save the libsvm-internal model to.\n"
+ "\tGets ignored if a directory is provided.",
"model", 1, "-model <file>"));
Enumeration en = super.listOptions();
while (en.hasMoreElements())
result.addElement(en.nextElement());
return result.elements();
} | Enumeration function() { Vector result; result = new Vector(); result.addElement( new Option( STR + STR + STR + STR + STR + STR, "S", 1, STR)); result.addElement( new Option( STR + STR + STR + STR + STR, "K", 1, STR)); result.addElement( new Option( STR, "D", 1, STR)); result.addElement( new Option( STR, "G", 1, STR)); result.addElement( new Option( STR, "R", 1, STR)); result.addElement( new Option( STR + STR, "C", 1, STR)); result.addElement( new Option( STR + STR, "N", 1, STR)); result.addElement( new Option( STR, "Z", 0, "-Z")); result.addElement( new Option(STR + STR, "J", 0, "-J")); result.addElement( new Option(STR + STR + STR, "V", 0, "-V")); result.addElement( new Option( STR, "P", 1, STR)); result.addElement( new Option( STR, "M", 1, STR)); result.addElement( new Option( STR, "E", 1, STR)); result.addElement( new Option( STR, "H", 0, "-H")); result.addElement( new Option( STR + STR1 1 1\STR + STR + STR, "W", 1, STR)); result.addElement( new Option( STR, "B", 0, "-B")); result.addElement( new Option( STR + STR, "model", 1, STR)); Enumeration en = super.listOptions(); while (en.hasMoreElements()) result.addElement(en.nextElement()); return result.elements(); } | /**
* Returns an enumeration describing the available options.
*
* @return an enumeration of all the available options.
*/ | Returns an enumeration describing the available options | listOptions | {
"repo_name": "Mindtoeye/Hoop",
"path": "wekafiles/packages/LibSVM/src/main/java/weka/classifiers/functions/LibSVM.java",
"license": "lgpl-3.0",
"size": 49428
} | [
"java.util.Enumeration",
"java.util.Vector"
] | import java.util.Enumeration; import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 994,231 |
@Override
public boolean matches(InventoryCrafting var1, World world)
{
final Map<IMultiFluidStacks, Integer> aggregateFluids = new HashMap<IMultiFluidStacks, Integer>();
for (IMultiFluidStacks fluid : fluids)
{
aggregateFluids.put(fluid, fluid.getAmount());
}
final ArrayList<IMultiItemStacks> required = new ArrayList<IMultiItemStacks>(input);
for (int x = 0; x < var1.getSizeInventory(); x++)
{
final ItemStack slot = var1.getStackInSlot(x);
if (!ItemUtils.isEmpty(slot))
{
boolean inRecipe = false;
final Iterator<IMultiItemStacks> req = required.iterator();
while (req.hasNext())
{
boolean match = false;
final IMultiItemStacks next = req.next();
final Iterator<ItemStack> itr = next.getItemStacks().iterator();
while (itr.hasNext() && !match)
{
match = OreDictionary.itemMatches(itr.next(), slot,
false);
}
if (match)
{
inRecipe = true;
required.remove(next);
break;
}
}
if (!inRecipe)
{
boolean fluidConsumed = false;
if (FluidContainerRegistry.isFilledContainer(slot))
{
final FluidStack containerFluid = FluidContainerRegistry
.getFluidForFilledItem(slot).copy();
for (IMultiFluidStacks fluidStacks : fluids)
{
final int aggregateAmount = aggregateFluids
.containsKey(fluidStacks) ? aggregateFluids
.get(fluidStacks) : 0;
if (fluidStacks.containsFluidStack(containerFluid)
&& aggregateAmount > 0)
{
final int leftover = Math.max(0, aggregateAmount
- containerFluid.amount);
if (leftover <= 1)
{
aggregateFluids.remove(fluidStacks);
} else
{
aggregateFluids.put(fluidStacks, leftover);
}
fluidConsumed = true;
}
}
}
if (!fluidConsumed)
{
return false;
}
}
}
}
return required.isEmpty() && aggregateFluids.isEmpty();
} | boolean function(InventoryCrafting var1, World world) { final Map<IMultiFluidStacks, Integer> aggregateFluids = new HashMap<IMultiFluidStacks, Integer>(); for (IMultiFluidStacks fluid : fluids) { aggregateFluids.put(fluid, fluid.getAmount()); } final ArrayList<IMultiItemStacks> required = new ArrayList<IMultiItemStacks>(input); for (int x = 0; x < var1.getSizeInventory(); x++) { final ItemStack slot = var1.getStackInSlot(x); if (!ItemUtils.isEmpty(slot)) { boolean inRecipe = false; final Iterator<IMultiItemStacks> req = required.iterator(); while (req.hasNext()) { boolean match = false; final IMultiItemStacks next = req.next(); final Iterator<ItemStack> itr = next.getItemStacks().iterator(); while (itr.hasNext() && !match) { match = OreDictionary.itemMatches(itr.next(), slot, false); } if (match) { inRecipe = true; required.remove(next); break; } } if (!inRecipe) { boolean fluidConsumed = false; if (FluidContainerRegistry.isFilledContainer(slot)) { final FluidStack containerFluid = FluidContainerRegistry .getFluidForFilledItem(slot).copy(); for (IMultiFluidStacks fluidStacks : fluids) { final int aggregateAmount = aggregateFluids .containsKey(fluidStacks) ? aggregateFluids .get(fluidStacks) : 0; if (fluidStacks.containsFluidStack(containerFluid) && aggregateAmount > 0) { final int leftover = Math.max(0, aggregateAmount - containerFluid.amount); if (leftover <= 1) { aggregateFluids.remove(fluidStacks); } else { aggregateFluids.put(fluidStacks, leftover); } fluidConsumed = true; } } } if (!fluidConsumed) { return false; } } } } return required.isEmpty() && aggregateFluids.isEmpty(); } | /**
* Used to check if a recipe matches current crafting inventory
*/ | Used to check if a recipe matches current crafting inventory | matches | {
"repo_name": "GrowthcraftCE/Growthcraft-1.11",
"path": "src/main/java/growthcraft/core/api/item/recipes/ShapelessMultiRecipe.java",
"license": "agpl-3.0",
"size": 5611
} | [
"java.util.ArrayList",
"java.util.HashMap",
"java.util.Iterator",
"java.util.Map",
"net.minecraft.inventory.InventoryCrafting",
"net.minecraft.item.ItemStack",
"net.minecraft.world.World",
"net.minecraftforge.fluids.FluidStack",
"net.minecraftforge.oredict.OreDictionary"
] | import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; | import java.util.*; import net.minecraft.inventory.*; import net.minecraft.item.*; import net.minecraft.world.*; import net.minecraftforge.fluids.*; import net.minecraftforge.oredict.*; | [
"java.util",
"net.minecraft.inventory",
"net.minecraft.item",
"net.minecraft.world",
"net.minecraftforge.fluids",
"net.minecraftforge.oredict"
] | java.util; net.minecraft.inventory; net.minecraft.item; net.minecraft.world; net.minecraftforge.fluids; net.minecraftforge.oredict; | 2,120,529 |
private TestSuite createDescendingSuite(final FeatureSpecificTestSuiteBuilder<?,
? extends OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>>> parentBuilder) {
final TestSortedMapGenerator<K, V> delegate
= (TestSortedMapGenerator<K, V>) parentBuilder.getSubjectGenerator().getInnerGenerator();
List<Feature<?>> features = new ArrayList<Feature<?>>();
features.add(NoRecurse.DESCENDING);
features.addAll(parentBuilder.getFeatures());
return subSuiteUsing(new DescendingTestMapGenerator<K, V>(delegate))
.named(parentBuilder.getName() + " descending")
.withFeatures(features)
.suppressing(parentBuilder.getSuppressedTests())
.createTestSuite();
} | TestSuite function(final FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>>> parentBuilder) { final TestSortedMapGenerator<K, V> delegate = (TestSortedMapGenerator<K, V>) parentBuilder.getSubjectGenerator().getInnerGenerator(); List<Feature<?>> features = new ArrayList<Feature<?>>(); features.add(NoRecurse.DESCENDING); features.addAll(parentBuilder.getFeatures()); return subSuiteUsing(new DescendingTestMapGenerator<K, V>(delegate)) .named(parentBuilder.getName() + STR) .withFeatures(features) .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); } | /**
* Create a suite whose maps are descending views of other maps.
*/ | Create a suite whose maps are descending views of other maps | createDescendingSuite | {
"repo_name": "qingsong-xu/guava",
"path": "guava-testlib/src/com/google/common/collect/testing/NavigableMapTestSuiteBuilder.java",
"license": "apache-2.0",
"size": 7006
} | [
"com.google.common.collect.testing.features.Feature",
"java.util.ArrayList",
"java.util.List",
"java.util.Map",
"junit.framework.TestSuite"
] | import com.google.common.collect.testing.features.Feature; import java.util.ArrayList; import java.util.List; import java.util.Map; import junit.framework.TestSuite; | import com.google.common.collect.testing.features.*; import java.util.*; import junit.framework.*; | [
"com.google.common",
"java.util",
"junit.framework"
] | com.google.common; java.util; junit.framework; | 748,492 |
public Connection getNativeConnectionFromStatement(Statement stmt) throws SQLException {
return getNativeConnection(stmt.getConnection());
} | Connection function(Statement stmt) throws SQLException { return getNativeConnection(stmt.getConnection()); } | /**
* Retrieve the Connection via the Statement's Connection.
* @see #getNativeConnection
* @see Statement#getConnection
*/ | Retrieve the Connection via the Statement's Connection | getNativeConnectionFromStatement | {
"repo_name": "raedle/univis",
"path": "lib/springframework-1.2.8/src/org/springframework/jdbc/support/nativejdbc/NativeJdbcExtractorAdapter.java",
"license": "lgpl-2.1",
"size": 5842
} | [
"java.sql.Connection",
"java.sql.SQLException",
"java.sql.Statement"
] | import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,519,101 |
public void setAuxBitsMode (
AuxBitsModeType auxBitsMode); | void function ( AuxBitsModeType auxBitsMode); | /**
* <p>Sets the AES3 use of auxiliary bits in the associated audio
* essence. To omit this optional property, call this method with
* <code>null</code>.</p>
*
* @param auxBitsMode AES3 use of auxiliary bits in the associated audio
* essence.
*
* @see #AUXBITSMODE_DEFAULT
*/ | Sets the AES3 use of auxiliary bits in the associated audio essence. To omit this optional property, call this method with <code>null</code> | setAuxBitsMode | {
"repo_name": "AMWA-TV/maj",
"path": "src/main/java/tv/amwa/maj/model/AES3PCMDescriptor.java",
"license": "apache-2.0",
"size": 15083
} | [
"tv.amwa.maj.enumeration.AuxBitsModeType"
] | import tv.amwa.maj.enumeration.AuxBitsModeType; | import tv.amwa.maj.enumeration.*; | [
"tv.amwa.maj"
] | tv.amwa.maj; | 2,769,615 |
public Solution<V, T> lastSolution() {
return (iLastSolution == null ? iCurrentSolution : iLastSolution);
} | Solution<V, T> function() { return (iLastSolution == null ? iCurrentSolution : iLastSolution); } | /** Last solution (when solver finishes)
* @return last solution
**/ | Last solution (when solver finishes) | lastSolution | {
"repo_name": "UniTime/cpsolver",
"path": "src/org/cpsolver/ifs/solver/Solver.java",
"license": "lgpl-3.0",
"size": 29279
} | [
"org.cpsolver.ifs.solution.Solution"
] | import org.cpsolver.ifs.solution.Solution; | import org.cpsolver.ifs.solution.*; | [
"org.cpsolver.ifs"
] | org.cpsolver.ifs; | 1,481,832 |
public String getPlayerName(NetworkPlayerInfo networkPlayerInfoIn)
{
return networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName());
} | String function(NetworkPlayerInfo networkPlayerInfoIn) { return networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); } | /**
* Returns the name that should be renderd for the player supplied
*/ | Returns the name that should be renderd for the player supplied | getPlayerName | {
"repo_name": "tomtomtom09/CampCraft",
"path": "build/tmp/recompileMc/sources/net/minecraft/client/gui/GuiPlayerTabOverlay.java",
"license": "gpl-3.0",
"size": 15957
} | [
"net.minecraft.client.network.NetworkPlayerInfo",
"net.minecraft.scoreboard.ScorePlayerTeam"
] | import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.scoreboard.ScorePlayerTeam; | import net.minecraft.client.network.*; import net.minecraft.scoreboard.*; | [
"net.minecraft.client",
"net.minecraft.scoreboard"
] | net.minecraft.client; net.minecraft.scoreboard; | 1,075,651 |
private static Expr extractCorrelatedPredicates(Expr root, List<TupleId> tupleIds,
ArrayList<Expr> matches) {
if (isCorrelatedPredicate(root, tupleIds)) {
matches.add(root);
return new BoolLiteral(true);
}
for (int i = 0; i < root.getChildren().size(); ++i) {
root.getChildren().set(i, extractCorrelatedPredicates(root.getChild(i), tupleIds,
matches));
}
return root;
} | static Expr function(Expr root, List<TupleId> tupleIds, ArrayList<Expr> matches) { if (isCorrelatedPredicate(root, tupleIds)) { matches.add(root); return new BoolLiteral(true); } for (int i = 0; i < root.getChildren().size(); ++i) { root.getChildren().set(i, extractCorrelatedPredicates(root.getChild(i), tupleIds, matches)); } return root; } | /**
* Extract all correlated predicates from the expr tree rooted at 'root' and
* replace them with true BoolLiterals. The modified expr tree is returned
* and the extracted correlated predicates are added to 'matches'.
*/ | Extract all correlated predicates from the expr tree rooted at 'root' and replace them with true BoolLiterals. The modified expr tree is returned and the extracted correlated predicates are added to 'matches' | extractCorrelatedPredicates | {
"repo_name": "kapilrastogi/Impala",
"path": "fe/src/main/java/com/cloudera/impala/analysis/StmtRewriter.java",
"license": "apache-2.0",
"size": 41697
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,341,186 |
public Task.TaskStatus getStatus() {
return (task != null) ? task.getStatus() : Task.TaskStatus.WAITING;
} | Task.TaskStatus function() { return (task != null) ? task.getStatus() : Task.TaskStatus.WAITING; } | /**
* Return status of service propagation (task status) based on current tasks states.
* Method compares "scheduled" dates of tasks in order to determine, which is more relevant.
*
* If can't determine, TaskStatus.NONE is returned.
*
* @return TaskStatus of service on facility
*/ | Return status of service propagation (task status) based on current tasks states. Method compares "scheduled" dates of tasks in order to determine, which is more relevant. If can't determine, TaskStatus.NONE is returned | getStatus | {
"repo_name": "zlamalp/perun",
"path": "perun-base/src/main/java/cz/metacentrum/perun/controller/model/ServiceState.java",
"license": "bsd-2-clause",
"size": 3351
} | [
"cz.metacentrum.perun.taskslib.model.Task"
] | import cz.metacentrum.perun.taskslib.model.Task; | import cz.metacentrum.perun.taskslib.model.*; | [
"cz.metacentrum.perun"
] | cz.metacentrum.perun; | 15,636 |
public Set<Scan> getSuccessorScans() {
Set<AbstractSampleDataRelationshipNode> nodes = getSuccessorsOfType(SdrfNodeType.SCAN, true);
HashSet<Scan> result = new HashSet<Scan>(nodes.size());
for (AbstractSampleDataRelationshipNode node : nodes) {
result.add((Scan) node);
}
return result;
}
| Set<Scan> function() { Set<AbstractSampleDataRelationshipNode> nodes = getSuccessorsOfType(SdrfNodeType.SCAN, true); HashSet<Scan> result = new HashSet<Scan>(nodes.size()); for (AbstractSampleDataRelationshipNode node : nodes) { result.add((Scan) node); } return result; } | /**
* Returns all <code>Scans</code> that originate from this node (searched recursively).
*
* @return the originating <code>Scans</code>.
*/ | Returns all <code>Scans</code> that originate from this node (searched recursively) | getSuccessorScans | {
"repo_name": "NCIP/caarray",
"path": "software/caarray-common.jar/src/main/java/gov/nih/nci/caarray/magetab/sdrf/AbstractSampleDataRelationshipNode.java",
"license": "bsd-3-clause",
"size": 15344
} | [
"java.util.HashSet",
"java.util.Set"
] | import java.util.HashSet; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,625,727 |
public void setTransactionManager(final RecoverableTransactionManager manager) {
this.transactionManager = manager;
}
| void function(final RecoverableTransactionManager manager) { this.transactionManager = manager; } | /**
* Set the transaction manager for the Geronimo Connection Manager.
*/ | Set the transaction manager for the Geronimo Connection Manager | setTransactionManager | {
"repo_name": "venanciolm/commons-j2ee-tools",
"path": "src/main/java/com/farmafene/commons/j2ee/tools/jca/geronimo3/GeronimoConnectionFactoryFactoryBean.java",
"license": "mit",
"size": 12101
} | [
"org.apache.geronimo.transaction.manager.RecoverableTransactionManager"
] | import org.apache.geronimo.transaction.manager.RecoverableTransactionManager; | import org.apache.geronimo.transaction.manager.*; | [
"org.apache.geronimo"
] | org.apache.geronimo; | 1,208,895 |
public static void saveAttachmentBody(Context context, Part part, Attachment localAttachment,
long accountId) throws MessagingException, IOException {
if (part.getBody() != null) {
long attachmentId = localAttachment.mId;
InputStream in = part.getBody().getInputStream();
File saveIn = AttachmentUtilities.getAttachmentDirectory(context, accountId);
if (!saveIn.exists()) {
saveIn.mkdirs();
}
File saveAs = AttachmentUtilities.getAttachmentFilename(context, accountId,
attachmentId);
saveAs.createNewFile();
FileOutputStream out = new FileOutputStream(saveAs);
long copySize = IOUtils.copy(in, out);
in.close();
out.close();
// update the attachment with the extra information we now know
String contentUriString = AttachmentUtilities.getAttachmentUri(
accountId, attachmentId).toString();
localAttachment.mSize = copySize;
localAttachment.mContentUri = contentUriString;
// update the attachment in the database as well
ContentValues cv = new ContentValues();
cv.put(AttachmentColumns.SIZE, copySize);
cv.put(AttachmentColumns.CONTENT_URI, contentUriString);
Uri uri = ContentUris.withAppendedId(Attachment.CONTENT_URI, attachmentId);
context.getContentResolver().update(uri, cv, null, null);
}
} | static void function(Context context, Part part, Attachment localAttachment, long accountId) throws MessagingException, IOException { if (part.getBody() != null) { long attachmentId = localAttachment.mId; InputStream in = part.getBody().getInputStream(); File saveIn = AttachmentUtilities.getAttachmentDirectory(context, accountId); if (!saveIn.exists()) { saveIn.mkdirs(); } File saveAs = AttachmentUtilities.getAttachmentFilename(context, accountId, attachmentId); saveAs.createNewFile(); FileOutputStream out = new FileOutputStream(saveAs); long copySize = IOUtils.copy(in, out); in.close(); out.close(); String contentUriString = AttachmentUtilities.getAttachmentUri( accountId, attachmentId).toString(); localAttachment.mSize = copySize; localAttachment.mContentUri = contentUriString; ContentValues cv = new ContentValues(); cv.put(AttachmentColumns.SIZE, copySize); cv.put(AttachmentColumns.CONTENT_URI, contentUriString); Uri uri = ContentUris.withAppendedId(Attachment.CONTENT_URI, attachmentId); context.getContentResolver().update(uri, cv, null, null); } } | /**
* Save the body part of a single attachment, to a file in the attachments directory.
*/ | Save the body part of a single attachment, to a file in the attachments directory | saveAttachmentBody | {
"repo_name": "craigacgomez/flaming_monkey_packages_apps_Email",
"path": "src/com/android/email/LegacyConversions.java",
"license": "apache-2.0",
"size": 22113
} | [
"android.content.ContentUris",
"android.content.ContentValues",
"android.content.Context",
"android.net.Uri",
"com.android.emailcommon.mail.MessagingException",
"com.android.emailcommon.mail.Part",
"com.android.emailcommon.provider.EmailContent",
"com.android.emailcommon.utility.AttachmentUtilities",
"java.io.File",
"java.io.FileOutputStream",
"java.io.IOException",
"java.io.InputStream",
"org.apache.commons.io.IOUtils"
] | import android.content.ContentUris; import android.content.ContentValues; import android.content.Context; import android.net.Uri; import com.android.emailcommon.mail.MessagingException; import com.android.emailcommon.mail.Part; import com.android.emailcommon.provider.EmailContent; import com.android.emailcommon.utility.AttachmentUtilities; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import org.apache.commons.io.IOUtils; | import android.content.*; import android.net.*; import com.android.emailcommon.mail.*; import com.android.emailcommon.provider.*; import com.android.emailcommon.utility.*; import java.io.*; import org.apache.commons.io.*; | [
"android.content",
"android.net",
"com.android.emailcommon",
"java.io",
"org.apache.commons"
] | android.content; android.net; com.android.emailcommon; java.io; org.apache.commons; | 1,358,734 |
private static GeoPackageConnection connect(File file) {
String databaseUrl = "jdbc:sqlite:" + file.getPath();
// load the sqlite-JDBC driver using the current class loader
try {
Class.forName("org.sqlite.JDBC");
} catch (ClassNotFoundException e) {
throw new GeoPackageException(
"Failed to load the SQLite JDBC driver", e);
}
// create a database connection
Connection databaseConnection;
try {
databaseConnection = DriverManager.getConnection(databaseUrl);
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to get connection to the SQLite file: "
+ file.getAbsolutePath(),
e);
}
ConnectionSource connectionSource;
try {
connectionSource = new JdbcConnectionSource(databaseUrl);
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to get connection source to the SQLite file: "
+ file.getAbsolutePath(),
e);
}
// Create the GeoPackage Connection
GeoPackageConnection connection = new GeoPackageConnection(file,
databaseConnection, connectionSource);
connection.enableForeignKeys();
return connection;
} | static GeoPackageConnection function(File file) { String databaseUrl = STR + file.getPath(); try { Class.forName(STR); } catch (ClassNotFoundException e) { throw new GeoPackageException( STR, e); } Connection databaseConnection; try { databaseConnection = DriverManager.getConnection(databaseUrl); } catch (SQLException e) { throw new GeoPackageException( STR + file.getAbsolutePath(), e); } ConnectionSource connectionSource; try { connectionSource = new JdbcConnectionSource(databaseUrl); } catch (SQLException e) { throw new GeoPackageException( STR + file.getAbsolutePath(), e); } GeoPackageConnection connection = new GeoPackageConnection(file, databaseConnection, connectionSource); connection.enableForeignKeys(); return connection; } | /**
* Connect to a GeoPackage file
*
* @param file
* GeoPackage file
* @return connection
*/ | Connect to a GeoPackage file | connect | {
"repo_name": "ngageoint/geopackage-java",
"path": "src/main/java/mil/nga/geopackage/GeoPackageManager.java",
"license": "mit",
"size": 7820
} | [
"com.j256.ormlite.jdbc.JdbcConnectionSource",
"com.j256.ormlite.support.ConnectionSource",
"java.io.File",
"java.sql.Connection",
"java.sql.DriverManager",
"java.sql.SQLException",
"mil.nga.geopackage.db.GeoPackageConnection"
] | import com.j256.ormlite.jdbc.JdbcConnectionSource; import com.j256.ormlite.support.ConnectionSource; import java.io.File; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import mil.nga.geopackage.db.GeoPackageConnection; | import com.j256.ormlite.jdbc.*; import com.j256.ormlite.support.*; import java.io.*; import java.sql.*; import mil.nga.geopackage.db.*; | [
"com.j256.ormlite",
"java.io",
"java.sql",
"mil.nga.geopackage"
] | com.j256.ormlite; java.io; java.sql; mil.nga.geopackage; | 43,625 |
private void attemptPaletteSelection() {
PaletteChooserPanel panel
= new PaletteChooserPanel(null, this.availablePaletteSamples);
int result = JOptionPane.showConfirmDialog(
this, panel, localizationResources.getString("Palette_Selection"),
JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE
);
if (result == JOptionPane.OK_OPTION) {
double zmin = this.currentPalette.getPalette().getMinZ();
double zmax = this.currentPalette.getPalette().getMaxZ();
this.currentPalette.setPalette(panel.getSelectedPalette());
this.currentPalette.getPalette().setMinZ(zmin);
this.currentPalette.getPalette().setMaxZ(zmax);
}
}
| void function() { PaletteChooserPanel panel = new PaletteChooserPanel(null, this.availablePaletteSamples); int result = JOptionPane.showConfirmDialog( this, panel, localizationResources.getString(STR), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE ); if (result == JOptionPane.OK_OPTION) { double zmin = this.currentPalette.getPalette().getMinZ(); double zmax = this.currentPalette.getPalette().getMaxZ(); this.currentPalette.setPalette(panel.getSelectedPalette()); this.currentPalette.getPalette().setMinZ(zmin); this.currentPalette.getPalette().setMaxZ(zmax); } } | /**
* Handle a palette selection.
*/ | Handle a palette selection | attemptPaletteSelection | {
"repo_name": "simon04/jfreechart",
"path": "src/main/java/org/jfree/chart/editor/DefaultColorBarEditor.java",
"license": "lgpl-2.1",
"size": 8527
} | [
"javax.swing.JOptionPane"
] | import javax.swing.JOptionPane; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 2,374,748 |
@ApiModelProperty(example = "null", value = "")
public CorporationAssetsLocationsPosition getPosition() {
return position;
} | @ApiModelProperty(example = "null", value = "") CorporationAssetsLocationsPosition function() { return position; } | /**
* Get position
*
* @return position
**/ | Get position | getPosition | {
"repo_name": "GoldenGnu/eve-esi",
"path": "src/main/java/net/troja/eve/esi/model/CorporationAssetsLocationsResponse.java",
"license": "apache-2.0",
"size": 3167
} | [
"io.swagger.annotations.ApiModelProperty",
"net.troja.eve.esi.model.CorporationAssetsLocationsPosition"
] | import io.swagger.annotations.ApiModelProperty; import net.troja.eve.esi.model.CorporationAssetsLocationsPosition; | import io.swagger.annotations.*; import net.troja.eve.esi.model.*; | [
"io.swagger.annotations",
"net.troja.eve"
] | io.swagger.annotations; net.troja.eve; | 1,862,672 |
private RequestProcessor getProcessorForModule(ModuleConfig config) {
String key = Globals.REQUEST_PROCESSOR_KEY + config.getPrefix();
return (RequestProcessor) getServletContext().getAttribute(key);
} | RequestProcessor function(ModuleConfig config) { String key = Globals.REQUEST_PROCESSOR_KEY + config.getPrefix(); return (RequestProcessor) getServletContext().getAttribute(key); } | /**
* <p>Returns the RequestProcessor for the given module or null if one
* does not exist. This method will not create a RequestProcessor.</p>
*
* @param config The ModuleConfig.
* @return The <code>RequestProcessor</code> for the given module, or
* <code>null</code> if one does not exist.
*/ | Returns the RequestProcessor for the given module or null if one does not exist. This method will not create a RequestProcessor | getProcessorForModule | {
"repo_name": "julien-sobczak/sonar-maven-plugin",
"path": "its/projects/shared/struts-1.3.9-diet/core/src/main/java/org/apache/struts/action/ActionServlet.java",
"license": "mit",
"size": 71973
} | [
"org.apache.struts.Globals",
"org.apache.struts.config.ModuleConfig"
] | import org.apache.struts.Globals; import org.apache.struts.config.ModuleConfig; | import org.apache.struts.*; import org.apache.struts.config.*; | [
"org.apache.struts"
] | org.apache.struts; | 1,350,189 |
public SoTValue getYPtoSoT(double p) {
if(yTransform_.isTime()) {
return new SoTValue.Time(yTransform_.getLongTimeTransU(p));
} else {
return new SoTValue.Double(yTransform_.getTransU(p));
}
} | SoTValue function(double p) { if(yTransform_.isTime()) { return new SoTValue.Time(yTransform_.getLongTimeTransU(p)); } else { return new SoTValue.Double(yTransform_.getTransU(p)); } } | /**
* Transform physical Y coordinate to user coordinate using <code>SoTValue</code>
* @param p physical coordinate
* @return user coorindinate
* @since 3.0
*/ | Transform physical Y coordinate to user coordinate using <code>SoTValue</code> | getYPtoSoT | {
"repo_name": "luttero/Maud",
"path": "src/gov/noaa/pmel/sgt/CartesianGraph.java",
"license": "bsd-3-clause",
"size": 28021
} | [
"gov.noaa.pmel.util.SoTValue"
] | import gov.noaa.pmel.util.SoTValue; | import gov.noaa.pmel.util.*; | [
"gov.noaa.pmel"
] | gov.noaa.pmel; | 1,323,936 |
@Test
public void testT1RV4D1_T1LV2D8() {
test_id = getTestId("T1RV4D1", "T1LV2D8", "42");
String src = selectTRVD("T1RV4D1");
String dest = selectTLVD("T1LV2D8");
String result = ".";
try {
result = TRVD_TLVD_Action(src, dest);
} catch (RecognitionException e) {
e.printStackTrace();
} catch (TokenStreamException e) {
e.printStackTrace();
}
assertTrue(Failure2, checkResult_Failure2(src, dest, result));
GraphicalEditor editor = getActiveEditor();
if (editor != null) {
validateOrGenerateResults(editor, generateResults);
}
}
| void function() { test_id = getTestId(STR, STR, "42"); String src = selectTRVD(STR); String dest = selectTLVD(STR); String result = "."; try { result = TRVD_TLVD_Action(src, dest); } catch (RecognitionException e) { e.printStackTrace(); } catch (TokenStreamException e) { e.printStackTrace(); } assertTrue(Failure2, checkResult_Failure2(src, dest, result)); GraphicalEditor editor = getActiveEditor(); if (editor != null) { validateOrGenerateResults(editor, generateResults); } } | /**
* Perform the test for the given matrix column (T1RV4D1) and row (T1LV2D8).
*
*/ | Perform the test for the given matrix column (T1RV4D1) and row (T1LV2D8) | testT1RV4D1_T1LV2D8 | {
"repo_name": "rmulvey/bptest",
"path": "src/org.xtuml.bp.als.oal.test/src/org/xtuml/bp/als/oal/test/SingleDimensionFixedArrayAssigmentTest_8_Generics.java",
"license": "apache-2.0",
"size": 153074
} | [
"org.xtuml.bp.ui.graphics.editor.GraphicalEditor"
] | import org.xtuml.bp.ui.graphics.editor.GraphicalEditor; | import org.xtuml.bp.ui.graphics.editor.*; | [
"org.xtuml.bp"
] | org.xtuml.bp; | 2,761,033 |
public static long getLastModified(@NonNull Context context, @NonNull RecipientId recipientId) {
File file = getAvatarFile(context, recipientId);
if (file.exists()) {
return file.lastModified();
} else {
return 0;
}
} | static long function(@NonNull Context context, @NonNull RecipientId recipientId) { File file = getAvatarFile(context, recipientId); if (file.exists()) { return file.lastModified(); } else { return 0; } } | /**
* Returns the timestamp of when the avatar was last modified, or zero if the avatar doesn't exist.
*/ | Returns the timestamp of when the avatar was last modified, or zero if the avatar doesn't exist | getLastModified | {
"repo_name": "AsamK/TextSecure",
"path": "app/src/main/java/org/thoughtcrime/securesms/profiles/AvatarHelper.java",
"license": "gpl-3.0",
"size": 8615
} | [
"android.content.Context",
"androidx.annotation.NonNull",
"java.io.File",
"org.thoughtcrime.securesms.recipients.RecipientId"
] | import android.content.Context; import androidx.annotation.NonNull; import java.io.File; import org.thoughtcrime.securesms.recipients.RecipientId; | import android.content.*; import androidx.annotation.*; import java.io.*; import org.thoughtcrime.securesms.recipients.*; | [
"android.content",
"androidx.annotation",
"java.io",
"org.thoughtcrime.securesms"
] | android.content; androidx.annotation; java.io; org.thoughtcrime.securesms; | 2,540,906 |
public Crypto getDecryptionCrypto() throws WSSConfigurationException {
if (decryptionWSSCrypto == null) {
return null;
}
return decryptionWSSCrypto.getCrypto();
} | Crypto function() throws WSSConfigurationException { if (decryptionWSSCrypto == null) { return null; } return decryptionWSSCrypto.getCrypto(); } | /**
* returns the decryptionCrypto for the key-management
*
* @return A Crypto instance
* @throws WSSConfigurationException thrown if something goes wrong
*/ | returns the decryptionCrypto for the key-management | getDecryptionCrypto | {
"repo_name": "asoldano/wss4j",
"path": "ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSSecurityProperties.java",
"license": "apache-2.0",
"size": 35117
} | [
"org.apache.wss4j.common.crypto.Crypto"
] | import org.apache.wss4j.common.crypto.Crypto; | import org.apache.wss4j.common.crypto.*; | [
"org.apache.wss4j"
] | org.apache.wss4j; | 2,346,404 |
public String getBaseURI() {
if (needsSyncData()) {
synchronizeData();
}
// Absolute base URI is computed according to
// XML Base (http://www.w3.org/TR/xmlbase/#granularity)
// 1. The base URI specified by an xml:base attribute on the element,
// if one exists
if (attributes != null) {
Attr attrNode = (Attr)attributes.getNamedItem("xml:base");
if (attrNode != null) {
String uri = attrNode.getNodeValue();
if (uri.length() != 0 ) {// attribute value is always empty string
try {
uri = new URI(uri).toString();
}
catch (com.sun.org.apache.xerces.internal.util.URI.MalformedURIException e) {
// This may be a relative URI.
// Make any parentURI into a URI object to use with the URI(URI, String) constructor
String parentBaseURI = (this.ownerNode != null) ? this.ownerNode.getBaseURI() : null;
if (parentBaseURI != null){
try{
uri = new URI(new URI(parentBaseURI), uri).toString();
}
catch (com.sun.org.apache.xerces.internal.util.URI.MalformedURIException ex){
// This should never happen: parent should have checked the URI and returned null if invalid.
return null;
}
return uri;
}
return null;
}
return uri;
}
}
}
// 2.the base URI of the element's parent element within the
// document or external entity, if one exists
// 3. the base URI of the document entity or external entity
// containing the element
// ownerNode serves as a parent or as document
String baseURI = (this.ownerNode != null) ? this.ownerNode.getBaseURI() : null ;
//base URI of parent element is not null
if(baseURI != null){
try {
//return valid absolute base URI
return new URI(baseURI).toString();
}
catch (com.sun.org.apache.xerces.internal.util.URI.MalformedURIException e){
return null;
}
}
return null;
} //getBaseURI | String function() { if (needsSyncData()) { synchronizeData(); } if (attributes != null) { Attr attrNode = (Attr)attributes.getNamedItem(STR); if (attrNode != null) { String uri = attrNode.getNodeValue(); if (uri.length() != 0 ) { try { uri = new URI(uri).toString(); } catch (com.sun.org.apache.xerces.internal.util.URI.MalformedURIException e) { String parentBaseURI = (this.ownerNode != null) ? this.ownerNode.getBaseURI() : null; if (parentBaseURI != null){ try{ uri = new URI(new URI(parentBaseURI), uri).toString(); } catch (com.sun.org.apache.xerces.internal.util.URI.MalformedURIException ex){ return null; } return uri; } return null; } return uri; } } } String baseURI = (this.ownerNode != null) ? this.ownerNode.getBaseURI() : null ; if(baseURI != null){ try { return new URI(baseURI).toString(); } catch (com.sun.org.apache.xerces.internal.util.URI.MalformedURIException e){ return null; } } return null; } | /**
* DOM Level 3 WD - Experimental.
* Retrieve baseURI
*/ | DOM Level 3 WD - Experimental. Retrieve baseURI | getBaseURI | {
"repo_name": "haikuowuya/android_system_code",
"path": "src/com/sun/org/apache/xerces/internal/dom/ElementImpl.java",
"license": "apache-2.0",
"size": 42956
} | [
"org.w3c.dom.Attr"
] | import org.w3c.dom.Attr; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 1,110,887 |
public void saveProperties() {
throw new GemFireIOException("saveProperties is no longer supported for security reasons");
} | void function() { throw new GemFireIOException(STR); } | /**
* Persists the current Agent configuration to its property file.
*
* @throws GemFireIOException if unable to persist the configuration to props
* @see #getPropertyFile
*/ | Persists the current Agent configuration to its property file | saveProperties | {
"repo_name": "pdxrunner/geode",
"path": "geode-core/src/main/java/org/apache/geode/admin/jmx/internal/AgentImpl.java",
"license": "apache-2.0",
"size": 54418
} | [
"org.apache.geode.GemFireIOException"
] | import org.apache.geode.GemFireIOException; | import org.apache.geode.*; | [
"org.apache.geode"
] | org.apache.geode; | 2,885,482 |
@Override
CompiledExpression compile(String query) throws XMLDBException; | CompiledExpression compile(String query) throws XMLDBException; | /**
* Compiles the specified XQuery and returns a handle to the compiled
* code, which can then be passed to {@link #execute(CompiledExpression)}.
*
* Note: {@link CompiledExpression} is not thread safe. Please make sure you don't
* call the same compiled expression from two threads at the same time.
*
* @param query The XQuery to compile
*
* @return a compiled representation of the query
*
* @throws XMLDBException if an error occurs whilst compiling the query
*/ | Compiles the specified XQuery and returns a handle to the compiled code, which can then be passed to <code>#execute(CompiledExpression)</code>. Note: <code>CompiledExpression</code> is not thread safe. Please make sure you don't call the same compiled expression from two threads at the same time | compile | {
"repo_name": "opax/exist",
"path": "src/org/exist/xmldb/EXistXQueryService.java",
"license": "lgpl-2.1",
"size": 10484
} | [
"org.xmldb.api.base.CompiledExpression",
"org.xmldb.api.base.XMLDBException"
] | import org.xmldb.api.base.CompiledExpression; import org.xmldb.api.base.XMLDBException; | import org.xmldb.api.base.*; | [
"org.xmldb.api"
] | org.xmldb.api; | 442,859 |
@Test
void testCategory()
{
assertEquals("name", category.getName());
assertEquals(Axis.X, category.getAxis());
assertEquals(1, category.getOffsetX());
assertEquals(2, category.getOffsetY());
assertEquals(group, category.getGroups().iterator().next());
assertEquals(formula, category.getFormulas().iterator().next());
}
| void testCategory() { assertEquals("name", category.getName()); assertEquals(Axis.X, category.getAxis()); assertEquals(1, category.getOffsetX()); assertEquals(2, category.getOffsetY()); assertEquals(group, category.getGroups().iterator().next()); assertEquals(formula, category.getFormulas().iterator().next()); } | /**
* Test the category construction.
*/ | Test the category construction | testCategory | {
"repo_name": "b3dgs/lionengine",
"path": "lionengine-game/src/test/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionCategoryTest.java",
"license": "gpl-3.0",
"size": 5568
} | [
"com.b3dgs.lionengine.UtilAssert"
] | import com.b3dgs.lionengine.UtilAssert; | import com.b3dgs.lionengine.*; | [
"com.b3dgs.lionengine"
] | com.b3dgs.lionengine; | 324,259 |
public void setRouteDistinguiher(RouteDistinguisher routeDistinguisher) {
this.routeDistinguisher = routeDistinguisher;
} | void function(RouteDistinguisher routeDistinguisher) { this.routeDistinguisher = routeDistinguisher; } | /**
* Set route distinguisher for flow specification component.
*
* @param routeDistinguisher route distinguisher
*/ | Set route distinguisher for flow specification component | setRouteDistinguiher | {
"repo_name": "sonu283304/onos",
"path": "protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/flowspec/BgpFlowSpecDetails.java",
"license": "apache-2.0",
"size": 4658
} | [
"org.onosproject.bgpio.types.RouteDistinguisher"
] | import org.onosproject.bgpio.types.RouteDistinguisher; | import org.onosproject.bgpio.types.*; | [
"org.onosproject.bgpio"
] | org.onosproject.bgpio; | 713,765 |
final Thread thread = Thread.currentThread();
log.debug(Scope.SYSTEM.marker(), "capturing context of {}", thread);
return new ContextPropagator(RequestContextHolder.currentRequestAttributes(), thread);
}
private final RequestAttributes stored;
private final Thread origin;
ContextPropagator(final RequestAttributes attributes, final Thread origin) {
stored = attributes;
this.origin = origin;
} | final Thread thread = Thread.currentThread(); log.debug(Scope.SYSTEM.marker(), STR, thread); return new ContextPropagator(RequestContextHolder.currentRequestAttributes(), thread); } private final RequestAttributes stored; private final Thread origin; ContextPropagator(final RequestAttributes attributes, final Thread origin) { stored = attributes; this.origin = origin; } | /**
* Create a propagator, which stores the context of the current thread, as retrieved from
* {@link RequestContextHolder#currentRequestAttributes()}.
*/ | Create a propagator, which stores the context of the current thread, as retrieved from <code>RequestContextHolder#currentRequestAttributes()</code> | capture | {
"repo_name": "pyranja/asio",
"path": "server/src/main/java/at/ac/univie/isc/asio/spring/ContextPropagator.java",
"license": "apache-2.0",
"size": 3409
} | [
"at.ac.univie.isc.asio.Scope",
"org.springframework.web.context.request.RequestAttributes",
"org.springframework.web.context.request.RequestContextHolder"
] | import at.ac.univie.isc.asio.Scope; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; | import at.ac.univie.isc.asio.*; import org.springframework.web.context.request.*; | [
"at.ac.univie",
"org.springframework.web"
] | at.ac.univie; org.springframework.web; | 2,383,991 |
public final void testTextOutputCallback_03() {
try {
text = new TextOutputCallback(5, "message");
fail("messageType should be either INFORMATION, WARNING or ERROR");
} catch (IllegalArgumentException e) {
}
}
| final void function() { try { text = new TextOutputCallback(5, STR); fail(STR); } catch (IllegalArgumentException e) { } } | /**
* Test for TextOutputCallback(int msgType,String msg) ctor,
* if mgsType is not INFORMATION, WARNING or ERROR, then expected IAE
*/ | Test for TextOutputCallback(int msgType,String msg) ctor, if mgsType is not INFORMATION, WARNING or ERROR, then expected IAE | testTextOutputCallback_03 | {
"repo_name": "skyHALud/codenameone",
"path": "Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/classlib/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/callback/TextOutputCallbackTest.java",
"license": "gpl-2.0",
"size": 2837
} | [
"javax.security.auth.callback.TextOutputCallback"
] | import javax.security.auth.callback.TextOutputCallback; | import javax.security.auth.callback.*; | [
"javax.security"
] | javax.security; | 2,178,830 |
public void testStandardFilter() throws Exception {
Reader reader = new StringReader("What's this thing do?");
TokenStream stream = tokenizerFactory("Classic").create(reader);
stream = tokenFilterFactory("Classic").create(stream);
assertTokenStreamContents(stream,
new String[] { "What", "this", "thing", "do" });
} | void function() throws Exception { Reader reader = new StringReader(STR); TokenStream stream = tokenizerFactory(STR).create(reader); stream = tokenFilterFactory(STR).create(stream); assertTokenStreamContents(stream, new String[] { "What", "this", "thing", "do" }); } | /**
* Test ClassicFilterFactory
*/ | Test ClassicFilterFactory | testStandardFilter | {
"repo_name": "fuchao01/fuchao",
"path": "lucene/analysis/common/src/test/org/apache/lucene/analysis/standard/TestStandardFactories.java",
"license": "apache-2.0",
"size": 7198
} | [
"java.io.Reader",
"java.io.StringReader",
"org.apache.lucene.analysis.TokenStream"
] | import java.io.Reader; import java.io.StringReader; import org.apache.lucene.analysis.TokenStream; | import java.io.*; import org.apache.lucene.analysis.*; | [
"java.io",
"org.apache.lucene"
] | java.io; org.apache.lucene; | 598,348 |
protected void setCalendarHour(final Calendar cal, final int hour) {
cal.set(java.util.Calendar.HOUR_OF_DAY, hour);
if (cal.get(java.util.Calendar.HOUR_OF_DAY) != hour && hour != 24) {
cal.set(java.util.Calendar.HOUR_OF_DAY, hour + 1);
}
} | void function(final Calendar cal, final int hour) { cal.set(java.util.Calendar.HOUR_OF_DAY, hour); if (cal.get(java.util.Calendar.HOUR_OF_DAY) != hour && hour != 24) { cal.set(java.util.Calendar.HOUR_OF_DAY, hour + 1); } } | /**
* Advance the calendar to the particular hour paying particular attention
* to daylight saving problems.
*
* @param cal the calendar to operate on
* @param hour the hour to set
*/ | Advance the calendar to the particular hour paying particular attention to daylight saving problems | setCalendarHour | {
"repo_name": "aol/cyclops-react",
"path": "cyclops/src/main/java/com/oath/cyclops/util/stream/scheduling/cron/CronExpression.java",
"license": "apache-2.0",
"size": 62943
} | [
"java.util.Calendar"
] | import java.util.Calendar; | import java.util.*; | [
"java.util"
] | java.util; | 1,874,932 |
public String paramsAsHidden(Collection<String> excludes) {
StringBuffer result = new StringBuffer(512);
Map<String, Object> params = paramValues();
Iterator<Entry<String, Object>> i = params.entrySet().iterator();
while (i.hasNext()) {
Entry<String, Object> entry = i.next();
String param = entry.getKey();
if ((excludes == null) || (!excludes.contains(param))) {
result.append("<input type=\"hidden\" name=\"");
result.append(param);
result.append("\" value=\"");
String encoded = CmsEncoder.encode(
entry.getValue().toString(),
getCms().getRequestContext().getEncoding());
result.append(encoded);
result.append("\">\n");
}
}
return result.toString();
} | String function(Collection<String> excludes) { StringBuffer result = new StringBuffer(512); Map<String, Object> params = paramValues(); Iterator<Entry<String, Object>> i = params.entrySet().iterator(); while (i.hasNext()) { Entry<String, Object> entry = i.next(); String param = entry.getKey(); if ((excludes == null) (!excludes.contains(param))) { result.append(STRhidden\STRSTR\STRSTR\">\n"); } } return result.toString(); } | /**
* Returns all initialized parameters of the current workplace class
* that are not in the given exclusion list as hidden field tags that can be inserted in a form.<p>
*
* @param excludes the parameters to exclude
*
* @return all initialized parameters of the current workplace class
* that are not in the given exclusion list as hidden field tags that can be inserted in a form
*/ | Returns all initialized parameters of the current workplace class that are not in the given exclusion list as hidden field tags that can be inserted in a form | paramsAsHidden | {
"repo_name": "alkacon/opencms-core",
"path": "src/org/opencms/workplace/CmsWorkplace.java",
"license": "lgpl-2.1",
"size": 95168
} | [
"java.util.Collection",
"java.util.Iterator",
"java.util.Map"
] | import java.util.Collection; import java.util.Iterator; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,752,507 |
boolean testAndSetRecovered(DiskRegionView dr); | boolean testAndSetRecovered(DiskRegionView dr); | /**
* Return true if we are the first to set it to false
*/ | Return true if we are the first to set it to false | testAndSetRecovered | {
"repo_name": "masaki-yamakawa/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java",
"license": "apache-2.0",
"size": 283772
} | [
"org.apache.geode.internal.cache.persistence.DiskRegionView"
] | import org.apache.geode.internal.cache.persistence.DiskRegionView; | import org.apache.geode.internal.cache.persistence.*; | [
"org.apache.geode"
] | org.apache.geode; | 2,278,812 |
@Test
public void testMultipleTokenParamInQueryString() {
final String methodName = "testMissingTokenParamInQueryString";
Hashtable<String, String> acceptTable = new Hashtable<String, String>();
acceptTable.put("application/json", "");
final Enumeration<String> acceptHeaders = acceptTable.keys();
Hashtable<String, String> acceptCharsetTable = new Hashtable<String, String>();
acceptCharsetTable.put("UTF-8", "");
final Enumeration<String> acceptCharsetHeaders = acceptCharsetTable.keys();
try {
mock.checking(new Expectations() {
{
allowing(request).getMethod();
will(returnValue(AbstractOidcEndpointServices.HTTP_METHOD_GET));
allowing(request).getHeaders(HDR_ACCEPT);
will(returnValue(acceptHeaders));
allowing(request).getHeaders(HDR_ACCEPT_CHARSET);
will(returnValue(acceptCharsetHeaders));
allowing(request).getQueryString();
will(returnValue("token_type=value1&token_type=value2"));
}
});
CoverageMapEndpointServices coverageMapServices = new CoverageMapEndpointServices();
coverageMapServices.handleEndpointRequest(provider, request, response);
} catch (OidcServerException oidcExc) {
assertEquals("CWWKS1436E: Request contains multiple token_type parameters.", oidcExc.getErrorDescription());
assertEquals(OIDCConstants.ERROR_INVALID_REQUEST, oidcExc.getErrorCode());
assertEquals(HttpServletResponse.SC_BAD_REQUEST, oidcExc.getHttpStatus());
} catch (Throwable t) {
outputMgr.failWithThrowable(methodName, t);
}
} | void function() { final String methodName = STR; Hashtable<String, String> acceptTable = new Hashtable<String, String>(); acceptTable.put(STR, STRUTF-8STRSTRtoken_type=value1&token_type=value2STRCWWKS1436E: Request contains multiple token_type parameters.", oidcExc.getErrorDescription()); assertEquals(OIDCConstants.ERROR_INVALID_REQUEST, oidcExc.getErrorCode()); assertEquals(HttpServletResponse.SC_BAD_REQUEST, oidcExc.getHttpStatus()); } catch (Throwable t) { outputMgr.failWithThrowable(methodName, t); } } | /**
* Test that having more than one token-type parameter in the query string
* will fail with an OIDCException
*/ | Test that having more than one token-type parameter in the query string will fail with an OIDCException | testMultipleTokenParamInQueryString | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.security.oauth/test/com/ibm/ws/security/oauth20/web/CoverageMapEndpointServicesTest.java",
"license": "epl-1.0",
"size": 20794
} | [
"com.ibm.ws.security.oauth20.util.OIDCConstants",
"java.util.Hashtable",
"javax.servlet.http.HttpServletResponse",
"org.junit.Assert"
] | import com.ibm.ws.security.oauth20.util.OIDCConstants; import java.util.Hashtable; import javax.servlet.http.HttpServletResponse; import org.junit.Assert; | import com.ibm.ws.security.oauth20.util.*; import java.util.*; import javax.servlet.http.*; import org.junit.*; | [
"com.ibm.ws",
"java.util",
"javax.servlet",
"org.junit"
] | com.ibm.ws; java.util; javax.servlet; org.junit; | 1,466,369 |
@Override
public Price update(Map<String, Object> params) throws StripeException {
return update(params, (RequestOptions) null);
} | Price function(Map<String, Object> params) throws StripeException { return update(params, (RequestOptions) null); } | /**
* Updates the specified price by setting the values of the parameters passed. Any parameters not
* provided are left unchanged.
*/ | Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged | update | {
"repo_name": "stripe/stripe-java",
"path": "src/main/java/com/stripe/model/Price.java",
"license": "mit",
"size": 14225
} | [
"com.stripe.exception.StripeException",
"com.stripe.net.RequestOptions",
"java.util.Map"
] | import com.stripe.exception.StripeException; import com.stripe.net.RequestOptions; import java.util.Map; | import com.stripe.exception.*; import com.stripe.net.*; import java.util.*; | [
"com.stripe.exception",
"com.stripe.net",
"java.util"
] | com.stripe.exception; com.stripe.net; java.util; | 765,939 |
return data;
}
/**
* Sets the value of the data property.
*
* @param value
* allowed object is
* {@link ZfcsSketchPlanType } | return data; } /** * Sets the value of the data property. * * @param value * allowed object is * {@link ZfcsSketchPlanType } | /**
* Gets the value of the data property.
*
* @return
* possible object is
* {@link ZfcsSketchPlanType }
*
*/ | Gets the value of the data property | getData | {
"repo_name": "simokhov/schemas44",
"path": "src/main/java/ru/gov/zakupki/oos/integration/_1/SketchPlan.java",
"license": "mit",
"size": 1951
} | [
"ru.gov.zakupki.oos.types._1.ZfcsSketchPlanType"
] | import ru.gov.zakupki.oos.types._1.ZfcsSketchPlanType; | import ru.gov.zakupki.oos.types.*; | [
"ru.gov.zakupki"
] | ru.gov.zakupki; | 755,007 |
public static void setAllMessageBar(String message) {
for (Player player : Bukkit.getOnlinePlayers())
setMessageBar(player, message);
} | static void function(String message) { for (Player player : Bukkit.getOnlinePlayers()) setMessageBar(player, message); } | /**
* Assign a message bar to all online players with the specified message. The bar will be full.
*
* @param message String message to be displayed to all players.
*/ | Assign a message bar to all online players with the specified message. The bar will be full | setAllMessageBar | {
"repo_name": "ewized/CommonUtils",
"path": "src/main/java/com/archeinteractive/dev/commonutils/bossbar/BossBar.java",
"license": "gpl-3.0",
"size": 18117
} | [
"org.bukkit.Bukkit",
"org.bukkit.entity.Player"
] | import org.bukkit.Bukkit; import org.bukkit.entity.Player; | import org.bukkit.*; import org.bukkit.entity.*; | [
"org.bukkit",
"org.bukkit.entity"
] | org.bukkit; org.bukkit.entity; | 1,465,342 |
public DataSession openDataSession(GroupConfiguration group) throws JGCSException {
if(group == null)
throw new JGCSException("Null GroupConfiguration is not valid");
DataSession data = lookupDataSession(group);
if(data == null){
AppiaGroup appiaGroup = null;
if( group instanceof AppiaGroup)
appiaGroup = (AppiaGroup) group;
else
throw new JGCSException("Wrong type of the given Group: "+group.getClass().getName()+
"should be of type "+AppiaGroup.class.getName());
createSessions(appiaGroup);
data = lookupDataSession(group);
}
return data;
} | DataSession function(GroupConfiguration group) throws JGCSException { if(group == null) throw new JGCSException(STR); DataSession data = lookupDataSession(group); if(data == null){ AppiaGroup appiaGroup = null; if( group instanceof AppiaGroup) appiaGroup = (AppiaGroup) group; else throw new JGCSException(STR+group.getClass().getName()+ STR+AppiaGroup.class.getName()); createSessions(appiaGroup); data = lookupDataSession(group); } return data; } | /**
* Opens a new Appia DataSession, using the given template. If the session already exists,
* returns the previously created session. Creates a new Appia instance without
* opening any channel.
*
* @param group the group configuration with the given template.
*/ | Opens a new Appia DataSession, using the given template. If the session already exists, returns the previously created session. Creates a new Appia instance without opening any channel | openDataSession | {
"repo_name": "wmalik/appia-byzantine",
"path": "src/groupcomm/net/sf/appia/jgcs/AppiaProtocol.java",
"license": "apache-2.0",
"size": 5096
} | [
"net.sf.jgcs.DataSession",
"net.sf.jgcs.GroupConfiguration",
"net.sf.jgcs.JGCSException"
] | import net.sf.jgcs.DataSession; import net.sf.jgcs.GroupConfiguration; import net.sf.jgcs.JGCSException; | import net.sf.jgcs.*; | [
"net.sf.jgcs"
] | net.sf.jgcs; | 2,735,280 |
public static <E> Queryable<E> queryable(DataContext root, Class<E> clazz,
Iterable<? extends String> names) {
SchemaPlus schema = root.getRootSchema();
for (Iterator<? extends String> iterator = names.iterator();;) {
String name = iterator.next();
if (iterator.hasNext()) {
schema = schema.getSubSchema(name);
} else {
return queryable(root, schema, clazz, name);
}
}
} | static <E> Queryable<E> function(DataContext root, Class<E> clazz, Iterable<? extends String> names) { SchemaPlus schema = root.getRootSchema(); for (Iterator<? extends String> iterator = names.iterator();;) { String name = iterator.next(); if (iterator.hasNext()) { schema = schema.getSubSchema(name); } else { return queryable(root, schema, clazz, name); } } } | /** Returns a {@link Queryable}, given a fully-qualified table name as an
* iterable. */ | Returns a <code>Queryable</code>, given a fully-qualified table name as an | queryable | {
"repo_name": "b-slim/calcite",
"path": "core/src/main/java/org/apache/calcite/schema/Schemas.java",
"license": "apache-2.0",
"size": 22946
} | [
"java.util.Iterator",
"org.apache.calcite.DataContext",
"org.apache.calcite.linq4j.Queryable"
] | import java.util.Iterator; import org.apache.calcite.DataContext; import org.apache.calcite.linq4j.Queryable; | import java.util.*; import org.apache.calcite.*; import org.apache.calcite.linq4j.*; | [
"java.util",
"org.apache.calcite"
] | java.util; org.apache.calcite; | 2,002,305 |
public int toBooleanMarshalCost()
{
return Marshal.COST_TO_BOOLEAN;
} | int function() { return Marshal.COST_TO_BOOLEAN; } | /**
* Cost to convert to a boolean
*/ | Cost to convert to a boolean | toBooleanMarshalCost | {
"repo_name": "dwango/quercus",
"path": "src/main/java/com/caucho/quercus/env/Value.java",
"license": "gpl-2.0",
"size": 58000
} | [
"com.caucho.quercus.marshal.Marshal"
] | import com.caucho.quercus.marshal.Marshal; | import com.caucho.quercus.marshal.*; | [
"com.caucho.quercus"
] | com.caucho.quercus; | 2,441,481 |
public Object unmarshall(InputStream inputStream); | Object function(InputStream inputStream); | /**
* Method unmarshals object from given input stream
* @param inputStream stream pointing to XML file
* @return Object representing given XML file
*/ | Method unmarshals object from given input stream | unmarshall | {
"repo_name": "empt-ak/bis",
"path": "bis-backend/bis-tools/src/main/java/cz/muni/ics/ff/bis/tools/wrappers/XStreamWrapper.java",
"license": "apache-2.0",
"size": 905
} | [
"java.io.InputStream"
] | import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,521,995 |
public static Command getInstance(String commandName) {
String thisPackage = CommandFactory.class.getPackage().getName();
String camelCaseCommandName = StringUtil.toCamelCase(commandName);
String fqCommandClassName = thisPackage+"."+camelCaseCommandName+Command.class.getSimpleName();
// Try to load!
try {
Class<?> commandClass = Class.forName(fqCommandClassName);
return (Command) commandClass.newInstance();
}
catch (Exception ex) {
logger.log(Level.INFO, "Could not find operation FQCN " + fqCommandClassName, ex);
return null;
}
} | static Command function(String commandName) { String thisPackage = CommandFactory.class.getPackage().getName(); String camelCaseCommandName = StringUtil.toCamelCase(commandName); String fqCommandClassName = thisPackage+"."+camelCaseCommandName+Command.class.getSimpleName(); try { Class<?> commandClass = Class.forName(fqCommandClassName); return (Command) commandClass.newInstance(); } catch (Exception ex) { logger.log(Level.INFO, STR + fqCommandClassName, ex); return null; } } | /**
* Maps the given command name to a corresponding {@link Command} class and
* instantiates it. The command name is camel-cased and mapped to a FQCN.
*
* <p>Example: The command 'ls-remote' is mapped to the FQCN
* <code>org.syncany.cli.LsRemoteCommand</code>.
*
* @param commandName Command name, e.g. ls-remote or init
* @return Returns a <code>Command</code> instance, or <code>null</code> if the command name cannot be mapped to a class
*/ | Maps the given command name to a corresponding <code>Command</code> class and instantiates it. The command name is camel-cased and mapped to a FQCN. Example: The command 'ls-remote' is mapped to the FQCN <code>org.syncany.cli.LsRemoteCommand</code> | getInstance | {
"repo_name": "syncany/syncany-plugin-sftp",
"path": "core/syncany-cli/src/main/java/org/syncany/cli/CommandFactory.java",
"license": "gpl-3.0",
"size": 2362
} | [
"java.util.logging.Level",
"org.syncany.util.StringUtil"
] | import java.util.logging.Level; import org.syncany.util.StringUtil; | import java.util.logging.*; import org.syncany.util.*; | [
"java.util",
"org.syncany.util"
] | java.util; org.syncany.util; | 1,983,298 |
private String scrollId() {
scrollId = randomSimpleString(random(), 1, 10); // Empty strings get special behavior we don't want
return scrollId;
} | String function() { scrollId = randomSimpleString(random(), 1, 10); return scrollId; } | /**
* Generates a random scrollId and registers it so that when the test
* finishes we check that it was cleared. Subsequent calls reregister a new
* random scroll id so it is checked instead.
*/ | Generates a random scrollId and registers it so that when the test finishes we check that it was cleared. Subsequent calls reregister a new random scroll id so it is checked instead | scrollId | {
"repo_name": "obourgain/elasticsearch",
"path": "core/src/test/java/org/elasticsearch/action/bulk/byscroll/AsyncBulkByScrollActionTests.java",
"license": "apache-2.0",
"size": 42257
} | [
"org.apache.lucene.util.TestUtil"
] | import org.apache.lucene.util.TestUtil; | import org.apache.lucene.util.*; | [
"org.apache.lucene"
] | org.apache.lucene; | 1,826,282 |
private static PendingIntent buildIntent(Context context, long referenceKeyId) {
Intent intent = new Intent(BROADCAST_ACTION_PASSPHRASE_CACHE_SERVICE);
intent.putExtra(EXTRA_KEY_ID, referenceKeyId);
// request code should be unique for each PendingIntent, thus keyId is used
return PendingIntent.getBroadcast(context, (int) referenceKeyId, intent,
PendingIntent.FLAG_CANCEL_CURRENT);
} | static PendingIntent function(Context context, long referenceKeyId) { Intent intent = new Intent(BROADCAST_ACTION_PASSPHRASE_CACHE_SERVICE); intent.putExtra(EXTRA_KEY_ID, referenceKeyId); return PendingIntent.getBroadcast(context, (int) referenceKeyId, intent, PendingIntent.FLAG_CANCEL_CURRENT); } | /**
* Build pending intent that is executed by alarm manager to time out a specific passphrase
*/ | Build pending intent that is executed by alarm manager to time out a specific passphrase | buildIntent | {
"repo_name": "bresalio/open-keychain",
"path": "OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java",
"license": "gpl-3.0",
"size": 25791
} | [
"android.app.PendingIntent",
"android.content.Context",
"android.content.Intent"
] | import android.app.PendingIntent; import android.content.Context; import android.content.Intent; | import android.app.*; import android.content.*; | [
"android.app",
"android.content"
] | android.app; android.content; | 1,593,707 |
public void testWait()
throws Throwable {
rep = null;
try {
ArrayList<CheckWireRecord> expected = setupLog(3 );
checkForwardScan(checker.nScanned, expected, new VLSN(1),
99,
true );
} catch (Throwable e) {
e.printStackTrace();
throw e;
} finally {
if (rep != null) {
rep.close();
rep = null;
}
}
} | void function() throws Throwable { rep = null; try { ArrayList<CheckWireRecord> expected = setupLog(3 ); checkForwardScan(checker.nScanned, expected, new VLSN(1), 99, true ); } catch (Throwable e) { e.printStackTrace(); throw e; } finally { if (rep != null) { rep.close(); rep = null; } } } | /**
* Check that we can wait for an upcoming VLSN when doing forward
* scans. Create a log, and start forward scans at each VLSN. (i.e. VLSN 1,
* VLSN2, etc.), and then ask for one more.
*/ | Check that we can wait for an upcoming VLSN when doing forward scans. Create a log, and start forward scans at each VLSN. (i.e. VLSN 1, VLSN2, etc.), and then ask for one more | testWait | {
"repo_name": "bjorndm/prebake",
"path": "code/third_party/bdb/test/com/sleepycat/je/rep/stream/FeederReaderTest.java",
"license": "apache-2.0",
"size": 26925
} | [
"com.sleepycat.je.rep.stream.VLSNTestUtils",
"java.util.ArrayList"
] | import com.sleepycat.je.rep.stream.VLSNTestUtils; import java.util.ArrayList; | import com.sleepycat.je.rep.stream.*; import java.util.*; | [
"com.sleepycat.je",
"java.util"
] | com.sleepycat.je; java.util; | 2,040,756 |
public void putMemoryBlock(int[] blockData)
{
this.segment.getLock().writeLock().lock();
try
{
long freeSpace = this.segment.getFreeSpace() - (blockData.length + MemoryArch.OFFSET_BLOCK);
int capacity = this.segment.getCapacity() + 1;
if (freeSpace > 0 && (capacity <= Configure.BUFFER_SEGMENT_CAPACITY))
{
ByteMapper byteMapper = new ByteMapper();
MemoryBlock memoryBlock = new MemoryBlock();
this.segment.increaseCapacity();
int seqBlockId = this.segment.increaseSeqBlockId();
long pointer = this.segment.getPointer() + MemoryArch.OFFSET_BLOCK;
memoryBlock.setAddress(pointer);
memoryBlock.setSize(blockData.length);
memoryBlock.setId(seqBlockId);
memoryBlock.setSegmentId(this.segment.getId());
memoryBlock.setExpireTime(0);
byteMapper.setOffset(pointer);
byteMapper.putIntArray(blockData);
this.segment.setFreeSpace(freeSpace);
this.segment.setPointer(pointer);
this.segment.setPointer(byteMapper.getOffset());
this.segment.getBlockList().put(seqBlockId, memoryBlock);
}
else
{
this.segment.setIsRellocate();
}
}
finally
{
this.segment.getLock().writeLock().unlock();
}
} | void function(int[] blockData) { this.segment.getLock().writeLock().lock(); try { long freeSpace = this.segment.getFreeSpace() - (blockData.length + MemoryArch.OFFSET_BLOCK); int capacity = this.segment.getCapacity() + 1; if (freeSpace > 0 && (capacity <= Configure.BUFFER_SEGMENT_CAPACITY)) { ByteMapper byteMapper = new ByteMapper(); MemoryBlock memoryBlock = new MemoryBlock(); this.segment.increaseCapacity(); int seqBlockId = this.segment.increaseSeqBlockId(); long pointer = this.segment.getPointer() + MemoryArch.OFFSET_BLOCK; memoryBlock.setAddress(pointer); memoryBlock.setSize(blockData.length); memoryBlock.setId(seqBlockId); memoryBlock.setSegmentId(this.segment.getId()); memoryBlock.setExpireTime(0); byteMapper.setOffset(pointer); byteMapper.putIntArray(blockData); this.segment.setFreeSpace(freeSpace); this.segment.setPointer(pointer); this.segment.setPointer(byteMapper.getOffset()); this.segment.getBlockList().put(seqBlockId, memoryBlock); } else { this.segment.setIsRellocate(); } } finally { this.segment.getLock().writeLock().unlock(); } } | /**
* Create memory block and put data into memory block
*
* @param blockData data
*/ | Create memory block and put data into memory block | putMemoryBlock | {
"repo_name": "xreload/tesseractdb",
"path": "src/main/java/org/tesseractdb/mapper/MemoryMapper.java",
"license": "gpl-2.0",
"size": 8690
} | [
"org.tesseractdb.engine.Configure",
"org.tesseractdb.memory.MemoryArch",
"org.tesseractdb.memory.MemoryBlock"
] | import org.tesseractdb.engine.Configure; import org.tesseractdb.memory.MemoryArch; import org.tesseractdb.memory.MemoryBlock; | import org.tesseractdb.engine.*; import org.tesseractdb.memory.*; | [
"org.tesseractdb.engine",
"org.tesseractdb.memory"
] | org.tesseractdb.engine; org.tesseractdb.memory; | 582,888 |
public List<String> getCustomFields() {
return customFields;
} | List<String> function() { return customFields; } | /**
* Gets the custom fields.
*
* @return the custom fields
*/ | Gets the custom fields | getCustomFields | {
"repo_name": "maltieri/docusign-restclient",
"path": "docusign-restclient-dto/src/main/java/uk/co/techblue/docusign/client/dto/recipients/Recipient.java",
"license": "apache-2.0",
"size": 13824
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,359,139 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.