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 int avio_rl24(Pointer<AVIOContext > s) {
return avio_rl24(Pointer.getPeer(s));
} | int function(Pointer<AVIOContext > s) { return avio_rl24(Pointer.getPeer(s)); } | /**
* Original signature : <code>int avio_rl24(AVIOContext*)</code><br>
* <i>native declaration : ffmpeg_build/include/libavformat/avio.h:309</i>
*/ | Original signature : <code>int avio_rl24(AVIOContext*)</code> native declaration : ffmpeg_build/include/libavformat/avio.h:309 | avio_rl24 | {
"repo_name": "mutars/java_libav",
"path": "wrapper/src/main/java/com/mutar/libav/bridge/avformat/AvformatLibrary.java",
"license": "gpl-2.0",
"size": 136321
} | [
"org.bridj.Pointer"
] | import org.bridj.Pointer; | import org.bridj.*; | [
"org.bridj"
] | org.bridj; | 1,917,257 |
private PartitionObjectsAndNames createPartitionObjects(Table table) {
List<String> partColNames = new ArrayList<>();
for (FieldSchema col : table.getPartitionKeys()) {
partColNames.add(col.getName());
}
List<Partition> ptns = new ArrayList<>();
List<String> ptnNames = new ArrayList<>();
String dbName = table.getDbName();
String tblName = table.getTableName();
StorageDescriptor sd = table.getSd();
List<String> ptnCol1Vals = Arrays.asList("a", "b", "c", "d", "e");
List<String> ptnCol2Vals = Arrays.asList("1", "2", "3", "4", "5");
for (String ptnCol1Val : ptnCol1Vals) {
for (String ptnCol2Val : ptnCol2Vals) {
List<String> partVals = Arrays.asList(ptnCol1Val, ptnCol2Val);
Partition ptn = new Partition(partVals, dbName, tblName, 0, 0, sd, new HashMap<String, String>());
ptn.setCatName(DEFAULT_CATALOG_NAME);
ptns.add(ptn);
ptnNames.add(FileUtils.makePartName(partColNames, partVals));
}
}
return new PartitionObjectsAndNames(ptns, ptnNames);
}
class PartitionObjectsAndNames {
private List<Partition> ptns;
private List<String> ptnNames;
PartitionObjectsAndNames(List<Partition> ptns, List<String> ptnNames) {
this.ptns = ptns;
this.ptnNames = ptnNames;
} | PartitionObjectsAndNames function(Table table) { List<String> partColNames = new ArrayList<>(); for (FieldSchema col : table.getPartitionKeys()) { partColNames.add(col.getName()); } List<Partition> ptns = new ArrayList<>(); List<String> ptnNames = new ArrayList<>(); String dbName = table.getDbName(); String tblName = table.getTableName(); StorageDescriptor sd = table.getSd(); List<String> ptnCol1Vals = Arrays.asList("a", "b", "c", "d", "e"); List<String> ptnCol2Vals = Arrays.asList("1", "2", "3", "4", "5"); for (String ptnCol1Val : ptnCol1Vals) { for (String ptnCol2Val : ptnCol2Vals) { List<String> partVals = Arrays.asList(ptnCol1Val, ptnCol2Val); Partition ptn = new Partition(partVals, dbName, tblName, 0, 0, sd, new HashMap<String, String>()); ptn.setCatName(DEFAULT_CATALOG_NAME); ptns.add(ptn); ptnNames.add(FileUtils.makePartName(partColNames, partVals)); } } return new PartitionObjectsAndNames(ptns, ptnNames); } class PartitionObjectsAndNames { private List<Partition> ptns; private List<String> ptnNames; PartitionObjectsAndNames(List<Partition> ptns, List<String> ptnNames) { this.ptns = ptns; this.ptnNames = ptnNames; } | /**
* Create 25 partition objects for table returned by createPartitionedTableObject
* Partitions are: a/1, a/2, ... e/4, e/5
* @param table
* @return
*/ | Create 25 partition objects for table returned by createPartitionedTableObject Partitions are: a/1, a/2, ... e/4, e/5 | createPartitionObjects | {
"repo_name": "vineetgarg02/hive",
"path": "standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/cache/TestCachedStore.java",
"license": "apache-2.0",
"size": 86519
} | [
"java.util.ArrayList",
"java.util.Arrays",
"java.util.HashMap",
"java.util.List",
"org.apache.hadoop.hive.metastore.api.FieldSchema",
"org.apache.hadoop.hive.metastore.api.Partition",
"org.apache.hadoop.hive.metastore.api.StorageDescriptor",
"org.apache.hadoop.hive.metastore.api.Table",
"org.apache.hadoop.hive.metastore.utils.FileUtils"
] | import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import org.apache.hadoop.hive.metastore.api.FieldSchema; import org.apache.hadoop.hive.metastore.api.Partition; import org.apache.hadoop.hive.metastore.api.StorageDescriptor; import org.apache.hadoop.hive.metastore.api.Table; import org.apache.hadoop.hive.metastore.utils.FileUtils; | import java.util.*; import org.apache.hadoop.hive.metastore.api.*; import org.apache.hadoop.hive.metastore.utils.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 2,777,264 |
public int getwhp_sites_contactsesCount() throws SystemException {
return whp_sites_contactsPersistence.countAll();
} | int function() throws SystemException { return whp_sites_contactsPersistence.countAll(); } | /**
* Returns the number of whp_sites_contactses.
*
* @return the number of whp_sites_contactses
* @throws SystemException if a system exception occurred
*/ | Returns the number of whp_sites_contactses | getwhp_sites_contactsesCount | {
"repo_name": "iucn-whp/world-heritage-outlook",
"path": "portlets/iucn-dbservice-portlet/docroot/WEB-INF/src/com/iucn/whp/dbservice/service/base/whp_sites_contactsLocalServiceBaseImpl.java",
"license": "gpl-2.0",
"size": 175964
} | [
"com.liferay.portal.kernel.exception.SystemException"
] | import com.liferay.portal.kernel.exception.SystemException; | import com.liferay.portal.kernel.exception.*; | [
"com.liferay.portal"
] | com.liferay.portal; | 1,615,857 |
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<RunInner> listAsync(String resourceGroupName, String registryName, String filter, Integer top) {
return new PagedFlux<>(
() -> listSinglePageAsync(resourceGroupName, registryName, filter, top),
nextLink -> listNextSinglePageAsync(nextLink));
} | @ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<RunInner> function(String resourceGroupName, String registryName, String filter, Integer top) { return new PagedFlux<>( () -> listSinglePageAsync(resourceGroupName, registryName, filter, top), nextLink -> listNextSinglePageAsync(nextLink)); } | /**
* Gets all the runs for a registry.
*
* @param resourceGroupName The name of the resource group to which the container registry belongs.
* @param registryName The name of the container registry.
* @param filter The runs filter to apply on the operation. Arithmetic operators are not supported. The allowed
* string function is 'contains'. All logical operators except 'Not', 'Has', 'All' are allowed.
* @param top $top is supported for get list of runs, which limits the maximum number of runs to return.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the runs for a registry.
*/ | Gets all the runs for a registry | listAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-containerregistry/src/main/java/com/azure/resourcemanager/containerregistry/implementation/RunsClientImpl.java",
"license": "mit",
"size": 64706
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.PagedFlux",
"com.azure.resourcemanager.containerregistry.fluent.models.RunInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.resourcemanager.containerregistry.fluent.models.RunInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.containerregistry.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 985,458 |
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux<LibraryResourceInner> listByWorkspaceAsync(String resourceGroupName, String workspaceName) {
return new PagedFlux<>(
() -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName),
nextLink -> listByWorkspaceNextSinglePageAsync(nextLink));
} | @ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<LibraryResourceInner> function(String resourceGroupName, String workspaceName) { return new PagedFlux<>( () -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName), nextLink -> listByWorkspaceNextSinglePageAsync(nextLink)); } | /**
* List libraries in a workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of Library resources.
*/ | List libraries in a workspace | listByWorkspaceAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/synapse/azure-resourcemanager-synapse/src/main/java/com/azure/resourcemanager/synapse/implementation/LibrariesOperationsClientImpl.java",
"license": "mit",
"size": 16281
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.PagedFlux",
"com.azure.resourcemanager.synapse.fluent.models.LibraryResourceInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.resourcemanager.synapse.fluent.models.LibraryResourceInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.synapse.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,665,225 |
private void initialize() {
if (GemFireCacheImpl.instance != null) {
Assert.assertTrue(GemFireCacheImpl.instance == null,
"Cache instance already in place: " + instance);
}
GemFireCacheImpl.instance = this;
GemFireCacheImpl.pdxInstance = this;
for (CacheLifecycleListener listener : cacheLifecycleListeners) {
listener.cacheCreated(this);
}
ClassPathLoader.setLatestToDefault(this.system.getConfig().getDeployWorkingDir());
// request and check cluster configuration
ConfigurationResponse configurationResponse = requestSharedConfiguration();
deployJarsReceivedFromClusterConfiguration(configurationResponse);
// apply the cluster's properties configuration and initialize security using that configuration
ClusterConfigurationLoader.applyClusterPropertiesConfiguration(this, configurationResponse,
this.system.getConfig());
// first initialize the security service using the security properties
this.securityService.initSecurity(this.system.getConfig().getSecurityProps());
// secondly if cacheConfig has a securityManager, use that instead
if (this.cacheConfig.getSecurityManager() != null) {
this.securityService.setSecurityManager(this.cacheConfig.getSecurityManager());
}
// if cacheConfig has a postProcessor, use that instead
if (this.cacheConfig.getPostProcessor() != null) {
this.securityService.setPostProcessor(this.cacheConfig.getPostProcessor());
}
SystemMemberCacheEventProcessor.send(this, Operation.CACHE_CREATE);
this.resourceAdvisor.initializationGate();
// Register function that we need to execute to fetch available REST service endpoints in DS
FunctionService.registerFunction(new FindRestEnabledServersFunction());
// moved this after initializeDeclarativeCache because in the future
// distributed system creation will not happen until we have read
// cache.xml file.
// For now this needs to happen before cache.xml otherwise
// we will not be ready for all the events that cache.xml
// processing can deliver (region creation, etc.).
// This call may need to be moved inside initializeDeclarativeCache.
this.jmxAdvisor.initializationGate(); // Entry to GemFire Management service
// this starts up the ManagementService, register and federate the internal beans
this.system.handleResourceEvent(ResourceEvent.CACHE_CREATE, this);
initializeServices();
boolean completedCacheXml = false;
try {
if (configurationResponse == null) {
// Deploy all the jars from the deploy working dir.
ClassPathLoader.getLatest().getJarDeployer().loadPreviouslyDeployedJarsFromDisk();
}
ClusterConfigurationLoader.applyClusterXmlConfiguration(this, configurationResponse,
this.system.getConfig());
initializeDeclarativeCache();
completedCacheXml = true;
} finally {
if (!completedCacheXml) {
// so initializeDeclarativeCache threw an exception
try {
close(); // fix for bug 34041
} catch (Throwable ignore) {
// I don't want init to throw an exception that came from the close.
// I want it to throw the original exception that came from initializeDeclarativeCache.
}
}
}
this.poolFactory = null;
startColocatedJmxManagerLocator();
startMemcachedServer();
startRedisServer();
startRestAgentServer(this);
this.isInitialized = true;
} | void function() { if (GemFireCacheImpl.instance != null) { Assert.assertTrue(GemFireCacheImpl.instance == null, STR + instance); } GemFireCacheImpl.instance = this; GemFireCacheImpl.pdxInstance = this; for (CacheLifecycleListener listener : cacheLifecycleListeners) { listener.cacheCreated(this); } ClassPathLoader.setLatestToDefault(this.system.getConfig().getDeployWorkingDir()); ConfigurationResponse configurationResponse = requestSharedConfiguration(); deployJarsReceivedFromClusterConfiguration(configurationResponse); ClusterConfigurationLoader.applyClusterPropertiesConfiguration(this, configurationResponse, this.system.getConfig()); this.securityService.initSecurity(this.system.getConfig().getSecurityProps()); if (this.cacheConfig.getSecurityManager() != null) { this.securityService.setSecurityManager(this.cacheConfig.getSecurityManager()); } if (this.cacheConfig.getPostProcessor() != null) { this.securityService.setPostProcessor(this.cacheConfig.getPostProcessor()); } SystemMemberCacheEventProcessor.send(this, Operation.CACHE_CREATE); this.resourceAdvisor.initializationGate(); FunctionService.registerFunction(new FindRestEnabledServersFunction()); this.jmxAdvisor.initializationGate(); this.system.handleResourceEvent(ResourceEvent.CACHE_CREATE, this); initializeServices(); boolean completedCacheXml = false; try { if (configurationResponse == null) { ClassPathLoader.getLatest().getJarDeployer().loadPreviouslyDeployedJarsFromDisk(); } ClusterConfigurationLoader.applyClusterXmlConfiguration(this, configurationResponse, this.system.getConfig()); initializeDeclarativeCache(); completedCacheXml = true; } finally { if (!completedCacheXml) { try { close(); } catch (Throwable ignore) { } } } this.poolFactory = null; startColocatedJmxManagerLocator(); startMemcachedServer(); startRedisServer(); startRestAgentServer(this); this.isInitialized = true; } | /**
* Perform initialization, solve the early escaped reference problem by putting publishing
* references to this instance in this method (vs. the constructor).
*/ | Perform initialization, solve the early escaped reference problem by putting publishing references to this instance in this method (vs. the constructor) | initialize | {
"repo_name": "prasi-in/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java",
"license": "apache-2.0",
"size": 184680
} | [
"org.apache.geode.admin.internal.SystemMemberCacheEventProcessor",
"org.apache.geode.cache.Operation",
"org.apache.geode.cache.execute.FunctionService",
"org.apache.geode.distributed.internal.ResourceEvent",
"org.apache.geode.internal.Assert",
"org.apache.geode.internal.ClassPathLoader",
"org.apache.geode.internal.cache.execute.util.FindRestEnabledServersFunction",
"org.apache.geode.management.internal.configuration.messages.ConfigurationResponse"
] | import org.apache.geode.admin.internal.SystemMemberCacheEventProcessor; import org.apache.geode.cache.Operation; import org.apache.geode.cache.execute.FunctionService; import org.apache.geode.distributed.internal.ResourceEvent; import org.apache.geode.internal.Assert; import org.apache.geode.internal.ClassPathLoader; import org.apache.geode.internal.cache.execute.util.FindRestEnabledServersFunction; import org.apache.geode.management.internal.configuration.messages.ConfigurationResponse; | import org.apache.geode.admin.internal.*; import org.apache.geode.cache.*; import org.apache.geode.cache.execute.*; import org.apache.geode.distributed.internal.*; import org.apache.geode.internal.*; import org.apache.geode.internal.cache.execute.util.*; import org.apache.geode.management.internal.configuration.messages.*; | [
"org.apache.geode"
] | org.apache.geode; | 910,768 |
protected Set doFindPathMatchingJarResources(Resource rootDirResource, String subPattern) throws IOException {
URLConnection con = rootDirResource.getURL().openConnection();
JarFile jarFile = null;
String jarFileUrl = null;
String rootEntryPath = null;
boolean newJarFile = false;
if (con instanceof JarURLConnection) {
// Should usually be the case for traditional JAR files.
JarURLConnection jarCon = (JarURLConnection) con;
jarCon.setUseCaches(false);
jarFile = jarCon.getJarFile();
jarFileUrl = jarCon.getJarFileURL().toExternalForm();
JarEntry jarEntry = jarCon.getJarEntry();
rootEntryPath = (jarEntry != null ? jarEntry.getName() : "");
}
else {
// No JarURLConnection -> need to resort to URL file parsing.
// We'll assume URLs of the format "jar:path!/entry", with the protocol
// being arbitrary as long as following the entry format.
// We'll also handle paths with and without leading "file:" prefix.
String urlFile = rootDirResource.getURL().getFile();
int separatorIndex = urlFile.indexOf(ResourceUtils.JAR_URL_SEPARATOR);
if (separatorIndex != -1) {
jarFileUrl = urlFile.substring(0, separatorIndex);
rootEntryPath = urlFile.substring(separatorIndex + ResourceUtils.JAR_URL_SEPARATOR.length());
jarFile = getJarFile(jarFileUrl);
}
else {
jarFile = new JarFile(urlFile);
jarFileUrl = urlFile;
rootEntryPath = "";
}
newJarFile = true;
}
try {
if (logger.isDebugEnabled()) {
logger.debug("Looking for matching resources in jar file [" + jarFileUrl + "]");
}
if (!"".equals(rootEntryPath) && !rootEntryPath.endsWith("/")) {
// Root entry path must end with slash to allow for proper matching.
// The Sun JRE does not return a slash here, but BEA JRockit does.
rootEntryPath = rootEntryPath + "/";
}
Set result = new LinkedHashSet(8);
for (Enumeration entries = jarFile.entries(); entries.hasMoreElements();) {
JarEntry entry = (JarEntry) entries.nextElement();
String entryPath = entry.getName();
if (entryPath.startsWith(rootEntryPath)) {
String relativePath = entryPath.substring(rootEntryPath.length());
if (getPathMatcher().match(subPattern, relativePath)) {
result.add(rootDirResource.createRelative(relativePath));
}
}
}
return result;
}
finally {
// Close jar file, but only if freshly obtained -
// not from JarURLConnection, which might cache the file reference.
if (newJarFile) {
jarFile.close();
}
}
} | Set function(Resource rootDirResource, String subPattern) throws IOException { URLConnection con = rootDirResource.getURL().openConnection(); JarFile jarFile = null; String jarFileUrl = null; String rootEntryPath = null; boolean newJarFile = false; if (con instanceof JarURLConnection) { JarURLConnection jarCon = (JarURLConnection) con; jarCon.setUseCaches(false); jarFile = jarCon.getJarFile(); jarFileUrl = jarCon.getJarFileURL().toExternalForm(); JarEntry jarEntry = jarCon.getJarEntry(); rootEntryPath = (jarEntry != null ? jarEntry.getName() : STRSTRLooking for matching resources in jar file [STR]STRSTR/STR/"; } Set result = new LinkedHashSet(8); for (Enumeration entries = jarFile.entries(); entries.hasMoreElements();) { JarEntry entry = (JarEntry) entries.nextElement(); String entryPath = entry.getName(); if (entryPath.startsWith(rootEntryPath)) { String relativePath = entryPath.substring(rootEntryPath.length()); if (getPathMatcher().match(subPattern, relativePath)) { result.add(rootDirResource.createRelative(relativePath)); } } } return result; } finally { if (newJarFile) { jarFile.close(); } } } | /**
* Find all resources in jar files that match the given location pattern
* via the Ant-style PathMatcher.
* @param rootDirResource the root directory as Resource
* @param subPattern the sub pattern to match (below the root directory)
* @return the Set of matching Resource instances
* @throws IOException in case of I/O errors
* @see java.net.JarURLConnection
* @see org.springframework.util.PathMatcher
*/ | Find all resources in jar files that match the given location pattern via the Ant-style PathMatcher | doFindPathMatchingJarResources | {
"repo_name": "cbeams-archive/spring-framework-2.5.x",
"path": "src/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java",
"license": "apache-2.0",
"size": 25059
} | [
"java.io.IOException",
"java.net.JarURLConnection",
"java.net.URLConnection",
"java.util.Enumeration",
"java.util.LinkedHashSet",
"java.util.Set",
"java.util.jar.JarEntry",
"java.util.jar.JarFile",
"org.springframework.core.io.Resource"
] | import java.io.IOException; import java.net.JarURLConnection; import java.net.URLConnection; import java.util.Enumeration; import java.util.LinkedHashSet; import java.util.Set; import java.util.jar.JarEntry; import java.util.jar.JarFile; import org.springframework.core.io.Resource; | import java.io.*; import java.net.*; import java.util.*; import java.util.jar.*; import org.springframework.core.io.*; | [
"java.io",
"java.net",
"java.util",
"org.springframework.core"
] | java.io; java.net; java.util; org.springframework.core; | 2,793,661 |
@SuppressWarnings("unchecked")
public T periodicSizeRotatingFileHandlers(
List<PeriodicSizeRotatingFileHandler> value) {
this.subresources.periodicSizeRotatingFileHandlers.addAll(value);
return (T) this;
} | @SuppressWarnings(STR) T function( List<PeriodicSizeRotatingFileHandler> value) { this.subresources.periodicSizeRotatingFileHandlers.addAll(value); return (T) this; } | /**
* Add all PeriodicSizeRotatingFileHandler objects to this subresource
* @return this
* @param value List of PeriodicSizeRotatingFileHandler objects.
*/ | Add all PeriodicSizeRotatingFileHandler objects to this subresource | periodicSizeRotatingFileHandlers | {
"repo_name": "wildfly-swarm/wildfly-config-api",
"path": "generator/src/test/java/org/wildfly/apigen/test/invocation/logging/Logging.java",
"license": "apache-2.0",
"size": 17694
} | [
"java.util.List",
"org.wildfly.apigen.test.invocation.logging.subsystem.periodicSizeRotatingFileHandler.PeriodicSizeRotatingFileHandler"
] | import java.util.List; import org.wildfly.apigen.test.invocation.logging.subsystem.periodicSizeRotatingFileHandler.PeriodicSizeRotatingFileHandler; | import java.util.*; import org.wildfly.apigen.test.invocation.logging.subsystem.*; | [
"java.util",
"org.wildfly.apigen"
] | java.util; org.wildfly.apigen; | 1,316,515 |
Object parseObject(String source) throws ParseException; | Object parseObject(String source) throws ParseException; | /**
* Parses text from a string to produce a Date.
*
* @param source A <code>String</code> whose beginning should be parsed.
* @return a <code>java.util.Date</code> object
* @throws ParseException if the beginning of the specified string cannot be parsed.
* @see java.text.DateFormat#parseObject(String)
*/ | Parses text from a string to produce a Date | parseObject | {
"repo_name": "apache/logging-log4j2",
"path": "log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/DateParser.java",
"license": "apache-2.0",
"size": 5104
} | [
"java.text.ParseException"
] | import java.text.ParseException; | import java.text.*; | [
"java.text"
] | java.text; | 2,332,988 |
public static void benchmarkTaskSubmission() {
final int numRepeats = 1_000_000;
Ray.init();
try {
time(() -> {
Ray.call(MicroBenchmarks::simpleFunction);
}, numRepeats, "task submission");
} finally {
Ray.shutdown();
}
} | static void function() { final int numRepeats = 1_000_000; Ray.init(); try { time(() -> { Ray.call(MicroBenchmarks::simpleFunction); }, numRepeats, STR); } finally { Ray.shutdown(); } } | /**
* Benchmark task submission.
*
* Note, this benchmark is supposed to measure the elapased time in Java worker, we should disable
* submitting tasks to raylet in `raylet_client.cc` before running this benchmark.
*/ | Benchmark task submission. Note, this benchmark is supposed to measure the elapased time in Java worker, we should disable submitting tasks to raylet in `raylet_client.cc` before running this benchmark | benchmarkTaskSubmission | {
"repo_name": "ujvl/ray-ng",
"path": "java/test/src/main/java/org/ray/api/benchmark/MicroBenchmarks.java",
"license": "apache-2.0",
"size": 1395
} | [
"org.ray.api.Ray"
] | import org.ray.api.Ray; | import org.ray.api.*; | [
"org.ray.api"
] | org.ray.api; | 2,391,565 |
public static String toCCStatus(Item i) {
if (i instanceof Job) {
Job j = (Job) i;
switch (j.getIconColor()) {
case ABORTED:
case ABORTED_ANIME:
case RED:
case RED_ANIME:
case YELLOW:
case YELLOW_ANIME:
return "Failure";
case BLUE:
case BLUE_ANIME:
return "Success";
case DISABLED:
case DISABLED_ANIME:
case GREY:
case GREY_ANIME:
case NOTBUILT:
case NOTBUILT_ANIME:
return "Unknown";
}
}
return "Unknown";
}
private static final Pattern LINE_END = Pattern.compile("\r?\n"); | static String function(Item i) { if (i instanceof Job) { Job j = (Job) i; switch (j.getIconColor()) { case ABORTED: case ABORTED_ANIME: case RED: case RED_ANIME: case YELLOW: case YELLOW_ANIME: return STR; case BLUE: case BLUE_ANIME: return STR; case DISABLED: case DISABLED_ANIME: case GREY: case GREY_ANIME: case NOTBUILT: case NOTBUILT_ANIME: return STR; } } return STR; } private static final Pattern LINE_END = Pattern.compile("\r?\n"); | /**
* Converts the Hudson build status to CruiseControl build status,
* which is either Success, Failure, Exception, or Unknown.
*/ | Converts the Hudson build status to CruiseControl build status, which is either Success, Failure, Exception, or Unknown | toCCStatus | {
"repo_name": "KostyaSha/jenkins",
"path": "core/src/main/java/hudson/Functions.java",
"license": "mit",
"size": 69172
} | [
"hudson.model.Item",
"hudson.model.Job",
"java.util.regex.Pattern"
] | import hudson.model.Item; import hudson.model.Job; import java.util.regex.Pattern; | import hudson.model.*; import java.util.regex.*; | [
"hudson.model",
"java.util"
] | hudson.model; java.util; | 2,707,535 |
private static IntervalXYDataset createDataset1() {
// create dataset 1...
TimeSeries series1 = new TimeSeries("Series 1");
series1.add(new Month(1, 2005), 7627.743);
series1.add(new Month(2, 2005), 7713.138);
series1.add(new Month(3, 2005), 6776.939);
series1.add(new Month(4, 2005), 5764.537);
series1.add(new Month(5, 2005), 4777.880);
series1.add(new Month(6, 2005), 4836.496);
series1.add(new Month(7, 2005), 3887.618);
series1.add(new Month(8, 2005), 3926.933);
series1.add(new Month(9, 2005), 4932.710);
series1.add(new Month(10, 2005), 4027.123);
series1.add(new Month(11, 2005), 8092.322);
series1.add(new Month(12, 2005), 8170.414);
series1.add(new Month(1, 2006), 8196.070);
series1.add(new Month(2, 2006), 8269.886);
series1.add(new Month(3, 2006), 5371.156);
series1.add(new Month(4, 2006), 5355.718);
series1.add(new Month(5, 2006), 5356.777);
series1.add(new Month(6, 2006), 8420.042);
series1.add(new Month(7, 2006), 8444.347);
series1.add(new Month(8, 2006), 8515.034);
series1.add(new Month(9, 2006), 8506.974);
series1.add(new Month(10, 2006), 8584.329);
series1.add(new Month(11, 2006), 8633.246);
series1.add(new Month(12, 2006), 8680.224);
series1.add(new Month(1, 2007), 8707.561);
return new TimeSeriesCollection(series1);
} | static IntervalXYDataset function() { TimeSeries series1 = new TimeSeries(STR); series1.add(new Month(1, 2005), 7627.743); series1.add(new Month(2, 2005), 7713.138); series1.add(new Month(3, 2005), 6776.939); series1.add(new Month(4, 2005), 5764.537); series1.add(new Month(5, 2005), 4777.880); series1.add(new Month(6, 2005), 4836.496); series1.add(new Month(7, 2005), 3887.618); series1.add(new Month(8, 2005), 3926.933); series1.add(new Month(9, 2005), 4932.710); series1.add(new Month(10, 2005), 4027.123); series1.add(new Month(11, 2005), 8092.322); series1.add(new Month(12, 2005), 8170.414); series1.add(new Month(1, 2006), 8196.070); series1.add(new Month(2, 2006), 8269.886); series1.add(new Month(3, 2006), 5371.156); series1.add(new Month(4, 2006), 5355.718); series1.add(new Month(5, 2006), 5356.777); series1.add(new Month(6, 2006), 8420.042); series1.add(new Month(7, 2006), 8444.347); series1.add(new Month(8, 2006), 8515.034); series1.add(new Month(9, 2006), 8506.974); series1.add(new Month(10, 2006), 8584.329); series1.add(new Month(11, 2006), 8633.246); series1.add(new Month(12, 2006), 8680.224); series1.add(new Month(1, 2007), 8707.561); return new TimeSeriesCollection(series1); } | /**
* Creates a sample dataset. You wouldn't normally hard-code the
* population of a dataset in this way (it would be better to read the
* values from a file or a database query), but for a self-contained demo
* this is the least complicated solution.
*
* @return The dataset.
*/ | Creates a sample dataset. You wouldn't normally hard-code the population of a dataset in this way (it would be better to read the values from a file or a database query), but for a self-contained demo this is the least complicated solution | createDataset1 | {
"repo_name": "Mr-Steve/LTSpice_Library_Manager",
"path": "libs/jfreechart-1.0.16/experimental/org/jfree/experimental/chart/demo/CombinedXYPlotDemo1.java",
"license": "gpl-2.0",
"size": 10033
} | [
"org.jfree.data.time.Month",
"org.jfree.data.time.TimeSeries",
"org.jfree.data.time.TimeSeriesCollection",
"org.jfree.data.xy.IntervalXYDataset"
] | import org.jfree.data.time.Month; import org.jfree.data.time.TimeSeries; import org.jfree.data.time.TimeSeriesCollection; import org.jfree.data.xy.IntervalXYDataset; | import org.jfree.data.time.*; import org.jfree.data.xy.*; | [
"org.jfree.data"
] | org.jfree.data; | 11,388 |
private void saveAuditModifyRow(FedoraObject fedoraObject, Long rid) {
CustomUser customUser = (CustomUser)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
AuditObject auditObject = new AuditObject();
auditObject.setLog_date(new java.util.Date());
auditObject.setLog_type("MODIFIED");
auditObject.setObject_id(fedoraObject.getId());
auditObject.setUser_id(customUser.getId());
auditObject.setRid(rid);
JAXBTransform jaxbTransform = new JAXBTransform();
Data removeData = new Data();
removeData.setItems(removedItems_);
StringWriter removedString = new StringWriter();
Data addData = new Data();
addData.setItems(addedItems_);
StringWriter addedString = new StringWriter();
try {
jaxbTransform.marshalStream(removedString, removeData, Data.class);
jaxbTransform.marshalStream(addedString, addData, Data.class);
}
catch (JAXBException e) {
LOGGER.error("Exception creating audit information", e);
}
auditObject.setBefore(removedString.toString());
auditObject.setAfter(addedString.toString());
GenericDAO<AuditObject,Long> auditDao = new GenericDAOImpl<AuditObject,Long>(AuditObject.class);
auditDao.create(auditObject);
}
| void function(FedoraObject fedoraObject, Long rid) { CustomUser customUser = (CustomUser)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); AuditObject auditObject = new AuditObject(); auditObject.setLog_date(new java.util.Date()); auditObject.setLog_type(STR); auditObject.setObject_id(fedoraObject.getId()); auditObject.setUser_id(customUser.getId()); auditObject.setRid(rid); JAXBTransform jaxbTransform = new JAXBTransform(); Data removeData = new Data(); removeData.setItems(removedItems_); StringWriter removedString = new StringWriter(); Data addData = new Data(); addData.setItems(addedItems_); StringWriter addedString = new StringWriter(); try { jaxbTransform.marshalStream(removedString, removeData, Data.class); jaxbTransform.marshalStream(addedString, addData, Data.class); } catch (JAXBException e) { LOGGER.error(STR, e); } auditObject.setBefore(removedString.toString()); auditObject.setAfter(addedString.toString()); GenericDAO<AuditObject,Long> auditDao = new GenericDAOImpl<AuditObject,Long>(AuditObject.class); auditDao.create(auditObject); } | /**
* saveAuditModifyRow
*
* Saves the changed information for the fedora object
*
* <pre>
* Version Date Developer Description
* 0.10 20/06/2012 Genevieve Turner(GT) Initial
* 0.18 09/11/2012 Genevieve Turner (GT) Added request id field
* </pre>
*
* @param fedoraObject The fedora object to add an audit row to
*/ | saveAuditModifyRow Saves the changed information for the fedora object <code> Version Date Developer Description 0.10 20/06/2012 Genevieve Turner(GT) Initial 0.18 09/11/2012 Genevieve Turner (GT) Added request id field </code> | saveAuditModifyRow | {
"repo_name": "anu-doi/anudc",
"path": "DataCommons/src/main/java/au/edu/anu/datacommons/xml/transform/ViewTransform.java",
"license": "gpl-3.0",
"size": 45481
} | [
"au.edu.anu.datacommons.data.db.dao.GenericDAO",
"au.edu.anu.datacommons.data.db.dao.GenericDAOImpl",
"au.edu.anu.datacommons.data.db.model.AuditObject",
"au.edu.anu.datacommons.data.db.model.FedoraObject",
"au.edu.anu.datacommons.security.CustomUser",
"au.edu.anu.datacommons.xml.data.Data",
"java.io.StringWriter",
"javax.xml.bind.JAXBException",
"org.springframework.security.core.context.SecurityContextHolder"
] | import au.edu.anu.datacommons.data.db.dao.GenericDAO; import au.edu.anu.datacommons.data.db.dao.GenericDAOImpl; import au.edu.anu.datacommons.data.db.model.AuditObject; import au.edu.anu.datacommons.data.db.model.FedoraObject; import au.edu.anu.datacommons.security.CustomUser; import au.edu.anu.datacommons.xml.data.Data; import java.io.StringWriter; import javax.xml.bind.JAXBException; import org.springframework.security.core.context.SecurityContextHolder; | import au.edu.anu.datacommons.data.db.dao.*; import au.edu.anu.datacommons.data.db.model.*; import au.edu.anu.datacommons.security.*; import au.edu.anu.datacommons.xml.data.*; import java.io.*; import javax.xml.bind.*; import org.springframework.security.core.context.*; | [
"au.edu.anu",
"java.io",
"javax.xml",
"org.springframework.security"
] | au.edu.anu; java.io; javax.xml; org.springframework.security; | 1,252,215 |
@Test
public void testLoadWrongSchema() throws Exception
{
LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
SchemaManager schemaManager = new DefaultSchemaManager( loader );
assertTrue( schemaManager.load( "system" ) );
try
{
schemaManager.loadWithDeps( "bad" );
fail();
}
catch ( LdapUnwillingToPerformException lonse )
{
// expected
}
assertTrue( schemaManager.getErrors().isEmpty() );
assertEquals( 38, schemaManager.getAttributeTypeRegistry().size() );
assertEquals( 35, schemaManager.getComparatorRegistry().size() );
assertEquals( 35, schemaManager.getMatchingRuleRegistry().size() );
assertEquals( 35, schemaManager.getNormalizerRegistry().size() );
assertEquals( 9, schemaManager.getObjectClassRegistry().size() );
assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() );
assertEquals( 59, schemaManager.getLdapSyntaxRegistry().size() );
assertEquals( 141, schemaManager.getGlobalOidRegistry().size() );
assertEquals( 1, schemaManager.getRegistries().getLoadedSchemas().size() );
assertNotNull( schemaManager.getRegistries().getLoadedSchema( "system" ) );
assertNull( schemaManager.getRegistries().getLoadedSchema( "bad" ) );
} | void function() throws Exception { LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository ); SchemaManager schemaManager = new DefaultSchemaManager( loader ); assertTrue( schemaManager.load( STR ) ); try { schemaManager.loadWithDeps( "bad" ); fail(); } catch ( LdapUnwillingToPerformException lonse ) { } assertTrue( schemaManager.getErrors().isEmpty() ); assertEquals( 38, schemaManager.getAttributeTypeRegistry().size() ); assertEquals( 35, schemaManager.getComparatorRegistry().size() ); assertEquals( 35, schemaManager.getMatchingRuleRegistry().size() ); assertEquals( 35, schemaManager.getNormalizerRegistry().size() ); assertEquals( 9, schemaManager.getObjectClassRegistry().size() ); assertEquals( 59, schemaManager.getSyntaxCheckerRegistry().size() ); assertEquals( 59, schemaManager.getLdapSyntaxRegistry().size() ); assertEquals( 141, schemaManager.getGlobalOidRegistry().size() ); assertEquals( 1, schemaManager.getRegistries().getLoadedSchemas().size() ); assertNotNull( schemaManager.getRegistries().getLoadedSchema( STR ) ); assertNull( schemaManager.getRegistries().getLoadedSchema( "bad" ) ); } | /**
* Test loading a wrong schema
*/ | Test loading a wrong schema | testLoadWrongSchema | {
"repo_name": "darranl/directory-shared",
"path": "ldap/schema/data/src/test/java/org/apache/directory/api/ldap/schemaloader/SchemaManagerLoadTest.java",
"license": "apache-2.0",
"size": 33764
} | [
"org.apache.directory.api.ldap.model.exception.LdapUnwillingToPerformException",
"org.apache.directory.api.ldap.model.schema.SchemaManager",
"org.apache.directory.api.ldap.schemaloader.LdifSchemaLoader",
"org.apache.directory.api.ldap.schemamanager.impl.DefaultSchemaManager",
"org.junit.Assert"
] | import org.apache.directory.api.ldap.model.exception.LdapUnwillingToPerformException; import org.apache.directory.api.ldap.model.schema.SchemaManager; import org.apache.directory.api.ldap.schemaloader.LdifSchemaLoader; import org.apache.directory.api.ldap.schemamanager.impl.DefaultSchemaManager; import org.junit.Assert; | import org.apache.directory.api.ldap.model.exception.*; import org.apache.directory.api.ldap.model.schema.*; import org.apache.directory.api.ldap.schemaloader.*; import org.apache.directory.api.ldap.schemamanager.impl.*; import org.junit.*; | [
"org.apache.directory",
"org.junit"
] | org.apache.directory; org.junit; | 1,534,459 |
public static int countByTagName(String tag, Document document) {
NodeList list = document.getElementsByTagName(tag);
return list.getLength();
}
| static int function(String tag, Document document) { NodeList list = document.getElementsByTagName(tag); return list.getLength(); } | /**
* Count Elements in Document by Tag Name
*
* @param tag
* @param document
* @return number elements by Tag Name
*/ | Count Elements in Document by Tag Name | countByTagName | {
"repo_name": "nport/jemma.ah.zigbee.zcl.compiler",
"path": "src/main/java/org/energy_home/jemma/ah/zigbee/zcl/generator/DOMUtil.java",
"license": "lgpl-3.0",
"size": 6167
} | [
"org.w3c.dom.Document",
"org.w3c.dom.NodeList"
] | import org.w3c.dom.Document; import org.w3c.dom.NodeList; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 1,214,044 |
public void testGetAlgorithm() {
String pSrcName = "pSrcName";
PSource ps = new PSource(pSrcName);
assertTrue("The returned value is not equal to the value specified "
+ "in constructor", pSrcName.equals(ps.getAlgorithm()));
} | void function() { String pSrcName = STR; PSource ps = new PSource(pSrcName); assertTrue(STR + STR, pSrcName.equals(ps.getAlgorithm())); } | /**
* getAlgorithm() method testing. Tests that returned value is
* equal to the value specified in the constructor.
*/ | getAlgorithm() method testing. Tests that returned value is equal to the value specified in the constructor | testGetAlgorithm | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "external/apache-harmony/crypto/src/test/api/java.injected/javax/crypto/spec/PSourceTest.java",
"license": "gpl-3.0",
"size": 3768
} | [
"javax.crypto.spec.PSource"
] | import javax.crypto.spec.PSource; | import javax.crypto.spec.*; | [
"javax.crypto"
] | javax.crypto; | 2,504,110 |
private Object readResolve() throws ObjectStreamException {
GradientPaintTransformType result = null;
if (this.equals(GradientPaintTransformType.HORIZONTAL)) {
result = GradientPaintTransformType.HORIZONTAL;
}
else if (this.equals(GradientPaintTransformType.VERTICAL)) {
result = GradientPaintTransformType.VERTICAL;
}
else if (this.equals(GradientPaintTransformType.CENTER_HORIZONTAL)) {
result = GradientPaintTransformType.CENTER_HORIZONTAL;
}
else if (this.equals(GradientPaintTransformType.CENTER_VERTICAL)) {
result = GradientPaintTransformType.CENTER_VERTICAL;
}
return result;
} | Object function() throws ObjectStreamException { GradientPaintTransformType result = null; if (this.equals(GradientPaintTransformType.HORIZONTAL)) { result = GradientPaintTransformType.HORIZONTAL; } else if (this.equals(GradientPaintTransformType.VERTICAL)) { result = GradientPaintTransformType.VERTICAL; } else if (this.equals(GradientPaintTransformType.CENTER_HORIZONTAL)) { result = GradientPaintTransformType.CENTER_HORIZONTAL; } else if (this.equals(GradientPaintTransformType.CENTER_VERTICAL)) { result = GradientPaintTransformType.CENTER_VERTICAL; } return result; } | /**
* Ensures that serialization returns the unique instances.
*
* @return The object.
*
* @throws ObjectStreamException if there is a problem.
*/ | Ensures that serialization returns the unique instances | readResolve | {
"repo_name": "linuxuser586/jfreechart",
"path": "source/org/jfree/chart/util/GradientPaintTransformType.java",
"license": "lgpl-2.1",
"size": 4726
} | [
"java.io.ObjectStreamException"
] | import java.io.ObjectStreamException; | import java.io.*; | [
"java.io"
] | java.io; | 2,155,992 |
@Generated
@ImportedCapacityFeature(Schedules.class)
protected AgentTask every(final long period, final Procedure1<? super Agent> procedure) {
return getSkill(io.sarl.core.Schedules.class).every(period, procedure);
}
| @ImportedCapacityFeature(Schedules.class) AgentTask function(final long period, final Procedure1<? super Agent> procedure) { return getSkill(io.sarl.core.Schedules.class).every(period, procedure); } | /**
* See the capacity {@link io.sarl.core.Schedules#every(long,(io.sarl.lang.core.Agent)=>void)}.
*
* @see io.sarl.core.Schedules#every(long,(io.sarl.lang.core.Agent)=>void)
*/ | See the capacity <code>io.sarl.core.Schedules#every(long,(io.sarl.lang.core.Agent)=>void)</code> | every | {
"repo_name": "trollmcqueen/eurock_vi51",
"path": "EuroSim/src/main/generated-sources/xtend/fr/utbm/info/vi51/framework/environment/EnvironmentAgent.java",
"license": "gpl-2.0",
"size": 24780
} | [
"io.sarl.core.AgentTask",
"io.sarl.core.Schedules",
"io.sarl.lang.annotation.ImportedCapacityFeature",
"io.sarl.lang.core.Agent",
"org.eclipse.xtext.xbase.lib.Procedures"
] | import io.sarl.core.AgentTask; import io.sarl.core.Schedules; import io.sarl.lang.annotation.ImportedCapacityFeature; import io.sarl.lang.core.Agent; import org.eclipse.xtext.xbase.lib.Procedures; | import io.sarl.core.*; import io.sarl.lang.annotation.*; import io.sarl.lang.core.*; import org.eclipse.xtext.xbase.lib.*; | [
"io.sarl.core",
"io.sarl.lang",
"org.eclipse.xtext"
] | io.sarl.core; io.sarl.lang; org.eclipse.xtext; | 274,102 |
public String updateReplicaUnderRecovery(ExtendedBlock oldBlock,
long recoveryId, long newBlockId, long newLength) throws IOException; | String function(ExtendedBlock oldBlock, long recoveryId, long newBlockId, long newLength) throws IOException; | /**
* Update replica's generation stamp and length and finalize it.
* @return the ID of storage that stores the block
*/ | Update replica's generation stamp and length and finalize it | updateReplicaUnderRecovery | {
"repo_name": "busbey/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/FsDatasetSpi.java",
"license": "apache-2.0",
"size": 21928
} | [
"java.io.IOException",
"org.apache.hadoop.hdfs.protocol.ExtendedBlock"
] | import java.io.IOException; import org.apache.hadoop.hdfs.protocol.ExtendedBlock; | import java.io.*; import org.apache.hadoop.hdfs.protocol.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,964,500 |
public Object execute(final Map<Object, Object> iArgs) {
if (role == null)
throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");
role.grant(resource, privilege);
role.save();
return role;
}
| Object function(final Map<Object, Object> iArgs) { if (role == null) throw new OCommandExecutionException(STR); role.grant(resource, privilege); role.save(); return role; } | /**
* Execute the GRANT.
*/ | Execute the GRANT | execute | {
"repo_name": "alonsod86/orientdb",
"path": "core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLGrant.java",
"license": "apache-2.0",
"size": 3802
} | [
"com.orientechnologies.orient.core.exception.OCommandExecutionException",
"java.util.Map"
] | import com.orientechnologies.orient.core.exception.OCommandExecutionException; import java.util.Map; | import com.orientechnologies.orient.core.exception.*; import java.util.*; | [
"com.orientechnologies.orient",
"java.util"
] | com.orientechnologies.orient; java.util; | 2,324,711 |
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<ReplicationInner>, ReplicationInner> beginUpdateAsync(
String resourceGroupName,
String registryName,
String replicationName,
Map<String, String> tags,
Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
updateWithResponseAsync(resourceGroupName, registryName, replicationName, tags, context);
return this
.client
.<ReplicationInner, ReplicationInner>getLroResult(
mono, this.client.getHttpPipeline(), ReplicationInner.class, ReplicationInner.class, context);
} | @ServiceMethod(returns = ReturnType.SINGLE) PollerFlux<PollResult<ReplicationInner>, ReplicationInner> function( String resourceGroupName, String registryName, String replicationName, Map<String, String> tags, Context context) { context = this.client.mergeContext(context); Mono<Response<Flux<ByteBuffer>>> mono = updateWithResponseAsync(resourceGroupName, registryName, replicationName, tags, context); return this .client .<ReplicationInner, ReplicationInner>getLroResult( mono, this.client.getHttpPipeline(), ReplicationInner.class, ReplicationInner.class, context); } | /**
* Updates a replication for a container registry with the specified parameters.
*
* @param resourceGroupName The name of the resource group to which the container registry belongs.
* @param registryName The name of the container registry.
* @param replicationName The name of the replication.
* @param tags The tags for the replication.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an object that represents a replication for a container registry.
*/ | Updates a replication for a container registry with the specified parameters | beginUpdateAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-containerregistry/src/main/java/com/azure/resourcemanager/containerregistry/implementation/ReplicationsClientImpl.java",
"license": "mit",
"size": 73917
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.management.polling.PollResult",
"com.azure.core.util.Context",
"com.azure.core.util.polling.PollerFlux",
"com.azure.resourcemanager.containerregistry.fluent.models.ReplicationInner",
"java.nio.ByteBuffer",
"java.util.Map"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.polling.PollerFlux; import com.azure.resourcemanager.containerregistry.fluent.models.ReplicationInner; import java.nio.ByteBuffer; import java.util.Map; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.management.polling.*; import com.azure.core.util.*; import com.azure.core.util.polling.*; import com.azure.resourcemanager.containerregistry.fluent.models.*; import java.nio.*; import java.util.*; | [
"com.azure.core",
"com.azure.resourcemanager",
"java.nio",
"java.util"
] | com.azure.core; com.azure.resourcemanager; java.nio; java.util; | 667,889 |
private FormulaBase addBaseFormula(FormulaBase.BaseType type, Parcelable p)
{
FormulaBase f = createFormula(type);
if (f != null)
{
f.onRestoreInstanceState(p);
f.updateTextSize();
formulas.put(f.getId(), f);
}
return f;
} | FormulaBase function(FormulaBase.BaseType type, Parcelable p) { FormulaBase f = createFormula(type); if (f != null) { f.onRestoreInstanceState(p); f.updateTextSize(); formulas.put(f.getId(), f); } return f; } | /**
* Procedure creates a formula with given type and given stored date
*/ | Procedure creates a formula with given type and given stored date | addBaseFormula | {
"repo_name": "mkulesh/microMathematics",
"path": "app/src/main/java/com/mkulesh/micromath/formula/FormulaList.java",
"license": "gpl-3.0",
"size": 41377
} | [
"android.os.Parcelable"
] | import android.os.Parcelable; | import android.os.*; | [
"android.os"
] | android.os; | 948,689 |
protected void trace( Request request, Response response )
throws IOException
{
notAllowed( response );
} | void function( Request request, Response response ) throws IOException { notAllowed( response ); } | /**
* HTTP TRACE request.
*
* @param request the HTTP request
* @param response the HTTP response
* @throws IOException if any error occurs while HTTP negotiation
*/ | HTTP TRACE request | trace | {
"repo_name": "simonetripodi/shs",
"path": "api/src/main/java/org/nnsoft/shs/http/BaseRequestHandler.java",
"license": "mit",
"size": 5883
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,162,505 |
public static boolean exists(IndexSearcher searcher, Query query, Filter filter,
EarlyTerminatingCollector collector) throws IOException {
collector.reset();
countWithEarlyTermination(searcher, filter, query, collector);
return collector.exists();
} | static boolean function(IndexSearcher searcher, Query query, Filter filter, EarlyTerminatingCollector collector) throws IOException { collector.reset(); countWithEarlyTermination(searcher, filter, query, collector); return collector.exists(); } | /**
* Performs an exists (count > 0) query on the <code>searcher</code> for <code>query</code>
* with <code>filter</code> using the given <code>collector</code>
*
* The <code>collector</code> can be instantiated using <code>Lucene.createExistsCollector()</code>
*/ | Performs an exists (count > 0) query on the <code>searcher</code> for <code>query</code> with <code>filter</code> using the given <code>collector</code> The <code>collector</code> can be instantiated using <code>Lucene.createExistsCollector()</code> | exists | {
"repo_name": "sarwarbhuiyan/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/common/lucene/Lucene.java",
"license": "apache-2.0",
"size": 37676
} | [
"java.io.IOException",
"org.apache.lucene.search.Filter",
"org.apache.lucene.search.IndexSearcher",
"org.apache.lucene.search.Query"
] | import java.io.IOException; import org.apache.lucene.search.Filter; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; | import java.io.*; import org.apache.lucene.search.*; | [
"java.io",
"org.apache.lucene"
] | java.io; org.apache.lucene; | 2,764,226 |
public void setId(PDFObject id) {
this.id = id;
}
| void function(PDFObject id) { this.id = id; } | /*************************************************************************
* ID - array of two byte strings constituting a file identifier, which
* should be included in the referenced file.
*
* @param id
************************************************************************/ | ID - array of two byte strings constituting a file identifier, which should be included in the referenced file | setId | {
"repo_name": "oswetto/PDFrenderer",
"path": "src/com/sun/pdfview/action/LaunchAction.java",
"license": "lgpl-2.1",
"size": 19405
} | [
"com.sun.pdfview.PDFObject"
] | import com.sun.pdfview.PDFObject; | import com.sun.pdfview.*; | [
"com.sun.pdfview"
] | com.sun.pdfview; | 340,845 |
private void init() {
implGeom = new LineStripArray();
stripsChanged = false;
coordsChanged = false;
} | void function() { implGeom = new LineStripArray(); stripsChanged = false; coordsChanged = false; } | /**
* Common initialisation functionality.
*/ | Common initialisation functionality | init | {
"repo_name": "Norkart/NK-VirtualGlobe",
"path": "Xj3D/src/java/org/web3d/vrml/renderer/ogl/nodes/render/OGLLineSet.java",
"license": "gpl-2.0",
"size": 13283
} | [
"org.j3d.aviatrix3d.LineStripArray"
] | import org.j3d.aviatrix3d.LineStripArray; | import org.j3d.aviatrix3d.*; | [
"org.j3d.aviatrix3d"
] | org.j3d.aviatrix3d; | 1,308,697 |
public void setCitation(final Citation newValue) {
checkWritePermission();
citation = newValue;
} | void function(final Citation newValue) { checkWritePermission(); citation = newValue; } | /**
* Sets the identification of authority requesting target collection.
*
* @param newValue The new citation value.
*/ | Sets the identification of authority requesting target collection | setCitation | {
"repo_name": "desruisseaux/sis",
"path": "core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultPlan.java",
"license": "apache-2.0",
"size": 8518
} | [
"org.opengis.metadata.citation.Citation"
] | import org.opengis.metadata.citation.Citation; | import org.opengis.metadata.citation.*; | [
"org.opengis.metadata"
] | org.opengis.metadata; | 1,529,973 |
private void setAttributes(final ResourceResolver resolver, final String authType,
final HttpServletRequest request) {
// HttpService API required attributes
request.setAttribute(HttpContext.REMOTE_USER, resolver.getUserID());
request.setAttribute(HttpContext.AUTHENTICATION_TYPE, authType);
// resource resolver for down-stream use
request.setAttribute(REQUEST_ATTRIBUTE_RESOLVER, resolver);
log.debug(
"setAttributes: ResourceResolver stored as request attribute: user={}",
resolver.getUserID());
} | void function(final ResourceResolver resolver, final String authType, final HttpServletRequest request) { request.setAttribute(HttpContext.REMOTE_USER, resolver.getUserID()); request.setAttribute(HttpContext.AUTHENTICATION_TYPE, authType); request.setAttribute(REQUEST_ATTRIBUTE_RESOLVER, resolver); log.debug( STR, resolver.getUserID()); } | /**
* Sets the request attributes required by the OSGi HttpContext interface
* specification for the <code>handleSecurity</code> method. In addition the
* {@link SlingAuthenticator#REQUEST_ATTRIBUTE_RESOLVER} request attribute
* is set to the ResourceResolver.
*/ | Sets the request attributes required by the OSGi HttpContext interface specification for the <code>handleSecurity</code> method. In addition the <code>SlingAuthenticator#REQUEST_ATTRIBUTE_RESOLVER</code> request attribute is set to the ResourceResolver | setAttributes | {
"repo_name": "nleite/sling",
"path": "bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java",
"license": "apache-2.0",
"size": 70449
} | [
"javax.servlet.http.HttpServletRequest",
"org.apache.sling.api.resource.ResourceResolver",
"org.osgi.service.http.HttpContext"
] | import javax.servlet.http.HttpServletRequest; import org.apache.sling.api.resource.ResourceResolver; import org.osgi.service.http.HttpContext; | import javax.servlet.http.*; import org.apache.sling.api.resource.*; import org.osgi.service.http.*; | [
"javax.servlet",
"org.apache.sling",
"org.osgi.service"
] | javax.servlet; org.apache.sling; org.osgi.service; | 2,658,995 |
public Engine createEngine() {
if( log.isDebugEnabled() )
log.debug("Creating engine");
StandardEngine engine = new StandardEngine();
// Default host will be set to the first host added
engine.setRealm(realm); // Inherited by all children
return (engine);
} | Engine function() { if( log.isDebugEnabled() ) log.debug(STR); StandardEngine engine = new StandardEngine(); engine.setRealm(realm); return (engine); } | /**
* Create, configure, and return an Engine that will process all
* HTTP requests received from one of the associated Connectors,
* based on the specified properties.
*/ | Create, configure, and return an Engine that will process all HTTP requests received from one of the associated Connectors, based on the specified properties | createEngine | {
"repo_name": "WhiteBearSolutions/WBSAirback",
"path": "packages/wbsairback-tomcat/wbsairback-tomcat-7.0.22/java/org/apache/catalina/startup/Embedded.java",
"license": "apache-2.0",
"size": 30455
} | [
"org.apache.catalina.Engine",
"org.apache.catalina.core.StandardEngine"
] | import org.apache.catalina.Engine; import org.apache.catalina.core.StandardEngine; | import org.apache.catalina.*; import org.apache.catalina.core.*; | [
"org.apache.catalina"
] | org.apache.catalina; | 508,252 |
public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
return par1ItemStack;
} | ItemStack function(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { return par1ItemStack; } | /**
* Prevents the item from being consumed on use
*/ | Prevents the item from being consumed on use | onEaten | {
"repo_name": "GhostMonk3408/MidgarCrusade",
"path": "src/main/java/fr/toss/FF7Weapons/Nikebow.java",
"license": "lgpl-2.1",
"size": 3469
} | [
"net.minecraft.entity.player.EntityPlayer",
"net.minecraft.item.ItemStack",
"net.minecraft.world.World"
] | import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; | import net.minecraft.entity.player.*; import net.minecraft.item.*; import net.minecraft.world.*; | [
"net.minecraft.entity",
"net.minecraft.item",
"net.minecraft.world"
] | net.minecraft.entity; net.minecraft.item; net.minecraft.world; | 1,741,171 |
public Material getMaterial() {
return material;
} | Material function() { return material; } | /**
* Returns the material of this data
*
* @return The material
*/ | Returns the material of this data | getMaterial | {
"repo_name": "TheApocalypseMC/FunCore",
"path": "src/com/theapocalypsemc/funcore/fx/ParticleEffect.java",
"license": "gpl-2.0",
"size": 67409
} | [
"org.bukkit.Material"
] | import org.bukkit.Material; | import org.bukkit.*; | [
"org.bukkit"
] | org.bukkit; | 2,740,202 |
public void releaseAllImmediately() {
if (DEBUG) Log.v(TAG, "releaseAllImmediately");
ArrayList<String> keys = new ArrayList<>(mHeadsUpEntries.keySet());
for (String key : keys) {
releaseImmediately(key);
}
} | void function() { if (DEBUG) Log.v(TAG, STR); ArrayList<String> keys = new ArrayList<>(mHeadsUpEntries.keySet()); for (String key : keys) { releaseImmediately(key); } } | /**
* Push any current Heads Up notification down into the shade.
*/ | Push any current Heads Up notification down into the shade | releaseAllImmediately | {
"repo_name": "xorware/android_frameworks_base",
"path": "packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java",
"license": "apache-2.0",
"size": 27788
} | [
"android.util.Log",
"java.util.ArrayList"
] | import android.util.Log; import java.util.ArrayList; | import android.util.*; import java.util.*; | [
"android.util",
"java.util"
] | android.util; java.util; | 171,060 |
public static Map<String, String> validateKeyConfigiration(
String groupName, String cacheName, CacheKeyConfiguration[] cacheKeyCfgs, IgniteLogger log,
boolean fail
) throws IgniteCheckedException {
Map<String, String> keyConfigurations = new HashMap<>();
if (cacheKeyCfgs != null) {
for (CacheKeyConfiguration cacheKeyCfg : cacheKeyCfgs) {
String typeName = cacheKeyCfg.getTypeName();
A.notNullOrEmpty(typeName, "typeName");
String fieldName = cacheKeyCfg.getAffinityKeyFieldName();
A.notNullOrEmpty(fieldName, "affKeyFieldName");
String oldFieldName = keyConfigurations.put(typeName, fieldName);
if (oldFieldName != null && !oldFieldName.equals(fieldName)) {
final String msg = "Cache key configuration contains conflicting definitions: [" +
(groupName != null ? "cacheGroup=" + groupName + ", " : "") +
"cacheName=" + cacheName + ", " +
"typeName=" + typeName + ", " +
"affKeyFieldName1=" + oldFieldName + ", " +
"affKeyFieldName2=" + fieldName + "].";
throwIgniteCheckedException(log, fail, msg);
}
}
}
return keyConfigurations;
} | static Map<String, String> function( String groupName, String cacheName, CacheKeyConfiguration[] cacheKeyCfgs, IgniteLogger log, boolean fail ) throws IgniteCheckedException { Map<String, String> keyConfigurations = new HashMap<>(); if (cacheKeyCfgs != null) { for (CacheKeyConfiguration cacheKeyCfg : cacheKeyCfgs) { String typeName = cacheKeyCfg.getTypeName(); A.notNullOrEmpty(typeName, STR); String fieldName = cacheKeyCfg.getAffinityKeyFieldName(); A.notNullOrEmpty(fieldName, STR); String oldFieldName = keyConfigurations.put(typeName, fieldName); if (oldFieldName != null && !oldFieldName.equals(fieldName)) { final String msg = STR + (groupName != null ? STR + groupName + STR : STRcacheName=" + cacheName + STR + "typeName=" + typeName + STR + "affKeyFieldName1=" + oldFieldName + STR + "affKeyFieldName2=STR]."; throwIgniteCheckedException(log, fail, msg); } } } return keyConfigurations; } | /**
* Validate affinity key configurations.
* All fields are initialized and not empty (typeName and affKeyFieldName is defined).
* Definition for the type does not repeat.
*
* @param groupName Cache group name.
* @param cacheName Cache name.
* @param cacheKeyCfgs keyConfiguration to validate.
* @param log Logger used to log warning message (used only if fail flag is not set).
* @param fail If true throws IgniteCheckedException in case of attribute values mismatch, otherwise logs warning.
* @return Affinity key maps (typeName -> fieldName)
* @throws IgniteCheckedException In case the affinity key configurations is not valid.
*/ | Validate affinity key configurations. All fields are initialized and not empty (typeName and affKeyFieldName is defined). Definition for the type does not repeat | validateKeyConfigiration | {
"repo_name": "andrey-kuznetsov/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java",
"license": "apache-2.0",
"size": 75590
} | [
"java.util.HashMap",
"java.util.Map",
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.IgniteLogger",
"org.apache.ignite.cache.CacheKeyConfiguration",
"org.apache.ignite.internal.util.typedef.internal.A"
] | import java.util.HashMap; import java.util.Map; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteLogger; import org.apache.ignite.cache.CacheKeyConfiguration; import org.apache.ignite.internal.util.typedef.internal.A; | import java.util.*; import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.internal.util.typedef.internal.*; | [
"java.util",
"org.apache.ignite"
] | java.util; org.apache.ignite; | 807,653 |
@Test
public void testProcessNoInputGivenButName() {
// mock
WebVariable webVariable = mock(WebVariable.class);
WebService webService = mock(WebService.class);
Map<String, MetaExpression> cookie = new HashMap<>();
cookie.put("name", fromValue("A name"));
CookieFactory factory = new CookieFactory();
// run
factory.setCookie(webVariable, cookie, webService);
}
| void function() { WebVariable webVariable = mock(WebVariable.class); WebService webService = mock(WebService.class); Map<String, MetaExpression> cookie = new HashMap<>(); cookie.put("name", fromValue(STR)); CookieFactory factory = new CookieFactory(); factory.setCookie(webVariable, cookie, webService); } | /**
* Test the construct when no values are given but the name value.
*/ | Test the construct when no values are given but the name value | testProcessNoInputGivenButName | {
"repo_name": "XillioQA/xill-platform-3.4",
"path": "plugin-web/src/test/java/nl/xillio/xill/plugins/web/constructs/CookieFactoryTest.java",
"license": "apache-2.0",
"size": 5634
} | [
"java.util.HashMap",
"java.util.Map",
"nl.xillio.xill.api.components.ExpressionBuilderHelper",
"nl.xillio.xill.api.components.MetaExpression",
"nl.xillio.xill.plugins.web.data.CookieFactory",
"nl.xillio.xill.plugins.web.data.WebVariable",
"nl.xillio.xill.plugins.web.services.web.WebService",
"org.mockito.Mockito"
] | import java.util.HashMap; import java.util.Map; import nl.xillio.xill.api.components.ExpressionBuilderHelper; import nl.xillio.xill.api.components.MetaExpression; import nl.xillio.xill.plugins.web.data.CookieFactory; import nl.xillio.xill.plugins.web.data.WebVariable; import nl.xillio.xill.plugins.web.services.web.WebService; import org.mockito.Mockito; | import java.util.*; import nl.xillio.xill.api.components.*; import nl.xillio.xill.plugins.web.data.*; import nl.xillio.xill.plugins.web.services.web.*; import org.mockito.*; | [
"java.util",
"nl.xillio.xill",
"org.mockito"
] | java.util; nl.xillio.xill; org.mockito; | 2,896,479 |
public void setMaxTime(int maxTime) {
if (maxTime < 1) {
throw new IllegalArgumentException("Max time less than 1 is not valid: " + maxTime);
}
JiveGlobals.setProperty("conversation.maxTime", Integer.toString(maxTime));
this.maxTime = maxTime * JiveConstants.MINUTE;
}
| void function(int maxTime) { if (maxTime < 1) { throw new IllegalArgumentException(STR + maxTime); } JiveGlobals.setProperty(STR, Integer.toString(maxTime)); this.maxTime = maxTime * JiveConstants.MINUTE; } | /**
* Sets the maximum number of minutes a conversation can last before it's ended. Any additional messages between the participants in the chat will
* be associated with a new conversation.
*
* @param maxTime
* the maximum number of minutes a conversation can last.
* @throws IllegalArgumentException
* if maxTime is less than 1.
*/ | Sets the maximum number of minutes a conversation can last before it's ended. Any additional messages between the participants in the chat will be associated with a new conversation | setMaxTime | {
"repo_name": "KSreeHarsha/openfire_8gb",
"path": "src/plugins/monitoring/src/java/org/jivesoftware/openfire/archive/ConversationManager.java",
"license": "apache-2.0",
"size": 47345
} | [
"org.jivesoftware.util.JiveConstants",
"org.jivesoftware.util.JiveGlobals"
] | import org.jivesoftware.util.JiveConstants; import org.jivesoftware.util.JiveGlobals; | import org.jivesoftware.util.*; | [
"org.jivesoftware.util"
] | org.jivesoftware.util; | 1,500,898 |
public void fireHandleCommit(long baseOffset, Records records) {
BufferSupplier bufferSupplier = BufferSupplier.create();
RecordsBatchReader<T> reader = new RecordsBatchReader<>(baseOffset, records,
serde, bufferSupplier, this);
fireHandleCommit(reader);
}
/**
* This API is used for committed records originating from {@link #scheduleAppend(int, List)} | void function(long baseOffset, Records records) { BufferSupplier bufferSupplier = BufferSupplier.create(); RecordsBatchReader<T> reader = new RecordsBatchReader<>(baseOffset, records, serde, bufferSupplier, this); fireHandleCommit(reader); } /** * This API is used for committed records originating from {@link #scheduleAppend(int, List)} | /**
* This API is used for committed records that have been received through
* replication. In general, followers will write new data to disk before they
* know whether it has been committed. Rather than retaining the uncommitted
* data in memory, we let the state machine read the records from disk.
*/ | This API is used for committed records that have been received through replication. In general, followers will write new data to disk before they know whether it has been committed. Rather than retaining the uncommitted data in memory, we let the state machine read the records from disk | fireHandleCommit | {
"repo_name": "Chasego/kafka",
"path": "raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java",
"license": "apache-2.0",
"size": 102501
} | [
"java.util.List",
"org.apache.kafka.common.record.Records",
"org.apache.kafka.common.utils.BufferSupplier",
"org.apache.kafka.raft.internals.RecordsBatchReader"
] | import java.util.List; import org.apache.kafka.common.record.Records; import org.apache.kafka.common.utils.BufferSupplier; import org.apache.kafka.raft.internals.RecordsBatchReader; | import java.util.*; import org.apache.kafka.common.record.*; import org.apache.kafka.common.utils.*; import org.apache.kafka.raft.internals.*; | [
"java.util",
"org.apache.kafka"
] | java.util; org.apache.kafka; | 1,867,077 |
Writer write(Writer writer, int indentFactor, int indent)
throws JSONException {
try {
boolean commanate = false;
int length = this.length();
writer.write('[');
if (length == 1) {
JSONObject.writeValue(writer, this.myArrayList.get(0),
indentFactor, indent);
} else if (length != 0) {
final int newindent = indent + indentFactor;
for (int i = 0; i < length; i += 1) {
if (commanate) {
writer.write(',');
}
if (indentFactor > 0) {
writer.write('\n');
}
JSONObject.indent(writer, newindent);
JSONObject.writeValue(writer, this.myArrayList.get(i),
indentFactor, newindent);
commanate = true;
}
if (indentFactor > 0) {
writer.write('\n');
}
JSONObject.indent(writer, indent);
}
writer.write(']');
return writer;
} catch (IOException e) {
throw new JSONException(e);
}
} | Writer write(Writer writer, int indentFactor, int indent) throws JSONException { try { boolean commanate = false; int length = this.length(); writer.write('['); if (length == 1) { JSONObject.writeValue(writer, this.myArrayList.get(0), indentFactor, indent); } else if (length != 0) { final int newindent = indent + indentFactor; for (int i = 0; i < length; i += 1) { if (commanate) { writer.write(','); } if (indentFactor > 0) { writer.write('\n'); } JSONObject.indent(writer, newindent); JSONObject.writeValue(writer, this.myArrayList.get(i), indentFactor, newindent); commanate = true; } if (indentFactor > 0) { writer.write('\n'); } JSONObject.indent(writer, indent); } writer.write(']'); return writer; } catch (IOException e) { throw new JSONException(e); } } | /**
* Write the contents of the JSONArray as JSON text to a writer. For
* compactness, no whitespace is added.
* <p>
* Warning: This method assumes that the data structure is acyclical.
*
* @param indentFactor
* The number of spaces to add to each level of indentation.
* @param indent
* The indention of the top level.
* @return The writer.
* @throws JSONException
*/ | Write the contents of the JSONArray as JSON text to a writer. For compactness, no whitespace is added. Warning: This method assumes that the data structure is acyclical | write | {
"repo_name": "jscrambler/java-jscrambler",
"path": "src/org/json/JSONArray.java",
"license": "lgpl-3.0",
"size": 32322
} | [
"java.io.IOException",
"java.io.Writer"
] | import java.io.IOException; import java.io.Writer; | import java.io.*; | [
"java.io"
] | java.io; | 2,913,517 |
public static String toString(@Nullable Object obj) {
if (obj == null) {
return "";
}
if (obj.getClass().isArray()) {
return Coerce.toList(obj).toString();
}
return obj.toString();
} | static String function(@Nullable Object obj) { if (obj == null) { return ""; } if (obj.getClass().isArray()) { return Coerce.toList(obj).toString(); } return obj.toString(); } | /**
* Coerce the supplied object to a string.
*
* @param obj Object to coerce
* @return Object as a string, empty string if the object is null
*/ | Coerce the supplied object to a string | toString | {
"repo_name": "SpongeHistory/SpongeAPI-History",
"path": "src/main/java/org/spongepowered/api/util/Coerce.java",
"license": "mit",
"size": 26147
} | [
"javax.annotation.Nullable"
] | import javax.annotation.Nullable; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 953,282 |
private static <X, Y> List<Y> mapList(Map<X, Y> mapping, Collection<X> input) {
final List<Y> output = new ArrayList<Y>(input.size());
for (final X item : input) {
output.add(mapping.get(item));
}
return output;
} | static <X, Y> List<Y> function(Map<X, Y> mapping, Collection<X> input) { final List<Y> output = new ArrayList<Y>(input.size()); for (final X item : input) { output.add(mapping.get(item)); } return output; } | /**
* Apply a mapping function to a collection of items.
* @param mapping the mapping function to apply
* @param input a collection of items
* @return the map value for each item, in order
*/ | Apply a mapping function to a collection of items | mapList | {
"repo_name": "knabar/openmicroscopy",
"path": "components/blitz/src/omero/cmd/fs/UsedFilesRequestI.java",
"license": "gpl-2.0",
"size": 16063
} | [
"java.util.ArrayList",
"java.util.Collection",
"java.util.List",
"java.util.Map"
] | import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,127,203 |
int updateByPrimaryKey(League record); | int updateByPrimaryKey(League record); | /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table league
*
* @mbggenerated Sat Jan 31 12:40:45 CST 2015
*/ | This method was generated by MyBatis Generator. This method corresponds to the database table league | updateByPrimaryKey | {
"repo_name": "marstianna/themostcd",
"path": "src/main/java/com/cd/dao/LeagueDao.java",
"license": "apache-2.0",
"size": 1464
} | [
"com.cd.domain.League"
] | import com.cd.domain.League; | import com.cd.domain.*; | [
"com.cd.domain"
] | com.cd.domain; | 1,226,643 |
@Test
public void testToMap() {
MapBuilder<String, Integer> mb = MapBuilder.hashMap("key1", 1);
mb.put("key2", 2);
Map<String, Integer> map = mb.toMap();
mb.put("key3", 3);
assertThat(map.size(), is(2));
assertThat(map, is(hasEntry("key1", 1)));
assertThat(map, is(hasEntry("key2", 2)));
}
| void function() { MapBuilder<String, Integer> mb = MapBuilder.hashMap("key1", 1); mb.put("key2", 2); Map<String, Integer> map = mb.toMap(); mb.put("key3", 3); assertThat(map.size(), is(2)); assertThat(map, is(hasEntry("key1", 1))); assertThat(map, is(hasEntry("key2", 2))); } | /**
* Test of toMap method, of class MapBuilder.
*/ | Test of toMap method, of class MapBuilder | testToMap | {
"repo_name": "enlo/jmt-projects",
"path": "jmt-core/src/test/java/info/naiv/lab/java/jmt/MapBuilderTest.java",
"license": "mit",
"size": 4913
} | [
"info.naiv.lab.java.jmt.collection.MapBuilder",
"java.util.Map",
"org.hamcrest.Matchers",
"org.junit.Assert"
] | import info.naiv.lab.java.jmt.collection.MapBuilder; import java.util.Map; import org.hamcrest.Matchers; import org.junit.Assert; | import info.naiv.lab.java.jmt.collection.*; import java.util.*; import org.hamcrest.*; import org.junit.*; | [
"info.naiv.lab",
"java.util",
"org.hamcrest",
"org.junit"
] | info.naiv.lab; java.util; org.hamcrest; org.junit; | 1,640,117 |
HRegionInterface getRootServerConnection(long timeout)
throws InterruptedException, NotAllMetaRegionsOnlineException, IOException {
return getCachedConnection(waitForRoot(timeout));
} | HRegionInterface getRootServerConnection(long timeout) throws InterruptedException, NotAllMetaRegionsOnlineException, IOException { return getCachedConnection(waitForRoot(timeout)); } | /**
* Gets a connection to the server hosting root, as reported by ZooKeeper,
* waiting up to the specified timeout for availability.
* <p>WARNING: Does not retry. Use an {@link HTable} instead.
* @param timeout How long to wait on root location
* @see #waitForRoot(long) for additional information
* @return connection to server hosting root
* @throws InterruptedException
* @throws NotAllMetaRegionsOnlineException if timed out waiting
* @throws IOException
*/ | Gets a connection to the server hosting root, as reported by ZooKeeper, waiting up to the specified timeout for availability | getRootServerConnection | {
"repo_name": "xiaofu/apache-hbase-0.94.10-read",
"path": "src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java",
"license": "apache-2.0",
"size": 26072
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException",
"org.apache.hadoop.hbase.ipc.HRegionInterface"
] | import java.io.IOException; import org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException; import org.apache.hadoop.hbase.ipc.HRegionInterface; | import java.io.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.ipc.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,304,816 |
Response<PrivateEndpointConnection> getWithResponse(
String resourceGroupName, String providerName, String privateEndpointConnectionName, Context context); | Response<PrivateEndpointConnection> getWithResponse( String resourceGroupName, String providerName, String privateEndpointConnectionName, Context context); | /**
* Gets the specified private endpoint connection associated with the attestation provider.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param providerName The name of the attestation provider.
* @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure
* resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the specified private endpoint connection associated with the attestation provider.
*/ | Gets the specified private endpoint connection associated with the attestation provider | getWithResponse | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpointConnections.java",
"license": "mit",
"size": 8547
} | [
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context"
] | import com.azure.core.http.rest.Response; import com.azure.core.util.Context; | import com.azure.core.http.rest.*; import com.azure.core.util.*; | [
"com.azure.core"
] | com.azure.core; | 1,934,838 |
public void serializeInto(@SuppressWarnings("unused") XcodeprojSerializer serializer) {
} | void function(@SuppressWarnings(STR) XcodeprojSerializer serializer) { } | /**
* Populates the serializer with the fields of this object.
*/ | Populates the serializer with the fields of this object | serializeInto | {
"repo_name": "vt09/bazel",
"path": "third_party/java/buck-ios-support/java/com/facebook/buck/apple/xcode/xcodeproj/PBXObject.java",
"license": "apache-2.0",
"size": 1810
} | [
"com.facebook.buck.apple.xcode.XcodeprojSerializer"
] | import com.facebook.buck.apple.xcode.XcodeprojSerializer; | import com.facebook.buck.apple.xcode.*; | [
"com.facebook.buck"
] | com.facebook.buck; | 1,499,865 |
@Override
public void onBrowserEvent(Event event) {
if (VOrchidScrollTable.this.enabled && event != null) {
if (this.isResizing || event.getEventTarget().cast() == this.colResizeWidget) {
if (this.dragging && (event.getTypeInt() == Event.ONMOUSEUP || event.getTypeInt() == Event.ONTOUCHEND)) {
// Handle releasing column header on spacer #5318
handleCaptionEvent(event);
} else {
onResizeEvent(event);
}
} else {
if (event.getTypeInt() == Event.ONMOUSEDOWN || event.getTypeInt() == Event.ONTOUCHSTART) {
VOrchidScrollTable.this.scrollBodyPanel.setFocus(true);
}
handleCaptionEvent(event);
boolean stopPropagation = true;
if (event.getTypeInt() == Event.ONCONTEXTMENU
&& !VOrchidScrollTable.this.client.hasEventListeners(VOrchidScrollTable.this, HEADER_CLICK_EVENT_ID)) {
// Prevent showing the browser's context menu only when
// there is a header click listener.
stopPropagation = false;
}
if (stopPropagation) {
event.stopPropagation();
event.preventDefault();
}
}
}
} | void function(Event event) { if (VOrchidScrollTable.this.enabled && event != null) { if (this.isResizing event.getEventTarget().cast() == this.colResizeWidget) { if (this.dragging && (event.getTypeInt() == Event.ONMOUSEUP event.getTypeInt() == Event.ONTOUCHEND)) { handleCaptionEvent(event); } else { onResizeEvent(event); } } else { if (event.getTypeInt() == Event.ONMOUSEDOWN event.getTypeInt() == Event.ONTOUCHSTART) { VOrchidScrollTable.this.scrollBodyPanel.setFocus(true); } handleCaptionEvent(event); boolean stopPropagation = true; if (event.getTypeInt() == Event.ONCONTEXTMENU && !VOrchidScrollTable.this.client.hasEventListeners(VOrchidScrollTable.this, HEADER_CLICK_EVENT_ID)) { stopPropagation = false; } if (stopPropagation) { event.stopPropagation(); event.preventDefault(); } } } } | /**
* Handle column reordering.
*/ | Handle column reordering | onBrowserEvent | {
"repo_name": "Softhouse/orchid",
"path": "se.softhouse.garden.orchid.vaadin/addon/src/main/java/se/softhouse/garden/orchid/vaadin/widgetset/client/ui/VOrchidScrollTable.java",
"license": "mit",
"size": 221302
} | [
"com.google.gwt.user.client.Event"
] | import com.google.gwt.user.client.Event; | import com.google.gwt.user.client.*; | [
"com.google.gwt"
] | com.google.gwt; | 2,282,034 |
private void growPointerArrayIfNecessary() {
assert(inMemSorter != null);
if (!inMemSorter.hasSpaceForAnotherRecord()) {
long used = inMemSorter.getMemoryUsage();
LongArray array;
try {
// could trigger spilling
array = allocateArray(used / 8 * 2);
} catch (OutOfMemoryError e) {
// should have trigger spilling
if (!inMemSorter.hasSpaceForAnotherRecord()) {
logger.error("Unable to grow the pointer array");
throw e;
}
return;
}
// check if spilling is triggered or not
if (inMemSorter.hasSpaceForAnotherRecord()) {
freeArray(array);
} else {
inMemSorter.expandPointerArray(array);
}
}
} | void function() { assert(inMemSorter != null); if (!inMemSorter.hasSpaceForAnotherRecord()) { long used = inMemSorter.getMemoryUsage(); LongArray array; try { array = allocateArray(used / 8 * 2); } catch (OutOfMemoryError e) { if (!inMemSorter.hasSpaceForAnotherRecord()) { logger.error(STR); throw e; } return; } if (inMemSorter.hasSpaceForAnotherRecord()) { freeArray(array); } else { inMemSorter.expandPointerArray(array); } } } | /**
* Checks whether there is enough space to insert an additional record in to the sort pointer
* array and grows the array if additional space is required. If the required space cannot be
* obtained, then the in-memory data will be spilled to disk.
*/ | Checks whether there is enough space to insert an additional record in to the sort pointer array and grows the array if additional space is required. If the required space cannot be obtained, then the in-memory data will be spilled to disk | growPointerArrayIfNecessary | {
"repo_name": "akopich/spark",
"path": "core/src/main/java/org/apache/spark/shuffle/sort/ShuffleExternalSorter.java",
"license": "apache-2.0",
"size": 17541
} | [
"org.apache.spark.unsafe.array.LongArray"
] | import org.apache.spark.unsafe.array.LongArray; | import org.apache.spark.unsafe.array.*; | [
"org.apache.spark"
] | org.apache.spark; | 1,405,854 |
EReference getDocumentRoot_BusinessTransaction(); | EReference getDocumentRoot_BusinessTransaction(); | /**
* Returns the meta object for the containment reference '{@link org.ebxml.business.process.DocumentRoot#getBusinessTransaction <em>Business Transaction</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference '<em>Business Transaction</em>'.
* @see org.ebxml.business.process.DocumentRoot#getBusinessTransaction()
* @see #getDocumentRoot()
* @generated
*/ | Returns the meta object for the containment reference '<code>org.ebxml.business.process.DocumentRoot#getBusinessTransaction Business Transaction</code>'. | getDocumentRoot_BusinessTransaction | {
"repo_name": "GRA-UML/tool",
"path": "plugins/org.ijis.gra.ebxml.ebBPSS/src/main/java/org/ebxml/business/process/ProcessPackage.java",
"license": "epl-1.0",
"size": 274455
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,355,768 |
@Override
public Enumeration<Editable> segments()
{
final Vector<Editable> res = new Vector<Editable>();
// ok, loop through the legs, representing each one as a track segment
// check if we have any solutions
if ((_newRoutes == null) || (_newRoutes.length == 0))
{
}
else
{
final CompositeRoute thisR = _newRoutes[0];
// To enable the SATC solution to be viewed in the Residuals plots,
// we wish to create points (fixes) at the same time as the bearing cuts.
// So, when we generate a leg of data, we can provide a series of time-stamps
// to indicate when the positions should be created at.
final long[] thisStamps;
if (_timeStamps.length != 0)
{
// ok, we have some pre-prepared, use them.
thisStamps = _timeStamps;
}
else
{
// aaah, we don't have any. We'll use the last-states object
// we learned about, even though some cuts may have
// been skipped
thisStamps = new long[_lastStates.size()];
int ctr = 0;
for (final BoundedState state : _lastStates)
{
thisStamps[ctr++] = state.getTime().getTime();
}
}
final boolean returnAlteringLegs = false;
// loop through the legs
final Iterator<CoreRoute> legs = thisR.getLegs().iterator();
while (legs.hasNext())
{
final CoreRoute thisLeg = legs.next();
final TrackSegment ts;
if (thisLeg instanceof StraightRoute)
{
final StraightRoute straight = (StraightRoute) thisLeg;
// ok - produce a TMA leg
final double courseDegs = Math.toDegrees(straight.getCourse());
final WorldSpeed speed =
new WorldSpeed(straight.getSpeed(), WorldSpeed.M_sec);
final WorldLocation origin =
conversions.toLocation(straight.getStartPoint().getCoordinate());
final HiResDate startTime =
new HiResDate(straight.getStartTime().getTime());
final HiResDate endTime =
new HiResDate(straight.getEndTime().getTime());
ts = new AbsoluteTMASegment(courseDegs, speed, origin, startTime,
endTime, thisStamps);
ts.setName(straight.getName());
}
else if(returnAlteringLegs)
{
// make the segment absolute, which SATC tracks are
ts = new TrackSegment(TrackSegment.ABSOLUTE);
// ok, loop through the states
final Iterator<State> iter = thisLeg.getStates().iterator();
while (iter.hasNext())
{
final State state = iter.next();
final WorldLocation theLoc =
conversions.toLocation(state.getLocation().getCoordinate());
final double theCourse = state.getCourse();
final double theSpeed =
new WorldSpeed(state.getSpeed(), WorldSpeed.M_sec)
.getValueIn(WorldSpeed.ft_sec / 3);
final Fix newF =
new Fix(new HiResDate(state.getTime().getTime()), theLoc,
theCourse, theSpeed);
final FixWrapper newFW = new FixWrapper(newF)
{
private static final long serialVersionUID = 1L;
| Enumeration<Editable> function() { final Vector<Editable> res = new Vector<Editable>(); if ((_newRoutes == null) (_newRoutes.length == 0)) { } else { final CompositeRoute thisR = _newRoutes[0]; final long[] thisStamps; if (_timeStamps.length != 0) { thisStamps = _timeStamps; } else { thisStamps = new long[_lastStates.size()]; int ctr = 0; for (final BoundedState state : _lastStates) { thisStamps[ctr++] = state.getTime().getTime(); } } final boolean returnAlteringLegs = false; final Iterator<CoreRoute> legs = thisR.getLegs().iterator(); while (legs.hasNext()) { final CoreRoute thisLeg = legs.next(); final TrackSegment ts; if (thisLeg instanceof StraightRoute) { final StraightRoute straight = (StraightRoute) thisLeg; final double courseDegs = Math.toDegrees(straight.getCourse()); final WorldSpeed speed = new WorldSpeed(straight.getSpeed(), WorldSpeed.M_sec); final WorldLocation origin = conversions.toLocation(straight.getStartPoint().getCoordinate()); final HiResDate startTime = new HiResDate(straight.getStartTime().getTime()); final HiResDate endTime = new HiResDate(straight.getEndTime().getTime()); ts = new AbsoluteTMASegment(courseDegs, speed, origin, startTime, endTime, thisStamps); ts.setName(straight.getName()); } else if(returnAlteringLegs) { ts = new TrackSegment(TrackSegment.ABSOLUTE); final Iterator<State> iter = thisLeg.getStates().iterator(); while (iter.hasNext()) { final State state = iter.next(); final WorldLocation theLoc = conversions.toLocation(state.getLocation().getCoordinate()); final double theCourse = state.getCourse(); final double theSpeed = new WorldSpeed(state.getSpeed(), WorldSpeed.M_sec) .getValueIn(WorldSpeed.ft_sec / 3); final Fix newF = new Fix(new HiResDate(state.getTime().getTime()), theLoc, theCourse, theSpeed); final FixWrapper newFW = new FixWrapper(newF) { private static final long serialVersionUID = 1L; | /**
* return our legs as a series of track segments - for the bearing residuals plot
*
*/ | return our legs as a series of track segments - for the bearing residuals plot | segments | {
"repo_name": "theanuradha/debrief",
"path": "org.mwc.debrief.satc.integration/src/org/mwc/debrief/satc_interface/data/SATC_Solution.java",
"license": "epl-1.0",
"size": 50470
} | [
"com.planetmayo.debrief.satc.model.legs.CompositeRoute",
"com.planetmayo.debrief.satc.model.legs.CoreRoute",
"com.planetmayo.debrief.satc.model.legs.StraightRoute",
"com.planetmayo.debrief.satc.model.states.BoundedState",
"com.planetmayo.debrief.satc.model.states.State",
"java.util.Enumeration",
"java.util.Iterator",
"java.util.Vector"
] | import com.planetmayo.debrief.satc.model.legs.CompositeRoute; import com.planetmayo.debrief.satc.model.legs.CoreRoute; import com.planetmayo.debrief.satc.model.legs.StraightRoute; import com.planetmayo.debrief.satc.model.states.BoundedState; import com.planetmayo.debrief.satc.model.states.State; import java.util.Enumeration; import java.util.Iterator; import java.util.Vector; | import com.planetmayo.debrief.satc.model.legs.*; import com.planetmayo.debrief.satc.model.states.*; import java.util.*; | [
"com.planetmayo.debrief",
"java.util"
] | com.planetmayo.debrief; java.util; | 1,145,538 |
List<Declaration> lexicallyScopedDeclarations(); | List<Declaration> lexicallyScopedDeclarations(); | /**
* Returns the list of lexically scoped declarations.
*/ | Returns the list of lexically scoped declarations | lexicallyScopedDeclarations | {
"repo_name": "rwaldron/es6draft",
"path": "src/main/java/com/github/anba/es6draft/ast/BlockScope.java",
"license": "mit",
"size": 604
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 486,827 |
public void test_fill$Ljava_lang_ObjectIILjava_lang_Object() {
// Test for method void java.util.Arrays.fill(java.lang.Object [], int,
// int, java.lang.Object)
Object val = new Object();
Object d[] = new Object[1000];
Arrays.fill(d, 400, d.length, val);
for (int i = 0; i < 400; i++)
assertTrue("Filled elements not in range", !(d[i] == val));
for (int i = 400; i < d.length; i++)
assertTrue("Failed to fill Object array correctly", d[i] == val);
Arrays.fill(d, 400, d.length, null);
for (int i = 400; i < d.length; i++)
assertNull("Failed to fill Object array correctly with nulls",
d[i]);
try {
Arrays.fill(d, 10, 0, val);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException e) {
//expected
}
try {
Arrays.fill(d, -10, 0, val);
fail("ArrayIndexOutOfBoundsException expected");
} catch (ArrayIndexOutOfBoundsException e) {
//expected
}
try {
Arrays.fill(d, 10, d.length+1, val);
fail("ArrayIndexOutOfBoundsException expected");
} catch (ArrayIndexOutOfBoundsException e) {
//expected
}
} | public void test_fill$Ljava_lang_ObjectIILjava_lang_Object() { Object val = new Object(); Object d[] = new Object[1000]; Arrays.fill(d, 400, d.length, val); for (int i = 0; i < 400; i++) assertTrue(STR, !(d[i] == val)); for (int i = 400; i < d.length; i++) assertTrue(STR, d[i] == val); Arrays.fill(d, 400, d.length, null); for (int i = 400; i < d.length; i++) assertNull(STR, d[i]); try { Arrays.fill(d, 10, 0, val); fail(STR); } catch (IllegalArgumentException e) { } try { Arrays.fill(d, -10, 0, val); fail(STR); } catch (ArrayIndexOutOfBoundsException e) { } try { Arrays.fill(d, 10, d.length+1, val); fail(STR); } catch (ArrayIndexOutOfBoundsException e) { } } | /**
* java.util.Arrays#fill(java.lang.Object[], int, int,
* java.lang.Object)
*/ | java.util.Arrays#fill(java.lang.Object[], int, int, java.lang.Object) | test_fill$Ljava_lang_ObjectIILjava_lang_Object | {
"repo_name": "AdmireTheDistance/android_libcore",
"path": "harmony-tests/src/test/java/org/apache/harmony/tests/java/util/ArraysTest.java",
"license": "gpl-2.0",
"size": 156287
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 1,836,678 |
protected static String randomString(int numCharacters) {
return new BigInteger(numCharacters, new Random()).toString(2);
} | static String function(int numCharacters) { return new BigInteger(numCharacters, new Random()).toString(2); } | /**
* returns a random of the given size using characters [0-1]
*/ | returns a random of the given size using characters [0-1] | randomString | {
"repo_name": "xasx/camunda-bpm-platform",
"path": "engine/src/test/java/org/camunda/bpm/engine/test/history/HistoricJobLogTest.java",
"license": "apache-2.0",
"size": 51114
} | [
"java.math.BigInteger",
"java.util.Random"
] | import java.math.BigInteger; import java.util.Random; | import java.math.*; import java.util.*; | [
"java.math",
"java.util"
] | java.math; java.util; | 51,769 |
public static DataResult<CustomDataKeyOverview> listDataKeys(User user) {
SelectMode m = ModeFactory.getMode("System_queries",
"custom_vals", CustomDataKeyOverview.class);
Map<String, Object> params = new HashMap<String, Object>();
params.put("uid", user.getId());
params.put("org_id", user.getOrg().getId());
return (DataResult<CustomDataKeyOverview>) m.execute(params);
} | static DataResult<CustomDataKeyOverview> function(User user) { SelectMode m = ModeFactory.getMode(STR, STR, CustomDataKeyOverview.class); Map<String, Object> params = new HashMap<String, Object>(); params.put("uid", user.getId()); params.put(STR, user.getOrg().getId()); return (DataResult<CustomDataKeyOverview>) m.execute(params); } | /**
* List all virtual hosts for a user
* @param user the user in question
* @return list of SystemOverview objects
*/ | List all virtual hosts for a user | listDataKeys | {
"repo_name": "mcalmer/spacewalk",
"path": "java/code/src/com/redhat/rhn/manager/system/SystemManager.java",
"license": "gpl-2.0",
"size": 134651
} | [
"com.redhat.rhn.common.db.datasource.DataResult",
"com.redhat.rhn.common.db.datasource.ModeFactory",
"com.redhat.rhn.common.db.datasource.SelectMode",
"com.redhat.rhn.domain.user.User",
"com.redhat.rhn.frontend.dto.CustomDataKeyOverview",
"java.util.HashMap",
"java.util.Map"
] | import com.redhat.rhn.common.db.datasource.DataResult; import com.redhat.rhn.common.db.datasource.ModeFactory; import com.redhat.rhn.common.db.datasource.SelectMode; import com.redhat.rhn.domain.user.User; import com.redhat.rhn.frontend.dto.CustomDataKeyOverview; import java.util.HashMap; import java.util.Map; | import com.redhat.rhn.common.db.datasource.*; import com.redhat.rhn.domain.user.*; import com.redhat.rhn.frontend.dto.*; import java.util.*; | [
"com.redhat.rhn",
"java.util"
] | com.redhat.rhn; java.util; | 1,043,679 |
protected void fireEvent(DebugEvent event) {
DebugPlugin manager= DebugPlugin.getDefault();
if (manager != null) {
manager.fireDebugEventSet(new DebugEvent[]{event});
}
} | void function(DebugEvent event) { DebugPlugin manager= DebugPlugin.getDefault(); if (manager != null) { manager.fireDebugEventSet(new DebugEvent[]{event}); } } | /**
* Fires the given debug event.
*
* @param event debug event to fire
*/ | Fires the given debug event | fireEvent | {
"repo_name": "UrsZeidler/uml2solidity",
"path": "de.urszeidler.eclipse.solidity.laucher.core/src/de/urszeidler/eclipse/solidity/laucher/core/GenerateUml2Solidity.java",
"license": "epl-1.0",
"size": 5356
} | [
"org.eclipse.debug.core.DebugEvent",
"org.eclipse.debug.core.DebugPlugin"
] | import org.eclipse.debug.core.DebugEvent; import org.eclipse.debug.core.DebugPlugin; | import org.eclipse.debug.core.*; | [
"org.eclipse.debug"
] | org.eclipse.debug; | 1,873,709 |
RedisFuture<String> flushall(); | RedisFuture<String> flushall(); | /**
* Remove all keys from all databases.
*
* @return String simple-string-reply.
*/ | Remove all keys from all databases | flushall | {
"repo_name": "lettuce-io/lettuce-core",
"path": "src/main/java/io/lettuce/core/api/async/RedisServerAsyncCommands.java",
"license": "apache-2.0",
"size": 12930
} | [
"io.lettuce.core.RedisFuture"
] | import io.lettuce.core.RedisFuture; | import io.lettuce.core.*; | [
"io.lettuce.core"
] | io.lettuce.core; | 1,732,121 |
public static TimePeriod halfDay() {
return new TimePeriod(ChronoUnit.HOURS, 12);
} | static TimePeriod function() { return new TimePeriod(ChronoUnit.HOURS, 12); } | /**
* Create and return a new TimePeriod representing one half of a day.
*
* @return a new TimePeriod representing one half of a day.
*/ | Create and return a new TimePeriod representing one half of a day | halfDay | {
"repo_name": "jrachiele/java-timeseries",
"path": "timeseries/src/main/java/com/github/signaflo/timeseries/TimePeriod.java",
"license": "mit",
"size": 9718
} | [
"java.time.temporal.ChronoUnit"
] | import java.time.temporal.ChronoUnit; | import java.time.temporal.*; | [
"java.time"
] | java.time; | 676,567 |
protected void handlePortStatusMessage(OFChannelHandler h, OFPortStatus m,
boolean doNotify) throws SwitchStateException {
if (h.sw == null) {
String msg = getSwitchStateMessage(h, m,
"State machine error: switch is null. Should never " +
"happen");
throw new SwitchStateException(msg);
}
h.sw.handleMessage(m);
} | void function(OFChannelHandler h, OFPortStatus m, boolean doNotify) throws SwitchStateException { if (h.sw == null) { String msg = getSwitchStateMessage(h, m, STR + STR); throw new SwitchStateException(msg); } h.sw.handleMessage(m); } | /**
* Handle a port status message.
*
* Handle a port status message by updating the port maps in the
* IOFSwitch instance and notifying Controller about the change so
* it can dispatch a switch update.
*
* @param h The OFChannelHhandler that received the message
* @param m The PortStatus message we received
* @param doNotify if true switch port changed events will be
* dispatched
* @throws SwitchStateException if the switch is not bound to the channel
*
*/ | Handle a port status message. Handle a port status message by updating the port maps in the IOFSwitch instance and notifying Controller about the change so it can dispatch a switch update | handlePortStatusMessage | {
"repo_name": "sonu283304/onos",
"path": "protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OFChannelHandler.java",
"license": "apache-2.0",
"size": 54129
} | [
"org.onosproject.openflow.controller.driver.SwitchStateException",
"org.projectfloodlight.openflow.protocol.OFPortStatus"
] | import org.onosproject.openflow.controller.driver.SwitchStateException; import org.projectfloodlight.openflow.protocol.OFPortStatus; | import org.onosproject.openflow.controller.driver.*; import org.projectfloodlight.openflow.protocol.*; | [
"org.onosproject.openflow",
"org.projectfloodlight.openflow"
] | org.onosproject.openflow; org.projectfloodlight.openflow; | 869,320 |
@Nullable
private Occupant getOccupant(String account, String bareAddress) {
if (MUCManager.getInstance().hasRoom(account, Jid.getBareAddress(bareAddress))) {
final Collection<Occupant> occupants = MUCManager.getInstance().getOccupants(account, Jid.getBareAddress(bareAddress));
for (Occupant occupant : occupants) {
if (occupant.getNickname().equals(Jid.getResource(bareAddress))) {
return occupant;
}
}
}
return null;
} | Occupant function(String account, String bareAddress) { if (MUCManager.getInstance().hasRoom(account, Jid.getBareAddress(bareAddress))) { final Collection<Occupant> occupants = MUCManager.getInstance().getOccupants(account, Jid.getBareAddress(bareAddress)); for (Occupant occupant : occupants) { if (occupant.getNickname().equals(Jid.getResource(bareAddress))) { return occupant; } } } return null; } | /**
* if contact is private MUC chat
*/ | if contact is private MUC chat | getOccupant | {
"repo_name": "bigbugbb/iTracker",
"path": "app/src/main/java/com/itracker/android/data/roster/PresenceManager.java",
"license": "apache-2.0",
"size": 11274
} | [
"com.itracker.android.data.extension.muc.MUCManager",
"com.itracker.android.data.extension.muc.Occupant",
"com.itracker.android.xmpp.address.Jid",
"java.util.Collection"
] | import com.itracker.android.data.extension.muc.MUCManager; import com.itracker.android.data.extension.muc.Occupant; import com.itracker.android.xmpp.address.Jid; import java.util.Collection; | import com.itracker.android.data.extension.muc.*; import com.itracker.android.xmpp.address.*; import java.util.*; | [
"com.itracker.android",
"java.util"
] | com.itracker.android; java.util; | 1,320,755 |
public void setAutoDdl(String value)
{
m_autoDdl = Boolean.valueOf(value).booleanValue();
}
protected Map<String, SiteServiceSql> databaseBeans;
protected SiteServiceSql siteServiceSql; | void function(String value) { m_autoDdl = Boolean.valueOf(value).booleanValue(); } protected Map<String, SiteServiceSql> databaseBeans; protected SiteServiceSql siteServiceSql; | /**
* Configuration: to run the ddl on init or not.
*
* @param value
* the auto ddl value.
*/ | Configuration: to run the ddl on init or not | setAutoDdl | {
"repo_name": "OpenCollabZA/sakai",
"path": "kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/DbSiteService.java",
"license": "apache-2.0",
"size": 83723
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,639,734 |
List<KeyId> supportingNetworkIds(); | List<KeyId> supportingNetworkIds(); | /**
* Returns the network keys (or identifiers) of the supporting
* networks which serve as the underlay networks of the current
* network which is mapped by the specified network identifier.
*
* @return list of network keys
*/ | Returns the network keys (or identifiers) of the supporting networks which serve as the underlay networks of the current network which is mapped by the specified network identifier | supportingNetworkIds | {
"repo_name": "sdnwiselab/onos",
"path": "apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/Network.java",
"license": "apache-2.0",
"size": 2941
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,330,534 |
protected void scanElement(XMLElement elt)
throws IOException
{
StringBuffer buf = new StringBuffer();
this.scanIdentifier(buf);
String name = buf.toString();
elt.setName(name);
char ch = this.scanWhitespace();
while ((ch != '>') && (ch != '/')) {
buf.setLength(0);
this.unreadChar(ch);
this.scanIdentifier(buf);
String key = buf.toString();
ch = this.scanWhitespace();
if (ch != '=') {
throw this.expectedInput("=");
}
this.unreadChar(this.scanWhitespace());
buf.setLength(0);
this.scanString(buf);
elt.setAttribute(key, buf);
ch = this.scanWhitespace();
}
if (ch == '/') {
ch = this.readChar();
if (ch != '>') {
throw this.expectedInput(">");
}
return;
}
buf.setLength(0);
ch = this.scanWhitespace(buf);
if (ch != '<') {
this.unreadChar(ch);
this.scanPCData(buf);
} else {
for (;;) {
ch = this.readChar();
if (ch == '!') {
if (this.checkCDATA(buf)) {
this.scanPCData(buf);
break;
} else {
ch = this.scanWhitespace(buf);
if (ch != '<') {
this.unreadChar(ch);
this.scanPCData(buf);
break;
}
}
} else {
if ((ch != '/') || this.ignoreWhitespace) {
buf.setLength(0);
}
if (ch == '/') {
this.unreadChar(ch);
}
break;
}
}
}
if (buf.length() == 0) {
while (ch != '/') {
if (ch == '!') {
ch = this.readChar();
if (ch != '-') {
throw this.expectedInput("Comment or Element");
}
ch = this.readChar();
if (ch != '-') {
throw this.expectedInput("Comment or Element");
}
this.skipComment();
} else {
this.unreadChar(ch);
XMLElement child = this.createAnotherElement();
this.scanElement(child);
elt.addChild(child);
}
ch = this.scanWhitespace();
if (ch != '<') {
throw this.expectedInput("<");
}
ch = this.readChar();
}
this.unreadChar(ch);
} else {
if (this.ignoreWhitespace) {
elt.setContent(buf.toString().trim());
} else {
elt.setContent(buf.toString());
}
}
ch = this.readChar();
if (ch != '/') {
throw this.expectedInput("/");
}
this.unreadChar(this.scanWhitespace());
if (! this.checkLiteral(name)) {
throw this.expectedInput(name);
}
if (this.scanWhitespace() != '>') {
throw this.expectedInput(">");
}
} | void function(XMLElement elt) throws IOException { StringBuffer buf = new StringBuffer(); this.scanIdentifier(buf); String name = buf.toString(); elt.setName(name); char ch = this.scanWhitespace(); while ((ch != '>') && (ch != '/')) { buf.setLength(0); this.unreadChar(ch); this.scanIdentifier(buf); String key = buf.toString(); ch = this.scanWhitespace(); if (ch != '=') { throw this.expectedInput("="); } this.unreadChar(this.scanWhitespace()); buf.setLength(0); this.scanString(buf); elt.setAttribute(key, buf); ch = this.scanWhitespace(); } if (ch == '/') { ch = this.readChar(); if (ch != '>') { throw this.expectedInput(">"); } return; } buf.setLength(0); ch = this.scanWhitespace(buf); if (ch != '<') { this.unreadChar(ch); this.scanPCData(buf); } else { for (;;) { ch = this.readChar(); if (ch == '!') { if (this.checkCDATA(buf)) { this.scanPCData(buf); break; } else { ch = this.scanWhitespace(buf); if (ch != '<') { this.unreadChar(ch); this.scanPCData(buf); break; } } } else { if ((ch != '/') this.ignoreWhitespace) { buf.setLength(0); } if (ch == '/') { this.unreadChar(ch); } break; } } } if (buf.length() == 0) { while (ch != '/') { if (ch == '!') { ch = this.readChar(); if (ch != '-') { throw this.expectedInput(STR); } ch = this.readChar(); if (ch != '-') { throw this.expectedInput(STR); } this.skipComment(); } else { this.unreadChar(ch); XMLElement child = this.createAnotherElement(); this.scanElement(child); elt.addChild(child); } ch = this.scanWhitespace(); if (ch != '<') { throw this.expectedInput("<"); } ch = this.readChar(); } this.unreadChar(ch); } else { if (this.ignoreWhitespace) { elt.setContent(buf.toString().trim()); } else { elt.setContent(buf.toString()); } } ch = this.readChar(); if (ch != '/') { throw this.expectedInput("/"); } this.unreadChar(this.scanWhitespace()); if (! this.checkLiteral(name)) { throw this.expectedInput(name); } if (this.scanWhitespace() != '>') { throw this.expectedInput(">"); } } | /**
* Scans an XML element.
*
* @param elt The element that will contain the result.
*
* </dl><dl><dt><b>Preconditions:</b></dt><dd>
* <ul><li>The first < has already been read.
* <li><code>elt != null</code>
* </ul></dd></dl>
*/ | Scans an XML element | scanElement | {
"repo_name": "lsilvestre/Jogre",
"path": "api/src/nanoxml/XMLElement.java",
"license": "gpl-2.0",
"size": 99514
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,896,497 |
public void close(DataAccessObject dao) {
AbstractFileDAO fileAbs = (AbstractFileDAO) dao;
try{
if(fileAbs.isWriteFlag()){
FileOutputStream fos = new FileOutputStream(fileAbs.getPath());
if(fileAbs.isPropsFile()){
fileAbs.getProperties().store(fos, "Saved To System by FileProxy !!");
fos.close();
}
else{
BufferedOutputStream bout = new BufferedOutputStream(fos);
bout.write(fileAbs.getFileBytes(), 0, fileAbs.getFileBytes().length);
bout.close();
fos.close();
}
}
}
catch (java.io.IOException e){
if(log.isDebugEnabled()){
log.debug("IOException from close: " + e.getMessage());
}
}
catch (Exception e){
if(log.isDebugEnabled()){
log.debug("Exception from close: " + e.getMessage());
}
}
fileAbs.close();
if(fileAbs != null) fileAbs = null;
if(dao != null){
dao.close();
dao = null;
}
}
| void function(DataAccessObject dao) { AbstractFileDAO fileAbs = (AbstractFileDAO) dao; try{ if(fileAbs.isWriteFlag()){ FileOutputStream fos = new FileOutputStream(fileAbs.getPath()); if(fileAbs.isPropsFile()){ fileAbs.getProperties().store(fos, STR); fos.close(); } else{ BufferedOutputStream bout = new BufferedOutputStream(fos); bout.write(fileAbs.getFileBytes(), 0, fileAbs.getFileBytes().length); bout.close(); fos.close(); } } } catch (java.io.IOException e){ if(log.isDebugEnabled()){ log.debug(STR + e.getMessage()); } } catch (Exception e){ if(log.isDebugEnabled()){ log.debug(STR + e.getMessage()); } } fileAbs.close(); if(fileAbs != null) fileAbs = null; if(dao != null){ dao.close(); dao = null; } } | /**
* Close and dispose of all opened resources.
* <p>
* Persists the contents of the file or properties file back to the file system. Any changes made to the object obtained from {@linkplain AbstractFileDAO#getProperties()} or {@linkplain AbstractFileDAO#getFileBytes()} will be automatically persisted by this method.
* </p>
*
* @param dao The DataAccessObject associated with this proxy
* @throws SpineApplicationException
* @see com.zphinx.spine.data.AbstractDataProxy#close(com.zphinx.spine.data.DataAccessObject)
*/ | Close and dispose of all opened resources. Persists the contents of the file or properties file back to the file system. Any changes made to the object obtained from AbstractFileDAO#getProperties() or AbstractFileDAO#getFileBytes() will be automatically persisted by this method. | close | {
"repo_name": "davidlad123/spine",
"path": "spine/src/com/zphinx/spine/data/impl/FileProxy.java",
"license": "gpl-3.0",
"size": 7794
} | [
"com.zphinx.spine.data.DataAccessObject",
"java.io.BufferedOutputStream",
"java.io.FileOutputStream"
] | import com.zphinx.spine.data.DataAccessObject; import java.io.BufferedOutputStream; import java.io.FileOutputStream; | import com.zphinx.spine.data.*; import java.io.*; | [
"com.zphinx.spine",
"java.io"
] | com.zphinx.spine; java.io; | 1,730,477 |
StatusCode getInitialState(Product service); | StatusCode getInitialState(Product service); | /**
* Answer the initial state of a service
*
* @param service
* @return the initial state of a service
*/ | Answer the initial state of a service | getInitialState | {
"repo_name": "ChiralBehaviors/Ultrastructure",
"path": "animations/src/main/java/com/chiralbehaviors/CoRE/meta/JobModel.java",
"license": "agpl-3.0",
"size": 14497
} | [
"com.chiralbehaviors.CoRE"
] | import com.chiralbehaviors.CoRE; | import com.chiralbehaviors.*; | [
"com.chiralbehaviors"
] | com.chiralbehaviors; | 1,636,198 |
@Test
public void testPDFBox3951() throws IOException
{
PDDocument doc = PDDocument.load(new File(TARGETPDFDIR, "PDFBOX-3951-FIHUZWDDL2VGPOE34N6YHWSIGSH5LVGZ.pdf"));
assertEquals(143, doc.getNumberOfPages());
doc.close();
} | void function() throws IOException { PDDocument doc = PDDocument.load(new File(TARGETPDFDIR, STR)); assertEquals(143, doc.getNumberOfPages()); doc.close(); } | /**
* PDFBOX-3951: test parsing of truncated file.
*
* @throws IOException
*/ | PDFBOX-3951: test parsing of truncated file | testPDFBox3951 | {
"repo_name": "torakiki/sambox",
"path": "src/test/java/org/sejda/sambox/input/PDFParserTest.java",
"license": "apache-2.0",
"size": 15289
} | [
"java.io.File",
"java.io.IOException",
"org.junit.Assert",
"org.sejda.sambox.pdmodel.PDDocument"
] | import java.io.File; import java.io.IOException; import org.junit.Assert; import org.sejda.sambox.pdmodel.PDDocument; | import java.io.*; import org.junit.*; import org.sejda.sambox.pdmodel.*; | [
"java.io",
"org.junit",
"org.sejda.sambox"
] | java.io; org.junit; org.sejda.sambox; | 2,321,319 |
public final synchronized void parentChanged(TerminalView parent) {
if (manager != null && !manager.isResizeAllowed()) {
Log.d(TAG, "Resize is not allowed now");
return;
}
this.parent = parent;
final int width = parent.getWidth();
final int height = parent.getHeight();
// Something has gone wrong with our layout; we're 0 width or height!
if (width <= 0 || height <= 0)
return;
clipboard = (ClipboardManager) parent.getContext().getSystemService(Context.CLIPBOARD_SERVICE);
keyListener.setClipboardManager(clipboard);
if (!forcedSize) {
// recalculate buffer size
int newColumns, newRows;
newColumns = width / charWidth;
newRows = height / charHeight;
// If nothing has changed in the terminal dimensions and not an intial
// draw then don't blow away scroll regions and such.
if (newColumns == columns && newRows == rows)
return;
columns = newColumns;
rows = newRows;
}
// reallocate new bitmap if needed
boolean newBitmap = (bitmap == null);
if (bitmap != null)
newBitmap = (bitmap.getWidth() != width || bitmap.getHeight() != height);
if (newBitmap) {
discardBitmap();
bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
canvas.setBitmap(bitmap);
}
// clear out any old buffer information
defaultPaint.setColor(Color.BLACK);
canvas.drawPaint(defaultPaint);
// Stroke the border of the terminal if the size is being forced;
if (forcedSize) {
int borderX = (columns * charWidth) + 1;
int borderY = (rows * charHeight) + 1;
defaultPaint.setColor(Color.GRAY);
defaultPaint.setStrokeWidth(0.0f);
if (width >= borderX)
canvas.drawLine(borderX, 0, borderX, borderY + 1, defaultPaint);
if (height >= borderY)
canvas.drawLine(0, borderY, borderX + 1, borderY, defaultPaint);
}
try {
// request a terminal pty resize
synchronized (buffer) {
buffer.setScreenSize(columns, rows, true);
}
if (transport != null)
transport.setDimensions(columns, rows, width, height);
} catch (Exception e) {
Log.e(TAG, "Problem while trying to resize screen or PTY", e);
}
// redraw local output if we don't have a sesson to receive our resize request
if (transport == null) {
synchronized (localOutput) {
((vt320) buffer).reset();
for (String line : localOutput)
((vt320) buffer).putString(line);
}
}
// force full redraw with new buffer size
fullRedraw = true;
redraw();
parent.notifyUser(String.format("%d x %d", columns, rows));
Log.i(TAG, String.format("parentChanged() now width=%d, height=%d", columns, rows));
} | final synchronized void function(TerminalView parent) { if (manager != null && !manager.isResizeAllowed()) { Log.d(TAG, STR); return; } this.parent = parent; final int width = parent.getWidth(); final int height = parent.getHeight(); if (width <= 0 height <= 0) return; clipboard = (ClipboardManager) parent.getContext().getSystemService(Context.CLIPBOARD_SERVICE); keyListener.setClipboardManager(clipboard); if (!forcedSize) { int newColumns, newRows; newColumns = width / charWidth; newRows = height / charHeight; if (newColumns == columns && newRows == rows) return; columns = newColumns; rows = newRows; } boolean newBitmap = (bitmap == null); if (bitmap != null) newBitmap = (bitmap.getWidth() != width bitmap.getHeight() != height); if (newBitmap) { discardBitmap(); bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); canvas.setBitmap(bitmap); } defaultPaint.setColor(Color.BLACK); canvas.drawPaint(defaultPaint); if (forcedSize) { int borderX = (columns * charWidth) + 1; int borderY = (rows * charHeight) + 1; defaultPaint.setColor(Color.GRAY); defaultPaint.setStrokeWidth(0.0f); if (width >= borderX) canvas.drawLine(borderX, 0, borderX, borderY + 1, defaultPaint); if (height >= borderY) canvas.drawLine(0, borderY, borderX + 1, borderY, defaultPaint); } try { synchronized (buffer) { buffer.setScreenSize(columns, rows, true); } if (transport != null) transport.setDimensions(columns, rows, width, height); } catch (Exception e) { Log.e(TAG, STR, e); } if (transport == null) { synchronized (localOutput) { ((vt320) buffer).reset(); for (String line : localOutput) ((vt320) buffer).putString(line); } } fullRedraw = true; redraw(); parent.notifyUser(String.format(STR, columns, rows)); Log.i(TAG, String.format(STR, columns, rows)); } | /**
* Something changed in our parent {@link TerminalView}, maybe it's a new
* parent, or maybe it's an updated font size. We should recalculate
* terminal size information and request a PTY resize.
*/ | Something changed in our parent <code>TerminalView</code>, maybe it's a new parent, or maybe it's an updated font size. We should recalculate terminal size information and request a PTY resize | parentChanged | {
"repo_name": "rhansby/connectbot",
"path": "app/src/main/java/org/connectbot/service/TerminalBridge.java",
"license": "apache-2.0",
"size": 29733
} | [
"android.content.Context",
"android.graphics.Bitmap",
"android.graphics.Color",
"android.text.ClipboardManager",
"android.util.Log",
"org.connectbot.TerminalView"
] | import android.content.Context; import android.graphics.Bitmap; import android.graphics.Color; import android.text.ClipboardManager; import android.util.Log; import org.connectbot.TerminalView; | import android.content.*; import android.graphics.*; import android.text.*; import android.util.*; import org.connectbot.*; | [
"android.content",
"android.graphics",
"android.text",
"android.util",
"org.connectbot"
] | android.content; android.graphics; android.text; android.util; org.connectbot; | 873,724 |
public boolean isInGroup(Group group) {
synchronized (groups) {
return (groups.contains(group));
}
} | boolean function(Group group) { synchronized (groups) { return (groups.contains(group)); } } | /**
* Is this user in the specified group?
*
* @param group The group to check
*/ | Is this user in the specified group | isInGroup | {
"repo_name": "plumer/codana",
"path": "tomcat_files/6.0.43/MemoryUser.java",
"license": "mit",
"size": 8691
} | [
"org.apache.catalina.Group"
] | import org.apache.catalina.Group; | import org.apache.catalina.*; | [
"org.apache.catalina"
] | org.apache.catalina; | 730,790 |
public T caseMParameterCSPSwitchCase(MParameterCSPSwitchCase object) {
return null;
} | T function(MParameterCSPSwitchCase object) { return null; } | /**
* Returns the result of interpreting the object as an instance of '<em>MParameterCSPSwitchCase</em>'.
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>MParameterCSPSwitchCase</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/ | Returns the result of interpreting the object as an instance of 'MParameterCSPSwitchCase' | caseMParameterCSPSwitchCase | {
"repo_name": "parraman/micobs",
"path": "mclev/es.uah.aut.srg.micobs.mclev/src/es/uah/aut/srg/micobs/mclev/mclevcmp/util/mclevcmpSwitch.java",
"license": "epl-1.0",
"size": 29745
} | [
"es.uah.aut.srg.micobs.mclev.mclevcmp.MParameterCSPSwitchCase"
] | import es.uah.aut.srg.micobs.mclev.mclevcmp.MParameterCSPSwitchCase; | import es.uah.aut.srg.micobs.mclev.mclevcmp.*; | [
"es.uah.aut"
] | es.uah.aut; | 817,351 |
@Override
public void handleMousePressed(ChartCanvas canvas, MouseEvent e) {
this.mousePressedPoint = new Point2D.Double(e.getX(), e.getY());
} | void function(ChartCanvas canvas, MouseEvent e) { this.mousePressedPoint = new Point2D.Double(e.getX(), e.getY()); } | /**
* Handles a mouse pressed event by recording the location of the mouse
* pointer (so that later we can check that the click isn't part of a
* drag).
*
* @param canvas the chart canvas.
* @param e the mouse event.
*/ | Handles a mouse pressed event by recording the location of the mouse pointer (so that later we can check that the click isn't part of a drag) | handleMousePressed | {
"repo_name": "informatik-mannheim/Moduro-Toolbox",
"path": "src/main/java/de/hs/mannheim/modUro/controller/diagram/fx/interaction/DispatchHandlerFX.java",
"license": "apache-2.0",
"size": 3973
} | [
"de.hs.mannheim.modUro.controller.diagram.fx.ChartCanvas",
"java.awt.geom.Point2D"
] | import de.hs.mannheim.modUro.controller.diagram.fx.ChartCanvas; import java.awt.geom.Point2D; | import de.hs.mannheim.*; import java.awt.geom.*; | [
"de.hs.mannheim",
"java.awt"
] | de.hs.mannheim; java.awt; | 2,299,473 |
@Override
public void flush() throws IOException {
super.flush();
this.branch.flush();
} | void function() throws IOException { super.flush(); this.branch.flush(); } | /**
* Flushes both streams.
* @throws IOException if an I/O error occurs
*/ | Flushes both streams | flush | {
"repo_name": "trivium-io/trivium-core",
"path": "src/io/trivium/dep/org/apache/commons/io/output/TeeOutputStream.java",
"license": "apache-2.0",
"size": 3335
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 830,106 |
public void setA_Period_8 (BigDecimal A_Period_8)
{
set_Value (COLUMNNAME_A_Period_8, A_Period_8);
} | void function (BigDecimal A_Period_8) { set_Value (COLUMNNAME_A_Period_8, A_Period_8); } | /** Set Period 8.
@param A_Period_8 Period 8 */ | Set Period 8 | setA_Period_8 | {
"repo_name": "erpcya/adempierePOS",
"path": "base/src/org/compiere/model/X_A_Asset_Spread.java",
"license": "gpl-2.0",
"size": 9737
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 445,206 |
public Adapter createStageQualifierAdapter() {
return null;
} | Adapter function() { return null; } | /**
* Creates a new adapter for an object of class
* '{@link org.enterprisedomain.classmaker.StageQualifier <em>Stage
* Qualifier</em>}'. <!-- begin-user-doc --> This default implementation returns
* null so that we can easily ignore cases; it's useful to ignore a case when
* inheritance will catch all the cases anyway. <!-- end-user-doc -->
*
* @return the new adapter.
* @see org.enterprisedomain.classmaker.StageQualifier
* @generated
*/ | Creates a new adapter for an object of class '<code>org.enterprisedomain.classmaker.StageQualifier Stage Qualifier</code>'. This default implementation returns null so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. | createStageQualifierAdapter | {
"repo_name": "enterpriseDomain/ClassMaker",
"path": "bundles/org.enterprisedomain.classmaker/src/org/enterprisedomain/classmaker/util/ClassMakerAdapterFactory.java",
"license": "apache-2.0",
"size": 24891
} | [
"org.eclipse.emf.common.notify.Adapter"
] | import org.eclipse.emf.common.notify.Adapter; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,213,767 |
@Override()
@NotNull()
public Socket createSocket(@NotNull final InetAddress host, final int port)
throws IOException
{
final Socket createdSocket =
delegateFactory.createSocket(host, port);
SSLUtil.applyEnabledSSLProtocols(createdSocket, protocols);
SSLUtil.applyEnabledSSLCipherSuites(createdSocket, cipherSuites);
return createdSocket;
} | @Override() @NotNull() Socket function(@NotNull final InetAddress host, final int port) throws IOException { final Socket createdSocket = delegateFactory.createSocket(host, port); SSLUtil.applyEnabledSSLProtocols(createdSocket, protocols); SSLUtil.applyEnabledSSLCipherSuites(createdSocket, cipherSuites); return createdSocket; } | /**
* Creates a new socket with the provided information.
*
* @param host The remote address to which the socket should be connected.
* @param port The remote port to which the socket should be connected.
*
* @return The socket that was created.
*
* @throws IOException If the socket cannot be created.
*/ | Creates a new socket with the provided information | createSocket | {
"repo_name": "UnboundID/ldapsdk",
"path": "src/com/unboundid/util/ssl/SetEnabledProtocolsAndCipherSuitesSSLSocketFactory.java",
"license": "gpl-2.0",
"size": 10694
} | [
"com.unboundid.util.NotNull",
"java.io.IOException",
"java.net.InetAddress",
"java.net.Socket"
] | import com.unboundid.util.NotNull; import java.io.IOException; import java.net.InetAddress; import java.net.Socket; | import com.unboundid.util.*; import java.io.*; import java.net.*; | [
"com.unboundid.util",
"java.io",
"java.net"
] | com.unboundid.util; java.io; java.net; | 482,698 |
public OutputStream getOutputStream()
{
return m_os;
} | OutputStream function() { return m_os; } | /**
* Get the output stream where the events will be serialized to.
*
* @return reference to the result stream, or null of only a writer was
* set.
*/ | Get the output stream where the events will be serialized to | getOutputStream | {
"repo_name": "shun634501730/java_source_cn",
"path": "src_en/com/sun/org/apache/xml/internal/serializer/WriterToASCI.java",
"license": "apache-2.0",
"size": 4182
} | [
"java.io.OutputStream"
] | import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 389,663 |
protected List<String> listPrimaryKeyFieldNamesConsultingAllServices(Class<?> type) {
return dataObjectMetaDataService.listPrimaryKeyFieldNames(type);
} | List<String> function(Class<?> type) { return dataObjectMetaDataService.listPrimaryKeyFieldNames(type); } | /**
* LookupServiceImpl calls BusinessObjectMetaDataService to listPrimaryKeyFieldNames.
* The BusinessObjectMetaDataService goes beyond the PersistenceStructureService to consult
* the associated ModuleService in determining the primary key field names.
* TODO: Do we need both listPrimaryKeyFieldNames/persistenceStructureService and
* listPrimaryKeyFieldNamesConsultingAllServices/businesObjectMetaDataService or
* can the latter superset be used for the former?
*
* @param type the data object class
* @return list of primary key field names, consulting persistence structure service, module service and
* datadictionary
*/ | LookupServiceImpl calls BusinessObjectMetaDataService to listPrimaryKeyFieldNames. The BusinessObjectMetaDataService goes beyond the PersistenceStructureService to consult the associated ModuleService in determining the primary key field names. listPrimaryKeyFieldNamesConsultingAllServices/businesObjectMetaDataService or can the latter superset be used for the former | listPrimaryKeyFieldNamesConsultingAllServices | {
"repo_name": "geothomasp/kualico-rice-kc",
"path": "rice-middleware/kns/src/main/java/org/kuali/rice/krad/service/impl/KNSLegacyDataAdapterImpl.java",
"license": "apache-2.0",
"size": 47709
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,065,825 |
protected List<Transition> getTransitions(int currentState, boolean includeStoppingTransition) {
final List<Transition> result = new ArrayList<>();
for (final Transition t : transitions) {
if (t.getFromState() == currentState) {
result.add(t);
}
}
if (includeStoppingTransition) {
for (final int state : finalStateProbabilities.keys()) {
if (state == currentState) {
result.add(getFinalTransition(state));
}
}
}
return result;
}
| List<Transition> function(int currentState, boolean includeStoppingTransition) { final List<Transition> result = new ArrayList<>(); for (final Transition t : transitions) { if (t.getFromState() == currentState) { result.add(t); } } if (includeStoppingTransition) { for (final int state : finalStateProbabilities.keys()) { if (state == currentState) { result.add(getFinalTransition(state)); } } } return result; } | /**
* Returns all outgoing transitions from the given state
*
* @param currentState
* the given state
* @param includeStoppingTransition
* whether to include final transition probabilities
* @return the outgoing transitions
*/ | Returns all outgoing transitions from the given state | getTransitions | {
"repo_name": "Pilger7/SADL",
"path": "PDTTA-core/src/sadl/models/PDTTAold.java",
"license": "gpl-2.0",
"size": 27627
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,917,205 |
public void setAuthenticationUserDetailsService(AuthenticationUserDetailsService authenticationUserDetailsService) {
this.authenticationUserDetailsService = authenticationUserDetailsService;
} | void function(AuthenticationUserDetailsService authenticationUserDetailsService) { this.authenticationUserDetailsService = authenticationUserDetailsService; } | /**
* Sets the <code>AuthenticationUserDetailsService</code> to load the local
* user details.
*
* @param authenticationUserDetailsService The <code>AuthenticationUserDetailsService</code>.
*/ | Sets the <code>AuthenticationUserDetailsService</code> to load the local user details | setAuthenticationUserDetailsService | {
"repo_name": "ParthPancholi/janrain4j",
"path": "src/main/java/com/googlecode/janrain4j/springframework/security/JanrainAuthenticationProvider.java",
"license": "apache-2.0",
"size": 3229
} | [
"org.springframework.security.core.userdetails.AuthenticationUserDetailsService"
] | import org.springframework.security.core.userdetails.AuthenticationUserDetailsService; | import org.springframework.security.core.userdetails.*; | [
"org.springframework.security"
] | org.springframework.security; | 1,126,516 |
public final AlertDialog shareText(CharSequence text) {
return shareText(text, "TEXT_TYPE");
} | final AlertDialog function(CharSequence text) { return shareText(text, STR); } | /**
* Defaults to type "TEXT_TYPE".
*
* @param text the text string to encode as a barcode
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
* if a prompt was needed, or null otherwise
* @see #shareText(CharSequence, CharSequence)
*/ | Defaults to type "TEXT_TYPE" | shareText | {
"repo_name": "KyCodeHuynh/QRU",
"path": "zxing-master/zxing-master/android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java",
"license": "gpl-2.0",
"size": 18861
} | [
"android.app.AlertDialog"
] | import android.app.AlertDialog; | import android.app.*; | [
"android.app"
] | android.app; | 2,705,462 |
public static Cipher getCipher(String algorithm) throws GeneralSecurityException {
return PROVIDER != null ? Cipher.getInstance(algorithm, PROVIDER)
: Cipher.getInstance(algorithm);
} | static Cipher function(String algorithm) throws GeneralSecurityException { return PROVIDER != null ? Cipher.getInstance(algorithm, PROVIDER) : Cipher.getInstance(algorithm); } | /**
* Workaround for JENKINS-6459 / http://java.net/jira/browse/GLASSFISH-11862
* This method uses specific provider selected via hudson.util.Secret.provider system property
* to provide a workaround for the above bug where default provide gives an unusable instance.
* (Glassfish Enterprise users should set value of this property to "SunJCE")
*/ | Workaround for JENKINS-6459 / HREF This method uses specific provider selected via hudson.util.Secret.provider system property to provide a workaround for the above bug where default provide gives an unusable instance. (Glassfish Enterprise users should set value of this property to "SunJCE") | getCipher | {
"repo_name": "hplatou/jenkins",
"path": "core/src/main/java/hudson/util/Secret.java",
"license": "mit",
"size": 11397
} | [
"java.security.GeneralSecurityException",
"javax.crypto.Cipher"
] | import java.security.GeneralSecurityException; import javax.crypto.Cipher; | import java.security.*; import javax.crypto.*; | [
"java.security",
"javax.crypto"
] | java.security; javax.crypto; | 2,493,362 |
public static Matcher<Resource> containsChildrenInAnyOrder(String... children) {
return new ResourceChildrenMatcher(Arrays.asList(children), true, false);
} | static Matcher<Resource> function(String... children) { return new ResourceChildrenMatcher(Arrays.asList(children), true, false); } | /**
* Matches resources which have exactly the children with the names given in <tt>children</tt>. The order is not validated.
*
* <pre>
* assertThat(resource, containsChildren('child1', 'child2'));
* </pre>
*
* @param children the expected children, not <code>null</code> or empty
* @return a matcher instance
*/ | Matches resources which have exactly the children with the names given in children. The order is not validated. <code> assertThat(resource, containsChildren('child1', 'child2')); </code> | containsChildrenInAnyOrder | {
"repo_name": "tteofili/sling",
"path": "testing/hamcrest/src/main/java/org/apache/sling/hamcrest/ResourceMatchers.java",
"license": "apache-2.0",
"size": 5748
} | [
"java.util.Arrays",
"org.apache.sling.api.resource.Resource",
"org.apache.sling.hamcrest.matchers.ResourceChildrenMatcher",
"org.hamcrest.Matcher"
] | import java.util.Arrays; import org.apache.sling.api.resource.Resource; import org.apache.sling.hamcrest.matchers.ResourceChildrenMatcher; import org.hamcrest.Matcher; | import java.util.*; import org.apache.sling.api.resource.*; import org.apache.sling.hamcrest.matchers.*; import org.hamcrest.*; | [
"java.util",
"org.apache.sling",
"org.hamcrest"
] | java.util; org.apache.sling; org.hamcrest; | 948,090 |
public void load(Sentence sentence, double beta, boolean oracleFscore, boolean beamParser) {
// assumes the scores in the supertags vectors are ordered by size
numWords = sentence.words.size();
// TODO investigate purpose of +1
numCells = (numWords + 1) * numWords / 2 + 1;
// numCells = (numWords + 1) * numWords / 2;
for (int i = 0; i < numWords; i++) {
ArrayList<Supertag> supertags = (sentence.multiSupertags).get(i);
double probCutoff = (supertags.get(0)).probability * beta;
for (Supertag supertag : supertags) {
if (supertag.probability < probCutoff) {
continue;
}
Category cat = supertag.lexicalCategory;
SuperCategory superCat = SuperCategory.Lexical((short) (i + 1), cat, (short) (0));
superCat.logPScore = Math.log(supertag.probability);
superCat.score = weights.getLogP() * superCat.logPScore;
superCat.inside = superCat.score;
// used by PrintForest (since the depsSumDecoder already resets score)
if (!beamParser) {
if (!oracleFscore) {
add(i, 1, superCat);
} else {
addFscore(i, 1, superCat);
}
} else {
addNoDP(i, 1, superCat);
}
}
}
} | void function(Sentence sentence, double beta, boolean oracleFscore, boolean beamParser) { numWords = sentence.words.size(); numCells = (numWords + 1) * numWords / 2 + 1; for (int i = 0; i < numWords; i++) { ArrayList<Supertag> supertags = (sentence.multiSupertags).get(i); double probCutoff = (supertags.get(0)).probability * beta; for (Supertag supertag : supertags) { if (supertag.probability < probCutoff) { continue; } Category cat = supertag.lexicalCategory; SuperCategory superCat = SuperCategory.Lexical((short) (i + 1), cat, (short) (0)); superCat.logPScore = Math.log(supertag.probability); superCat.score = weights.getLogP() * superCat.logPScore; superCat.inside = superCat.score; if (!beamParser) { if (!oracleFscore) { add(i, 1, superCat); } else { addFscore(i, 1, superCat); } } else { addNoDP(i, 1, superCat); } } } } | /**
* Loads sentence into chart.
*
* The method assumes that the sentence size is less than or equal
* to MAX_WORDS.
*
* @param sentence sentence to be parsed
* @param beta beta which determines probability cutoff for loaded supertags
* @param oracleFscore TODO
*/ | Loads sentence into chart. The method assumes that the sentence size is less than or equal to MAX_WORDS | load | {
"repo_name": "darrenfoong/candc",
"path": "src/chart_parser/Chart.java",
"license": "bsd-2-clause",
"size": 5578
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 2,879,770 |
private Result pExtension(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyRepetition1;
Pair<Node> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pJavaIdentifier$Word(yyStart);
if (yyResult.hasValue("extends")) {
yyResult = pType(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyBase = yyRepetition1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(",")) {
yyResult = pType(yyResult.index);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
continue;
}
} else {
yyError = yyError.select("',' expected", yyBase);
}
break;
}
{ // Start scope for v$g$2.
final Pair<Node> v$g$2 = yyRepValue1.reverse();
yyValue = GNode.createFromPair("Extension", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$g$2.
}
}
// Done.
yyError = yyError.select("extension expected", yyStart);
return yyError;
}
// ========================================================================= | Result function(final int yyStart) throws IOException { Result yyResult; int yyBase; int yyRepetition1; Pair<Node> yyRepValue1; Node yyValue; ParseError yyError = ParseError.DUMMY; yyResult = pJavaIdentifier$Word(yyStart); if (yyResult.hasValue(STR)) { yyResult = pType(yyResult.index); yyError = yyResult.select(yyError); if (yyResult.hasValue()) { final Node v$g$1 = yyResult.semanticValue(); yyRepetition1 = yyResult.index; yyRepValue1 = Pair.empty(); while (true) { yyBase = yyRepetition1; yyResult = pSymbol(yyBase); if (yyResult.hasValue(",")) { yyResult = pType(yyResult.index); yyError = yyResult.select(yyError, yyRepetition1); if (yyResult.hasValue()) { final Node v$el$1 = yyResult.semanticValue(); yyRepetition1 = yyResult.index; yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1); continue; } } else { yyError = yyError.select(STR, yyBase); } break; } { final Pair<Node> v$g$2 = yyRepValue1.reverse(); yyValue = GNode.createFromPair(STR, v$g$1, v$g$2); yyValue.setLocation(location(yyStart)); return new SemanticValue(yyValue, yyRepetition1, yyError); } } } yyError = yyError.select(STR, yyStart); return yyError; } | /**
* Parse nonterminal xtc.lang.jeannie.JeannieJava.Extension.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/ | Parse nonterminal xtc.lang.jeannie.JeannieJava.Extension | pExtension | {
"repo_name": "wandoulabs/xtc-rats",
"path": "xtc-core/src/main/java/xtc/lang/jeannie/JeannieParser.java",
"license": "lgpl-2.1",
"size": 647687
} | [
"java.io.IOException",
"xtc.parser.ParseError",
"xtc.parser.Result",
"xtc.parser.SemanticValue",
"xtc.tree.GNode",
"xtc.tree.Node",
"xtc.util.Pair"
] | import java.io.IOException; import xtc.parser.ParseError; import xtc.parser.Result; import xtc.parser.SemanticValue; import xtc.tree.GNode; import xtc.tree.Node; import xtc.util.Pair; | import java.io.*; import xtc.parser.*; import xtc.tree.*; import xtc.util.*; | [
"java.io",
"xtc.parser",
"xtc.tree",
"xtc.util"
] | java.io; xtc.parser; xtc.tree; xtc.util; | 2,001,552 |
@Test
public void whenOriginalContainsSubstringThenTrue() {
ChapterQuiz quiz = new ChapterQuiz();
boolean result = quiz.contains("Welcome to Java!", "to");
assertThat(result, is(true));
} | void function() { ChapterQuiz quiz = new ChapterQuiz(); boolean result = quiz.contains(STR, "to"); assertThat(result, is(true)); } | /**
* Test contains method (original contains the sub).
*
* @author Vladimir Ivanov
* @since 09.08.2017
*/ | Test contains method (original contains the sub) | whenOriginalContainsSubstringThenTrue | {
"repo_name": "dimir2/vivanov",
"path": "part1/ch1/src/test/java/ru/job4j/ChapterQuizTest.java",
"license": "apache-2.0",
"size": 1718
} | [
"org.hamcrest.core.Is",
"org.junit.Assert"
] | import org.hamcrest.core.Is; import org.junit.Assert; | import org.hamcrest.core.*; import org.junit.*; | [
"org.hamcrest.core",
"org.junit"
] | org.hamcrest.core; org.junit; | 1,571,951 |
PagedIterable<User> listByLab(String resourceGroupName, String labName); | PagedIterable<User> listByLab(String resourceGroupName, String labName); | /**
* Returns a list of all users for a lab.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param labName The name of the lab that uniquely identifies it within containing lab account. Used in resource
* URIs.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return paged list of users.
*/ | Returns a list of all users for a lab | listByLab | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/labservices/azure-resourcemanager-labservices/src/main/java/com/azure/resourcemanager/labservices/models/Users.java",
"license": "mit",
"size": 9723
} | [
"com.azure.core.http.rest.PagedIterable"
] | import com.azure.core.http.rest.PagedIterable; | import com.azure.core.http.rest.*; | [
"com.azure.core"
] | com.azure.core; | 1,256,580 |
@Override
public boolean equals(Object object) {
if (object == this ) {
return true;
}
if (object instanceof ResizableDoubleArray == false) {
return false;
}
synchronized(this) {
synchronized(object) {
boolean result = true;
ResizableDoubleArray other = (ResizableDoubleArray) object;
result = result && (other.initialCapacity == initialCapacity);
result = result && (other.contractionCriteria == contractionCriteria);
result = result && (other.expansionFactor == expansionFactor);
result = result && (other.expansionMode == expansionMode);
result = result && (other.numElements == numElements);
result = result && (other.startIndex == startIndex);
if (!result) {
return false;
} else {
return Arrays.equals(internalArray, other.internalArray);
}
}
}
} | boolean function(Object object) { if (object == this ) { return true; } if (object instanceof ResizableDoubleArray == false) { return false; } synchronized(this) { synchronized(object) { boolean result = true; ResizableDoubleArray other = (ResizableDoubleArray) object; result = result && (other.initialCapacity == initialCapacity); result = result && (other.contractionCriteria == contractionCriteria); result = result && (other.expansionFactor == expansionFactor); result = result && (other.expansionMode == expansionMode); result = result && (other.numElements == numElements); result = result && (other.startIndex == startIndex); if (!result) { return false; } else { return Arrays.equals(internalArray, other.internalArray); } } } } | /**
* Returns true iff object is a ResizableDoubleArray with the same properties
* as this and an identical internal storage array.
*
* @param object object to be compared for equality with this
* @return true iff object is a ResizableDoubleArray with the same data and
* properties as this
* @since 2.0
*/ | Returns true iff object is a ResizableDoubleArray with the same properties as this and an identical internal storage array | equals | {
"repo_name": "scptest/scpb",
"path": "org/apache/commons/math3/util/ResizableDoubleArray.java",
"license": "gpl-3.0",
"size": 35797
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 1,784,712 |
public DateTimeFormatter getFormatForMenuTimes() {
return formatForMenuTimes;
} | DateTimeFormatter function() { return formatForMenuTimes; } | /**
* getFormatForMenuTimes, Returns the value this setting. See the "set" function for setting
* information.
*/ | getFormatForMenuTimes, Returns the value this setting. See the "set" function for setting information | getFormatForMenuTimes | {
"repo_name": "LGoodDatePicker/LGoodDatePicker",
"path": "Project/src/main/java/com/github/lgooddatepicker/components/TimePickerSettings.java",
"license": "mit",
"size": 45857
} | [
"java.time.format.DateTimeFormatter"
] | import java.time.format.DateTimeFormatter; | import java.time.format.*; | [
"java.time"
] | java.time; | 1,852,869 |
public static int executeIntQuery(Connection connection, String query, String param1, String param2) throws JdbcException {
PreparedStatement stmt = null;
try {
if (log.isDebugEnabled()) log.debug("prepare and execute query ["+query+"]"+displayParameters(param1,param2));
stmt = connection.prepareStatement(query);
applyParameters(stmt,param1,param2);
ResultSet rs = stmt.executeQuery();
try {
if (!rs.next()) {
return -1;
}
return rs.getInt(1);
} finally {
rs.close();
}
} catch (Exception e) {
throw new JdbcException("could not obtain value using query ["+query+"]"+displayParameters(param1,param2),e);
} finally {
if (stmt!=null) {
try {
stmt.close();
} catch (Exception e) {
throw new JdbcException("could not close statement of query ["+query+"]"+displayParameters(param1,param2),e);
}
}
}
} | static int function(Connection connection, String query, String param1, String param2) throws JdbcException { PreparedStatement stmt = null; try { if (log.isDebugEnabled()) log.debug(STR+query+"]"+displayParameters(param1,param2)); stmt = connection.prepareStatement(query); applyParameters(stmt,param1,param2); ResultSet rs = stmt.executeQuery(); try { if (!rs.next()) { return -1; } return rs.getInt(1); } finally { rs.close(); } } catch (Exception e) { throw new JdbcException(STR+query+"]"+displayParameters(param1,param2),e); } finally { if (stmt!=null) { try { stmt.close(); } catch (Exception e) { throw new JdbcException(STR+query+"]"+displayParameters(param1,param2),e); } } } } | /**
* exectues query that returns an integer. Returns -1 if no results are found.
*/ | exectues query that returns an integer. Returns -1 if no results are found | executeIntQuery | {
"repo_name": "smhoekstra/iaf",
"path": "JavaSource/nl/nn/adapterframework/util/JdbcUtil.java",
"license": "apache-2.0",
"size": 40154
} | [
"java.sql.Connection",
"java.sql.PreparedStatement",
"java.sql.ResultSet",
"nl.nn.adapterframework.jdbc.JdbcException"
] | import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import nl.nn.adapterframework.jdbc.JdbcException; | import java.sql.*; import nl.nn.adapterframework.jdbc.*; | [
"java.sql",
"nl.nn.adapterframework"
] | java.sql; nl.nn.adapterframework; | 977,088 |
public ColorHandle getBorderRightColor( )
{
return doGetColorHandle( HighlightRule.BORDER_RIGHT_COLOR_MEMBER );
} | ColorHandle function( ) { return doGetColorHandle( HighlightRule.BORDER_RIGHT_COLOR_MEMBER ); } | /**
* Returns a handle to work with the border right color.
*
* @return a ColorHandle to deal with the border right color.
*/ | Returns a handle to work with the border right color | getBorderRightColor | {
"repo_name": "sguan-actuate/birt",
"path": "model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/HighlightRuleHandle.java",
"license": "epl-1.0",
"size": 29896
} | [
"org.eclipse.birt.report.model.api.elements.structures.HighlightRule"
] | import org.eclipse.birt.report.model.api.elements.structures.HighlightRule; | import org.eclipse.birt.report.model.api.elements.structures.*; | [
"org.eclipse.birt"
] | org.eclipse.birt; | 1,863,465 |
public static <T> CompletableFuture<T> supplyAsync(SupplierWithException<T, ?> supplier, Executor executor) {
return CompletableFuture.supplyAsync(
() -> {
try {
return supplier.get();
} catch (Throwable e) {
throw new CompletionException(e);
}
},
executor);
} | static <T> CompletableFuture<T> function(SupplierWithException<T, ?> supplier, Executor executor) { return CompletableFuture.supplyAsync( () -> { try { return supplier.get(); } catch (Throwable e) { throw new CompletionException(e); } }, executor); } | /**
* Returns a future which is completed with the result of the {@link SupplierWithException}.
*
* @param supplier to provide the future's value
* @param executor to execute the supplier
* @param <T> type of the result
* @return Future which is completed with the value of the supplier
*/ | Returns a future which is completed with the result of the <code>SupplierWithException</code> | supplyAsync | {
"repo_name": "yew1eb/flink",
"path": "flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java",
"license": "apache-2.0",
"size": 27603
} | [
"java.util.concurrent.CompletableFuture",
"java.util.concurrent.CompletionException",
"java.util.concurrent.Executor",
"org.apache.flink.util.function.SupplierWithException"
] | import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; import java.util.concurrent.Executor; import org.apache.flink.util.function.SupplierWithException; | import java.util.concurrent.*; import org.apache.flink.util.function.*; | [
"java.util",
"org.apache.flink"
] | java.util; org.apache.flink; | 2,280,772 |
public ConditionBase createCondition() {
logOverride("condition", condition);
condition = new NestedCondition();
return condition;
} | ConditionBase function() { logOverride(STR, condition); condition = new NestedCondition(); return condition; } | /**
* Add a condition element.
* @return <code>ConditionBase</code>.
* @since Ant 1.6.2
*/ | Add a condition element | createCondition | {
"repo_name": "Mayo-WE01051879/mayosapp",
"path": "Build/src/main/org/apache/tools/ant/taskdefs/optional/testing/Funtest.java",
"license": "mit",
"size": 17947
} | [
"org.apache.tools.ant.taskdefs.condition.ConditionBase"
] | import org.apache.tools.ant.taskdefs.condition.ConditionBase; | import org.apache.tools.ant.taskdefs.condition.*; | [
"org.apache.tools"
] | org.apache.tools; | 1,759,187 |
@POST
@Path("/")
@Consumes({"*/*"})
@Produces({MediaType.APPLICATION_OCTET_STREAM, MediaType.APPLICATION_JSON})
public Response postRoot(final InputStream in,
@Context
final UserGroupInformation ugi,
@QueryParam(DelegationParam.NAME)
@DefaultValue(DelegationParam.DEFAULT)
final DelegationParam delegation,
@QueryParam(NamenodeRpcAddressParam.NAME)
@DefaultValue(NamenodeRpcAddressParam.DEFAULT)
final NamenodeRpcAddressParam namenodeRpcAddress,
@QueryParam(PostOpParam.NAME)
@DefaultValue(PostOpParam.DEFAULT)
final PostOpParam op,
@QueryParam(BufferSizeParam.NAME)
@DefaultValue(BufferSizeParam.DEFAULT)
final BufferSizeParam bufferSize)
throws IOException, InterruptedException {
return post(in, ugi, delegation, namenodeRpcAddress, ROOT, op, bufferSize);
} | @Path("/") @Consumes({"*/*"}) @Produces({MediaType.APPLICATION_OCTET_STREAM, MediaType.APPLICATION_JSON}) Response function(final InputStream in, final UserGroupInformation ugi, @QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT) final DelegationParam delegation, @QueryParam(NamenodeRpcAddressParam.NAME) @DefaultValue(NamenodeRpcAddressParam.DEFAULT) final NamenodeRpcAddressParam namenodeRpcAddress, @QueryParam(PostOpParam.NAME) @DefaultValue(PostOpParam.DEFAULT) final PostOpParam op, @QueryParam(BufferSizeParam.NAME) @DefaultValue(BufferSizeParam.DEFAULT) final BufferSizeParam bufferSize) throws IOException, InterruptedException { return post(in, ugi, delegation, namenodeRpcAddress, ROOT, op, bufferSize); } | /**
* Handle HTTP POST request for the root for the root.
*/ | Handle HTTP POST request for the root for the root | postRoot | {
"repo_name": "robzor92/hops",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/resources/DatanodeWebHdfsMethods.java",
"license": "apache-2.0",
"size": 17879
} | [
"java.io.IOException",
"java.io.InputStream",
"javax.ws.rs.Consumes",
"javax.ws.rs.DefaultValue",
"javax.ws.rs.Path",
"javax.ws.rs.Produces",
"javax.ws.rs.QueryParam",
"javax.ws.rs.core.MediaType",
"javax.ws.rs.core.Response",
"org.apache.hadoop.hdfs.web.resources.BufferSizeParam",
"org.apache.hadoop.hdfs.web.resources.DelegationParam",
"org.apache.hadoop.hdfs.web.resources.NamenodeRpcAddressParam",
"org.apache.hadoop.hdfs.web.resources.PostOpParam",
"org.apache.hadoop.security.UserGroupInformation"
] | import java.io.IOException; import java.io.InputStream; import javax.ws.rs.Consumes; import javax.ws.rs.DefaultValue; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.hadoop.hdfs.web.resources.BufferSizeParam; import org.apache.hadoop.hdfs.web.resources.DelegationParam; import org.apache.hadoop.hdfs.web.resources.NamenodeRpcAddressParam; import org.apache.hadoop.hdfs.web.resources.PostOpParam; import org.apache.hadoop.security.UserGroupInformation; | import java.io.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.apache.hadoop.hdfs.web.resources.*; import org.apache.hadoop.security.*; | [
"java.io",
"javax.ws",
"org.apache.hadoop"
] | java.io; javax.ws; org.apache.hadoop; | 2,566,772 |
protected String getChannelUID(String channelName, int zone) {
return String.format(PioneerAvrBindingConstants.GROUP_CHANNEL_PATTERN, zone, channelName);
} | String function(String channelName, int zone) { return String.format(PioneerAvrBindingConstants.GROUP_CHANNEL_PATTERN, zone, channelName); } | /**
* Build the channelUID from the channel name and the zone number.
*
* @param channelName
* @param zone
* @return
*/ | Build the channelUID from the channel name and the zone number | getChannelUID | {
"repo_name": "openhab/openhab2",
"path": "bundles/org.openhab.binding.pioneeravr/src/main/java/org/openhab/binding/pioneeravr/internal/handler/AbstractAvrHandler.java",
"license": "epl-1.0",
"size": 15508
} | [
"org.openhab.binding.pioneeravr.internal.PioneerAvrBindingConstants"
] | import org.openhab.binding.pioneeravr.internal.PioneerAvrBindingConstants; | import org.openhab.binding.pioneeravr.internal.*; | [
"org.openhab.binding"
] | org.openhab.binding; | 2,096,036 |
if (a == null || b == null) {
throw new NullPointerException(
"use Taint.State." + INVALID.name() + " instead of null"
);
}
if (a == TAINTED || b == TAINTED) {
return TAINTED;
}
if (a == UNKNOWN || b == UNKNOWN) {
return UNKNOWN;
}
if (a == SAFE || b == SAFE) {
return SAFE;
}
if (a == NULL || b == NULL) {
return NULL;
}
assert a == INVALID && b == INVALID;
return INVALID;
}
}
public enum Tag {
XSS_SAFE,
SQL_INJECTION_SAFE,
COMMAND_INJECTION_SAFE,
LDAP_INJECTION_SAFE,
XPATH_INJECTION_SAFE,
HTTP_POLLUTION_SAFE,
CR_ENCODED,
LF_ENCODED,
QUOTE_ENCODED,
APOSTROPHE_ENCODED,
LT_ENCODED,
SENSITIVE_DATA,
CUSTOM_INJECTION_SAFE,
URL_ENCODED,
PATH_TRAVERSAL_SAFE,
CREDIT_CARD_VARIABLE,
PASSWORD_VARIABLE,
HASH_VARIABLE;
}
private State state;
private static final int INVALID_INDEX = -1;
private int variableIndex;
private final Set<TaintLocation> taintLocations;
private final Set<TaintLocation> unknownLocations;
private final Set<Integer> parameters;
private State nonParametricState;
private ObjectType realInstanceClass;
private final Set<Tag> tags;
private final Set<Tag> tagsToRemove;
private String constantValue;
private String debugInfo = null;
public Taint(State state) {
Objects.requireNonNull(state, "state is null");
if (state == State.INVALID) {
throw new IllegalArgumentException("state not allowed");
}
this.state = state;
this.variableIndex = INVALID_INDEX;
this.unknownLocations = new HashSet<TaintLocation>();
this.taintLocations = new HashSet<TaintLocation>();
this.parameters = new HashSet<Integer>();
this.nonParametricState = State.INVALID;
this.realInstanceClass = null;
this.tags = EnumSet.noneOf(Tag.class);
this.tagsToRemove = EnumSet.noneOf(Tag.class);
this.constantValue = null;
if (FindSecBugsGlobalConfig.getInstance().isDebugTaintState()) {
this.debugInfo = "?";
}
}
public Taint(Taint taint) {
Objects.requireNonNull(taint, "taint is null");
assert taint.state != null;
this.state = taint.state;
this.variableIndex = taint.variableIndex;
this.taintLocations = new HashSet<TaintLocation>(taint.taintLocations);
this.unknownLocations = new HashSet<TaintLocation>(taint.unknownLocations);
this.parameters = new HashSet<Integer>(taint.getParameters());
this.nonParametricState = taint.nonParametricState;
this.realInstanceClass = taint.realInstanceClass;
this.tags = EnumSet.copyOf(taint.tags);
this.tagsToRemove = EnumSet.copyOf(taint.tagsToRemove);
this.constantValue = taint.constantValue;
if (FindSecBugsGlobalConfig.getInstance().isDebugTaintState()) {
this.debugInfo = taint.debugInfo;
}
} | if (a == null b == null) { throw new NullPointerException( STR + INVALID.name() + STR ); } if (a == TAINTED b == TAINTED) { return TAINTED; } if (a == UNKNOWN b == UNKNOWN) { return UNKNOWN; } if (a == SAFE b == SAFE) { return SAFE; } if (a == NULL b == NULL) { return NULL; } assert a == INVALID && b == INVALID; return INVALID; } } public enum Tag { XSS_SAFE, SQL_INJECTION_SAFE, COMMAND_INJECTION_SAFE, LDAP_INJECTION_SAFE, XPATH_INJECTION_SAFE, HTTP_POLLUTION_SAFE, CR_ENCODED, LF_ENCODED, QUOTE_ENCODED, APOSTROPHE_ENCODED, LT_ENCODED, SENSITIVE_DATA, CUSTOM_INJECTION_SAFE, URL_ENCODED, PATH_TRAVERSAL_SAFE, CREDIT_CARD_VARIABLE, PASSWORD_VARIABLE, HASH_VARIABLE; } private State state; private static final int INVALID_INDEX = -1; private int variableIndex; private final Set<TaintLocation> taintLocations; private final Set<TaintLocation> unknownLocations; private final Set<Integer> parameters; private State nonParametricState; private ObjectType realInstanceClass; private final Set<Tag> tags; private final Set<Tag> tagsToRemove; private String constantValue; private String debugInfo = null; public Taint(State state) { Objects.requireNonNull(state, STR); if (state == State.INVALID) { throw new IllegalArgumentException(STR); } this.state = state; this.variableIndex = INVALID_INDEX; this.unknownLocations = new HashSet<TaintLocation>(); this.taintLocations = new HashSet<TaintLocation>(); this.parameters = new HashSet<Integer>(); this.nonParametricState = State.INVALID; this.realInstanceClass = null; this.tags = EnumSet.noneOf(Tag.class); this.tagsToRemove = EnumSet.noneOf(Tag.class); this.constantValue = null; if (FindSecBugsGlobalConfig.getInstance().isDebugTaintState()) { this.debugInfo = "?"; } } public Taint(Taint taint) { Objects.requireNonNull(taint, STR); assert taint.state != null; this.state = taint.state; this.variableIndex = taint.variableIndex; this.taintLocations = new HashSet<TaintLocation>(taint.taintLocations); this.unknownLocations = new HashSet<TaintLocation>(taint.unknownLocations); this.parameters = new HashSet<Integer>(taint.getParameters()); this.nonParametricState = taint.nonParametricState; this.realInstanceClass = taint.realInstanceClass; this.tags = EnumSet.copyOf(taint.tags); this.tagsToRemove = EnumSet.copyOf(taint.tagsToRemove); this.constantValue = taint.constantValue; if (FindSecBugsGlobalConfig.getInstance().isDebugTaintState()) { this.debugInfo = taint.debugInfo; } } | /**
* Returns the "more dangerous" state (TAINTED > UNKNOWN > SAFE
* > NULL > INVALID) as a merge of two states
*
* @param a first state to merge
* @param b second state to merge
* @return one of the values a, b
*/ | Returns the "more dangerous" state (TAINTED > UNKNOWN > SAFE > NULL > INVALID) as a merge of two states | merge | {
"repo_name": "MaxNad/find-sec-bugs",
"path": "plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/Taint.java",
"license": "lgpl-3.0",
"size": 20748
} | [
"com.h3xstream.findsecbugs.FindSecBugsGlobalConfig",
"java.util.EnumSet",
"java.util.HashSet",
"java.util.Objects",
"java.util.Set",
"org.apache.bcel.generic.ObjectType"
] | import com.h3xstream.findsecbugs.FindSecBugsGlobalConfig; import java.util.EnumSet; import java.util.HashSet; import java.util.Objects; import java.util.Set; import org.apache.bcel.generic.ObjectType; | import com.h3xstream.findsecbugs.*; import java.util.*; import org.apache.bcel.generic.*; | [
"com.h3xstream.findsecbugs",
"java.util",
"org.apache.bcel"
] | com.h3xstream.findsecbugs; java.util; org.apache.bcel; | 2,180,570 |
private Table getTable(int tableNumber) {
if (!isReady()) {
throw new IllegalStateException("Database isn't created");
}
if (tableNumber < 0 && tableNumber >= structure.countOfTables()) {
throw new IllegalStateException("No table with this number. Initialization was stopped");
}
long[] startEnd = null;
try {
startEnd = structure.getTableStartEnd(tableNumber);
} catch (IOException e) {
dbLogger.message(e.getMessage());
return null;
}
try {
TableAccess accessor = new TableAccess(raf, startEnd[0], startEnd[1]);
PrimaryIndex primaryIndex = null;
ColumnIndex[] columnIndexes = new ColumnIndex[accessor.getCountOfColumns()];
int[] maxCountOfUniqWordInRecordColumn = this.tableInfos[tableNumber].getMaxCountOfUniqWordInRecordColumn();
for (int i = 0; i < accessor.getCountOfColumns(); i++) {
long[] indexStartEnd = structure.getIndexStartEnd(
getIndexNumberFromTableNumberAndColumnNumber(this.tableInfos, tableNumber, i));
if (accessor.getKeyColumn() == i) {
primaryIndex = new PrimaryIndex(raf, indexStartEnd[0], indexStartEnd[1], accessor, false);
columnIndexes[i] = null;
} else {
columnIndexes[i] = new ColumnIndex(raf, indexStartEnd[0], indexStartEnd[1], accessor, i,
0, maxCountOfUniqWordInRecordColumn[i], false);
if (!columnIndexes[i].isExist()) {
columnIndexes[i] = null;
}
}
}
Table crtTable = new Table(accessor, primaryIndex, columnIndexes);
return crtTable;
} catch (IOException e) {
dbLogger.message(e.getMessage());
return null;
} catch (IllegalStateException estate) {
dbLogger.message(estate.getMessage());
return null;
}
} | Table function(int tableNumber) { if (!isReady()) { throw new IllegalStateException(STR); } if (tableNumber < 0 && tableNumber >= structure.countOfTables()) { throw new IllegalStateException(STR); } long[] startEnd = null; try { startEnd = structure.getTableStartEnd(tableNumber); } catch (IOException e) { dbLogger.message(e.getMessage()); return null; } try { TableAccess accessor = new TableAccess(raf, startEnd[0], startEnd[1]); PrimaryIndex primaryIndex = null; ColumnIndex[] columnIndexes = new ColumnIndex[accessor.getCountOfColumns()]; int[] maxCountOfUniqWordInRecordColumn = this.tableInfos[tableNumber].getMaxCountOfUniqWordInRecordColumn(); for (int i = 0; i < accessor.getCountOfColumns(); i++) { long[] indexStartEnd = structure.getIndexStartEnd( getIndexNumberFromTableNumberAndColumnNumber(this.tableInfos, tableNumber, i)); if (accessor.getKeyColumn() == i) { primaryIndex = new PrimaryIndex(raf, indexStartEnd[0], indexStartEnd[1], accessor, false); columnIndexes[i] = null; } else { columnIndexes[i] = new ColumnIndex(raf, indexStartEnd[0], indexStartEnd[1], accessor, i, 0, maxCountOfUniqWordInRecordColumn[i], false); if (!columnIndexes[i].isExist()) { columnIndexes[i] = null; } } } Table crtTable = new Table(accessor, primaryIndex, columnIndexes); return crtTable; } catch (IOException e) { dbLogger.message(e.getMessage()); return null; } catch (IllegalStateException estate) { dbLogger.message(estate.getMessage()); return null; } } | /**
* Get table by number
*
* @param tableNumber
* @return
*/ | Get table by number | getTable | {
"repo_name": "Shiwin/TwoeekDB",
"path": "src/com/company/database_classes/SimpleDB.java",
"license": "mit",
"size": 22590
} | [
"com.company.file_access.TableAccess",
"java.io.IOException"
] | import com.company.file_access.TableAccess; import java.io.IOException; | import com.company.file_access.*; import java.io.*; | [
"com.company.file_access",
"java.io"
] | com.company.file_access; java.io; | 1,793,835 |
public static State getOneAgentOneLocationState(Domain d){
State s = new State();
s.addObject(new ObjectInstance(d.getObjectClass(CLASSLOCATION), CLASSLOCATION+0));
s.addObject(new ObjectInstance(d.getObjectClass(CLASSAGENT), CLASSAGENT+0));
return s;
}
| static State function(Domain d){ State s = new State(); s.addObject(new ObjectInstance(d.getObjectClass(CLASSLOCATION), CLASSLOCATION+0)); s.addObject(new ObjectInstance(d.getObjectClass(CLASSAGENT), CLASSAGENT+0)); return s; } | /**
* Will return a state object with a single agent object and a single location object
* @param d the domain object that is used to specify the min/max dimensions
* @return a state object with a single agent object and a single location object
*/ | Will return a state object with a single agent object and a single location object | getOneAgentOneLocationState | {
"repo_name": "jmacglashan/affordances_code",
"path": "src/burlap/domain/singleagent/gridworld/GridWorldDomain.java",
"license": "lgpl-3.0",
"size": 28689
} | [
"burlap.oomdp.core.Domain",
"burlap.oomdp.core.ObjectInstance",
"burlap.oomdp.core.State"
] | import burlap.oomdp.core.Domain; import burlap.oomdp.core.ObjectInstance; import burlap.oomdp.core.State; | import burlap.oomdp.core.*; | [
"burlap.oomdp.core"
] | burlap.oomdp.core; | 512,026 |
@Test
public void testIteratorFunctionality () throws IOException
{
final ICommonsList <ICommonsList <String>> expectedResult = new CommonsArrayList <> ();
expectedResult.add (CollectionHelper.newList ("a", "b", "aReader"));
expectedResult.add (CollectionHelper.newList ("a", "b,b,b", "aReader"));
expectedResult.add (CollectionHelper.newList ("", "", ""));
expectedResult.add (CollectionHelper.newList ("a", "PO Box 123,\nKippax,ACT. 2615.\nAustralia", "d."));
expectedResult.add (CollectionHelper.newList ("Glen \"The Man\" Smith", "Athlete", "Developer"));
expectedResult.add (CollectionHelper.newList ("\"\"", "test"));
expectedResult.add (CollectionHelper.newList ("a\nb", "b", "\nd", "e"));
int idx = 0;
try (final CSVReader aReader = _createCSVReader ())
{
for (final ICommonsList <String> line : aReader)
{
final ICommonsList <String> expectedLine = expectedResult.get (idx++);
assertEquals (expectedLine, line);
}
}
} | void function () throws IOException { final ICommonsList <ICommonsList <String>> expectedResult = new CommonsArrayList <> (); expectedResult.add (CollectionHelper.newList ("aSTRb", STR)); expectedResult.add (CollectionHelper.newList ("aSTRb,b,b", STR)); expectedResult.add (CollectionHelper.newList (STRSTRSTRaSTRPO Box 123,\nKippax,ACT. 2615.\nAustraliaSTRd.STRGlen \STR SmithSTRAthleteSTRDeveloperSTR\"\STRtestSTRa\nbSTRbSTR\ndSTRe")); int idx = 0; try (final CSVReader aReader = _createCSVReader ()) { for (final ICommonsList <String> line : aReader) { final ICommonsList <String> expectedLine = expectedResult.get (idx++); assertEquals (expectedLine, line); } } } | /**
* Tests iterating over a reader.
*
* @throws IOException
* if the reader fails.
*/ | Tests iterating over a reader | testIteratorFunctionality | {
"repo_name": "phax/ph-commons",
"path": "ph-commons/src/test/java/com/helger/commons/csv/CSVReaderTest.java",
"license": "apache-2.0",
"size": 21951
} | [
"com.helger.commons.collection.CollectionHelper",
"com.helger.commons.collection.impl.CommonsArrayList",
"com.helger.commons.collection.impl.ICommonsList",
"java.io.IOException"
] | import com.helger.commons.collection.CollectionHelper; import com.helger.commons.collection.impl.CommonsArrayList; import com.helger.commons.collection.impl.ICommonsList; import java.io.IOException; | import com.helger.commons.collection.*; import com.helger.commons.collection.impl.*; import java.io.*; | [
"com.helger.commons",
"java.io"
] | com.helger.commons; java.io; | 2,753,379 |
Map<String, Long> tableCounts = managementService.getTableCount();
CloseableHttpResponse response = executeRequest(new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_TABLES_COLLECTION)),
HttpStatus.SC_OK);
// Check table array
JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent());
closeResponse(response);
assertThat(responseNode).isNotNull();
assertThat(responseNode.isArray()).isTrue();
assertThat(responseNode).hasSize(tableCounts.size());
for (int i = 0; i < responseNode.size(); i++) {
ObjectNode table = (ObjectNode) responseNode.get(i);
assertThat(table.get("name").textValue()).isNotNull();
assertThat(table.get("count").longValue()).isNotNull();
assertThat(table.get("url").textValue()).endsWith(RestUrls.createRelativeResourceUrl(RestUrls.URL_TABLE, table.get("name").textValue()));
assertThat(table.get("count").longValue()).isEqualTo(tableCounts.get(table.get("name").textValue()).longValue());
}
}
/**
* Test getting a single table. GET management/tables/{tableName} | Map<String, Long> tableCounts = managementService.getTableCount(); CloseableHttpResponse response = executeRequest(new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_TABLES_COLLECTION)), HttpStatus.SC_OK); JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent()); closeResponse(response); assertThat(responseNode).isNotNull(); assertThat(responseNode.isArray()).isTrue(); assertThat(responseNode).hasSize(tableCounts.size()); for (int i = 0; i < responseNode.size(); i++) { ObjectNode table = (ObjectNode) responseNode.get(i); assertThat(table.get("name").textValue()).isNotNull(); assertThat(table.get("count").longValue()).isNotNull(); assertThat(table.get("url").textValue()).endsWith(RestUrls.createRelativeResourceUrl(RestUrls.URL_TABLE, table.get("name").textValue())); assertThat(table.get("count").longValue()).isEqualTo(tableCounts.get(table.get("name").textValue()).longValue()); } } /** * Test getting a single table. GET management/tables/{tableName} | /**
* Test getting tables. GET management/tables
*/ | Test getting tables. GET management/tables | testGetTables | {
"repo_name": "dbmalkovsky/flowable-engine",
"path": "modules/flowable-rest/src/test/java/org/flowable/rest/service/api/management/TableResourceTest.java",
"license": "apache-2.0",
"size": 3909
} | [
"com.fasterxml.jackson.databind.JsonNode",
"com.fasterxml.jackson.databind.node.ObjectNode",
"java.util.Map",
"org.apache.http.HttpStatus",
"org.apache.http.client.methods.CloseableHttpResponse",
"org.apache.http.client.methods.HttpGet",
"org.assertj.core.api.Assertions",
"org.flowable.rest.service.api.RestUrls",
"org.junit.Test"
] | import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import java.util.Map; import org.apache.http.HttpStatus; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.assertj.core.api.Assertions; import org.flowable.rest.service.api.RestUrls; import org.junit.Test; | import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.node.*; import java.util.*; import org.apache.http.*; import org.apache.http.client.methods.*; import org.assertj.core.api.*; import org.flowable.rest.service.api.*; import org.junit.*; | [
"com.fasterxml.jackson",
"java.util",
"org.apache.http",
"org.assertj.core",
"org.flowable.rest",
"org.junit"
] | com.fasterxml.jackson; java.util; org.apache.http; org.assertj.core; org.flowable.rest; org.junit; | 1,974,773 |
private void restoreFile() throws IOException{
File dir = new File(_bs.getRestoresDir() + File.separator + _fileId.toString());
if (!dir.exists()){
throw new NoSuchFileException("Couldn't find directory '" + dir.getAbsolutePath() + "'."); //first chunk is missing
}
//get all chunk files from directory in lexicographical order
File[] fileListing = getSortedChunks(dir);
//ensure all chunks are available and valid, if not, throw exception
validateChunks(fileListing);
//create destination file and append all chunks to it
writeChunksToFile(fileListing);
FileSystemUtils.deleteFile(dir);
} | void function() throws IOException{ File dir = new File(_bs.getRestoresDir() + File.separator + _fileId.toString()); if (!dir.exists()){ throw new NoSuchFileException(STR + dir.getAbsolutePath() + "'."); } File[] fileListing = getSortedChunks(dir); validateChunks(fileListing); writeChunksToFile(fileListing); FileSystemUtils.deleteFile(dir); } | /**
* Attempts to restore the file by reading chunks in the directory "restores/{fileHexId}"
*
* If any chunks are invalid/missing, throws a NoSuchFileException with the number of the first invalid chunk.
*
* Throws an IOException in case of other generic errors handling files.
* @throws IOException
*/ | Attempts to restore the file by reading chunks in the directory "restores/{fileHexId}" If any chunks are invalid/missing, throws a NoSuchFileException with the number of the first invalid chunk. Throws an IOException in case of other generic errors handling files | restoreFile | {
"repo_name": "migulorama/feup-sdis-2014",
"path": "src/pt/up/fe/sdis/proj1/protocols/initiator/FileRestore.java",
"license": "mit",
"size": 5617
} | [
"java.io.File",
"java.io.IOException",
"java.nio.file.NoSuchFileException",
"pt.up.fe.sdis.proj1.utils.FileSystemUtils"
] | import java.io.File; import java.io.IOException; import java.nio.file.NoSuchFileException; import pt.up.fe.sdis.proj1.utils.FileSystemUtils; | import java.io.*; import java.nio.file.*; import pt.up.fe.sdis.proj1.utils.*; | [
"java.io",
"java.nio",
"pt.up.fe"
] | java.io; java.nio; pt.up.fe; | 2,759,341 |
@GET
@NoCache
@Produces(MediaType.APPLICATION_JSON)
@Path("default-default-client-scopes")
public Stream<ClientScopeRepresentation> getDefaultDefaultClientScopes() {
return getDefaultClientScopes(true);
} | @Produces(MediaType.APPLICATION_JSON) @Path(STR) Stream<ClientScopeRepresentation> function() { return getDefaultClientScopes(true); } | /**
* Get realm default client scopes. Only name and ids are returned.
*
* @return
*/ | Get realm default client scopes. Only name and ids are returned | getDefaultDefaultClientScopes | {
"repo_name": "keycloak/keycloak",
"path": "services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java",
"license": "apache-2.0",
"size": 45553
} | [
"java.util.stream.Stream",
"javax.ws.rs.Path",
"javax.ws.rs.Produces",
"javax.ws.rs.core.MediaType",
"org.keycloak.representations.idm.ClientScopeRepresentation"
] | import java.util.stream.Stream; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.keycloak.representations.idm.ClientScopeRepresentation; | import java.util.stream.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.keycloak.representations.idm.*; | [
"java.util",
"javax.ws",
"org.keycloak.representations"
] | java.util; javax.ws; org.keycloak.representations; | 2,235,106 |
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<AgentPoolAvailableVersionsInner> getAvailableAgentPoolVersionsWithResponse(
String resourceGroupName, String resourceName, Context context) {
return getAvailableAgentPoolVersionsWithResponseAsync(resourceGroupName, resourceName, context).block();
} | @ServiceMethod(returns = ReturnType.SINGLE) Response<AgentPoolAvailableVersionsInner> function( String resourceGroupName, String resourceName, Context context) { return getAvailableAgentPoolVersionsWithResponseAsync(resourceGroupName, resourceName, context).block(); } | /**
* See [supported Kubernetes versions](https://docs.microsoft.com/azure/aks/supported-kubernetes-versions) for more
* details about the version lifecycle.
*
* @param resourceGroupName The name of the resource group.
* @param resourceName The name of the managed cluster resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of available versions for an agent pool along with {@link Response}.
*/ | See [supported Kubernetes versions](HREF) for more details about the version lifecycle | getAvailableAgentPoolVersionsWithResponse | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-containerservice/src/main/java/com/azure/resourcemanager/containerservice/implementation/AgentPoolsClientImpl.java",
"license": "mit",
"size": 90812
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context",
"com.azure.resourcemanager.containerservice.fluent.models.AgentPoolAvailableVersionsInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolAvailableVersionsInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.containerservice.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,152,824 |
private static ByteSizeValue thresholdBytesFromWatermark(String watermark, String settingName, boolean lenient) {
try {
return ByteSizeValue.parseBytesSizeValue(watermark, settingName);
} catch (ElasticsearchParseException ex) {
// NOTE: this is not end-user leniency, since up above we check that it's a valid byte or percentage, and then store the two
// cases separately
if (lenient) {
return ByteSizeValue.parseBytesSizeValue("0b", settingName);
}
throw ex;
}
} | static ByteSizeValue function(String watermark, String settingName, boolean lenient) { try { return ByteSizeValue.parseBytesSizeValue(watermark, settingName); } catch (ElasticsearchParseException ex) { if (lenient) { return ByteSizeValue.parseBytesSizeValue("0b", settingName); } throw ex; } } | /**
* Attempts to parse the watermark into a {@link ByteSizeValue}, returning zero bytes if it can not be parsed and the specified lenient
* parameter is true, otherwise throwing an {@link ElasticsearchParseException}.
*
* @param watermark the watermark to parse as a byte size
* @param settingName the name of the setting
* @param lenient true if lenient parsing should be applied
* @return the parsed byte size value
*/ | Attempts to parse the watermark into a <code>ByteSizeValue</code>, returning zero bytes if it can not be parsed and the specified lenient parameter is true, otherwise throwing an <code>ElasticsearchParseException</code> | thresholdBytesFromWatermark | {
"repo_name": "coding0011/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/cluster/routing/allocation/DiskThresholdSettings.java",
"license": "apache-2.0",
"size": 17188
} | [
"org.elasticsearch.ElasticsearchParseException",
"org.elasticsearch.common.unit.ByteSizeValue"
] | import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.unit.ByteSizeValue; | import org.elasticsearch.*; import org.elasticsearch.common.unit.*; | [
"org.elasticsearch",
"org.elasticsearch.common"
] | org.elasticsearch; org.elasticsearch.common; | 2,530,225 |
public void assertKeys(final int[] keys, final AbstractNode<?> node) {
// // verify the capacity of the keys[] on the node.
// assertEquals("keys[] capacity", (node.maxKeys + 1) * stride,
// actualKeys.length);
final int nkeys = keys.length;
// verify the #of defined keys.
assertEquals("nkeys", nkeys, node.getKeyCount());
// verify ordered values for the defined keys.
for (int i = 0; i < nkeys; i++) {
final byte[] expectedKey = keyBuilder.reset().append(keys[i]).getKey();
final byte[] actualKey = node.getKeys().get(i);
if(BytesUtil.compareBytes(expectedKey, actualKey)!=0) {
fail("keys[" + i + "]: expected="
+ BytesUtil.toString(expectedKey) + ", actual="
+ BytesUtil.toString(actualKey));
}
}
// // verify the undefined keys are all NEGINF.
// for (int i = nkeys * stride; i < actualKeys.length; i++) {
//
// assertEquals("keys[" + i + "]", (byte) 0, actualKeys[i]);
//
// }
} | void function(final int[] keys, final AbstractNode<?> node) { final int nkeys = keys.length; assertEquals("nkeys", nkeys, node.getKeyCount()); for (int i = 0; i < nkeys; i++) { final byte[] expectedKey = keyBuilder.reset().append(keys[i]).getKey(); final byte[] actualKey = node.getKeys().get(i); if(BytesUtil.compareBytes(expectedKey, actualKey)!=0) { fail("keys[" + i + STR + BytesUtil.toString(expectedKey) + STR + BytesUtil.toString(actualKey)); } } } | /**
* Test helper provides backwards compatibility for a large #of tests that
* were written with <code>int</code> keys. Each key is encoded by the
* {@link KeyBuilder} before comparison with the key at the corresponding
* index in the node.
*
* @param keys
* An array of the defined <code>int</code> keys.
* @param node
* The node whose keys will be tested.
*/ | Test helper provides backwards compatibility for a large #of tests that were written with <code>int</code> keys. Each key is encoded by the <code>KeyBuilder</code> before comparison with the key at the corresponding index in the node | assertKeys | {
"repo_name": "blazegraph/database",
"path": "bigdata-core-test/bigdata/src/test/com/bigdata/btree/AbstractBTreeTestCase.java",
"license": "gpl-2.0",
"size": 88098
} | [
"com.bigdata.util.BytesUtil"
] | import com.bigdata.util.BytesUtil; | import com.bigdata.util.*; | [
"com.bigdata.util"
] | com.bigdata.util; | 1,547,994 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.