method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
private EmrMasterSecurityGroup createEmrClusterMasterGroupFromRequest(String namespaceCd, String clusterDefinitionName, String clusterName,
List<String> groupIds)
{
// Create the EMR cluster.
EmrMasterSecurityGroup emrMasterSecurityGroup = new EmrMasterSecurityGroup();
emrMasterSecurityGroup.setNamespace(namespaceCd);
emrMasterSecurityGroup.setEmrClusterDefinitionName(clusterDefinitionName);
emrMasterSecurityGroup.setEmrClusterName(clusterName);
emrMasterSecurityGroup.setSecurityGroupIds(groupIds);
return emrMasterSecurityGroup;
} | EmrMasterSecurityGroup function(String namespaceCd, String clusterDefinitionName, String clusterName, List<String> groupIds) { EmrMasterSecurityGroup emrMasterSecurityGroup = new EmrMasterSecurityGroup(); emrMasterSecurityGroup.setNamespace(namespaceCd); emrMasterSecurityGroup.setEmrClusterDefinitionName(clusterDefinitionName); emrMasterSecurityGroup.setEmrClusterName(clusterName); emrMasterSecurityGroup.setSecurityGroupIds(groupIds); return emrMasterSecurityGroup; } | /**
* Creates a new EMR master group object from request.
*
* @param namespaceCd, the namespace Code
* @param clusterDefinitionName, the cluster definition name
* @param clusterName, the cluster name
* @param groupIds, the List of groupId
*
* @return the created EMR master group object
*/ | Creates a new EMR master group object from request | createEmrClusterMasterGroupFromRequest | {
"repo_name": "seoj/herd",
"path": "herd-code/herd-service/src/main/java/org/finra/herd/service/impl/EmrServiceImpl.java",
"license": "apache-2.0",
"size": 55398
} | [
"java.util.List",
"org.finra.herd.model.api.xml.EmrMasterSecurityGroup"
] | import java.util.List; import org.finra.herd.model.api.xml.EmrMasterSecurityGroup; | import java.util.*; import org.finra.herd.model.api.xml.*; | [
"java.util",
"org.finra.herd"
] | java.util; org.finra.herd; | 2,631,806 |
private void checkPatternNameUniqueness() {
// make sure there is no pattern with name "$endState$"
stateNameHandler.checkNameUniqueness(ENDING_STATE_NAME);
Pattern patternToCheck = currentPattern;
while (patternToCheck != null) {
checkPatternNameUniqueness(patternToCheck);
patternToCheck = patternToCheck.getPrevious();
}
stateNameHandler.clear();
} | void function() { stateNameHandler.checkNameUniqueness(ENDING_STATE_NAME); Pattern patternToCheck = currentPattern; while (patternToCheck != null) { checkPatternNameUniqueness(patternToCheck); patternToCheck = patternToCheck.getPrevious(); } stateNameHandler.clear(); } | /**
* Check if there are duplicate pattern names. If yes, it
* throws a {@link MalformedPatternException}.
*/ | Check if there are duplicate pattern names. If yes, it throws a <code>MalformedPatternException</code> | checkPatternNameUniqueness | {
"repo_name": "zhangminglei/flink",
"path": "flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/compiler/NFACompiler.java",
"license": "apache-2.0",
"size": 34981
} | [
"org.apache.flink.cep.pattern.Pattern"
] | import org.apache.flink.cep.pattern.Pattern; | import org.apache.flink.cep.pattern.*; | [
"org.apache.flink"
] | org.apache.flink; | 754,472 |
public AffineTransform getAffineTransform() {
return getAffineTransform(mValues);
} | AffineTransform function() { return getAffineTransform(mValues); } | /**
* Returns an {@link AffineTransform} matching the matrix.
*/ | Returns an <code>AffineTransform</code> matching the matrix | getAffineTransform | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "frameworks/base/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java",
"license": "gpl-3.0",
"size": 33948
} | [
"java.awt.geom.AffineTransform"
] | import java.awt.geom.AffineTransform; | import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 1,551,700 |
private void tweakTreeBorder(AbstractSourceTree tree) {
Border treeBorder = tree.getBorder();
if (treeBorder==null) {
treeBorder = BorderFactory.createEmptyBorder(2, 0, 0, 0);
tree.setBorder(treeBorder);
}
else if (treeBorder instanceof EmptyBorder &&
((EmptyBorder)treeBorder).getBorderInsets().top==0) {
treeBorder = BorderFactory.createCompoundBorder(
BorderFactory.createEmptyBorder(2, 0, 0, 0), treeBorder);
tree.setBorder(treeBorder);
}
}
private class Listener extends MouseAdapter implements WindowFocusListener,
ComponentListener, DocumentListener, ActionListener, KeyListener { | void function(AbstractSourceTree tree) { Border treeBorder = tree.getBorder(); if (treeBorder==null) { treeBorder = BorderFactory.createEmptyBorder(2, 0, 0, 0); tree.setBorder(treeBorder); } else if (treeBorder instanceof EmptyBorder && ((EmptyBorder)treeBorder).getBorderInsets().top==0) { treeBorder = BorderFactory.createCompoundBorder( BorderFactory.createEmptyBorder(2, 0, 0, 0), treeBorder); tree.setBorder(treeBorder); } } private class Listener extends MouseAdapter implements WindowFocusListener, ComponentListener, DocumentListener, ActionListener, KeyListener { | /**
* Ensures the tree has a very small empty border at the top, to make
* things look a little nicer.
*
* @param tree The tree whose border should be examined.
*/ | Ensures the tree has a very small empty border at the top, to make things look a little nicer | tweakTreeBorder | {
"repo_name": "ZenHarbinger/RSTALanguageSupport",
"path": "src/main/java/org/fife/rsta/ac/GoToMemberWindow.java",
"license": "bsd-3-clause",
"size": 7749
} | [
"java.awt.event.ActionListener",
"java.awt.event.ComponentListener",
"java.awt.event.KeyListener",
"java.awt.event.MouseAdapter",
"java.awt.event.WindowFocusListener",
"javax.swing.BorderFactory",
"javax.swing.border.Border",
"javax.swing.border.EmptyBorder",
"javax.swing.event.DocumentListener"
] | import java.awt.event.ActionListener; import java.awt.event.ComponentListener; import java.awt.event.KeyListener; import java.awt.event.MouseAdapter; import java.awt.event.WindowFocusListener; import javax.swing.BorderFactory; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; import javax.swing.event.DocumentListener; | import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.event.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 2,841,682 |
public FormValidation doCheckControllerPollingInterval(@QueryParameter String value) {
if (StringUtils.isEmpty(value)) {
return FormValidation.ok();
}
if (!StringUtils.isNumeric(value)) {
return FormValidation.error("Controller Polling Interval must be a number");
}
return FormValidation.ok();
} | FormValidation function(@QueryParameter String value) { if (StringUtils.isEmpty(value)) { return FormValidation.ok(); } if (!StringUtils.isNumeric(value)) { return FormValidation.error(STR); } return FormValidation.ok(); } | /**
* Do check controller polling interval form validation.
*
* @param value the value
* @return the form validation
*/ | Do check controller polling interval form validation | doCheckControllerPollingInterval | {
"repo_name": "hpsa/hpe-application-automation-tools-plugin",
"path": "src/main/java/com/hp/application/automation/tools/run/RunFromFileBuilder.java",
"license": "mit",
"size": 21546
} | [
"hudson.util.FormValidation",
"org.apache.commons.lang.StringUtils",
"org.kohsuke.stapler.QueryParameter"
] | import hudson.util.FormValidation; import org.apache.commons.lang.StringUtils; import org.kohsuke.stapler.QueryParameter; | import hudson.util.*; import org.apache.commons.lang.*; import org.kohsuke.stapler.*; | [
"hudson.util",
"org.apache.commons",
"org.kohsuke.stapler"
] | hudson.util; org.apache.commons; org.kohsuke.stapler; | 323,119 |
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<MicrosoftGraphDelegatedPermissionClassificationInner> createDelegatedPermissionClassificationsAsync(
String servicePrincipalId, MicrosoftGraphDelegatedPermissionClassificationInner body); | @ServiceMethod(returns = ReturnType.SINGLE) Mono<MicrosoftGraphDelegatedPermissionClassificationInner> createDelegatedPermissionClassificationsAsync( String servicePrincipalId, MicrosoftGraphDelegatedPermissionClassificationInner body); | /**
* Create new navigation property to delegatedPermissionClassifications for servicePrincipals.
*
* @param servicePrincipalId key: id of servicePrincipal.
* @param body New navigation property.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return delegatedPermissionClassification.
*/ | Create new navigation property to delegatedPermissionClassifications for servicePrincipals | createDelegatedPermissionClassificationsAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-authorization/src/main/java/com/azure/resourcemanager/authorization/fluent/ServicePrincipalsClient.java",
"license": "mit",
"size": 228379
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.authorization.fluent.models.MicrosoftGraphDelegatedPermissionClassificationInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.authorization.fluent.models.MicrosoftGraphDelegatedPermissionClassificationInner; | import com.azure.core.annotation.*; import com.azure.resourcemanager.authorization.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 107,145 |
public void setExtdirs(Path path) {
cmd.createArgument().setValue("-extdirs");
cmd.createArgument().setPath(path);
} | void function(Path path) { cmd.createArgument().setValue(STR); cmd.createArgument().setPath(path); } | /**
* Set the location of the extensions directories.
*
* @param path a path containing the extension directories.
*/ | Set the location of the extensions directories | setExtdirs | {
"repo_name": "Mayo-WE01051879/mayosapp",
"path": "Build/src/main/org/apache/tools/ant/taskdefs/Javadoc.java",
"license": "mit",
"size": 84218
} | [
"org.apache.tools.ant.types.Path"
] | import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.*; | [
"org.apache.tools"
] | org.apache.tools; | 719,815 |
void enterLogicalOrExpression(@NotNull ECMAScriptParser.LogicalOrExpressionContext ctx);
void exitLogicalOrExpression(@NotNull ECMAScriptParser.LogicalOrExpressionContext ctx); | void enterLogicalOrExpression(@NotNull ECMAScriptParser.LogicalOrExpressionContext ctx); void exitLogicalOrExpression(@NotNull ECMAScriptParser.LogicalOrExpressionContext ctx); | /**
* Exit a parse tree produced by {@link ECMAScriptParser#LogicalOrExpression}.
* @param ctx the parse tree
*/ | Exit a parse tree produced by <code>ECMAScriptParser#LogicalOrExpression</code> | exitLogicalOrExpression | {
"repo_name": "IsThisThePayneResidence/intellidots",
"path": "src/main/java/ua/edu/hneu/ast/parsers/ECMAScriptListener.java",
"license": "gpl-3.0",
"size": 39591
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 44,134 |
String description;
Method method;
try {
method = option.getToolTipMethod();
description = (String) method.invoke(option.getOptionHandler(), new Object[0]);
}
catch (Exception e) {
description = "-none-";
}
parent.addRow(new String[]{
"Description",
description
});
} | String description; Method method; try { method = option.getToolTipMethod(); description = (String) method.invoke(option.getOptionHandler(), new Object[0]); } catch (Exception e) { description = STR; } parent.addRow(new String[]{ STR, description }); } | /**
* Adds the description of the option as row.
*
* @param parent the table to add to
* @param option the option to use
*/ | Adds the description of the option as row | addDescription | {
"repo_name": "automenta/adams-core",
"path": "src/main/java/adams/core/option/DocBookProducer.java",
"license": "gpl-3.0",
"size": 15389
} | [
"java.lang.reflect.Method"
] | import java.lang.reflect.Method; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 1,839,996 |
public void addParameter(String name, String value) {
queryParams.add(new BasicNameValuePair(name, value));
}
| void function(String name, String value) { queryParams.add(new BasicNameValuePair(name, value)); } | /**
* Adds a parameter to the request's query string. This method does not do
* duplicate detection. Adding a parameter more than once will result in a
* query string with a duplicated parameter.
*
* @param name
* The name of the parameter to add
* @param value
* The value to associate with the parameter */ | Adds a parameter to the request's query string. This method does not do duplicate detection. Adding a parameter more than once will result in a query string with a duplicated parameter | addParameter | {
"repo_name": "almajeas/RHITMobile-Android",
"path": "src/RHITMobile/src/edu/rosehulman/android/directory/service/RestClient.java",
"license": "apache-2.0",
"size": 3551
} | [
"org.apache.http.message.BasicNameValuePair"
] | import org.apache.http.message.BasicNameValuePair; | import org.apache.http.message.*; | [
"org.apache.http"
] | org.apache.http; | 377,594 |
@Test
public void testIotProviderCloseApplicationDirect() throws Exception {
IotProvider provider = new IotProvider(EchoIotDevice::new);
assertSame(provider.getApplicationService(),
provider.getServices().getService(ApplicationService.class));
provider.start();
IotTestApps.registerApplications(provider);
// Create a Submit AppOne request
JsonObject submitAppOne = IotAppServiceIT.newSubmitRequest("AppOne");
// Create an application that sends a device event
// with the submit job command, and this will be echoed
// back as the command that Edgent will detect and pick
// up to start the application.
Topology submitter = provider.newTopology();
TStream<JsonObject> cmds = submitter.of(submitAppOne);
IotDevice publishedDevice = IotDevicePubSub.addIotDevice(submitter);
publishedDevice.events(cmds, Commands.CONTROL_SERVICE, 0);
Job appStarter = provider.submit(submitter).get();
ControlService cs = provider.getServices().getService(ControlService.class);
assertTrue(cs instanceof JsonControlService);
JsonControlService jsc = (JsonControlService) cs;
JobMXBean jobMbean;
do {
Thread.sleep(100);
jobMbean = cs.getControl(JobMXBean.TYPE, "AppOne", JobMXBean.class);
} while (jobMbean == null);
assertEquals("AppOne", jobMbean.getName());
// Now close the job
JsonObject closeJob = new JsonObject();
closeJob.addProperty(JsonControlService.TYPE_KEY, JobMXBean.TYPE);
closeJob.addProperty(JsonControlService.ALIAS_KEY, "AppOne");
JsonArray args = new JsonArray();
args.add(new JsonPrimitive(Action.CLOSE.name()));
closeJob.addProperty(JsonControlService.OP_KEY, "stateChange");
closeJob.add(JsonControlService.ARGS_KEY, args);
assertEquals(Job.State.RUNNING, appStarter.getCurrentState());
assertEquals(Job.State.RUNNING, jobMbean.getCurrentState());
jsc.controlRequest(closeJob);
// Wait for the job to complete
for (int i = 0; i < 30; i++) {
Thread.sleep(100);
if (jobMbean.getCurrentState() == Job.State.CLOSED)
break;
}
assertEquals(Job.State.CLOSED, jobMbean.getCurrentState());
// Wait for the associated control to be released
Thread.sleep(1000 * (Controls.JOB_HOLD_AFTER_CLOSE_SECS + 1));
jobMbean = cs.getControl(JobMXBean.TYPE, "AppOne", JobMXBean.class);
assertNull(jobMbean);
appStarter.stateChange(Action.CLOSE);
} | void function() throws Exception { IotProvider provider = new IotProvider(EchoIotDevice::new); assertSame(provider.getApplicationService(), provider.getServices().getService(ApplicationService.class)); provider.start(); IotTestApps.registerApplications(provider); JsonObject submitAppOne = IotAppServiceIT.newSubmitRequest(STR); Topology submitter = provider.newTopology(); TStream<JsonObject> cmds = submitter.of(submitAppOne); IotDevice publishedDevice = IotDevicePubSub.addIotDevice(submitter); publishedDevice.events(cmds, Commands.CONTROL_SERVICE, 0); Job appStarter = provider.submit(submitter).get(); ControlService cs = provider.getServices().getService(ControlService.class); assertTrue(cs instanceof JsonControlService); JsonControlService jsc = (JsonControlService) cs; JobMXBean jobMbean; do { Thread.sleep(100); jobMbean = cs.getControl(JobMXBean.TYPE, STR, JobMXBean.class); } while (jobMbean == null); assertEquals(STR, jobMbean.getName()); JsonObject closeJob = new JsonObject(); closeJob.addProperty(JsonControlService.TYPE_KEY, JobMXBean.TYPE); closeJob.addProperty(JsonControlService.ALIAS_KEY, STR); JsonArray args = new JsonArray(); args.add(new JsonPrimitive(Action.CLOSE.name())); closeJob.addProperty(JsonControlService.OP_KEY, STR); closeJob.add(JsonControlService.ARGS_KEY, args); assertEquals(Job.State.RUNNING, appStarter.getCurrentState()); assertEquals(Job.State.RUNNING, jobMbean.getCurrentState()); jsc.controlRequest(closeJob); for (int i = 0; i < 30; i++) { Thread.sleep(100); if (jobMbean.getCurrentState() == Job.State.CLOSED) break; } assertEquals(Job.State.CLOSED, jobMbean.getCurrentState()); Thread.sleep(1000 * (Controls.JOB_HOLD_AFTER_CLOSE_SECS + 1)); jobMbean = cs.getControl(JobMXBean.TYPE, STR, JobMXBean.class); assertNull(jobMbean); appStarter.stateChange(Action.CLOSE); } | /**
* Basic test we can stop applications
* @throws Exception on failure
*/ | Basic test we can stop applications | testIotProviderCloseApplicationDirect | {
"repo_name": "queeniema/incubator-edgent",
"path": "test/fvtiot/src/test/java/org/apache/edgent/test/fvt/iot/IotProviderIT.java",
"license": "apache-2.0",
"size": 10007
} | [
"com.google.gson.JsonArray",
"com.google.gson.JsonObject",
"com.google.gson.JsonPrimitive",
"org.apache.edgent.apps.iot.IotDevicePubSub",
"org.apache.edgent.connectors.iot.Commands",
"org.apache.edgent.connectors.iot.IotDevice",
"org.apache.edgent.execution.Job",
"org.apache.edgent.execution.mbeans.JobMXBean",
"org.apache.edgent.execution.services.ControlService",
"org.apache.edgent.execution.services.Controls",
"org.apache.edgent.providers.iot.IotProvider",
"org.apache.edgent.runtime.jsoncontrol.JsonControlService",
"org.apache.edgent.test.apps.iot.EchoIotDevice",
"org.apache.edgent.topology.TStream",
"org.apache.edgent.topology.Topology",
"org.apache.edgent.topology.services.ApplicationService",
"org.junit.Assert"
] | import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import org.apache.edgent.apps.iot.IotDevicePubSub; import org.apache.edgent.connectors.iot.Commands; import org.apache.edgent.connectors.iot.IotDevice; import org.apache.edgent.execution.Job; import org.apache.edgent.execution.mbeans.JobMXBean; import org.apache.edgent.execution.services.ControlService; import org.apache.edgent.execution.services.Controls; import org.apache.edgent.providers.iot.IotProvider; import org.apache.edgent.runtime.jsoncontrol.JsonControlService; import org.apache.edgent.test.apps.iot.EchoIotDevice; import org.apache.edgent.topology.TStream; import org.apache.edgent.topology.Topology; import org.apache.edgent.topology.services.ApplicationService; import org.junit.Assert; | import com.google.gson.*; import org.apache.edgent.apps.iot.*; import org.apache.edgent.connectors.iot.*; import org.apache.edgent.execution.*; import org.apache.edgent.execution.mbeans.*; import org.apache.edgent.execution.services.*; import org.apache.edgent.providers.iot.*; import org.apache.edgent.runtime.jsoncontrol.*; import org.apache.edgent.test.apps.iot.*; import org.apache.edgent.topology.*; import org.apache.edgent.topology.services.*; import org.junit.*; | [
"com.google.gson",
"org.apache.edgent",
"org.junit"
] | com.google.gson; org.apache.edgent; org.junit; | 376,262 |
@Test
public void nullCallback() throws Exception {
mThrown.expect(UnsupportedCallbackException.class);
mThrown.expectMessage(null + " is unsupported.");
Callback[] callbacks = new Callback[3];
callbacks[0] = new NameCallback("Username:");
callbacks[1] = new PasswordCallback("Password:", true);
callbacks[2] = null;
String user = "alluxio-user-5";
String password = "alluxio-user-5-password";
CallbackHandler clientCBHandler =
new PlainSaslClientCallbackHandler(user, password);
clientCBHandler.handle(callbacks);
} | void function() throws Exception { mThrown.expect(UnsupportedCallbackException.class); mThrown.expectMessage(null + STR); Callback[] callbacks = new Callback[3]; callbacks[0] = new NameCallback(STR); callbacks[1] = new PasswordCallback(STR, true); callbacks[2] = null; String user = STR; String password = STR; CallbackHandler clientCBHandler = new PlainSaslClientCallbackHandler(user, password); clientCBHandler.handle(callbacks); } | /**
* Tests that an exception is thrown when a callback is {@code null}.
*/ | Tests that an exception is thrown when a callback is null | nullCallback | {
"repo_name": "ShailShah/alluxio",
"path": "core/common/src/test/java/alluxio/security/authentication/PlainSaslClientCallbackHandlerTest.java",
"license": "apache-2.0",
"size": 4823
} | [
"javax.security.auth.callback.Callback",
"javax.security.auth.callback.CallbackHandler",
"javax.security.auth.callback.NameCallback",
"javax.security.auth.callback.PasswordCallback",
"javax.security.auth.callback.UnsupportedCallbackException"
] | import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.NameCallback; import javax.security.auth.callback.PasswordCallback; import javax.security.auth.callback.UnsupportedCallbackException; | import javax.security.auth.callback.*; | [
"javax.security"
] | javax.security; | 1,171,609 |
@Generated
@Selector("isDeviceMotionActive")
public native boolean isDeviceMotionActive(); | @Selector(STR) native boolean function(); | /**
* deviceMotionActive
* <p>
* Discussion:
* Determines whether the CMMotionManager is currently providing device
* motion updates.
*/ | deviceMotionActive Discussion: Determines whether the CMMotionManager is currently providing device motion updates | isDeviceMotionActive | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/coremotion/CMMotionManager.java",
"license": "apache-2.0",
"size": 23031
} | [
"org.moe.natj.objc.ann.Selector"
] | import org.moe.natj.objc.ann.Selector; | import org.moe.natj.objc.ann.*; | [
"org.moe.natj"
] | org.moe.natj; | 798,552 |
private void sendCommand(int command) {
int buf;
// Send bit7-4 firstly
buf = command & 0xF0;
buf |= RS0_RW0_EN1;
writeDataToI2C(buf);
Tools.sleepMilliseconds(2);
buf &= MAKE_EN0;
writeDataToI2C(buf);
// Send bit3-0 secondly
buf = (command & 0x0F) << 4;
buf |= RS0_RW0_EN1;
writeDataToI2C(buf);
Tools.sleepMilliseconds(2);
buf &= MAKE_EN0;
writeDataToI2C(buf);
} | void function(int command) { int buf; buf = command & 0xF0; buf = RS0_RW0_EN1; writeDataToI2C(buf); Tools.sleepMilliseconds(2); buf &= MAKE_EN0; writeDataToI2C(buf); buf = (command & 0x0F) << 4; buf = RS0_RW0_EN1; writeDataToI2C(buf); Tools.sleepMilliseconds(2); buf &= MAKE_EN0; writeDataToI2C(buf); } | /**
* Send a command to the LCM using I2C protocol. This command is sent using
* the 4-bit data-length interface.
* @param command
*/ | Send a command to the LCM using I2C protocol. This command is sent using the 4-bit data-length interface | sendCommand | {
"repo_name": "chpressler/JRemote",
"path": "src/main/java/com/raspoid/additionalcomponents/LCM1602.java",
"license": "apache-2.0",
"size": 13481
} | [
"com.raspoid.Tools"
] | import com.raspoid.Tools; | import com.raspoid.*; | [
"com.raspoid"
] | com.raspoid; | 2,834,213 |
public BufferedImage createRawImage() {
if (planar) {
// Create a single-banded image of the appropriate data type.
// Get the number of bits per sample.
int bps = bitsPerSample[sourceBands[0]];
// Determine the data type.
int dataType;
if(sampleFormat[0] ==
BaselineTIFFTagSet.SAMPLE_FORMAT_FLOATING_POINT) {
dataType = DataBuffer.TYPE_FLOAT;
} else if(bps <= 8) {
dataType = DataBuffer.TYPE_BYTE;
} else if(bps <= 16) {
if(sampleFormat[0] ==
BaselineTIFFTagSet.SAMPLE_FORMAT_SIGNED_INTEGER) {
dataType = DataBuffer.TYPE_SHORT;
} else {
dataType = DataBuffer.TYPE_USHORT;
}
} else {
dataType = DataBuffer.TYPE_INT;
}
ColorSpace csGray = ColorSpace.getInstance(ColorSpace.CS_GRAY);
ImageTypeSpecifier its = null;
// For planar images with 1, 2 or 4 bits per sample, we need to
// use a MultiPixelPackedSampleModel so that when the TIFF
// decoder properly decodes the data per pixel, we know how to
// extract it back out into individual pixels. This is how the
// pixels are actually stored in the planar bands.
if(bps == 1 || bps == 2 || bps == 4) {
int bits = bps;
int size = 1 << bits;
byte[] r = new byte[size];
byte[] g = new byte[size];
byte[] b = new byte[size];
for(int j=0; j<r.length; j++) {
r[j] = 0;
g[j] = 0;
b[j] = 0;
}
ColorModel cmGray= new IndexColorModel(bits,size,r,g,b);
SampleModel smGray = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE, 1, 1, bits);
its = new ImageTypeSpecifier(cmGray, smGray);
}
else {
its = ImageTypeSpecifier.createInterleaved(csGray,
new int[] {0},
dataType,
false,
false);
}
return its.createBufferedImage(srcWidth, srcHeight);
} else {
ImageTypeSpecifier its = getRawImageType();
if (its == null) {
return null;
}
BufferedImage bi = its.createBufferedImage(srcWidth, srcHeight);
return bi;
}
} | BufferedImage function() { if (planar) { int bps = bitsPerSample[sourceBands[0]]; int dataType; if(sampleFormat[0] == BaselineTIFFTagSet.SAMPLE_FORMAT_FLOATING_POINT) { dataType = DataBuffer.TYPE_FLOAT; } else if(bps <= 8) { dataType = DataBuffer.TYPE_BYTE; } else if(bps <= 16) { if(sampleFormat[0] == BaselineTIFFTagSet.SAMPLE_FORMAT_SIGNED_INTEGER) { dataType = DataBuffer.TYPE_SHORT; } else { dataType = DataBuffer.TYPE_USHORT; } } else { dataType = DataBuffer.TYPE_INT; } ColorSpace csGray = ColorSpace.getInstance(ColorSpace.CS_GRAY); ImageTypeSpecifier its = null; if(bps == 1 bps == 2 bps == 4) { int bits = bps; int size = 1 << bits; byte[] r = new byte[size]; byte[] g = new byte[size]; byte[] b = new byte[size]; for(int j=0; j<r.length; j++) { r[j] = 0; g[j] = 0; b[j] = 0; } ColorModel cmGray= new IndexColorModel(bits,size,r,g,b); SampleModel smGray = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE, 1, 1, bits); its = new ImageTypeSpecifier(cmGray, smGray); } else { its = ImageTypeSpecifier.createInterleaved(csGray, new int[] {0}, dataType, false, false); } return its.createBufferedImage(srcWidth, srcHeight); } else { ImageTypeSpecifier its = getRawImageType(); if (its == null) { return null; } BufferedImage bi = its.createBufferedImage(srcWidth, srcHeight); return bi; } } | /**
* Creates a <code>BufferedImage</code> whose underlying data
* array will be suitable for holding the raw decoded output of
* the <code>decodeRaw</code> method.
*
* <p> The default implementation calls
* <code>getRawImageType</code>, and calls the resulting
* <code>ImageTypeSpecifier</code>'s
* <code>createBufferedImage</code> method.
*
* @return a <code>BufferedImage</code> whose underlying data
* array has the same format as the raw source pixel data, or
* <code>null</code> if it is not possible to create such an
* image.
*/ | Creates a <code>BufferedImage</code> whose underlying data array will be suitable for holding the raw decoded output of the <code>decodeRaw</code> method. The default implementation calls <code>getRawImageType</code>, and calls the resulting <code>ImageTypeSpecifier</code>'s <code>createBufferedImage</code> method | createRawImage | {
"repo_name": "hflynn/bioformats",
"path": "components/forks/jai/src/com/sun/media/imageio/plugins/tiff/TIFFDecompressor.java",
"license": "gpl-2.0",
"size": 115340
} | [
"java.awt.color.ColorSpace",
"java.awt.image.BufferedImage",
"java.awt.image.ColorModel",
"java.awt.image.DataBuffer",
"java.awt.image.IndexColorModel",
"java.awt.image.MultiPixelPackedSampleModel",
"java.awt.image.SampleModel",
"javax.imageio.ImageTypeSpecifier"
] | import java.awt.color.ColorSpace; import java.awt.image.BufferedImage; import java.awt.image.ColorModel; import java.awt.image.DataBuffer; import java.awt.image.IndexColorModel; import java.awt.image.MultiPixelPackedSampleModel; import java.awt.image.SampleModel; import javax.imageio.ImageTypeSpecifier; | import java.awt.color.*; import java.awt.image.*; import javax.imageio.*; | [
"java.awt",
"javax.imageio"
] | java.awt; javax.imageio; | 1,971,865 |
public void seek(long newOffset) throws IOException {
if (raInput == null) {
throw new IOException("Provided stream of type " + in.getClass().getSimpleName() + " is not seekable.");
}
// clear unread buffer by skipping over all bytes of buffer
int unreadLength = buf.length - pos;
if (unreadLength > 0) {
skip(unreadLength);
}
raInput.seek(newOffset);
offset = newOffset;
} | void function(long newOffset) throws IOException { if (raInput == null) { throw new IOException(STR + in.getClass().getSimpleName() + STR); } int unreadLength = buf.length - pos; if (unreadLength > 0) { skip(unreadLength); } raInput.seek(newOffset); offset = newOffset; } | /**
* Allows to seek to another position within stream in case the underlying stream implements {@link RandomAccessRead}. Otherwise an
* {@link IOException} is thrown.
*
* Pushback buffer is cleared before seek operation by skipping over all bytes of buffer.
*
* @param newOffset new position within stream from which to read next
*
* @throws IOException if underlying stream does not implement {@link RandomAccessRead} or seek operation on underlying stream was not successful
*/ | Allows to seek to another position within stream in case the underlying stream implements <code>RandomAccessRead</code>. Otherwise an <code>IOException</code> is thrown. Pushback buffer is cleared before seek operation by skipping over all bytes of buffer | seek | {
"repo_name": "sencko/NALB",
"path": "nalb2013/src/org/apache/pdfbox/io/PushBackInputStream.java",
"license": "gpl-2.0",
"size": 6129
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,261,265 |
public ScopeAuthorizationDelegate getAuthorizationDelegate(Action action){
return this.getAuthorizationDelegate(action.getScope());
}
| ScopeAuthorizationDelegate function(Action action){ return this.getAuthorizationDelegate(action.getScope()); } | /**
* Returns the scope authorization delegate for the scope of the given action.
* @param action
* @return
*/ | Returns the scope authorization delegate for the scope of the given action | getAuthorizationDelegate | {
"repo_name": "UCSFMemoryAndAging/lava",
"path": "lava-core/src/edu/ucsf/lava/core/scope/ScopeManager.java",
"license": "bsd-2-clause",
"size": 3189
} | [
"edu.ucsf.lava.core.action.model.Action"
] | import edu.ucsf.lava.core.action.model.Action; | import edu.ucsf.lava.core.action.model.*; | [
"edu.ucsf.lava"
] | edu.ucsf.lava; | 1,927,764 |
public void testHighestShow() throws Exception {
// Create another connection for the same user of connection 1
ConnectionConfiguration connectionConfiguration =
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
XMPPConnection conn3 = new XMPPConnection(connectionConfiguration);
conn3.connect();
conn3.login(getUsername(0), getPassword(0), "Home");
// Set this connection as highest priority
Presence presence = new Presence(Presence.Type.available);
presence.setMode(Presence.Mode.away);
conn3.sendPacket(presence);
// Set this connection as highest priority
presence = new Presence(Presence.Type.available);
presence.setMode(Presence.Mode.available);
getConnection(0).sendPacket(presence);
// Let the server process the change in presences
Thread.sleep(200);
// User0 listen in both connected clients
PacketCollector collector = getConnection(0).createPacketCollector(new MessageTypeFilter(Message.Type.chat));
PacketCollector coll3 = conn3.createPacketCollector(new MessageTypeFilter(Message.Type.chat));
// User1 sends a message to the bare JID of User0
Chat chat = getConnection(1).getChatManager().createChat(getBareJID(0), null);
chat.sendMessage("Test 1");
chat.sendMessage("Test 2");
// Check that messages were sent to resource with highest priority
Message message = (Message) coll3.nextResult(2000);
assertNull("Resource with lowest show value got the message", message);
message = (Message) collector.nextResult(2000);
assertNotNull(message);
assertEquals("Test 1", message.getBody());
message = (Message) collector.nextResult(1000);
assertNotNull(message);
assertEquals("Test 2", message.getBody());
conn3.disconnect();
} | void function() throws Exception { ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(getHost(), getPort(), getServiceName()); XMPPConnection conn3 = new XMPPConnection(connectionConfiguration); conn3.connect(); conn3.login(getUsername(0), getPassword(0), "Home"); Presence presence = new Presence(Presence.Type.available); presence.setMode(Presence.Mode.away); conn3.sendPacket(presence); presence = new Presence(Presence.Type.available); presence.setMode(Presence.Mode.available); getConnection(0).sendPacket(presence); Thread.sleep(200); PacketCollector collector = getConnection(0).createPacketCollector(new MessageTypeFilter(Message.Type.chat)); PacketCollector coll3 = conn3.createPacketCollector(new MessageTypeFilter(Message.Type.chat)); Chat chat = getConnection(1).getChatManager().createChat(getBareJID(0), null); chat.sendMessage(STR); chat.sendMessage(STR); Message message = (Message) coll3.nextResult(2000); assertNull(STR, message); message = (Message) collector.nextResult(2000); assertNotNull(message); assertEquals(STR, message.getBody()); message = (Message) collector.nextResult(1000); assertNotNull(message); assertEquals(STR, message.getBody()); conn3.disconnect(); } | /**
* User0 is connected from 2 resources. User0 is available in both resources
* but with different show values. User1 sends a message to the
* bare JID of User0. Check that the resource with highest show value will get
* the messages.
*
* @throws Exception if an error occurs.
*/ | User0 is connected from 2 resources. User0 is available in both resources but with different show values. User1 sends a message to the bare JID of User0. Check that the resource with highest show value will get the messages | testHighestShow | {
"repo_name": "UzxMx/java-bells",
"path": "lib-src/smack_src_3_3_0/test/org/jivesoftware/smack/MessageTest.java",
"license": "bsd-3-clause",
"size": 17029
} | [
"org.jivesoftware.smack.filter.MessageTypeFilter",
"org.jivesoftware.smack.packet.Message",
"org.jivesoftware.smack.packet.Presence"
] | import org.jivesoftware.smack.filter.MessageTypeFilter; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Presence; | import org.jivesoftware.smack.filter.*; import org.jivesoftware.smack.packet.*; | [
"org.jivesoftware.smack"
] | org.jivesoftware.smack; | 2,079,732 |
AffineTransform getGlyphTransform(int glyphIndex); | AffineTransform getGlyphTransform(int glyphIndex); | /**
* Gets the transform of the specified glyph within this GlyphVector.
*/ | Gets the transform of the specified glyph within this GlyphVector | getGlyphTransform | {
"repo_name": "Uni-Sol/batik",
"path": "sources/org/apache/batik/gvt/font/GVTGlyphVector.java",
"license": "apache-2.0",
"size": 5734
} | [
"java.awt.geom.AffineTransform"
] | import java.awt.geom.AffineTransform; | import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 1,214,482 |
public Observable<ServiceResponse<ServiceRunnerInner>> getWithServiceResponseAsync(String resourceGroupName, String labName, String name) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (labName == null) {
throw new IllegalArgumentException("Parameter labName is required and cannot be null.");
}
if (name == null) {
throw new IllegalArgumentException("Parameter name is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
} | Observable<ServiceResponse<ServiceRunnerInner>> function(String resourceGroupName, String labName, String name) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (labName == null) { throw new IllegalArgumentException(STR); } if (name == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); } | /**
* Get service runner.
*
* @param resourceGroupName The name of the resource group.
* @param labName The name of the lab.
* @param name The name of the service runner.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ServiceRunnerInner object
*/ | Get service runner | getWithServiceResponseAsync | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/devtestlabs/mgmt-v2018_09_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2018_09_15/implementation/ServiceRunnersInner.java",
"license": "mit",
"size": 19325
} | [
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.rest.ServiceResponse; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 2,458,333 |
public static void write(byte[] data, Writer output) throws IOException {
write(data, output, Charset.defaultCharset());
} | static void function(byte[] data, Writer output) throws IOException { write(data, output, Charset.defaultCharset()); } | /**
* Writes bytes from a <code>byte[]</code> to chars on a <code>Writer</code>
* using the default character encoding of the platform.
* <p>
* This method uses {@link String#String(byte[])}.
*
* @param data the byte array to write, do not modify during output,
* null ignored
* @param output the <code>Writer</code> to write to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since 1.1
*/ | Writes bytes from a <code>byte[]</code> to chars on a <code>Writer</code> using the default character encoding of the platform. This method uses <code>String#String(byte[])</code> | write | {
"repo_name": "trungnt13/fasta-game",
"path": "TNTEngine/src/org/tntstudio/utils/io/IOUtils.java",
"license": "mit",
"size": 97808
} | [
"java.io.IOException",
"java.io.Writer",
"java.nio.charset.Charset"
] | import java.io.IOException; import java.io.Writer; import java.nio.charset.Charset; | import java.io.*; import java.nio.charset.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 1,932,940 |
protected TransactionEvent fireTransactionEnded() {
return fireTransactionEnded("Transaction Ended; Source: " + this);
} | TransactionEvent function() { return fireTransactionEnded(STR + this); } | /**
* Fires a transaction ended event.
*
* @return The event that was fired or null if no event was fired, for
* testing purposes.
*/ | Fires a transaction ended event | fireTransactionEnded | {
"repo_name": "SQLPower/sqlpower-library",
"path": "src/main/java/ca/sqlpower/object/AbstractSPObject.java",
"license": "gpl-3.0",
"size": 24742
} | [
"ca.sqlpower.util.TransactionEvent"
] | import ca.sqlpower.util.TransactionEvent; | import ca.sqlpower.util.*; | [
"ca.sqlpower.util"
] | ca.sqlpower.util; | 1,024,995 |
private double[][] doFitJumpDistanceHistogram(double[][] jdHistogram, double estimatedD, int n) {
calibrated = isCalibrated();
if (n == 1) {
// Fit using a single population model
final LevenbergMarquardtOptimizer lvmOptimizer = new LevenbergMarquardtOptimizer();
try {
final JumpDistanceCumulFunction function =
new JumpDistanceCumulFunction(jdHistogram[0], jdHistogram[1], estimatedD);
//@formatter:off
final LeastSquaresProblem problem = new LeastSquaresBuilder()
.maxEvaluations(Integer.MAX_VALUE)
.maxIterations(3000)
.start(function.guess())
.target(function.getY())
.weight(new DiagonalMatrix(function.getWeights()))
.model(function, function::jacobian)
.build();
//@formatter:on
final Optimum lvmSolution = lvmOptimizer.optimize(problem);
final double[] fitParams = lvmSolution.getPoint().toArray();
// True for an unweighted fit
ss = lvmSolution.getResiduals().dotProduct(lvmSolution.getResiduals());
// ss = calculateSumOfSquares(function.getY(), function.value(fitParams));
lastFitValue = fitValue = MathUtils.getAdjustedCoefficientOfDetermination(ss,
MathUtils.getTotalSumOfSquares(function.getY()), function.x.length, 1);
final double[] coefficients = fitParams;
final double[] fractions = new double[] {1};
LoggerUtils.log(logger, Level.INFO,
"Fit Jump distance (N=1) : %s, SS = %s, Adjusted R^2 = %s (%d evaluations)",
formatD(fitParams[0]), MathUtils.rounded(ss, 4), MathUtils.rounded(fitValue, 4),
lvmSolution.getEvaluations());
return new double[][] {coefficients, fractions};
} catch (final TooManyIterationsException ex) {
LoggerUtils.log(logger, Level.INFO,
"LVM optimiser failed to fit (N=1) : Too many iterations : %s", ex.getMessage());
} catch (final ConvergenceException ex) {
LoggerUtils.log(logger, Level.INFO, "LVM optimiser failed to fit (N=1) : %s",
ex.getMessage());
}
}
// Uses a weighted sum of n exponential functions, each function models a fraction of the
// particles.
// An LVM fit cannot restrict the parameters so the fractions do not go below zero.
// Use the CustomPowell/CMEASOptimizer which supports bounded fitting.
final MixedJumpDistanceCumulFunctionMultivariate function =
new MixedJumpDistanceCumulFunctionMultivariate(jdHistogram[0], jdHistogram[1], estimatedD,
n);
final double[] lB = function.getLowerBounds();
int evaluations = 0;
PointValuePair constrainedSolution = null;
final MaxEval maxEval = new MaxEval(20000);
final CustomPowellOptimizer powellOptimizer = createCustomPowellOptimizer();
try {
// The Powell algorithm can use more general bounds: 0 - Infinity
constrainedSolution = powellOptimizer.optimize(maxEval, new ObjectiveFunction(function),
new InitialGuess(function.guess()),
new SimpleBounds(lB,
function.getUpperBounds(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY)),
new CustomPowellOptimizer.BasisStep(function.step()), GoalType.MINIMIZE);
evaluations = powellOptimizer.getEvaluations();
LoggerUtils.log(logger, Level.FINE, "Powell optimiser fit (N=%d) : SS = %f (%d evaluations)",
n, constrainedSolution.getValue(), evaluations);
} catch (final TooManyEvaluationsException ex) {
LoggerUtils.log(logger, Level.INFO,
"Powell optimiser failed to fit (N=%d) : Too many evaluations (%d)", n,
powellOptimizer.getEvaluations());
} catch (final TooManyIterationsException ex) {
LoggerUtils.log(logger, Level.INFO,
"Powell optimiser failed to fit (N=%d) : Too many iterations (%d)", n,
powellOptimizer.getIterations());
} catch (final ConvergenceException ex) {
LoggerUtils.log(logger, Level.INFO, "Powell optimiser failed to fit (N=%d) : %s", n,
ex.getMessage());
}
if (constrainedSolution == null) {
LoggerUtils.log(logger, Level.INFO, "Trying CMAES optimiser with restarts ...");
final double[] uB = function.getUpperBounds();
final SimpleBounds bounds = new SimpleBounds(lB, uB);
// The sigma determines the search range for the variables. It should be 1/3 of the initial
// search region.
final double[] s = new double[lB.length];
for (int i = 0; i < s.length; i++) {
s[i] = (uB[i] - lB[i]) / 3;
}
final OptimizationData sigma = new CMAESOptimizer.Sigma(s);
final OptimizationData popSize = new CMAESOptimizer.PopulationSize(
(int) (4 + Math.floor(3 * Math.log(function.x.length))));
// Iterate this for stability in the initial guess
final CMAESOptimizer cmaesOptimizer = createCmaesOptimizer();
for (int i = 0; i <= fitRestarts; i++) {
// Try from the initial guess
try {
final PointValuePair solution = cmaesOptimizer.optimize(
new InitialGuess(function.guess()), new ObjectiveFunction(function),
GoalType.MINIMIZE, bounds, sigma, popSize, maxEval);
if (constrainedSolution == null || solution.getValue() < constrainedSolution.getValue()) {
evaluations = cmaesOptimizer.getEvaluations();
constrainedSolution = solution;
LoggerUtils.log(logger, Level.FINE,
"CMAES optimiser [%da] fit (N=%d) : SS = %f (%d evaluations)", i, n,
solution.getValue(), evaluations);
}
} catch (final TooManyEvaluationsException ex) {
// No solution
}
if (constrainedSolution == null) {
continue;
}
// Try from the current optimum
try {
final PointValuePair solution = cmaesOptimizer.optimize(
new InitialGuess(constrainedSolution.getPointRef()), new ObjectiveFunction(function),
GoalType.MINIMIZE, bounds, sigma, popSize, maxEval);
if (solution.getValue() < constrainedSolution.getValue()) {
evaluations = cmaesOptimizer.getEvaluations();
constrainedSolution = solution;
LoggerUtils.log(logger, Level.FINE,
"CMAES optimiser [%db] fit (N=%d) : SS = %f (%d evaluations)", i, n,
solution.getValue(), evaluations);
}
} catch (final TooManyEvaluationsException ex) {
// No solution
}
}
if (constrainedSolution != null) {
// Re-optimise with Powell?
try {
final PointValuePair solution = powellOptimizer.optimize(maxEval,
new ObjectiveFunction(function), new InitialGuess(constrainedSolution.getPointRef()),
new SimpleBounds(lB,
function.getUpperBounds(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY)),
new CustomPowellOptimizer.BasisStep(function.step()), GoalType.MINIMIZE);
if (solution.getValue() < constrainedSolution.getValue()) {
evaluations = cmaesOptimizer.getEvaluations();
constrainedSolution = solution;
LoggerUtils.log(logger, Level.INFO,
"Powell optimiser re-fit (N=%d) : SS = %f (%d evaluations)", n,
constrainedSolution.getValue(), evaluations);
}
} catch (final TooManyEvaluationsException ex) {
// No solution
} catch (final TooManyIterationsException ex) {
// No solution
} catch (final ConvergenceException ex) {
// No solution
}
}
}
if (constrainedSolution == null) {
LoggerUtils.log(logger, Level.INFO, "Failed to fit N=%d", n);
return null;
}
double[] fitParams = constrainedSolution.getPointRef();
ss = constrainedSolution.getValue();
// TODO - Try a bounded BFGS optimiser
// Try and improve using a LVM fit
final MixedJumpDistanceCumulFunctionGradient functionGradient =
new MixedJumpDistanceCumulFunctionGradient(jdHistogram[0], jdHistogram[1], estimatedD, n);
Optimum lvmSolution;
final LevenbergMarquardtOptimizer lvmOptimizer = new LevenbergMarquardtOptimizer();
try {
//@formatter:off
final LeastSquaresProblem problem = new LeastSquaresBuilder()
.maxEvaluations(Integer.MAX_VALUE)
.maxIterations(3000)
.start(fitParams)
.target(functionGradient.getY())
.weight(new DiagonalMatrix(functionGradient.getWeights()))
.model(functionGradient, functionGradient::jacobian)
.build();
//@formatter:on
lvmSolution = lvmOptimizer.optimize(problem);
// True for an unweighted fit
final double ss = lvmSolution.getResiduals().dotProduct(lvmSolution.getResiduals());
// double ss = calculateSumOfSquares(functionGradient.getY(),
// functionGradient.value(lvmSolution.getPoint().toArray()));
// All fitted parameters must be above zero
if (ss < this.ss && MathUtils.min(lvmSolution.getPoint().toArray()) > 0) {
LoggerUtils.log(logger, Level.INFO, " Re-fitting improved the SS from %s to %s (-%s%%)",
MathUtils.rounded(this.ss, 4), MathUtils.rounded(ss, 4),
MathUtils.rounded(100 * (this.ss - ss) / this.ss, 4));
fitParams = lvmSolution.getPoint().toArray();
this.ss = ss;
evaluations += lvmSolution.getEvaluations();
}
} catch (final TooManyIterationsException ex) {
LoggerUtils.log(logger, Level.WARNING, "Failed to re-fit : Too many iterations : %s",
ex.getMessage());
} catch (final ConvergenceException ex) {
LoggerUtils.log(logger, Level.WARNING, "Failed to re-fit : %s", ex.getMessage());
}
// Since the fractions must sum to one we subtract 1 degree of freedom from the number of
// parameters
fitValue = MathUtils.getAdjustedCoefficientOfDetermination(ss,
MathUtils.getTotalSumOfSquares(function.getY()), function.x.length, fitParams.length - 1);
final double[] d = new double[n];
final double[] f = new double[n];
double sum = 0;
for (int i = 0; i < d.length; i++) {
f[i] = fitParams[i * 2];
sum += f[i];
d[i] = fitParams[i * 2 + 1];
}
for (int i = 0; i < f.length; i++) {
f[i] /= sum;
}
// Sort by coefficient size
sort(d, f);
final double[] coefficients = d;
final double[] fractions = f;
LoggerUtils.log(logger, Level.INFO,
"Fit Jump distance (N=%d) : %s (%s), SS = %s, Adjusted R^2 = %s (%d evaluations)", n,
formatD(d), format(f), MathUtils.rounded(ss, 4), MathUtils.rounded(fitValue, 4),
evaluations);
if (isValid(d, f)) {
lastFitValue = fitValue;
return new double[][] {coefficients, fractions};
}
return null;
} | double[][] function(double[][] jdHistogram, double estimatedD, int n) { calibrated = isCalibrated(); if (n == 1) { final LevenbergMarquardtOptimizer lvmOptimizer = new LevenbergMarquardtOptimizer(); try { final JumpDistanceCumulFunction function = new JumpDistanceCumulFunction(jdHistogram[0], jdHistogram[1], estimatedD); final LeastSquaresProblem problem = new LeastSquaresBuilder() .maxEvaluations(Integer.MAX_VALUE) .maxIterations(3000) .start(function.guess()) .target(function.getY()) .weight(new DiagonalMatrix(function.getWeights())) .model(function, function::jacobian) .build(); final Optimum lvmSolution = lvmOptimizer.optimize(problem); final double[] fitParams = lvmSolution.getPoint().toArray(); ss = lvmSolution.getResiduals().dotProduct(lvmSolution.getResiduals()); lastFitValue = fitValue = MathUtils.getAdjustedCoefficientOfDetermination(ss, MathUtils.getTotalSumOfSquares(function.getY()), function.x.length, 1); final double[] coefficients = fitParams; final double[] fractions = new double[] {1}; LoggerUtils.log(logger, Level.INFO, STR, formatD(fitParams[0]), MathUtils.rounded(ss, 4), MathUtils.rounded(fitValue, 4), lvmSolution.getEvaluations()); return new double[][] {coefficients, fractions}; } catch (final TooManyIterationsException ex) { LoggerUtils.log(logger, Level.INFO, STR, ex.getMessage()); } catch (final ConvergenceException ex) { LoggerUtils.log(logger, Level.INFO, STR, ex.getMessage()); } } final MixedJumpDistanceCumulFunctionMultivariate function = new MixedJumpDistanceCumulFunctionMultivariate(jdHistogram[0], jdHistogram[1], estimatedD, n); final double[] lB = function.getLowerBounds(); int evaluations = 0; PointValuePair constrainedSolution = null; final MaxEval maxEval = new MaxEval(20000); final CustomPowellOptimizer powellOptimizer = createCustomPowellOptimizer(); try { constrainedSolution = powellOptimizer.optimize(maxEval, new ObjectiveFunction(function), new InitialGuess(function.guess()), new SimpleBounds(lB, function.getUpperBounds(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY)), new CustomPowellOptimizer.BasisStep(function.step()), GoalType.MINIMIZE); evaluations = powellOptimizer.getEvaluations(); LoggerUtils.log(logger, Level.FINE, STR, n, constrainedSolution.getValue(), evaluations); } catch (final TooManyEvaluationsException ex) { LoggerUtils.log(logger, Level.INFO, STR, n, powellOptimizer.getEvaluations()); } catch (final TooManyIterationsException ex) { LoggerUtils.log(logger, Level.INFO, STR, n, powellOptimizer.getIterations()); } catch (final ConvergenceException ex) { LoggerUtils.log(logger, Level.INFO, STR, n, ex.getMessage()); } if (constrainedSolution == null) { LoggerUtils.log(logger, Level.INFO, STR); final double[] uB = function.getUpperBounds(); final SimpleBounds bounds = new SimpleBounds(lB, uB); final double[] s = new double[lB.length]; for (int i = 0; i < s.length; i++) { s[i] = (uB[i] - lB[i]) / 3; } final OptimizationData sigma = new CMAESOptimizer.Sigma(s); final OptimizationData popSize = new CMAESOptimizer.PopulationSize( (int) (4 + Math.floor(3 * Math.log(function.x.length)))); final CMAESOptimizer cmaesOptimizer = createCmaesOptimizer(); for (int i = 0; i <= fitRestarts; i++) { try { final PointValuePair solution = cmaesOptimizer.optimize( new InitialGuess(function.guess()), new ObjectiveFunction(function), GoalType.MINIMIZE, bounds, sigma, popSize, maxEval); if (constrainedSolution == null solution.getValue() < constrainedSolution.getValue()) { evaluations = cmaesOptimizer.getEvaluations(); constrainedSolution = solution; LoggerUtils.log(logger, Level.FINE, STR, i, n, solution.getValue(), evaluations); } } catch (final TooManyEvaluationsException ex) { } if (constrainedSolution == null) { continue; } try { final PointValuePair solution = cmaesOptimizer.optimize( new InitialGuess(constrainedSolution.getPointRef()), new ObjectiveFunction(function), GoalType.MINIMIZE, bounds, sigma, popSize, maxEval); if (solution.getValue() < constrainedSolution.getValue()) { evaluations = cmaesOptimizer.getEvaluations(); constrainedSolution = solution; LoggerUtils.log(logger, Level.FINE, STR, i, n, solution.getValue(), evaluations); } } catch (final TooManyEvaluationsException ex) { } } if (constrainedSolution != null) { try { final PointValuePair solution = powellOptimizer.optimize(maxEval, new ObjectiveFunction(function), new InitialGuess(constrainedSolution.getPointRef()), new SimpleBounds(lB, function.getUpperBounds(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY)), new CustomPowellOptimizer.BasisStep(function.step()), GoalType.MINIMIZE); if (solution.getValue() < constrainedSolution.getValue()) { evaluations = cmaesOptimizer.getEvaluations(); constrainedSolution = solution; LoggerUtils.log(logger, Level.INFO, STR, n, constrainedSolution.getValue(), evaluations); } } catch (final TooManyEvaluationsException ex) { } catch (final TooManyIterationsException ex) { } catch (final ConvergenceException ex) { } } } if (constrainedSolution == null) { LoggerUtils.log(logger, Level.INFO, STR, n); return null; } double[] fitParams = constrainedSolution.getPointRef(); ss = constrainedSolution.getValue(); final MixedJumpDistanceCumulFunctionGradient functionGradient = new MixedJumpDistanceCumulFunctionGradient(jdHistogram[0], jdHistogram[1], estimatedD, n); Optimum lvmSolution; final LevenbergMarquardtOptimizer lvmOptimizer = new LevenbergMarquardtOptimizer(); try { final LeastSquaresProblem problem = new LeastSquaresBuilder() .maxEvaluations(Integer.MAX_VALUE) .maxIterations(3000) .start(fitParams) .target(functionGradient.getY()) .weight(new DiagonalMatrix(functionGradient.getWeights())) .model(functionGradient, functionGradient::jacobian) .build(); lvmSolution = lvmOptimizer.optimize(problem); final double ss = lvmSolution.getResiduals().dotProduct(lvmSolution.getResiduals()); if (ss < this.ss && MathUtils.min(lvmSolution.getPoint().toArray()) > 0) { LoggerUtils.log(logger, Level.INFO, STR, MathUtils.rounded(this.ss, 4), MathUtils.rounded(ss, 4), MathUtils.rounded(100 * (this.ss - ss) / this.ss, 4)); fitParams = lvmSolution.getPoint().toArray(); this.ss = ss; evaluations += lvmSolution.getEvaluations(); } } catch (final TooManyIterationsException ex) { LoggerUtils.log(logger, Level.WARNING, STR, ex.getMessage()); } catch (final ConvergenceException ex) { LoggerUtils.log(logger, Level.WARNING, STR, ex.getMessage()); } fitValue = MathUtils.getAdjustedCoefficientOfDetermination(ss, MathUtils.getTotalSumOfSquares(function.getY()), function.x.length, fitParams.length - 1); final double[] d = new double[n]; final double[] f = new double[n]; double sum = 0; for (int i = 0; i < d.length; i++) { f[i] = fitParams[i * 2]; sum += f[i]; d[i] = fitParams[i * 2 + 1]; } for (int i = 0; i < f.length; i++) { f[i] /= sum; } sort(d, f); final double[] coefficients = d; final double[] fractions = f; LoggerUtils.log(logger, Level.INFO, STR, n, formatD(d), format(f), MathUtils.rounded(ss, 4), MathUtils.rounded(fitValue, 4), evaluations); if (isValid(d, f)) { lastFitValue = fitValue; return new double[][] {coefficients, fractions}; } return null; } | /**
* Fit the jump distance histogram using a cumulative sum with the given number of species.
*
* <p>Results are sorted by the diffusion coefficient ascending.
*
* @param jdHistogram The cumulative jump distance histogram. X-axis is um^2, Y-axis is cumulative
* probability. Must be monototic ascending.
* @param estimatedD The estimated diffusion coefficient
* @param n The number of species in the mixed population
* @return Array containing: { D (um^2), Fractions }. Can be null if no fit was made.
*/ | Fit the jump distance histogram using a cumulative sum with the given number of species. Results are sorted by the diffusion coefficient ascending | doFitJumpDistanceHistogram | {
"repo_name": "aherbert/GDSC-SMLM",
"path": "src/main/java/uk/ac/sussex/gdsc/smlm/fitting/JumpDistanceAnalysis.java",
"license": "gpl-3.0",
"size": 81045
} | [
"java.util.logging.Level",
"org.apache.commons.math3.exception.ConvergenceException",
"org.apache.commons.math3.exception.TooManyEvaluationsException",
"org.apache.commons.math3.exception.TooManyIterationsException",
"org.apache.commons.math3.fitting.leastsquares.LeastSquaresBuilder",
"org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer",
"org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem",
"org.apache.commons.math3.fitting.leastsquares.LevenbergMarquardtOptimizer",
"org.apache.commons.math3.linear.DiagonalMatrix",
"org.apache.commons.math3.optim.InitialGuess",
"org.apache.commons.math3.optim.MaxEval",
"org.apache.commons.math3.optim.OptimizationData",
"org.apache.commons.math3.optim.PointValuePair",
"org.apache.commons.math3.optim.SimpleBounds",
"org.apache.commons.math3.optim.nonlinear.scalar.GoalType",
"org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction",
"org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer",
"uk.ac.sussex.gdsc.core.logging.LoggerUtils",
"uk.ac.sussex.gdsc.core.utils.MathUtils",
"uk.ac.sussex.gdsc.smlm.math3.optim.nonlinear.scalar.noderiv.CustomPowellOptimizer"
] | import java.util.logging.Level; import org.apache.commons.math3.exception.ConvergenceException; import org.apache.commons.math3.exception.TooManyEvaluationsException; import org.apache.commons.math3.exception.TooManyIterationsException; import org.apache.commons.math3.fitting.leastsquares.LeastSquaresBuilder; import org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer; import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem; import org.apache.commons.math3.fitting.leastsquares.LevenbergMarquardtOptimizer; import org.apache.commons.math3.linear.DiagonalMatrix; import org.apache.commons.math3.optim.InitialGuess; import org.apache.commons.math3.optim.MaxEval; import org.apache.commons.math3.optim.OptimizationData; import org.apache.commons.math3.optim.PointValuePair; import org.apache.commons.math3.optim.SimpleBounds; import org.apache.commons.math3.optim.nonlinear.scalar.GoalType; import org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction; import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer; import uk.ac.sussex.gdsc.core.logging.LoggerUtils; import uk.ac.sussex.gdsc.core.utils.MathUtils; import uk.ac.sussex.gdsc.smlm.math3.optim.nonlinear.scalar.noderiv.CustomPowellOptimizer; | import java.util.logging.*; import org.apache.commons.math3.exception.*; import org.apache.commons.math3.fitting.leastsquares.*; import org.apache.commons.math3.linear.*; import org.apache.commons.math3.optim.*; import org.apache.commons.math3.optim.nonlinear.scalar.*; import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.*; import uk.ac.sussex.gdsc.core.logging.*; import uk.ac.sussex.gdsc.core.utils.*; import uk.ac.sussex.gdsc.smlm.math3.optim.nonlinear.scalar.noderiv.*; | [
"java.util",
"org.apache.commons",
"uk.ac.sussex"
] | java.util; org.apache.commons; uk.ac.sussex; | 1,513,778 |
private void leaveOneOutTripletSecond(Triplet set){
double selectedClasses[];
double oldW[][];
double term;
double bestMembership;
int trueOutput;
int expectedOutput;
int misses;
misses=0;
selectedClasses= new double[nClasses];
oldW= new double [totalInstances][nClasses];
for(int i=0;i<totalInstances;i++){
System.arraycopy(set.w[i], 0, oldW[i], 0, oldW[i].length);
}
for(int instance=0;instance<totalInstances;instance++){
double minDist[];
int nearestN[];
double dist;
boolean stop;
nearestN = new int[set.k];
minDist = new double[set.k];
for (int i=0; i<set.k; i++) {
nearestN[i] = 0;
minDist[i] = Double.MAX_VALUE;
}
//KNN Method starts here
for (int i=0; i<totalInstances; i++) {
dist = distances[i][instance];
if (i != instance){ //leave-one-out
//see if it's nearer than our previous selected neighbors
stop=false;
for(int j=0;j<set.k && !stop;j++){
if (dist < minDist[j]) {
for (int l = set.k - 1; l >= j+1; l--) {
minDist[l] = minDist[l - 1];
nearestN[l] = nearestN[l - 1];
}
minDist[j] = dist;
nearestN[j] = i;
stop=true;
}
}
}
}
//we have check all the instances... see what is the most present class
Arrays.fill(selectedClasses, 0.0);
for (int i=0; i<set.k; i++) {
for(int j=0;j<nClasses;j++){
selectedClasses[j]+=oldW[nearestN[i]][j];
}
}
bestMembership=0.0;
expectedOutput=-1;
for (int i=0; i<nClasses; i++) {
term = ((double)selectedClasses[i]/(double)set.k);
set.w[instance][i]=term;
if(term>bestMembership){
bestMembership=term;
expectedOutput=i;
}
}
if(instance<trainInstances){
trueOutput=trainOutput[instance];
if(trueOutput!=expectedOutput){
misses++;
}
}
}
//compute LOO error
set.error=(double)((double)misses/(double)trainInstances);
}//end-method
| void function(Triplet set){ double selectedClasses[]; double oldW[][]; double term; double bestMembership; int trueOutput; int expectedOutput; int misses; misses=0; selectedClasses= new double[nClasses]; oldW= new double [totalInstances][nClasses]; for(int i=0;i<totalInstances;i++){ System.arraycopy(set.w[i], 0, oldW[i], 0, oldW[i].length); } for(int instance=0;instance<totalInstances;instance++){ double minDist[]; int nearestN[]; double dist; boolean stop; nearestN = new int[set.k]; minDist = new double[set.k]; for (int i=0; i<set.k; i++) { nearestN[i] = 0; minDist[i] = Double.MAX_VALUE; } for (int i=0; i<totalInstances; i++) { dist = distances[i][instance]; if (i != instance){ stop=false; for(int j=0;j<set.k && !stop;j++){ if (dist < minDist[j]) { for (int l = set.k - 1; l >= j+1; l--) { minDist[l] = minDist[l - 1]; nearestN[l] = nearestN[l - 1]; } minDist[j] = dist; nearestN[j] = i; stop=true; } } } } Arrays.fill(selectedClasses, 0.0); for (int i=0; i<set.k; i++) { for(int j=0;j<nClasses;j++){ selectedClasses[j]+=oldW[nearestN[i]][j]; } } bestMembership=0.0; expectedOutput=-1; for (int i=0; i<nClasses; i++) { term = ((double)selectedClasses[i]/(double)set.k); set.w[instance][i]=term; if(term>bestMembership){ bestMembership=term; expectedOutput=i; } } if(instance<trainInstances){ trueOutput=trainOutput[instance]; if(trueOutput!=expectedOutput){ misses++; } } } set.error=(double)((double)misses/(double)trainInstances); } | /**
* Performs a LOO process on a triplet, to estimate its error
* This time, both training and test instances are considered
*
* @param set triplet to analyze
*/ | Performs a LOO process on a triplet, to estimate its error This time, both training and test instances are considered | leaveOneOutTripletSecond | {
"repo_name": "triguero/Keel3.0",
"path": "src/keel/Algorithms/Fuzzy_Instance_Based_Learning/JFKNN/JFKNN.java",
"license": "gpl-3.0",
"size": 17766
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 1,202,268 |
public void playFirstTrack() {
Dispatch.call(this, "PlayFirstTrack");
} | void function() { Dispatch.call(this, STR); } | /**
* Wrapper for calling the ActiveX-Method with input-parameter(s).
*/ | Wrapper for calling the ActiveX-Method with input-parameter(s) | playFirstTrack | {
"repo_name": "cpesch/MetaMusic",
"path": "itunes-com-library/src/main/java/slash/metamusic/itunes/com/binding/IITPlaylist.java",
"license": "gpl-2.0",
"size": 9268
} | [
"com.jacob.com.Dispatch"
] | import com.jacob.com.Dispatch; | import com.jacob.com.*; | [
"com.jacob.com"
] | com.jacob.com; | 2,373,419 |
public void addOption(String option, String value) {
checkArgument(option != null, "option is null");
checkArgument(value != null, "value is null");
properties.put(option, value);
} | void function(String option, String value) { checkArgument(option != null, STR); checkArgument(value != null, STR); properties.put(option, value); } | /**
* Add another option to the iterator.
*
* @param option
* the name of the option
* @param value
* the value of the option
*/ | Add another option to the iterator | addOption | {
"repo_name": "milleruntime/accumulo",
"path": "core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java",
"license": "apache-2.0",
"size": 12498
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 985,172 |
public void show(final IPartialPageRequestHandler target)
{
if (shown == false)
{
getContent().setVisible(true);
target.add(this);
target.appendJavaScript(getWindowOpenJavaScript());
shown = true;
}
} | void function(final IPartialPageRequestHandler target) { if (shown == false) { getContent().setVisible(true); target.add(this); target.appendJavaScript(getWindowOpenJavaScript()); shown = true; } } | /**
* Shows the modal window.
*
* @param target
* Request target associated with current ajax request.
*/ | Shows the modal window | show | {
"repo_name": "topicusonderwijs/wicket",
"path": "wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java",
"license": "apache-2.0",
"size": 34961
} | [
"org.apache.wicket.core.request.handler.IPartialPageRequestHandler"
] | import org.apache.wicket.core.request.handler.IPartialPageRequestHandler; | import org.apache.wicket.core.request.handler.*; | [
"org.apache.wicket"
] | org.apache.wicket; | 2,671,793 |
public static void assertUie(boolean v) {
if (!v)
throw new UIMARuntimeException(UIMARuntimeException.INTERNAL_ERROR);
} | static void function(boolean v) { if (!v) throw new UIMARuntimeException(UIMARuntimeException.INTERNAL_ERROR); } | /**
* Check and throw UIMA Internal Error if false
*
* @param v
* if false, throws
*/ | Check and throw UIMA Internal Error if false | assertUie | {
"repo_name": "apache/uima-uimaj",
"path": "uimaj-core/src/main/java/org/apache/uima/internal/util/Misc.java",
"license": "apache-2.0",
"size": 42029
} | [
"org.apache.uima.UIMARuntimeException"
] | import org.apache.uima.UIMARuntimeException; | import org.apache.uima.*; | [
"org.apache.uima"
] | org.apache.uima; | 1,052,573 |
@Override
protected void execute() {
if (!checkCULDevice()) {
return;
}
logger.debug("Processing " + temperatureCommandQueue.size() + " waiting FHT temperature commands");
Map<String, FHTDesiredTemperatureCommand> copyMap = new HashMap<String, FHTDesiredTemperatureCommand>(
temperatureCommandQueue);
for (Entry<String, FHTDesiredTemperatureCommand> entry : copyMap.entrySet()) {
FHTDesiredTemperatureCommand waitingCommand = entry.getValue();
String commandString = "T" + waitingCommand.getAddress() + waitingCommand.getCommand();
try {
culHandlerLifecycle.getCul().send(commandString);
temperatureCommandQueue.remove(entry.getKey());
} catch (CULCommunicationException e) {
logger.error("Can't send desired temperature via CUL", e);
}
}
} | void function() { if (!checkCULDevice()) { return; } logger.debug(STR + temperatureCommandQueue.size() + STR); Map<String, FHTDesiredTemperatureCommand> copyMap = new HashMap<String, FHTDesiredTemperatureCommand>( temperatureCommandQueue); for (Entry<String, FHTDesiredTemperatureCommand> entry : copyMap.entrySet()) { FHTDesiredTemperatureCommand waitingCommand = entry.getValue(); String commandString = "T" + waitingCommand.getAddress() + waitingCommand.getCommand(); try { culHandlerLifecycle.getCul().send(commandString); temperatureCommandQueue.remove(entry.getKey()); } catch (CULCommunicationException e) { logger.error(STR, e); } } } | /**
* Here we send waiting commands to the FHT-80b. Since we can only send
* every 2 minutes a limited amount of commads, we collect commands and
* discard older commands in favor of newer ones, so we send as less packets
* as possible.
*/ | Here we send waiting commands to the FHT-80b. Since we can only send every 2 minutes a limited amount of commads, we collect commands and discard older commands in favor of newer ones, so we send as less packets as possible | execute | {
"repo_name": "aschor/openhab",
"path": "bundles/binding/org.openhab.binding.fht/src/main/java/org/openhab/binding/fht/internal/FHTBinding.java",
"license": "epl-1.0",
"size": 26167
} | [
"java.util.HashMap",
"java.util.Map",
"org.openhab.io.transport.cul.CULCommunicationException"
] | import java.util.HashMap; import java.util.Map; import org.openhab.io.transport.cul.CULCommunicationException; | import java.util.*; import org.openhab.io.transport.cul.*; | [
"java.util",
"org.openhab.io"
] | java.util; org.openhab.io; | 2,077,807 |
public HashMap<Integer, RCSNode> getNodeMap() {
return nodeMap;
} | HashMap<Integer, RCSNode> function() { return nodeMap; } | /**
* Returns the node map.
*
* @return the node map
*/ | Returns the node map | getNodeMap | {
"repo_name": "r-kober/ReCaLys",
"path": "ReCaLys/src/de/upb/recalys/model/RCSGraph.java",
"license": "mit",
"size": 16858
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 964,258 |
private String getElementsDeleteJavascript()
{
// build the javascript call
final AppendingStringBuffer buffer = new AppendingStringBuffer(100);
buffer.append("Wicket.Tree.removeNodes(\"");
// first parameter is the markup id of tree (will be used as prefix to
// build ids of child items
buffer.append(getMarkupId() + "_\",[");
// append the ids of elements to be deleted
buffer.append(deleteIds);
// does the buffer end if ','?
if (buffer.endsWith(","))
{
// it does, trim it
buffer.setLength(buffer.length() - 1);
}
buffer.append("]);");
return buffer.toString();
}
//
// State and Model callbacks
// | String function() { final AppendingStringBuffer buffer = new AppendingStringBuffer(100); buffer.append(STRSTR_\",["); buffer.append(deleteIds); if (buffer.endsWith(",")) { buffer.setLength(buffer.length() - 1); } buffer.append("]);"); return buffer.toString(); } // | /**
* Returns the javascript used to delete removed elements.
*
* @return The javascript
*/ | Returns the javascript used to delete removed elements | getElementsDeleteJavascript | {
"repo_name": "Servoy/wicket",
"path": "wicket/src/main/java/org/apache/wicket/markup/html/tree/AbstractTree.java",
"license": "apache-2.0",
"size": 41630
} | [
"org.apache.wicket.util.string.AppendingStringBuffer"
] | import org.apache.wicket.util.string.AppendingStringBuffer; | import org.apache.wicket.util.string.*; | [
"org.apache.wicket"
] | org.apache.wicket; | 1,969,116 |
int updateByPrimaryKeySelective(TaskList record); | int updateByPrimaryKeySelective(TaskList record); | /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table m_prj_task_list
*
* @mbggenerated Thu Jul 16 10:50:12 ICT 2015
*/ | This method was generated by MyBatis Generator. This method corresponds to the database table m_prj_task_list | updateByPrimaryKeySelective | {
"repo_name": "uniteddiversity/mycollab",
"path": "mycollab-services/src/main/java/com/esofthead/mycollab/module/project/dao/TaskListMapper.java",
"license": "agpl-3.0",
"size": 5566
} | [
"com.esofthead.mycollab.module.project.domain.TaskList"
] | import com.esofthead.mycollab.module.project.domain.TaskList; | import com.esofthead.mycollab.module.project.domain.*; | [
"com.esofthead.mycollab"
] | com.esofthead.mycollab; | 2,076,318 |
@Override
public void chartChanged(ChartChangeEvent event) {
this.flag = true;
}
}
| void function(ChartChangeEvent event) { this.flag = true; } } | /**
* Event handler.
*
* @param event the event.
*/ | Event handler | chartChanged | {
"repo_name": "oskopek/jfreechart-fse",
"path": "src/test/java/org/jfree/chart/LineChartTest.java",
"license": "lgpl-2.1",
"size": 6440
} | [
"org.jfree.chart.event.ChartChangeEvent"
] | import org.jfree.chart.event.ChartChangeEvent; | import org.jfree.chart.event.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 2,503,064 |
public static MozuClient deleteChannelGroupClient(String code) throws Exception
{
MozuUrl url = com.mozu.api.urls.commerce.ChannelGroupUrl.deleteChannelGroupUrl(code);
String verb = "DELETE";
MozuClient mozuClient = (MozuClient) MozuClientFactory.getInstance();
mozuClient.setVerb(verb);
mozuClient.setResourceUrl(url);
return mozuClient;
}
| static MozuClient function(String code) throws Exception { MozuUrl url = com.mozu.api.urls.commerce.ChannelGroupUrl.deleteChannelGroupUrl(code); String verb = STR; MozuClient mozuClient = (MozuClient) MozuClientFactory.getInstance(); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); return mozuClient; } | /**
*
* <p><pre><code>
* MozuClient mozuClient=DeleteChannelGroupClient( code);
* client.setBaseAddress(url);
* client.executeRequest();
* </code></pre></p>
* @param code User-defined code that uniqely identifies the channel group.
* @return Mozu.Api.MozuClient
*/ | <code><code> MozuClient mozuClient=DeleteChannelGroupClient( code); client.setBaseAddress(url); client.executeRequest(); </code></code> | deleteChannelGroupClient | {
"repo_name": "Mozu/mozu-java",
"path": "mozu-javaasync-core/src/main/java/com/mozu/api/clients/commerce/ChannelGroupClient.java",
"license": "mit",
"size": 12489
} | [
"com.mozu.api.MozuClient",
"com.mozu.api.MozuClientFactory",
"com.mozu.api.MozuUrl"
] | import com.mozu.api.MozuClient; import com.mozu.api.MozuClientFactory; import com.mozu.api.MozuUrl; | import com.mozu.api.*; | [
"com.mozu.api"
] | com.mozu.api; | 152,164 |
public List<SystemOverview> listUserSystems(User loggedInUser) {
// Get the logged in user
return SystemManager.systemListShort(loggedInUser, null);
} | List<SystemOverview> function(User loggedInUser) { return SystemManager.systemListShort(loggedInUser, null); } | /**
* List systems for the logged in user
* @param loggedInUser The current user
* @return Returns an array of maps representing a system
*
* @xmlrpc.doc List systems for the logged in user.
* @xmlrpc.param #param("string", "sessionKey")
* @xmlrpc.returntype
* #array()
* $SystemOverviewSerializer
* #array_end()
*/ | List systems for the logged in user | listUserSystems | {
"repo_name": "jdobes/spacewalk",
"path": "java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java",
"license": "gpl-2.0",
"size": 240801
} | [
"com.redhat.rhn.domain.user.User",
"com.redhat.rhn.frontend.dto.SystemOverview",
"com.redhat.rhn.manager.system.SystemManager",
"java.util.List"
] | import com.redhat.rhn.domain.user.User; import com.redhat.rhn.frontend.dto.SystemOverview; import com.redhat.rhn.manager.system.SystemManager; import java.util.List; | import com.redhat.rhn.domain.user.*; import com.redhat.rhn.frontend.dto.*; import com.redhat.rhn.manager.system.*; import java.util.*; | [
"com.redhat.rhn",
"java.util"
] | com.redhat.rhn; java.util; | 2,279,997 |
private Tag findTag(final CTag tag, final Tag apiTag) {
if (tag == apiTag.getNative().getObject()) {
return apiTag;
}
for (final Tag child : apiTag.getChildren()) {
final Tag foundTag = findTag(tag, child);
if (foundTag != null) {
return foundTag;
}
}
return null;
} | Tag function(final CTag tag, final Tag apiTag) { if (tag == apiTag.getNative().getObject()) { return apiTag; } for (final Tag child : apiTag.getChildren()) { final Tag foundTag = findTag(tag, child); if (foundTag != null) { return foundTag; } } return null; } | /**
* Searches for an API tag that wraps a given internal tag.
*
* @param tag The internal tag to search for.
* @param apiTag Tag to search through.
*
* @return The found API tag or null.
*/ | Searches for an API tag that wraps a given internal tag | findTag | {
"repo_name": "google/binnavi",
"path": "src/main/java/com/google/security/zynamics/binnavi/API/disassembly/TagManager.java",
"license": "apache-2.0",
"size": 11371
} | [
"com.google.security.zynamics.binnavi.Tagging"
] | import com.google.security.zynamics.binnavi.Tagging; | import com.google.security.zynamics.binnavi.*; | [
"com.google.security"
] | com.google.security; | 2,114,076 |
public Command getEquivalentCommand(Class<? extends Command> clazz) {
for (Command cmd : this.container.getCommandHandler().get().getCommands()) {
if (clazz.isInstance(cmd)) {
return cmd;
}
}
return null;
} | Command function(Class<? extends Command> clazz) { for (Command cmd : this.container.getCommandHandler().get().getCommands()) { if (clazz.isInstance(cmd)) { return cmd; } } return null; } | /**
* Gets the 'equivalent' command of this class. This is useful to prevent
* many instances of the same object being passed around XtraCore.
*
* @param clazz The class
* @return The command object for the specified class
*/ | Gets the 'equivalent' command of this class. This is useful to prevent many instances of the same object being passed around XtraCore | getEquivalentCommand | {
"repo_name": "XtraStudio/XtraCore",
"path": "src/main/java/com/xtra/core/util/CommandHelper.java",
"license": "mit",
"size": 7208
} | [
"com.xtra.api.command.Command"
] | import com.xtra.api.command.Command; | import com.xtra.api.command.*; | [
"com.xtra.api"
] | com.xtra.api; | 2,735,627 |
@Test void basicCheck() {
for( ImageType type : imageTypes ) {
basicCheck(type);
}
} | @Test void basicCheck() { for( ImageType type : imageTypes ) { basicCheck(type); } } | /**
* Basic check were multiple images are feed into the algorithm and another image,
* which has a region which is clearly different is then segmented.
*/ | Basic check were multiple images are feed into the algorithm and another image, which has a region which is clearly different is then segmented | basicCheck | {
"repo_name": "lessthanoptimal/BoofCV",
"path": "main/boofcv-feature/src/test/java/boofcv/alg/background/stationary/GenericBackgroundModelStationaryChecks.java",
"license": "apache-2.0",
"size": 7058
} | [
"org.junit.jupiter.api.Test"
] | import org.junit.jupiter.api.Test; | import org.junit.jupiter.api.*; | [
"org.junit.jupiter"
] | org.junit.jupiter; | 2,143,602 |
@Override
protected void makeExtensionsImmutable() {
extensions.makeImmutable();
}
protected class ExtensionWriter {
// Imagine how much simpler this code would be if Java iterators had
// a way to get the next element without advancing the iterator.
private final Iterator<Map.Entry<ExtensionDescriptor, Object>> iter =
extensions.iterator();
private Map.Entry<ExtensionDescriptor, Object> next;
private final boolean messageSetWireFormat;
private ExtensionWriter(boolean messageSetWireFormat) {
if (iter.hasNext()) {
next = iter.next();
}
this.messageSetWireFormat = messageSetWireFormat;
} | void function() { extensions.makeImmutable(); } protected class ExtensionWriter { private final Iterator<Map.Entry<ExtensionDescriptor, Object>> iter = extensions.iterator(); private Map.Entry<ExtensionDescriptor, Object> next; private final boolean messageSetWireFormat; private ExtensionWriter(boolean messageSetWireFormat) { if (iter.hasNext()) { next = iter.next(); } this.messageSetWireFormat = messageSetWireFormat; } | /**
* Used by parsing constructors in generated classes.
*/ | Used by parsing constructors in generated classes | makeExtensionsImmutable | {
"repo_name": "udoprog/ffwd-client-java",
"path": "src/main/java/com/google/protobuf250/GeneratedMessageLite.java",
"license": "apache-2.0",
"size": 28819
} | [
"java.util.Iterator",
"java.util.Map"
] | import java.util.Iterator; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 485,759 |
public ServiceResponse<String> loginUser(String username, String password) throws ServiceException, IOException {
Call<ResponseBody> call = service.loginUser(username, password);
return loginUserDelegate(call.execute());
} | ServiceResponse<String> function(String username, String password) throws ServiceException, IOException { Call<ResponseBody> call = service.loginUser(username, password); return loginUserDelegate(call.execute()); } | /**
* Logs user into the system.
*
* @param username The user name for login
* @param password The password for login in clear text
* @throws ServiceException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @return the String object wrapped in {@link ServiceResponse} if successful.
*/ | Logs user into the system | loginUser | {
"repo_name": "John-Hart/autorest",
"path": "Samples/petstore/Java/implementation/SwaggerPetstoreImpl.java",
"license": "mit",
"size": 88839
} | [
"com.microsoft.rest.ServiceException",
"com.microsoft.rest.ServiceResponse",
"java.io.IOException"
] | import com.microsoft.rest.ServiceException; import com.microsoft.rest.ServiceResponse; import java.io.IOException; | import com.microsoft.rest.*; import java.io.*; | [
"com.microsoft.rest",
"java.io"
] | com.microsoft.rest; java.io; | 623,608 |
private void delete(ElisDataObject[] data, boolean finalRun) throws StorageException {
if (data != null && data.length > 0) {
// Just delegate this to the insert(AbstractUser, false) method.
for (ElisDataObject dataParticle : data) {
delete(dataParticle, false);
}
}
} | void function(ElisDataObject[] data, boolean finalRun) throws StorageException { if (data != null && data.length > 0) { for (ElisDataObject dataParticle : data) { delete(dataParticle, false); } } } | /**
* This method is called by the public delete(ElisDataObject[]) method. It
* tries to create the table needed to store the data object if it doesn't
* already exist. However, it will only try once. If it doesn't succeed on
* its first try, it will stop trying by throwing an exception.
*
* @param data The data objects to be deleted.
* @param finalRun True if this method has been run before. Any method
* which isn't in fact this very method should call the method by
* setting this parameter to false.
* @throws StorageException Thrown when the objects couldn't be deleted.
* @since 2.0
*/ | This method is called by the public delete(ElisDataObject[]) method. It tries to create the table needed to store the data object if it doesn't already exist. However, it will only try once. If it doesn't succeed on its first try, it will stop trying by throwing an exception | delete | {
"repo_name": "iotap-center/elis-platform",
"path": "Elis user and persistent storage service implementations/src/main/java/se/mah/elis/impl/services/storage/StorageImpl.java",
"license": "mit",
"size": 63812
} | [
"se.mah.elis.data.ElisDataObject",
"se.mah.elis.services.storage.exceptions.StorageException"
] | import se.mah.elis.data.ElisDataObject; import se.mah.elis.services.storage.exceptions.StorageException; | import se.mah.elis.data.*; import se.mah.elis.services.storage.exceptions.*; | [
"se.mah.elis"
] | se.mah.elis; | 1,427,011 |
EClass getFieldType(); | EClass getFieldType(); | /**
* Returns the meta object for class '{@link org.w3._2001.schema.FieldType <em>Field Type</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Field Type</em>'.
* @see org.w3._2001.schema.FieldType
* @generated
*/ | Returns the meta object for class '<code>org.w3._2001.schema.FieldType Field Type</code>'. | getFieldType | {
"repo_name": "geotools/geotools",
"path": "modules/ogc/net.opengis.wps/src/org/w3/_2001/schema/SchemaPackage.java",
"license": "lgpl-2.1",
"size": 433240
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,878,500 |
public int getHeight(RenderedImage fallback) {
if (isValid(HEIGHT_MASK)) {
return height;
} else {
if (fallback == null) {
return 0;
} else {
return fallback.getHeight();
}
}
} | int function(RenderedImage fallback) { if (isValid(HEIGHT_MASK)) { return height; } else { if (fallback == null) { return 0; } else { return fallback.getHeight(); } } } | /**
* Returns the value of height if it is valid, and
* otherwise returns the value from the supplied <code>RenderedImage</code>.
* If height is not valid and fallback is null, 0 is returned.
*
* @param fallback the <code>RenderedImage</code> fallback.
* @return the appropriate value of height.
*/ | Returns the value of height if it is valid, and otherwise returns the value from the supplied <code>RenderedImage</code>. If height is not valid and fallback is null, 0 is returned | getHeight | {
"repo_name": "MarinnaCole/LightZone",
"path": "lightcrafts/extsrc/com/lightcrafts/mediax/jai/ImageLayout.java",
"license": "bsd-3-clause",
"size": 29012
} | [
"java.awt.image.RenderedImage"
] | import java.awt.image.RenderedImage; | import java.awt.image.*; | [
"java.awt"
] | java.awt; | 38,728 |
public Collection<CommandExecutor> getCommandExecutors();
| Collection<CommandExecutor> function(); | /**
* Gets a list of all executors registered.
* @return All executors.
*/ | Gets a list of all executors registered | getCommandExecutors | {
"repo_name": "good2000mo/OpenClassicAPI",
"path": "src/main/java/ch/spacebase/openclassic/api/Game.java",
"license": "mit",
"size": 4225
} | [
"ch.spacebase.openclassic.api.command.CommandExecutor",
"java.util.Collection"
] | import ch.spacebase.openclassic.api.command.CommandExecutor; import java.util.Collection; | import ch.spacebase.openclassic.api.command.*; import java.util.*; | [
"ch.spacebase.openclassic",
"java.util"
] | ch.spacebase.openclassic; java.util; | 1,569,067 |
private static String fromUtf8(Object object)
{
String result = Constants.EMPTY_STRING;
if (object instanceof String)
{
result = (String)object;
} else if (object instanceof byte[])
{
result = StringUtils.fromUTF8((byte[])object);
}
return result;
}
| static String function(Object object) { String result = Constants.EMPTY_STRING; if (object instanceof String) { result = (String)object; } else if (object instanceof byte[]) { result = StringUtils.fromUTF8((byte[])object); } return result; } | /**
* Converts strings and bytes arrays to the string.
*
* @param object string or bytes array.
*
* @return string.
*/ | Converts strings and bytes arrays to the string | fromUtf8 | {
"repo_name": "pitosalas/blogbridge",
"path": "src/com/salas/bb/discovery/MDDiscoveryLogic.java",
"license": "gpl-2.0",
"size": 13312
} | [
"com.salas.bb.utils.Constants",
"com.salas.bb.utils.StringUtils"
] | import com.salas.bb.utils.Constants; import com.salas.bb.utils.StringUtils; | import com.salas.bb.utils.*; | [
"com.salas.bb"
] | com.salas.bb; | 2,217,501 |
private byte[] getBytes(InputStream inputStream) throws IOException {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int numberRead;
byte[] data = new byte[BLOCK_LENGTH_AS_HEX];
while ((numberRead = inputStream.read(data, 0, data.length)) != -1) {
buffer.write(data, 0, numberRead);
}
buffer.flush();
return buffer.toByteArray();
} | byte[] function(InputStream inputStream) throws IOException { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int numberRead; byte[] data = new byte[BLOCK_LENGTH_AS_HEX]; while ((numberRead = inputStream.read(data, 0, data.length)) != -1) { buffer.write(data, 0, numberRead); } buffer.flush(); return buffer.toByteArray(); } | /**
* Returns the contents of the InputStream as a byte array.
*/ | Returns the contents of the InputStream as a byte array | getBytes | {
"repo_name": "leafcoin/leafcoinj",
"path": "core/src/test/java/com/google/leafcoin/core/CoinbaseBlockTest.java",
"license": "apache-2.0",
"size": 4296
} | [
"java.io.ByteArrayOutputStream",
"java.io.IOException",
"java.io.InputStream"
] | import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,454,486 |
public void addChildRDN(RDN rdn)
throws InvalidNameException
{
add(rdn);
}
| void function(RDN rdn) throws InvalidNameException { add(rdn); } | /**
* Adds a new 'deepest level' RDN to a DN
*
* @param RDN the RDN to append to the end of the DN
*/ | Adds a new 'deepest level' RDN to a DN | addChildRDN | {
"repo_name": "idega/com.idega.block.ldap",
"path": "src/java/com/idega/core/ldap/client/naming/DN.java",
"license": "gpl-3.0",
"size": 23619
} | [
"javax.naming.InvalidNameException"
] | import javax.naming.InvalidNameException; | import javax.naming.*; | [
"javax.naming"
] | javax.naming; | 1,414,314 |
void updateRemotes() {
service
.remoteList(project.getLocation(), null, true)
.then(
remotes -> {
updateLocalBranches();
view.setRepositories(remotes);
view.setEnablePushButton(!remotes.isEmpty());
view.setSelectedForcePushCheckBox(false);
view.showDialog();
})
.catchError(
error -> {
String errorMessage =
error.getMessage() != null ? error.getMessage() : locale.remoteListFailed();
GitOutputConsole console = gitOutputConsoleFactory.create(REMOTE_REPO_COMMAND_NAME);
console.printError(errorMessage);
processesPanelPresenter.addCommandOutput(console);
notificationManager.notify(locale.remoteListFailed(), FAIL, FLOAT_MODE);
view.setEnablePushButton(false);
});
} | void updateRemotes() { service .remoteList(project.getLocation(), null, true) .then( remotes -> { updateLocalBranches(); view.setRepositories(remotes); view.setEnablePushButton(!remotes.isEmpty()); view.setSelectedForcePushCheckBox(false); view.showDialog(); }) .catchError( error -> { String errorMessage = error.getMessage() != null ? error.getMessage() : locale.remoteListFailed(); GitOutputConsole console = gitOutputConsoleFactory.create(REMOTE_REPO_COMMAND_NAME); console.printError(errorMessage); processesPanelPresenter.addCommandOutput(console); notificationManager.notify(locale.remoteListFailed(), FAIL, FLOAT_MODE); view.setEnablePushButton(false); }); } | /**
* Get the list of remote repositories for local one. If remote repositories are found, then get
* the list of branches (remote and local).
*/ | Get the list of remote repositories for local one. If remote repositories are found, then get the list of branches (remote and local) | updateRemotes | {
"repo_name": "sleshchenko/che",
"path": "plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/push/PushToRemotePresenter.java",
"license": "epl-1.0",
"size": 15280
} | [
"org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole"
] | import org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole; | import org.eclipse.che.ide.ext.git.client.outputconsole.*; | [
"org.eclipse.che"
] | org.eclipse.che; | 1,631,227 |
protected ContextMenu getWeekDayViewMenu(ContextMenuParameter param) {
ContextMenu contextMenu = getDayViewBaseMenu(param);
WeekDayView weekDayView = (WeekDayView) param.getDateControl();
WeekView weekView = weekDayView.getWeekView();
Menu daysMenu = new Menu(Messages.getString("ContextMenuProvider.SHOW_DAYS")); //$NON-NLS-1$
int[] days = new int[]{5, 7, 14, 21, 28};
for (int d : days) {
String itemText = MessageFormat.format(Messages.getString("ContextMenuProvider.DAYS"), d); //$NON-NLS-1$
MenuItem item = new MenuItem(itemText);
item.setOnAction(evt -> weekView.setNumberOfDays(d));
daysMenu.getItems().add(item);
}
contextMenu.getItems().add(daysMenu);
return contextMenu;
} | ContextMenu function(ContextMenuParameter param) { ContextMenu contextMenu = getDayViewBaseMenu(param); WeekDayView weekDayView = (WeekDayView) param.getDateControl(); WeekView weekView = weekDayView.getWeekView(); Menu daysMenu = new Menu(Messages.getString(STR)); int[] days = new int[]{5, 7, 14, 21, 28}; for (int d : days) { String itemText = MessageFormat.format(Messages.getString(STR), d); MenuItem item = new MenuItem(itemText); item.setOnAction(evt -> weekView.setNumberOfDays(d)); daysMenu.getItems().add(item); } contextMenu.getItems().add(daysMenu); return contextMenu; } | /**
* Returns the context menu specific for a single {@link WeekDayView}. Week
* day views are used inside a {@link WeekView}.
*
* @param param
* parameter object with the most relevant information for
* creating a new context menu
* @return a context menu for a week day view
*/ | Returns the context menu specific for a single <code>WeekDayView</code>. Week day views are used inside a <code>WeekView</code> | getWeekDayViewMenu | {
"repo_name": "TeHenua/Atea",
"path": "src/com/calendarfx/view/ContextMenuProvider.java",
"license": "gpl-3.0",
"size": 11042
} | [
"com.calendarfx.view.DateControl",
"java.text.MessageFormat"
] | import com.calendarfx.view.DateControl; import java.text.MessageFormat; | import com.calendarfx.view.*; import java.text.*; | [
"com.calendarfx.view",
"java.text"
] | com.calendarfx.view; java.text; | 1,090,323 |
public TestElement createTestElement(Class<?> guiClass, Class<?> testClass) {
try {
JMeterGUIComponent comp = getGuiFromCache(guiClass, testClass);
comp.clearGui();
TestElement node = comp.createTestElement();
nodesToGui.put(node, comp);
return node;
} catch (Exception e) {
log.error("Problem retrieving gui", e);
return null;
}
} | TestElement function(Class<?> guiClass, Class<?> testClass) { try { JMeterGUIComponent comp = getGuiFromCache(guiClass, testClass); comp.clearGui(); TestElement node = comp.createTestElement(); nodesToGui.put(node, comp); return node; } catch (Exception e) { log.error(STR, e); return null; } } | /**
* Create a TestElement corresponding to the specified GUI class.
*
* @param guiClass
* the fully qualified class name of the GUI component or a
* TestBean class for TestBeanGUIs.
* @param testClass
* the fully qualified class name of the test elements edited by
* this GUI component.
* @return the test element corresponding to the specified GUI class.
*/ | Create a TestElement corresponding to the specified GUI class | createTestElement | {
"repo_name": "benbenw/jmeter",
"path": "src/core/src/main/java/org/apache/jmeter/gui/GuiPackage.java",
"license": "apache-2.0",
"size": 34909
} | [
"org.apache.jmeter.testelement.TestElement"
] | import org.apache.jmeter.testelement.TestElement; | import org.apache.jmeter.testelement.*; | [
"org.apache.jmeter"
] | org.apache.jmeter; | 2,478,390 |
public TestSuiteBuilder matchClasses(Predicate<Class<?>> predicate) {
matchClassPredicate = predicate;
return this;
} | TestSuiteBuilder function(Predicate<Class<?>> predicate) { matchClassPredicate = predicate; return this; } | /**
* Specifies a predicate returns false for classes we want to exclude.
*/ | Specifies a predicate returns false for classes we want to exclude | matchClasses | {
"repo_name": "orrsella/bazel-example",
"path": "build_tools/src/main/java/testing/junit/TestSuiteBuilder.java",
"license": "apache-2.0",
"size": 4280
} | [
"com.google.common.base.Predicate"
] | import com.google.common.base.Predicate; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 944,847 |
public TIFFNode getMetaDataTree() {
return root;
} | TIFFNode function() { return root; } | /**
* Gets the meta data as a Swing TreeNode structure.
*/ | Gets the meta data as a Swing TreeNode structure | getMetaDataTree | {
"repo_name": "sebkur/montemedia",
"path": "src/main/org/monte/media/exif/EXIFReader.java",
"license": "lgpl-3.0",
"size": 50534
} | [
"org.monte.media.tiff.TIFFNode"
] | import org.monte.media.tiff.TIFFNode; | import org.monte.media.tiff.*; | [
"org.monte.media"
] | org.monte.media; | 2,511,249 |
EReference getInBinding_Binding(); | EReference getInBinding_Binding(); | /**
* Returns the meta object for the container reference '{@link ucm.map.InBinding#getBinding <em>Binding</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the container reference '<em>Binding</em>'.
* @see ucm.map.InBinding#getBinding()
* @see #getInBinding()
* @generated
*/ | Returns the meta object for the container reference '<code>ucm.map.InBinding#getBinding Binding</code>'. | getInBinding_Binding | {
"repo_name": "McGill-DP-Group/seg.jUCMNav",
"path": "src/ucm/map/MapPackage.java",
"license": "epl-1.0",
"size": 151897
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,919,286 |
@Test
public void testSubtaskRequestNoSummary() throws Exception {
PendingCheckpointStats checkpoint = mock(PendingCheckpointStats.class);
when(checkpoint.getCheckpointId()).thenReturn(1992139L);
when(checkpoint.getStatus()).thenReturn(CheckpointStatsStatus.IN_PROGRESS);
when(checkpoint.getTriggerTimestamp()).thenReturn(0L); // ack timestamp = duration
TaskStateStats task = createTaskStateStats(0); // no acknowledged
when(checkpoint.getTaskStateStats(any(JobVertexID.class))).thenReturn(task);
JsonNode rootNode = triggerRequest(checkpoint);
assertNull(rootNode.get("summary"));
} | void function() throws Exception { PendingCheckpointStats checkpoint = mock(PendingCheckpointStats.class); when(checkpoint.getCheckpointId()).thenReturn(1992139L); when(checkpoint.getStatus()).thenReturn(CheckpointStatsStatus.IN_PROGRESS); when(checkpoint.getTriggerTimestamp()).thenReturn(0L); TaskStateStats task = createTaskStateStats(0); when(checkpoint.getTaskStateStats(any(JobVertexID.class))).thenReturn(task); JsonNode rootNode = triggerRequest(checkpoint); assertNull(rootNode.get(STR)); } | /**
* Tests a subtask details request.
*/ | Tests a subtask details request | testSubtaskRequestNoSummary | {
"repo_name": "haohui/flink",
"path": "flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/legacy/checkpoints/CheckpointStatsSubtaskDetailsHandlerTest.java",
"license": "apache-2.0",
"size": 18273
} | [
"com.fasterxml.jackson.databind.JsonNode",
"org.apache.flink.runtime.checkpoint.CheckpointStatsStatus",
"org.apache.flink.runtime.checkpoint.PendingCheckpointStats",
"org.apache.flink.runtime.checkpoint.TaskStateStats",
"org.apache.flink.runtime.jobgraph.JobVertexID",
"org.junit.Assert",
"org.mockito.Mockito"
] | import com.fasterxml.jackson.databind.JsonNode; import org.apache.flink.runtime.checkpoint.CheckpointStatsStatus; import org.apache.flink.runtime.checkpoint.PendingCheckpointStats; import org.apache.flink.runtime.checkpoint.TaskStateStats; import org.apache.flink.runtime.jobgraph.JobVertexID; import org.junit.Assert; import org.mockito.Mockito; | import com.fasterxml.jackson.databind.*; import org.apache.flink.runtime.checkpoint.*; import org.apache.flink.runtime.jobgraph.*; import org.junit.*; import org.mockito.*; | [
"com.fasterxml.jackson",
"org.apache.flink",
"org.junit",
"org.mockito"
] | com.fasterxml.jackson; org.apache.flink; org.junit; org.mockito; | 647,471 |
@Test
public void testMapJoin3() throws IOException {
assertEqual("mapJoin3");
} | void function() throws IOException { assertEqual(STR); } | /**
* Tests maps and joins.
*
* @throws IOException should not occur
*/ | Tests maps and joins | testMapJoin3 | {
"repo_name": "SSEHUB/EASyProducer",
"path": "Plugins/Instantiation/de.uni_hildesheim.sse.vil.buildlang.tests/src/test/de/uni_hildesheim/sse/vil/buildlang/BasicTests.java",
"license": "apache-2.0",
"size": 16990
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,313,801 |
public void setAtomicWorkPath(Path atomicWorkPath) {
this.atomicWorkPath = atomicWorkPath;
} | void function(Path atomicWorkPath) { this.atomicWorkPath = atomicWorkPath; } | /**
* Set the work path for atomic commit
*
* @param atomicWorkPath - Path on the target cluster
*/ | Set the work path for atomic commit | setAtomicWorkPath | {
"repo_name": "busbey/hadoop",
"path": "hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/DistCpOptions.java",
"license": "apache-2.0",
"size": 19158
} | [
"org.apache.hadoop.fs.Path"
] | import org.apache.hadoop.fs.Path; | import org.apache.hadoop.fs.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,845,791 |
public static OptionSet parse(String xmlFilePath) throws ParserConfigurationException,
SAXException,
IOException {
// Validation
XMLValidator xmlValidator = new XMLValidator(xmlFilePath);
xmlValidator.validate();
if (!xmlValidator.isValidXml()) {
throw new SAXException(xmlValidator.getError());
}
// Parsing
XMLOptionReader xmlReader = new XMLOptionReader();
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
parser.parse(new File(xmlFilePath), xmlReader);
return xmlReader.getOptions();
} | static OptionSet function(String xmlFilePath) throws ParserConfigurationException, SAXException, IOException { XMLValidator xmlValidator = new XMLValidator(xmlFilePath); xmlValidator.validate(); if (!xmlValidator.isValidXml()) { throw new SAXException(xmlValidator.getError()); } XMLOptionReader xmlReader = new XMLOptionReader(); SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); parser.parse(new File(xmlFilePath), xmlReader); return xmlReader.getOptions(); } | /**
* Returns the options created from the XML file.
*
* @param xmlFilePath Path of the xmlFile
* @return The options created
*
* @throws ParserConfigurationException Parser creation failed
* @throws SAXException Invalid XML format or option creation error
* @throws IOException xmlFile not found
*/ | Returns the options created from the XML file | parse | {
"repo_name": "jdussouillez/JCLAP",
"path": "src/main/java/org/jd/jclap/options/xml/XMLOptionReader.java",
"license": "bsd-3-clause",
"size": 6887
} | [
"java.io.File",
"java.io.IOException",
"javax.xml.parsers.ParserConfigurationException",
"javax.xml.parsers.SAXParser",
"javax.xml.parsers.SAXParserFactory",
"org.jd.jclap.options.OptionSet",
"org.xml.sax.SAXException"
] | import java.io.File; import java.io.IOException; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.jd.jclap.options.OptionSet; import org.xml.sax.SAXException; | import java.io.*; import javax.xml.parsers.*; import org.jd.jclap.options.*; import org.xml.sax.*; | [
"java.io",
"javax.xml",
"org.jd.jclap",
"org.xml.sax"
] | java.io; javax.xml; org.jd.jclap; org.xml.sax; | 1,979,502 |
protected void set_lastpolltime(Date time) {
m_lastPollTime = new Timestamp(time.getTime());
m_changed |= CHANGED_POLLTIME;
} | void function(Date time) { m_lastPollTime = new Timestamp(time.getTime()); m_changed = CHANGED_POLLTIME; } | /**
* Sets the last poll time.
*
* @param time The last poll time.
*
*/ | Sets the last poll time | set_lastpolltime | {
"repo_name": "vishwaAbhinav/OpenNMS",
"path": "opennms-services/src/main/java/org/opennms/netmgt/linkd/DbVlanEntry.java",
"license": "gpl-2.0",
"size": 18681
} | [
"java.sql.Timestamp",
"java.util.Date"
] | import java.sql.Timestamp; import java.util.Date; | import java.sql.*; import java.util.*; | [
"java.sql",
"java.util"
] | java.sql; java.util; | 2,858,462 |
public YangUInt8 getMaxPdnConnPerUeValue() throws JNCException {
YangUInt8 maxPdnConnPerUe = (YangUInt8)getValue("max-pdn-conn-per-ue");
if (maxPdnConnPerUe == null) {
maxPdnConnPerUe = new YangUInt8("8"); // default
}
return maxPdnConnPerUe;
} | YangUInt8 function() throws JNCException { YangUInt8 maxPdnConnPerUe = (YangUInt8)getValue(STR); if (maxPdnConnPerUe == null) { maxPdnConnPerUe = new YangUInt8("8"); } return maxPdnConnPerUe; } | /**
* Gets the value for child leaf "max-pdn-conn-per-ue".
* @return The value of the leaf.
*/ | Gets the value for child leaf "max-pdn-conn-per-ue" | getMaxPdnConnPerUeValue | {
"repo_name": "jnpr-shinma/yangfile",
"path": "hitel/src/hctaEpc/mmeSgsn/interface_/nas/MmeNasSm.java",
"license": "apache-2.0",
"size": 46144
} | [
"com.tailf.jnc.YangUInt8"
] | import com.tailf.jnc.YangUInt8; | import com.tailf.jnc.*; | [
"com.tailf.jnc"
] | com.tailf.jnc; | 1,014,249 |
public String processSelectedRange(ValueChangeEvent vce) {
String viewRange = (String) vce.getNewValue();
if (disabledSelectView.equals(viewRange))
return MAIN_EVENTS_LIST_PAGE_URL;// do-nothing for IE browser
// case
setViewDateRang(viewRange);
setSignupMeetings(null);// reset
return MAIN_EVENTS_LIST_PAGE_URL;
}
| String function(ValueChangeEvent vce) { String viewRange = (String) vce.getNewValue(); if (disabledSelectView.equals(viewRange)) return MAIN_EVENTS_LIST_PAGE_URL; setViewDateRang(viewRange); setSignupMeetings(null); return MAIN_EVENTS_LIST_PAGE_URL; } | /**
* This is a ValueChange Listener to watch the view-range type selection by
* user.
*
* @param vce
* a ValuechangeEvent object.
* @return a outcome string.
*/ | This is a ValueChange Listener to watch the view-range type selection by user | processSelectedRange | {
"repo_name": "noondaysun/sakai",
"path": "signup/tool/src/java/org/sakaiproject/signup/tool/jsf/SignupMeetingsBean.java",
"license": "apache-2.0",
"size": 34804
} | [
"javax.faces.event.ValueChangeEvent"
] | import javax.faces.event.ValueChangeEvent; | import javax.faces.event.*; | [
"javax.faces"
] | javax.faces; | 827,362 |
@Test
public void testExtendedAttributesConditionalUpdates() throws Exception {
final AttributeId ea1 = AttributeId.uuid(0, 1);
final AttributeId ea2 = AttributeId.uuid(0, 2);
final List<AttributeId> allAttributes = Stream.of(ea1, ea2).collect(Collectors.toList());
// We set a longer Segment Expiration time, since this test executes more operations than the others.
final TestContainerConfig containerConfig = new TestContainerConfig();
containerConfig.setSegmentMetadataExpiration(Duration.ofMillis(EVICTION_SEGMENT_EXPIRATION_MILLIS_LONG));
AtomicInteger expectedAttributeValue = new AtomicInteger(0);
@Cleanup
TestContext context = createContext();
OperationLogFactory localDurableLogFactory = new DurableLogFactory(FREQUENT_TRUNCATIONS_DURABLE_LOG_CONFIG, context.dataLogFactory, executorService());
@Cleanup
MetadataCleanupContainer localContainer = new MetadataCleanupContainer(CONTAINER_ID, containerConfig, localDurableLogFactory,
context.readIndexFactory, context.attributeIndexFactory, context.writerFactory, context.storageFactory,
context.getDefaultExtensions(), executorService());
localContainer.startAsync().awaitRunning();
// 1. Create the StreamSegments and set the initial attribute values.
ArrayList<String> segmentNames = createSegments(localContainer);
ArrayList<CompletableFuture<Void>> opFutures = new ArrayList<>();
// 2. Update some of the attributes.
expectedAttributeValue.set(1);
for (String segmentName : segmentNames) {
AttributeUpdateCollection attributeUpdates = allAttributes
.stream()
.map(attributeId -> new AttributeUpdate(attributeId, AttributeUpdateType.Accumulate, 1))
.collect(Collectors.toCollection(AttributeUpdateCollection::new));
opFutures.add(localContainer.updateAttributes(segmentName, attributeUpdates, TIMEOUT));
}
Futures.allOf(opFutures).get(TIMEOUT.toMillis(), TimeUnit.MILLISECONDS);
// 3. Force these segments out of memory, so that we may verify conditional appends/updates on extended attributes.
localContainer.triggerMetadataCleanup(segmentNames).get(TIMEOUT.toMillis(), TimeUnit.MILLISECONDS);
// 4. Execute various conditional operations using these attributes as comparison.
long compare = expectedAttributeValue.getAndIncrement();
long set = expectedAttributeValue.get();
boolean badUpdate = false;
for (String segmentName : segmentNames) {
if (badUpdate) {
// For every other segment, try to do a bad update, then a good one. This helps us verify both direct
// conditional operations, failed conditional operations and conditional operations with cached attributes.
AssertExtensions.assertSuppliedFutureThrows(
"Conditional append succeeded with incorrect compare value.",
() -> localContainer.append(segmentName, getAppendData(segmentName, 0),
AttributeUpdateCollection.from(new AttributeUpdate(ea1, AttributeUpdateType.ReplaceIfEquals, set, compare - 1)), TIMEOUT),
ex -> (ex instanceof BadAttributeUpdateException) && !((BadAttributeUpdateException) ex).isPreviousValueMissing());
AssertExtensions.assertSuppliedFutureThrows(
"Conditional update-attributes succeeded with incorrect compare value.",
() -> localContainer.updateAttributes(segmentName,
AttributeUpdateCollection.from(new AttributeUpdate(ea2, AttributeUpdateType.ReplaceIfEquals, set, compare - 1)), TIMEOUT),
ex -> (ex instanceof BadAttributeUpdateException) && !((BadAttributeUpdateException) ex).isPreviousValueMissing());
}
opFutures.add(Futures.toVoid(localContainer.append(segmentName, getAppendData(segmentName, 0),
AttributeUpdateCollection.from(new AttributeUpdate(ea1, AttributeUpdateType.ReplaceIfEquals, set, compare)), TIMEOUT)));
opFutures.add(localContainer.updateAttributes(segmentName,
AttributeUpdateCollection.from(new AttributeUpdate(ea2, AttributeUpdateType.ReplaceIfEquals, set, compare)), TIMEOUT));
badUpdate = !badUpdate;
}
Futures.allOf(opFutures).get(TIMEOUT.toMillis(), TimeUnit.MILLISECONDS);
// 4. Evict the segment from memory, then verify results.
localContainer.triggerMetadataCleanup(segmentNames).get(TIMEOUT.toMillis(), TimeUnit.MILLISECONDS);
for (String segmentName : segmentNames) {
// Verify all attribute values.
val attributeValues = localContainer.getAttributes(segmentName, allAttributes, true, TIMEOUT).join();
val sp = localContainer.getStreamSegmentInfo(segmentName, TIMEOUT).join();
for (val attributeId : allAttributes) {
Assert.assertEquals("Unexpected value for non-cached attribute " + attributeId + " for segment " + segmentName,
expectedAttributeValue.get(), (long) attributeValues.getOrDefault(attributeId, Attributes.NULL_ATTRIBUTE_VALUE));
Assert.assertEquals("Unexpected value for metadata attribute " + attributeId + " for segment " + segmentName,
expectedAttributeValue.get(), (long) sp.getAttributes().getOrDefault(attributeId, Attributes.NULL_ATTRIBUTE_VALUE));
}
}
localContainer.stopAsync().awaitTerminated();
} | void function() throws Exception { final AttributeId ea1 = AttributeId.uuid(0, 1); final AttributeId ea2 = AttributeId.uuid(0, 2); final List<AttributeId> allAttributes = Stream.of(ea1, ea2).collect(Collectors.toList()); final TestContainerConfig containerConfig = new TestContainerConfig(); containerConfig.setSegmentMetadataExpiration(Duration.ofMillis(EVICTION_SEGMENT_EXPIRATION_MILLIS_LONG)); AtomicInteger expectedAttributeValue = new AtomicInteger(0); TestContext context = createContext(); OperationLogFactory localDurableLogFactory = new DurableLogFactory(FREQUENT_TRUNCATIONS_DURABLE_LOG_CONFIG, context.dataLogFactory, executorService()); MetadataCleanupContainer localContainer = new MetadataCleanupContainer(CONTAINER_ID, containerConfig, localDurableLogFactory, context.readIndexFactory, context.attributeIndexFactory, context.writerFactory, context.storageFactory, context.getDefaultExtensions(), executorService()); localContainer.startAsync().awaitRunning(); ArrayList<String> segmentNames = createSegments(localContainer); ArrayList<CompletableFuture<Void>> opFutures = new ArrayList<>(); expectedAttributeValue.set(1); for (String segmentName : segmentNames) { AttributeUpdateCollection attributeUpdates = allAttributes .stream() .map(attributeId -> new AttributeUpdate(attributeId, AttributeUpdateType.Accumulate, 1)) .collect(Collectors.toCollection(AttributeUpdateCollection::new)); opFutures.add(localContainer.updateAttributes(segmentName, attributeUpdates, TIMEOUT)); } Futures.allOf(opFutures).get(TIMEOUT.toMillis(), TimeUnit.MILLISECONDS); localContainer.triggerMetadataCleanup(segmentNames).get(TIMEOUT.toMillis(), TimeUnit.MILLISECONDS); long compare = expectedAttributeValue.getAndIncrement(); long set = expectedAttributeValue.get(); boolean badUpdate = false; for (String segmentName : segmentNames) { if (badUpdate) { AssertExtensions.assertSuppliedFutureThrows( STR, () -> localContainer.append(segmentName, getAppendData(segmentName, 0), AttributeUpdateCollection.from(new AttributeUpdate(ea1, AttributeUpdateType.ReplaceIfEquals, set, compare - 1)), TIMEOUT), ex -> (ex instanceof BadAttributeUpdateException) && !((BadAttributeUpdateException) ex).isPreviousValueMissing()); AssertExtensions.assertSuppliedFutureThrows( STR, () -> localContainer.updateAttributes(segmentName, AttributeUpdateCollection.from(new AttributeUpdate(ea2, AttributeUpdateType.ReplaceIfEquals, set, compare - 1)), TIMEOUT), ex -> (ex instanceof BadAttributeUpdateException) && !((BadAttributeUpdateException) ex).isPreviousValueMissing()); } opFutures.add(Futures.toVoid(localContainer.append(segmentName, getAppendData(segmentName, 0), AttributeUpdateCollection.from(new AttributeUpdate(ea1, AttributeUpdateType.ReplaceIfEquals, set, compare)), TIMEOUT))); opFutures.add(localContainer.updateAttributes(segmentName, AttributeUpdateCollection.from(new AttributeUpdate(ea2, AttributeUpdateType.ReplaceIfEquals, set, compare)), TIMEOUT)); badUpdate = !badUpdate; } Futures.allOf(opFutures).get(TIMEOUT.toMillis(), TimeUnit.MILLISECONDS); localContainer.triggerMetadataCleanup(segmentNames).get(TIMEOUT.toMillis(), TimeUnit.MILLISECONDS); for (String segmentName : segmentNames) { val attributeValues = localContainer.getAttributes(segmentName, allAttributes, true, TIMEOUT).join(); val sp = localContainer.getStreamSegmentInfo(segmentName, TIMEOUT).join(); for (val attributeId : allAttributes) { Assert.assertEquals(STR + attributeId + STR + segmentName, expectedAttributeValue.get(), (long) attributeValues.getOrDefault(attributeId, Attributes.NULL_ATTRIBUTE_VALUE)); Assert.assertEquals(STR + attributeId + STR + segmentName, expectedAttributeValue.get(), (long) sp.getAttributes().getOrDefault(attributeId, Attributes.NULL_ATTRIBUTE_VALUE)); } } localContainer.stopAsync().awaitTerminated(); } | /**
* Test conditional updates for Extended Attributes when they are not loaded in memory (i.e., they will need to be
* auto-fetched from the AttributeIndex so that the operation may succeed).
*/ | Test conditional updates for Extended Attributes when they are not loaded in memory (i.e., they will need to be auto-fetched from the AttributeIndex so that the operation may succeed) | testExtendedAttributesConditionalUpdates | {
"repo_name": "pravega/pravega",
"path": "segmentstore/server/src/test/java/io/pravega/segmentstore/server/containers/StreamSegmentContainerTests.java",
"license": "apache-2.0",
"size": 197112
} | [
"io.pravega.common.concurrent.Futures",
"io.pravega.segmentstore.contracts.AttributeId",
"io.pravega.segmentstore.contracts.AttributeUpdate",
"io.pravega.segmentstore.contracts.AttributeUpdateCollection",
"io.pravega.segmentstore.contracts.AttributeUpdateType",
"io.pravega.segmentstore.contracts.Attributes",
"io.pravega.segmentstore.contracts.BadAttributeUpdateException",
"io.pravega.segmentstore.server.OperationLogFactory",
"io.pravega.segmentstore.server.logs.DurableLogFactory",
"io.pravega.test.common.AssertExtensions",
"java.time.Duration",
"java.util.ArrayList",
"java.util.List",
"java.util.concurrent.CompletableFuture",
"java.util.concurrent.TimeUnit",
"java.util.concurrent.atomic.AtomicInteger",
"java.util.stream.Collectors",
"java.util.stream.Stream",
"org.junit.Assert"
] | import io.pravega.common.concurrent.Futures; import io.pravega.segmentstore.contracts.AttributeId; import io.pravega.segmentstore.contracts.AttributeUpdate; import io.pravega.segmentstore.contracts.AttributeUpdateCollection; import io.pravega.segmentstore.contracts.AttributeUpdateType; import io.pravega.segmentstore.contracts.Attributes; import io.pravega.segmentstore.contracts.BadAttributeUpdateException; import io.pravega.segmentstore.server.OperationLogFactory; import io.pravega.segmentstore.server.logs.DurableLogFactory; import io.pravega.test.common.AssertExtensions; import java.time.Duration; import java.util.ArrayList; import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import java.util.stream.Stream; import org.junit.Assert; | import io.pravega.common.concurrent.*; import io.pravega.segmentstore.contracts.*; import io.pravega.segmentstore.server.*; import io.pravega.segmentstore.server.logs.*; import io.pravega.test.common.*; import java.time.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; import java.util.stream.*; import org.junit.*; | [
"io.pravega.common",
"io.pravega.segmentstore",
"io.pravega.test",
"java.time",
"java.util",
"org.junit"
] | io.pravega.common; io.pravega.segmentstore; io.pravega.test; java.time; java.util; org.junit; | 807,596 |
private GridSqlCreateIndex parseCreateIndex(CreateIndex createIdx) {
if (CREATE_INDEX_HASH.get(createIdx) || CREATE_INDEX_PRIMARY_KEY.get(createIdx) ||
CREATE_INDEX_UNIQUE.get(createIdx))
throw new IgniteSQLException("Only SPATIAL modifier is supported for CREATE INDEX",
IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
GridSqlCreateIndex res = new GridSqlCreateIndex();
Schema schema = SCHEMA_COMMAND_SCHEMA.get(createIdx);
String tblName = CREATE_INDEX_TABLE_NAME.get(createIdx);
res.schemaName(schema.getName());
res.tableName(tblName);
res.ifNotExists(CREATE_INDEX_IF_NOT_EXISTS.get(createIdx));
QueryIndex idx = new QueryIndex();
idx.setName(CREATE_INDEX_NAME.get(createIdx));
idx.setIndexType(CREATE_INDEX_SPATIAL.get(createIdx) ? QueryIndexType.GEOSPATIAL : QueryIndexType.SORTED);
IndexColumn[] cols = CREATE_INDEX_COLUMNS.get(createIdx);
LinkedHashMap<String, Boolean> flds = new LinkedHashMap<>(cols.length);
for (IndexColumn col : CREATE_INDEX_COLUMNS.get(createIdx)) {
int sortType = INDEX_COLUMN_SORT_TYPE.get(col);
if ((sortType & SortOrder.NULLS_FIRST) != 0 || (sortType & SortOrder.NULLS_LAST) != 0)
throw new IgniteSQLException("NULLS FIRST and NULLS LAST modifiers are not supported for index columns",
IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
flds.put(INDEX_COLUMN_NAME.get(col), (sortType & SortOrder.DESCENDING) == 0);
}
idx.setFields(flds);
res.index(idx);
return res;
} | GridSqlCreateIndex function(CreateIndex createIdx) { if (CREATE_INDEX_HASH.get(createIdx) CREATE_INDEX_PRIMARY_KEY.get(createIdx) CREATE_INDEX_UNIQUE.get(createIdx)) throw new IgniteSQLException(STR, IgniteQueryErrorCode.UNSUPPORTED_OPERATION); GridSqlCreateIndex res = new GridSqlCreateIndex(); Schema schema = SCHEMA_COMMAND_SCHEMA.get(createIdx); String tblName = CREATE_INDEX_TABLE_NAME.get(createIdx); res.schemaName(schema.getName()); res.tableName(tblName); res.ifNotExists(CREATE_INDEX_IF_NOT_EXISTS.get(createIdx)); QueryIndex idx = new QueryIndex(); idx.setName(CREATE_INDEX_NAME.get(createIdx)); idx.setIndexType(CREATE_INDEX_SPATIAL.get(createIdx) ? QueryIndexType.GEOSPATIAL : QueryIndexType.SORTED); IndexColumn[] cols = CREATE_INDEX_COLUMNS.get(createIdx); LinkedHashMap<String, Boolean> flds = new LinkedHashMap<>(cols.length); for (IndexColumn col : CREATE_INDEX_COLUMNS.get(createIdx)) { int sortType = INDEX_COLUMN_SORT_TYPE.get(col); if ((sortType & SortOrder.NULLS_FIRST) != 0 (sortType & SortOrder.NULLS_LAST) != 0) throw new IgniteSQLException(STR, IgniteQueryErrorCode.UNSUPPORTED_OPERATION); flds.put(INDEX_COLUMN_NAME.get(col), (sortType & SortOrder.DESCENDING) == 0); } idx.setFields(flds); res.index(idx); return res; } | /**
* Parse {@code CREATE INDEX} statement.
*
* @param createIdx {@code CREATE INDEX} statement.
* @see <a href="http://h2database.com/html/grammar.html#create_index">H2 {@code CREATE INDEX} spec.</a>
*/ | Parse CREATE INDEX statement | parseCreateIndex | {
"repo_name": "a1vanov/ignite",
"path": "modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java",
"license": "apache-2.0",
"size": 55947
} | [
"java.util.LinkedHashMap",
"org.apache.ignite.cache.QueryIndex",
"org.apache.ignite.cache.QueryIndexType",
"org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode",
"org.apache.ignite.internal.processors.query.IgniteSQLException",
"org.apache.ignite.internal.processors.query.h2.sql.GridSqlOperationType",
"org.h2.command.ddl.CreateIndex",
"org.h2.result.SortOrder",
"org.h2.schema.Schema",
"org.h2.table.IndexColumn"
] | import java.util.LinkedHashMap; import org.apache.ignite.cache.QueryIndex; import org.apache.ignite.cache.QueryIndexType; import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode; import org.apache.ignite.internal.processors.query.IgniteSQLException; import org.apache.ignite.internal.processors.query.h2.sql.GridSqlOperationType; import org.h2.command.ddl.CreateIndex; import org.h2.result.SortOrder; import org.h2.schema.Schema; import org.h2.table.IndexColumn; | import java.util.*; import org.apache.ignite.cache.*; import org.apache.ignite.internal.processors.cache.query.*; import org.apache.ignite.internal.processors.query.*; import org.apache.ignite.internal.processors.query.h2.sql.*; import org.h2.command.ddl.*; import org.h2.result.*; import org.h2.schema.*; import org.h2.table.*; | [
"java.util",
"org.apache.ignite",
"org.h2.command",
"org.h2.result",
"org.h2.schema",
"org.h2.table"
] | java.util; org.apache.ignite; org.h2.command; org.h2.result; org.h2.schema; org.h2.table; | 1,663,726 |
public void setArray(Map<String, List<String>> array) {
this.array = array;
} | void function(Map<String, List<String>> array) { this.array = array; } | /**
* Sets the arrays.
*
* @param array the arrays
*/ | Sets the arrays | setArray | {
"repo_name": "balachandarsv/rivescript-java",
"path": "rivescript-core/src/main/java/com/rivescript/ast/Begin.java",
"license": "mit",
"size": 5379
} | [
"java.util.List",
"java.util.Map"
] | import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 533,771 |
//------------------------- AUTOGENERATED START -------------------------
///CLOVER:OFF
public static CalculationRequirements.Meta meta() {
return CalculationRequirements.Meta.INSTANCE;
}
static {
JodaBeanUtils.registerMetaBean(CalculationRequirements.Meta.INSTANCE);
}
CalculationRequirements(
Set<? extends ObservableId> observables,
Set<? extends MarketDataId<?>> nonObservables,
Set<? extends ObservableId> timeSeries,
Set<Currency> outputCurrencies) {
JodaBeanUtils.notNull(observables, "observables");
JodaBeanUtils.notNull(nonObservables, "nonObservables");
JodaBeanUtils.notNull(timeSeries, "timeSeries");
JodaBeanUtils.notNull(outputCurrencies, "outputCurrencies");
this.observables = ImmutableSet.copyOf(observables);
this.nonObservables = ImmutableSet.copyOf(nonObservables);
this.timeSeries = ImmutableSet.copyOf(timeSeries);
this.outputCurrencies = ImmutableSet.copyOf(outputCurrencies);
} | static CalculationRequirements.Meta function() { return CalculationRequirements.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(CalculationRequirements.Meta.INSTANCE); } CalculationRequirements( Set<? extends ObservableId> observables, Set<? extends MarketDataId<?>> nonObservables, Set<? extends ObservableId> timeSeries, Set<Currency> outputCurrencies) { JodaBeanUtils.notNull(observables, STR); JodaBeanUtils.notNull(nonObservables, STR); JodaBeanUtils.notNull(timeSeries, STR); JodaBeanUtils.notNull(outputCurrencies, STR); this.observables = ImmutableSet.copyOf(observables); this.nonObservables = ImmutableSet.copyOf(nonObservables); this.timeSeries = ImmutableSet.copyOf(timeSeries); this.outputCurrencies = ImmutableSet.copyOf(outputCurrencies); } | /**
* The meta-bean for {@code CalculationRequirements}.
* @return the meta-bean, not null
*/ | The meta-bean for CalculationRequirements | meta | {
"repo_name": "nssales/Strata",
"path": "modules/engine/src/main/java/com/opengamma/strata/engine/marketdata/CalculationRequirements.java",
"license": "apache-2.0",
"size": 18065
} | [
"com.google.common.collect.ImmutableSet",
"com.opengamma.strata.basics.currency.Currency",
"com.opengamma.strata.basics.market.MarketDataId",
"com.opengamma.strata.basics.market.ObservableId",
"java.util.Set",
"org.joda.beans.JodaBeanUtils"
] | import com.google.common.collect.ImmutableSet; import com.opengamma.strata.basics.currency.Currency; import com.opengamma.strata.basics.market.MarketDataId; import com.opengamma.strata.basics.market.ObservableId; import java.util.Set; import org.joda.beans.JodaBeanUtils; | import com.google.common.collect.*; import com.opengamma.strata.basics.currency.*; import com.opengamma.strata.basics.market.*; import java.util.*; import org.joda.beans.*; | [
"com.google.common",
"com.opengamma.strata",
"java.util",
"org.joda.beans"
] | com.google.common; com.opengamma.strata; java.util; org.joda.beans; | 461,836 |
public DateTimeZone timeZone() {
return timeZone;
} | DateTimeZone function() { return timeZone; } | /**
* Gets the time zone to use for this aggregation
*/ | Gets the time zone to use for this aggregation | timeZone | {
"repo_name": "qwerty4030/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/DateHistogramValuesSourceBuilder.java",
"license": "apache-2.0",
"size": 10437
} | [
"org.joda.time.DateTimeZone"
] | import org.joda.time.DateTimeZone; | import org.joda.time.*; | [
"org.joda.time"
] | org.joda.time; | 2,044,194 |
private void positionInvisibleNode(TNNode node, int x, int y) {
Rectangle nodeBounds = new Rectangle(x, y, 0, 0);
Map nodeAttributes = node.getAttributes();
GraphConstants.setBounds(nodeAttributes, nodeBounds);
node.setX(x);
node.setY(y);
refreshGraph();
} | void function(TNNode node, int x, int y) { Rectangle nodeBounds = new Rectangle(x, y, 0, 0); Map nodeAttributes = node.getAttributes(); GraphConstants.setBounds(nodeAttributes, nodeBounds); node.setX(x); node.setY(y); refreshGraph(); } | /**
* Positions the given invisible node. Subsequently, the graph will be
* refreshed. An invisible node is characterized by the fact that its
* width and height is 0.
* @param node The invisible node.
* @param x The new x coordinate.
* @param y The new y coordinate.
*/ | Positions the given invisible node. Subsequently, the graph will be refreshed. An invisible node is characterized by the fact that its width and height is 0 | positionInvisibleNode | {
"repo_name": "elitak/peertrust",
"path": "sandbox/TomcatPeerTrust/src/org/peertrust/demo/client/applet/TestSequenceDiagramm.java",
"license": "gpl-2.0",
"size": 27233
} | [
"java.awt.Rectangle",
"java.util.Map",
"org.jgraph.graph.GraphConstants",
"org.peertrust.tnviz.app.TNNode"
] | import java.awt.Rectangle; import java.util.Map; import org.jgraph.graph.GraphConstants; import org.peertrust.tnviz.app.TNNode; | import java.awt.*; import java.util.*; import org.jgraph.graph.*; import org.peertrust.tnviz.app.*; | [
"java.awt",
"java.util",
"org.jgraph.graph",
"org.peertrust.tnviz"
] | java.awt; java.util; org.jgraph.graph; org.peertrust.tnviz; | 2,284,684 |
private void repairClicked(Button ignored)
{
MineColonies.getNetwork().sendToServer(new BuildRequestMessage(building, BuildRequestMessage.REPAIR));
} | void function(Button ignored) { MineColonies.getNetwork().sendToServer(new BuildRequestMessage(building, BuildRequestMessage.REPAIR)); } | /**
* Action when repair button is clicked
*
* @param ignored Parameter is ignored, since some actions require a button.
* This method does not
*/ | Action when repair button is clicked | repairClicked | {
"repo_name": "MinecoloniesDevs/Minecolonies",
"path": "src/main/java/com/minecolonies/client/gui/AbstractWindowSkeleton.java",
"license": "gpl-3.0",
"size": 4870
} | [
"com.blockout.controls.Button",
"com.minecolonies.MineColonies",
"com.minecolonies.network.messages.BuildRequestMessage"
] | import com.blockout.controls.Button; import com.minecolonies.MineColonies; import com.minecolonies.network.messages.BuildRequestMessage; | import com.blockout.controls.*; import com.minecolonies.*; import com.minecolonies.network.messages.*; | [
"com.blockout.controls",
"com.minecolonies",
"com.minecolonies.network"
] | com.blockout.controls; com.minecolonies; com.minecolonies.network; | 2,662,046 |
public void assertHasSameSizeAs(AssertionInfo info, Map<?, ?> map, Map<?, ?> other) {
assertNotNull(info, map);
hasSameSizeAsCheck(info, map, other, map.size());
} | void function(AssertionInfo info, Map<?, ?> map, Map<?, ?> other) { assertNotNull(info, map); hasSameSizeAsCheck(info, map, other, map.size()); } | /**
* Asserts that the size of the given {@code Map} is equal to the size of the other {@code Map}.
*
* @param info contains information about the assertion.
* @param map the given {@code Map}.
* @param other the other {@code Map} to compare
* @throws NullPointerException if the other {@code Map} is {@code null}.
* @throws AssertionError if the given {@code Map} is {@code null}.
* @throws AssertionError if the size of the given {@code Map} is not equal to the other {@code Map} size
*/ | Asserts that the size of the given Map is equal to the size of the other Map | assertHasSameSizeAs | {
"repo_name": "joel-costigliola/assertj-core",
"path": "src/main/java/org/assertj/core/internal/Maps.java",
"license": "apache-2.0",
"size": 40648
} | [
"java.util.Map",
"org.assertj.core.api.AssertionInfo",
"org.assertj.core.internal.CommonValidations"
] | import java.util.Map; import org.assertj.core.api.AssertionInfo; import org.assertj.core.internal.CommonValidations; | import java.util.*; import org.assertj.core.api.*; import org.assertj.core.internal.*; | [
"java.util",
"org.assertj.core"
] | java.util; org.assertj.core; | 2,511,397 |
public PerunBl getPerunBl() {
return this.perunBl;
} | PerunBl function() { return this.perunBl; } | /**
* Gets the perunBl.
*
* @return The perunBl.
*/ | Gets the perunBl | getPerunBl | {
"repo_name": "martin-kuba/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/blImpl/MembersManagerBlImpl.java",
"license": "bsd-2-clause",
"size": 152238
} | [
"cz.metacentrum.perun.core.bl.PerunBl"
] | import cz.metacentrum.perun.core.bl.PerunBl; | import cz.metacentrum.perun.core.bl.*; | [
"cz.metacentrum.perun"
] | cz.metacentrum.perun; | 2,901,941 |
public PresenceSubscribeHandler getPresenceSubscribeHandler() {
return (PresenceSubscribeHandler) modules.get(PresenceSubscribeHandler.class);
} | PresenceSubscribeHandler function() { return (PresenceSubscribeHandler) modules.get(PresenceSubscribeHandler.class); } | /**
* Returns the <code>PresenceSubscribeHandler</code> registered with this server. The
* <code>PresenceSubscribeHandler</code> was registered with the server as a module while
* starting up the server.
*
* @return the <code>PresenceSubscribeHandler</code> registered with this server.
*/ | Returns the <code>PresenceSubscribeHandler</code> registered with this server. The <code>PresenceSubscribeHandler</code> was registered with the server as a module while starting up the server | getPresenceSubscribeHandler | {
"repo_name": "derek-wang/ca.rides.openfire",
"path": "src/java/org/jivesoftware/openfire/XMPPServer.java",
"license": "apache-2.0",
"size": 56798
} | [
"org.jivesoftware.openfire.handler.PresenceSubscribeHandler"
] | import org.jivesoftware.openfire.handler.PresenceSubscribeHandler; | import org.jivesoftware.openfire.handler.*; | [
"org.jivesoftware.openfire"
] | org.jivesoftware.openfire; | 2,323,789 |
public MatchResult match() {
if (!matchSuccessful) {
throw new IllegalStateException();
}
return matcher.toMatchResult();
} | MatchResult function() { if (!matchSuccessful) { throw new IllegalStateException(); } return matcher.toMatchResult(); } | /**
* Returns the result of the last matching operation.
* <p>
* The next* and find* methods return the match result in the case of a
* successful match.
*
* @return the match result of the last successful match operation
* @throws IllegalStateException
* if the match result is not available, of if the last match
* was not successful.
*/ | Returns the result of the last matching operation. The next* and find* methods return the match result in the case of a successful match | match | {
"repo_name": "openweave/openweave-core",
"path": "third_party/android/platform-libcore/android-platform-libcore/luni/src/main/java/java/util/Scanner.java",
"license": "apache-2.0",
"size": 82276
} | [
"java.util.regex.MatchResult"
] | import java.util.regex.MatchResult; | import java.util.regex.*; | [
"java.util"
] | java.util; | 2,438,384 |
public CenterLeader save(CenterLeader researchLeader);
| CenterLeader function(CenterLeader researchLeader); | /**
* This method saves the information of the given research leader
*
* @param researchLeader - is the research leader object with the new information to be added/updated.
* @return a number greater than 0 representing the new ID assigned by the database, 0 if the research leader was
* updated
* or -1 is some error occurred.
*/ | This method saves the information of the given research leader | save | {
"repo_name": "CCAFS/MARLO",
"path": "marlo-data/src/main/java/org/cgiar/ccafs/marlo/data/dao/ICenterLeaderDAO.java",
"license": "gpl-3.0",
"size": 2644
} | [
"org.cgiar.ccafs.marlo.data.model.CenterLeader"
] | import org.cgiar.ccafs.marlo.data.model.CenterLeader; | import org.cgiar.ccafs.marlo.data.model.*; | [
"org.cgiar.ccafs"
] | org.cgiar.ccafs; | 1,294,868 |
@RequestMapping(value = "/data/current-user", method = RequestMethod.POST, produces = "application/json", consumes = "application/json")
@PreAuthorize(value = "hasRole('ROLE_USER')")
public @ResponseBody Map<String, Object> currentUser(@RequestBody String data, Principal principal) throws Exception {
try {
return JsonOutput.mapSingle(JsonOutput.readSasUser(principal).getUsername());
} catch (Exception e) {
e.printStackTrace();
return JsonOutput.mapError("Error while getting current user: "
+ e.getLocalizedMessage());
}
}
| @RequestMapping(value = STR, method = RequestMethod.POST, produces = STR, consumes = STR) @PreAuthorize(value = STR) @ResponseBody Map<String, Object> function(@RequestBody String data, Principal principal) throws Exception { try { return JsonOutput.mapSingle(JsonOutput.readSasUser(principal).getUsername()); } catch (Exception e) { e.printStackTrace(); return JsonOutput.mapError(STR + e.getLocalizedMessage()); } } | /**
* Current user.
*
* @param data the data
* @param principal the principal
* @return the map
* @throws Exception the exception
*/ | Current user | currentUser | {
"repo_name": "gleb619/webcam",
"path": "src/main/java/org/test/webcam/controller/other/UtilsController.java",
"license": "apache-2.0",
"size": 6364
} | [
"java.security.Principal",
"java.util.Map",
"org.springframework.security.access.prepost.PreAuthorize",
"org.springframework.web.bind.annotation.RequestBody",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.bind.annotation.RequestMethod",
"org.springframework.web.bind.annotation.ResponseBody",
"org.test.webcam.controller.data.types.JsonOutput"
] | import java.security.Principal; import java.util.Map; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.test.webcam.controller.data.types.JsonOutput; | import java.security.*; import java.util.*; import org.springframework.security.access.prepost.*; import org.springframework.web.bind.annotation.*; import org.test.webcam.controller.data.types.*; | [
"java.security",
"java.util",
"org.springframework.security",
"org.springframework.web",
"org.test.webcam"
] | java.security; java.util; org.springframework.security; org.springframework.web; org.test.webcam; | 1,745,010 |
public void init(int numPointclouds){
assert(numPointclouds > 0) : new IllegalArgumentException("Number of point-clouds must be bigger than 0.");
this.numPc = numPointclouds;
this.pointList = new ArrayList<SimpleMatrix>(numPc);
}
| void function(int numPointclouds){ assert(numPointclouds > 0) : new IllegalArgumentException(STR); this.numPc = numPointclouds; this.pointList = new ArrayList<SimpleMatrix>(numPc); } | /**
* Initializes the object and initializes the point-cloud list.
* @param numPointClouds Number of point-clouds used for this GPA run.
*/ | Initializes the object and initializes the point-cloud list | init | {
"repo_name": "PhilippSchlieper/CONRAD",
"path": "src/edu/stanford/rsl/conrad/geometry/shapes/activeshapemodels/GPA.java",
"license": "gpl-3.0",
"size": 19483
} | [
"edu.stanford.rsl.conrad.numerics.SimpleMatrix",
"java.util.ArrayList"
] | import edu.stanford.rsl.conrad.numerics.SimpleMatrix; import java.util.ArrayList; | import edu.stanford.rsl.conrad.numerics.*; import java.util.*; | [
"edu.stanford.rsl",
"java.util"
] | edu.stanford.rsl; java.util; | 400,125 |
public static byte [][] split(final byte [] a, final byte [] b, final int num) {
byte [] aPadded = null;
byte [] bPadded = null;
if (a.length < b.length) {
aPadded = padTail(a,b.length-a.length);
bPadded = b;
} else if (b.length < a.length) {
aPadded = a;
bPadded = padTail(b,a.length-b.length);
} else {
aPadded = a;
bPadded = b;
}
if (compareTo(aPadded,bPadded) > 1) {
throw new IllegalArgumentException("b > a");
}
if (num <= 0) throw new IllegalArgumentException("num cannot be < 0");
byte [] prependHeader = {1, 0};
BigInteger startBI = new BigInteger(add(prependHeader, aPadded));
BigInteger stopBI = new BigInteger(add(prependHeader, bPadded));
BigInteger diffBI = stopBI.subtract(startBI);
BigInteger splitsBI = BigInteger.valueOf(num + 1);
if(diffBI.compareTo(splitsBI) <= 0) return null;
BigInteger intervalBI = null;
try {
intervalBI = diffBI.divide(splitsBI);
} catch(Exception e) {
return null;
}
byte [][] result = new byte[num+2][];
result[0] = a;
for (int i = 1; i <= num; i++) {
BigInteger curBI = startBI.add(intervalBI.multiply(BigInteger.valueOf(i)));
byte [] padded = curBI.toByteArray();
if (padded[1] == 0)
padded = tail(padded,padded.length-2);
else
padded = tail(padded,padded.length-1);
result[i] = padded;
}
result[num+1] = b;
return result;
} | static byte [][] function(final byte [] a, final byte [] b, final int num) { byte [] aPadded = null; byte [] bPadded = null; if (a.length < b.length) { aPadded = padTail(a,b.length-a.length); bPadded = b; } else if (b.length < a.length) { aPadded = a; bPadded = padTail(b,a.length-b.length); } else { aPadded = a; bPadded = b; } if (compareTo(aPadded,bPadded) > 1) { throw new IllegalArgumentException(STR); } if (num <= 0) throw new IllegalArgumentException(STR); byte [] prependHeader = {1, 0}; BigInteger startBI = new BigInteger(add(prependHeader, aPadded)); BigInteger stopBI = new BigInteger(add(prependHeader, bPadded)); BigInteger diffBI = stopBI.subtract(startBI); BigInteger splitsBI = BigInteger.valueOf(num + 1); if(diffBI.compareTo(splitsBI) <= 0) return null; BigInteger intervalBI = null; try { intervalBI = diffBI.divide(splitsBI); } catch(Exception e) { return null; } byte [][] result = new byte[num+2][]; result[0] = a; for (int i = 1; i <= num; i++) { BigInteger curBI = startBI.add(intervalBI.multiply(BigInteger.valueOf(i))); byte [] padded = curBI.toByteArray(); if (padded[1] == 0) padded = tail(padded,padded.length-2); else padded = tail(padded,padded.length-1); result[i] = padded; } result[num+1] = b; return result; } | /**
* Split passed range. Expensive operation relatively. Uses BigInteger math.
* Useful splitting ranges for MapReduce jobs.
* @param a Beginning of range
* @param b End of range
* @param num Number of times to split range. Pass 1 if you want to split
* the range in two; i.e. one split.
* @return Array of dividing values
*/ | Split passed range. Expensive operation relatively. Uses BigInteger math. Useful splitting ranges for MapReduce jobs | split | {
"repo_name": "adragomir/hbaseindex",
"path": "src/java/org/apache/hadoop/hbase/util/Bytes.java",
"license": "apache-2.0",
"size": 31033
} | [
"java.math.BigInteger"
] | import java.math.BigInteger; | import java.math.*; | [
"java.math"
] | java.math; | 1,554,790 |
return planboardMessageRepository.findOrderableFlexOffers().stream().filter(this::validateOffer).collect(Collectors.toList());
}
/**
* Update the flex orders in the planboard given.
*
* @param flexOrderSequence {@link Long} the flex order sequence number.
* @param acknowledgementStatus the new {@link AcknowledgementStatus} | return planboardMessageRepository.findOrderableFlexOffers().stream().filter(this::validateOffer).collect(Collectors.toList()); } /** * Update the flex orders in the planboard given. * * @param flexOrderSequence {@link Long} the flex order sequence number. * @param acknowledgementStatus the new {@link AcknowledgementStatus} | /**
* Find {@link PlanboardMessage} which have status ACCEPTED to know which offers needs to be processed.
*
* @return the {@link List} of {@link PlanboardMessage} of type {@link DocumentType#FLEX_OFFER} with status ACCEPTED.
*/ | Find <code>PlanboardMessage</code> which have status ACCEPTED to know which offers needs to be processed | findOrderableFlexOffers | {
"repo_name": "USEF-Foundation/ri.usef.energy",
"path": "usef-build/usef-workflow/usef-brp/src/main/java/energy/usef/brp/service/business/BrpPlanboardBusinessService.java",
"license": "apache-2.0",
"size": 5463
} | [
"energy.usef.core.model.AcknowledgementStatus",
"java.util.stream.Collectors"
] | import energy.usef.core.model.AcknowledgementStatus; import java.util.stream.Collectors; | import energy.usef.core.model.*; import java.util.stream.*; | [
"energy.usef.core",
"java.util"
] | energy.usef.core; java.util; | 721,401 |
public boolean isGUIOpen(Class<? extends GuiScreen> gui)
{
return client.currentScreen != null && client.currentScreen.getClass().equals(gui);
} | boolean function(Class<? extends GuiScreen> gui) { return client.currentScreen != null && client.currentScreen.getClass().equals(gui); } | /**
* Is this GUI type open?
*
* @param gui The type of GUI to test for
* @return if a GUI of this type is open
*/ | Is this GUI type open | isGUIOpen | {
"repo_name": "CheeseL0ver/Ore-TTM",
"path": "build/tmp/recompSrc/cpw/mods/fml/client/FMLClientHandler.java",
"license": "lgpl-2.1",
"size": 36709
} | [
"net.minecraft.client.gui.GuiScreen"
] | import net.minecraft.client.gui.GuiScreen; | import net.minecraft.client.gui.*; | [
"net.minecraft.client"
] | net.minecraft.client; | 2,666,345 |
public static <T> void invokeOffEDT(final Supplier<T> runnable, final Consumer<T> consumer) {
new SupplierLoggingSwingWorker<>(runnable, consumer).execute();
} | static <T> void function(final Supplier<T> runnable, final Consumer<T> consumer) { new SupplierLoggingSwingWorker<>(runnable, consumer).execute(); } | /**
* Invokes something off the EDT, handling the result when its finished on the EDT, logging
* any exceptions that occur.
*
* @param runnable Runnable to execute off the EDT
* @param consumer Consumer to finalise the runnable on the EDT
*
* @param <T> Type the consumer takes
*/ | Invokes something off the EDT, handling the result when its finished on the EDT, logging any exceptions that occur | invokeOffEDT | {
"repo_name": "DMDirc/Plugins",
"path": "ui_swing/src/main/java/com/dmdirc/addons/ui_swing/UIUtilities.java",
"license": "mit",
"size": 21673
} | [
"com.dmdirc.addons.ui_swing.components.SupplierLoggingSwingWorker",
"java.util.function.Consumer",
"java.util.function.Supplier"
] | import com.dmdirc.addons.ui_swing.components.SupplierLoggingSwingWorker; import java.util.function.Consumer; import java.util.function.Supplier; | import com.dmdirc.addons.ui_swing.components.*; import java.util.function.*; | [
"com.dmdirc.addons",
"java.util"
] | com.dmdirc.addons; java.util; | 2,779,177 |
private Lease getClientLease(Object o) {
if (!(o instanceof Map.Entry))
return null;
final Map.Entry e = (Map.Entry) o;
final Object eValue = e.getValue();
if (!(e.getKey() instanceof ClientLeaseWrapper) ||
!(eValue instanceof Long) ||
(eValue == null))
{
return null;
}
final ClientLeaseWrapper clw = (ClientLeaseWrapper) e.getKey();
// Note if clw is deformed this call will return null, this is
// the right thing since a deformed lease can't be in this map
return clw.getClientLease();
} | Lease function(Object o) { if (!(o instanceof Map.Entry)) return null; final Map.Entry e = (Map.Entry) o; final Object eValue = e.getValue(); if (!(e.getKey() instanceof ClientLeaseWrapper) !(eValue instanceof Long) (eValue == null)) { return null; } final ClientLeaseWrapper clw = (ClientLeaseWrapper) e.getKey(); return clw.getClientLease(); } | /**
* If the passed object is a Map.Entry that is in the
* ClientMapWrapper return the client lease associated with it,
* otherwise return null
*/ | If the passed object is a Map.Entry that is in the ClientMapWrapper return the client lease associated with it, otherwise return null | getClientLease | {
"repo_name": "cdegroot/river",
"path": "src/com/sun/jini/norm/ClientLeaseMapWrapper.java",
"license": "apache-2.0",
"size": 14226
} | [
"java.util.Map",
"net.jini.core.lease.Lease"
] | import java.util.Map; import net.jini.core.lease.Lease; | import java.util.*; import net.jini.core.lease.*; | [
"java.util",
"net.jini.core"
] | java.util; net.jini.core; | 676,245 |
private void handlePurgeProject(HttpServletRequest req,
HttpServletResponse resp, Session session) throws ServletException,
IOException {
User user = session.getUser();
HashMap<String, Object> ret = new HashMap<String, Object>();
boolean isOperationSuccessful = true;
try {
Project project = null;
String projectParam = getParam(req, "project");
if (StringUtils.isNumeric(projectParam)) {
project = projectManager.getProject(Integer.parseInt(projectParam)); // get
// project
// by
// Id
} else {
project = projectManager.getProject(projectParam); // get project by
// name (name cannot
// start
// from ints)
}
// invalid project
if (project == null) {
ret.put("error", "invalid project");
isOperationSuccessful = false;
}
// project is already deleted
if (isOperationSuccessful
&& projectManager.isActiveProject(project.getId())) {
ret.put("error", "Project " + project.getName()
+ " should be deleted before purging");
isOperationSuccessful = false;
}
// only eligible users can purge a project
if (isOperationSuccessful && !hasPermission(project, user, Type.ADMIN)) {
ret.put("error", "Cannot purge. User '" + user.getUserId()
+ "' is not an ADMIN.");
isOperationSuccessful = false;
}
if (isOperationSuccessful) {
projectManager.purgeProject(project, user);
}
} catch (Exception e) {
ret.put("error", e.getMessage());
isOperationSuccessful = false;
}
ret.put("success", isOperationSuccessful);
this.writeJSON(resp, ret);
} | void function(HttpServletRequest req, HttpServletResponse resp, Session session) throws ServletException, IOException { User user = session.getUser(); HashMap<String, Object> ret = new HashMap<String, Object>(); boolean isOperationSuccessful = true; try { Project project = null; String projectParam = getParam(req, STR); if (StringUtils.isNumeric(projectParam)) { project = projectManager.getProject(Integer.parseInt(projectParam)); } else { project = projectManager.getProject(projectParam); } if (project == null) { ret.put("error", STR); isOperationSuccessful = false; } if (isOperationSuccessful && projectManager.isActiveProject(project.getId())) { ret.put("error", STR + project.getName() + STR); isOperationSuccessful = false; } if (isOperationSuccessful && !hasPermission(project, user, Type.ADMIN)) { ret.put("error", STR + user.getUserId() + STR); isOperationSuccessful = false; } if (isOperationSuccessful) { projectManager.purgeProject(project, user); } } catch (Exception e) { ret.put("error", e.getMessage()); isOperationSuccessful = false; } ret.put(STR, isOperationSuccessful); this.writeJSON(resp, ret); } | /**
* validate readiness of a project and user permission and use projectManager
* to purge the project if things looks good
**/ | validate readiness of a project and user permission and use projectManager to purge the project if things looks good | handlePurgeProject | {
"repo_name": "mradamlacey/azkaban",
"path": "azkaban-web-server/src/main/java/azkaban/webapp/servlet/ProjectManagerServlet.java",
"license": "apache-2.0",
"size": 64753
} | [
"java.io.IOException",
"java.util.HashMap",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.apache.commons.lang.StringUtils"
] | import java.io.IOException; import java.util.HashMap; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; | import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; import org.apache.commons.lang.*; | [
"java.io",
"java.util",
"javax.servlet",
"org.apache.commons"
] | java.io; java.util; javax.servlet; org.apache.commons; | 1,992,703 |
private boolean isOutputInJson() {
return config.jsonStreamMode == JsonStreamMode.OUT
|| config.jsonStreamMode == JsonStreamMode.BOTH;
} | boolean function() { return config.jsonStreamMode == JsonStreamMode.OUT config.jsonStreamMode == JsonStreamMode.BOTH; } | /**
* Returns whether output should be a JSON stream.
*/ | Returns whether output should be a JSON stream | isOutputInJson | {
"repo_name": "lgeorgieff/closure-compiler",
"path": "src/com/google/javascript/jscomp/AbstractCommandLineRunner.java",
"license": "apache-2.0",
"size": 83284
} | [
"com.google.javascript.jscomp.CompilerOptions"
] | import com.google.javascript.jscomp.CompilerOptions; | import com.google.javascript.jscomp.*; | [
"com.google.javascript"
] | com.google.javascript; | 1,857,884 |
int getLevel(final Bundle bundle) {
final Long key = new Long(bundle.getBundleId());
Integer level = null;
synchronized (bidFilters) {
level = bidFilters.get(key);
}
// final PrintStream out = (null!=origOut) ? origOut : System.out;
// out.println("LogConfigImpl.getLevel(" +key +"): " +level);
return (level != null) ? level.intValue() : getFilter();
} | int getLevel(final Bundle bundle) { final Long key = new Long(bundle.getBundleId()); Integer level = null; synchronized (bidFilters) { level = bidFilters.get(key); } return (level != null) ? level.intValue() : getFilter(); } | /**
* Return the log filter level for the given bundle.
*/ | Return the log filter level for the given bundle | getLevel | {
"repo_name": "knopflerfish/knopflerfish.org",
"path": "osgi/bundles/log/src/org/knopflerfish/bundle/log/LogConfigImpl.java",
"license": "bsd-3-clause",
"size": 34078
} | [
"org.osgi.framework.Bundle"
] | import org.osgi.framework.Bundle; | import org.osgi.framework.*; | [
"org.osgi.framework"
] | org.osgi.framework; | 853,280 |
static void mergeNodeReferences(final JavaParserDTO toPopulate, final NodeNamesDTO nestedNodeNamesDTO, final MethodCallExpr evaluateNodeInitializer) {
final NodeList<Expression> evaluateNodeReferences = evaluateNodeInitializer.getArguments();
final String expectedReference = String.format(PACKAGE_CLASS_TEMPLATE, toPopulate.packageName,
nestedNodeNamesDTO.nodeClassName);
Optional<MethodReferenceExpr> found = Optional.empty();
for (Expression expression : evaluateNodeReferences) {
if (expectedReference.equals(expression.asMethodReferenceExpr().getScope().toString())) {
found = Optional.of(expression.asMethodReferenceExpr());
break;
}
}
final MethodReferenceExpr evaluateNodeReference = found
.orElseThrow(() -> new KiePMMLException(String.format(MISSING_METHOD_REFERENCE_TEMPLATE,
expectedReference, evaluateNodeInitializer)));
String identifier = EVALUATE_NODE + nestedNodeNamesDTO.nodeClassName;
evaluateNodeReference.setScope(new NameExpr(toPopulate.nodeClassName));
evaluateNodeReference.setIdentifier(identifier);
} | static void mergeNodeReferences(final JavaParserDTO toPopulate, final NodeNamesDTO nestedNodeNamesDTO, final MethodCallExpr evaluateNodeInitializer) { final NodeList<Expression> evaluateNodeReferences = evaluateNodeInitializer.getArguments(); final String expectedReference = String.format(PACKAGE_CLASS_TEMPLATE, toPopulate.packageName, nestedNodeNamesDTO.nodeClassName); Optional<MethodReferenceExpr> found = Optional.empty(); for (Expression expression : evaluateNodeReferences) { if (expectedReference.equals(expression.asMethodReferenceExpr().getScope().toString())) { found = Optional.of(expression.asMethodReferenceExpr()); break; } } final MethodReferenceExpr evaluateNodeReference = found .orElseThrow(() -> new KiePMMLException(String.format(MISSING_METHOD_REFERENCE_TEMPLATE, expectedReference, evaluateNodeInitializer))); String identifier = EVALUATE_NODE + nestedNodeNamesDTO.nodeClassName; evaluateNodeReference.setScope(new NameExpr(toPopulate.nodeClassName)); evaluateNodeReference.setIdentifier(identifier); } | /**
* Adjust the <b>evaluateNode(?)</b> references to the ones declared in the given
* <code>JavaParserDTO.nodeTemplate</code>
*
* @param toPopulate
* @param nestedNodeNamesDTO
* @param evaluateNodeInitializer
*/ | Adjust the evaluateNode(?) references to the ones declared in the given <code>JavaParserDTO.nodeTemplate</code> | mergeNodeReferences | {
"repo_name": "mbiarnes/drools",
"path": "kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tree/kie-pmml-models-tree-compiler/src/main/java/org/kie/pmml/models/tree/compiler/factories/KiePMMLNodeFactory.java",
"license": "apache-2.0",
"size": 30182
} | [
"com.github.javaparser.ast.NodeList",
"com.github.javaparser.ast.expr.Expression",
"com.github.javaparser.ast.expr.MethodCallExpr",
"com.github.javaparser.ast.expr.MethodReferenceExpr",
"com.github.javaparser.ast.expr.NameExpr",
"java.util.Optional",
"org.kie.pmml.api.exceptions.KiePMMLException"
] | import com.github.javaparser.ast.NodeList; import com.github.javaparser.ast.expr.Expression; import com.github.javaparser.ast.expr.MethodCallExpr; import com.github.javaparser.ast.expr.MethodReferenceExpr; import com.github.javaparser.ast.expr.NameExpr; import java.util.Optional; import org.kie.pmml.api.exceptions.KiePMMLException; | import com.github.javaparser.ast.*; import com.github.javaparser.ast.expr.*; import java.util.*; import org.kie.pmml.api.exceptions.*; | [
"com.github.javaparser",
"java.util",
"org.kie.pmml"
] | com.github.javaparser; java.util; org.kie.pmml; | 1,187,442 |
void addOfflineSegment(String offlineTableName, String segmentName, File indexDir)
throws Exception; | void addOfflineSegment(String offlineTableName, String segmentName, File indexDir) throws Exception; | /**
* Adds a segment from local disk into an OFFLINE table.
*/ | Adds a segment from local disk into an OFFLINE table | addOfflineSegment | {
"repo_name": "linkedin/pinot",
"path": "pinot-core/src/main/java/org/apache/pinot/core/data/manager/InstanceDataManager.java",
"license": "apache-2.0",
"size": 4055
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,843,335 |
public static boolean writeFile(String filePath, InputStream is) {
return writeFile(filePath, is, false);
} | static boolean function(String filePath, InputStream is) { return writeFile(filePath, is, false); } | /**
* Write file
*
* @param filePath
* @param is
* @return
*/ | Write file | writeFile | {
"repo_name": "umeitime/common",
"path": "common-library/src/main/java/com/umeitime/common/tools/FileUtils.java",
"license": "epl-1.0",
"size": 11414
} | [
"java.io.InputStream"
] | import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,631,367 |
private static List<Response> getResponses() {
final RpcMetadataResponse rpcMetadata = new RpcMetadataResponse("localhost:8765");
LinkedList<Response> responses = new LinkedList<>();
// Nested classes (Signature, ColumnMetaData, CursorFactory, etc) are implicitly getting tested)
// Stub out the metadata for a row
ScalarType arrayComponentType = ColumnMetaData.scalar(Types.INTEGER, "integer", Rep.INTEGER);
ColumnMetaData arrayColumnMetaData = getArrayColumnMetaData(arrayComponentType, 2, "counts");
List<ColumnMetaData> columns =
Arrays.asList(MetaImpl.columnMetaData("str", 0, String.class),
MetaImpl.columnMetaData("count", 1, Integer.class),
arrayColumnMetaData);
List<AvaticaParameter> params =
Arrays.asList(
new AvaticaParameter(false, 10, 0, Types.VARCHAR, "VARCHAR",
String.class.getName(), "str"));
Meta.CursorFactory cursorFactory = Meta.CursorFactory.create(Style.LIST, Object.class,
Arrays.asList("str", "count", "counts"));
// The row values
List<Object> rows = new ArrayList<>();
rows.add(new Object[] {"str_value1", 50, Arrays.asList(1, 2, 3)});
rows.add(new Object[] {"str_value2", 100, Arrays.asList(1)});
// Create the signature and frame using the metadata and values
Signature signature = Signature.create(columns, "sql", params, cursorFactory,
Meta.StatementType.SELECT);
Frame frame = Frame.create(Integer.MAX_VALUE, true, rows);
// And then create a ResultSetResponse
ResultSetResponse results1 = new ResultSetResponse("connectionId", Integer.MAX_VALUE, true,
signature, frame, Long.MAX_VALUE, rpcMetadata);
responses.add(results1);
responses.add(new CloseStatementResponse(rpcMetadata));
ConnectionPropertiesImpl connProps = new ConnectionPropertiesImpl(false, true,
Integer.MAX_VALUE, "catalog", "schema");
responses.add(new ConnectionSyncResponse(connProps, rpcMetadata));
responses.add(new OpenConnectionResponse(rpcMetadata));
responses.add(new CloseConnectionResponse(rpcMetadata));
responses.add(new CreateStatementResponse("connectionId", Integer.MAX_VALUE, rpcMetadata));
Map<Meta.DatabaseProperty, Object> propertyMap = new HashMap<>();
for (Meta.DatabaseProperty prop : Meta.DatabaseProperty.values()) {
propertyMap.put(prop, prop.defaultValue);
}
responses.add(new DatabasePropertyResponse(propertyMap, rpcMetadata));
responses.add(
new ExecuteResponse(Arrays.asList(results1, results1, results1), false, rpcMetadata));
responses.add(new FetchResponse(frame, false, false, rpcMetadata));
responses.add(new FetchResponse(frame, true, true, rpcMetadata));
responses.add(new FetchResponse(frame, false, true, rpcMetadata));
responses.add(
new PrepareResponse(
new Meta.StatementHandle("connectionId", Integer.MAX_VALUE, signature),
rpcMetadata));
StringWriter sw = new StringWriter();
new Exception().printStackTrace(new PrintWriter(sw));
responses.add(
new ErrorResponse(Collections.singletonList(sw.toString()), "Test Error Message",
ErrorResponse.UNKNOWN_ERROR_CODE, ErrorResponse.UNKNOWN_SQL_STATE,
AvaticaSeverity.WARNING, rpcMetadata));
// No more results, statement not missing
responses.add(new SyncResultsResponse(false, false, rpcMetadata));
// Missing statement, no results
responses.add(new SyncResultsResponse(false, true, rpcMetadata));
// More results, no missing statement
responses.add(new SyncResultsResponse(true, false, rpcMetadata));
// Some tests to make sure ErrorResponse doesn't fail.
responses.add(new ErrorResponse((List<String>) null, null, 0, null, null, null));
responses.add(
new ErrorResponse(Arrays.asList("stacktrace1", "stacktrace2"), null, 0, null, null, null));
responses.add(new CommitResponse());
responses.add(new RollbackResponse());
long[] updateCounts = new long[]{1, 0, 1, 1};
responses.add(
new ExecuteBatchResponse("connectionId", 12345, updateCounts, false, rpcMetadata));
return responses;
}
private final T object;
private final IdentityFunction<T> function;
public ProtobufTranslationImplTest(T object, IdentityFunction<T> func) {
this.object = object;
this.function = func;
} | static List<Response> function() { final RpcMetadataResponse rpcMetadata = new RpcMetadataResponse(STR); LinkedList<Response> responses = new LinkedList<>(); ScalarType arrayComponentType = ColumnMetaData.scalar(Types.INTEGER, STR, Rep.INTEGER); ColumnMetaData arrayColumnMetaData = getArrayColumnMetaData(arrayComponentType, 2, STR); List<ColumnMetaData> columns = Arrays.asList(MetaImpl.columnMetaData("str", 0, String.class), MetaImpl.columnMetaData("count", 1, Integer.class), arrayColumnMetaData); List<AvaticaParameter> params = Arrays.asList( new AvaticaParameter(false, 10, 0, Types.VARCHAR, STR, String.class.getName(), "str")); Meta.CursorFactory cursorFactory = Meta.CursorFactory.create(Style.LIST, Object.class, Arrays.asList("str", "count", STR)); List<Object> rows = new ArrayList<>(); rows.add(new Object[] {STR, 50, Arrays.asList(1, 2, 3)}); rows.add(new Object[] {STR, 100, Arrays.asList(1)}); Signature signature = Signature.create(columns, "sql", params, cursorFactory, Meta.StatementType.SELECT); Frame frame = Frame.create(Integer.MAX_VALUE, true, rows); ResultSetResponse results1 = new ResultSetResponse(STR, Integer.MAX_VALUE, true, signature, frame, Long.MAX_VALUE, rpcMetadata); responses.add(results1); responses.add(new CloseStatementResponse(rpcMetadata)); ConnectionPropertiesImpl connProps = new ConnectionPropertiesImpl(false, true, Integer.MAX_VALUE, STR, STR); responses.add(new ConnectionSyncResponse(connProps, rpcMetadata)); responses.add(new OpenConnectionResponse(rpcMetadata)); responses.add(new CloseConnectionResponse(rpcMetadata)); responses.add(new CreateStatementResponse(STR, Integer.MAX_VALUE, rpcMetadata)); Map<Meta.DatabaseProperty, Object> propertyMap = new HashMap<>(); for (Meta.DatabaseProperty prop : Meta.DatabaseProperty.values()) { propertyMap.put(prop, prop.defaultValue); } responses.add(new DatabasePropertyResponse(propertyMap, rpcMetadata)); responses.add( new ExecuteResponse(Arrays.asList(results1, results1, results1), false, rpcMetadata)); responses.add(new FetchResponse(frame, false, false, rpcMetadata)); responses.add(new FetchResponse(frame, true, true, rpcMetadata)); responses.add(new FetchResponse(frame, false, true, rpcMetadata)); responses.add( new PrepareResponse( new Meta.StatementHandle(STR, Integer.MAX_VALUE, signature), rpcMetadata)); StringWriter sw = new StringWriter(); new Exception().printStackTrace(new PrintWriter(sw)); responses.add( new ErrorResponse(Collections.singletonList(sw.toString()), STR, ErrorResponse.UNKNOWN_ERROR_CODE, ErrorResponse.UNKNOWN_SQL_STATE, AvaticaSeverity.WARNING, rpcMetadata)); responses.add(new SyncResultsResponse(false, false, rpcMetadata)); responses.add(new SyncResultsResponse(false, true, rpcMetadata)); responses.add(new SyncResultsResponse(true, false, rpcMetadata)); responses.add(new ErrorResponse((List<String>) null, null, 0, null, null, null)); responses.add( new ErrorResponse(Arrays.asList(STR, STR), null, 0, null, null, null)); responses.add(new CommitResponse()); responses.add(new RollbackResponse()); long[] updateCounts = new long[]{1, 0, 1, 1}; responses.add( new ExecuteBatchResponse(STR, 12345, updateCounts, false, rpcMetadata)); return responses; } private final T object; private final IdentityFunction<T> function; public ProtobufTranslationImplTest(T object, IdentityFunction<T> func) { this.object = object; this.function = func; } | /**
* Generates a collection of Responses whose serialization will be tested.
*/ | Generates a collection of Responses whose serialization will be tested | getResponses | {
"repo_name": "yeongwei/incubator-calcite",
"path": "avatica/core/src/test/java/org/apache/calcite/avatica/remote/ProtobufTranslationImplTest.java",
"license": "apache-2.0",
"size": 16179
} | [
"java.io.PrintWriter",
"java.io.StringWriter",
"java.sql.Types",
"java.util.ArrayList",
"java.util.Arrays",
"java.util.Collections",
"java.util.HashMap",
"java.util.LinkedList",
"java.util.List",
"java.util.Map",
"org.apache.calcite.avatica.AvaticaParameter",
"org.apache.calcite.avatica.AvaticaSeverity",
"org.apache.calcite.avatica.ColumnMetaData",
"org.apache.calcite.avatica.ConnectionPropertiesImpl",
"org.apache.calcite.avatica.Meta",
"org.apache.calcite.avatica.MetaImpl",
"org.apache.calcite.avatica.remote.Service"
] | import java.io.PrintWriter; import java.io.StringWriter; import java.sql.Types; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import org.apache.calcite.avatica.AvaticaParameter; import org.apache.calcite.avatica.AvaticaSeverity; import org.apache.calcite.avatica.ColumnMetaData; import org.apache.calcite.avatica.ConnectionPropertiesImpl; import org.apache.calcite.avatica.Meta; import org.apache.calcite.avatica.MetaImpl; import org.apache.calcite.avatica.remote.Service; | import java.io.*; import java.sql.*; import java.util.*; import org.apache.calcite.avatica.*; import org.apache.calcite.avatica.remote.*; | [
"java.io",
"java.sql",
"java.util",
"org.apache.calcite"
] | java.io; java.sql; java.util; org.apache.calcite; | 2,776,680 |
public static MozuClient<com.mozu.api.contracts.core.BehaviorCollection> getBehaviorsClient() throws Exception
{
return getBehaviorsClient( null, null);
} | static MozuClient<com.mozu.api.contracts.core.BehaviorCollection> function() throws Exception { return getBehaviorsClient( null, null); } | /**
* Retrieves a list of application behaviors.
* <p><pre><code>
* MozuClient<com.mozu.api.contracts.core.BehaviorCollection> mozuClient=GetBehaviorsClient();
* client.setBaseAddress(url);
* client.executeRequest();
* BehaviorCollection behaviorCollection = client.Result();
* </code></pre></p>
* @return Mozu.Api.MozuClient <com.mozu.api.contracts.core.BehaviorCollection>
* @see com.mozu.api.contracts.core.BehaviorCollection
*/ | Retrieves a list of application behaviors. <code><code> MozuClient mozuClient=GetBehaviorsClient(); client.setBaseAddress(url); client.executeRequest(); BehaviorCollection behaviorCollection = client.Result(); </code></code> | getBehaviorsClient | {
"repo_name": "lakshmi-nair/mozu-java",
"path": "mozu-java-core/src/main/java/com/mozu/api/clients/platform/ReferenceDataClient.java",
"license": "mit",
"size": 27055
} | [
"com.mozu.api.MozuClient"
] | import com.mozu.api.MozuClient; | import com.mozu.api.*; | [
"com.mozu.api"
] | com.mozu.api; | 1,798,285 |
public void setExceptionSegments(List exceptionSegments) {
this.exceptionSegments = exceptionSegments;
}
| void function(List exceptionSegments) { this.exceptionSegments = exceptionSegments; } | /**
* Sets the exception segments list.
*
* @param exceptionSegments the exception segments.
*/ | Sets the exception segments list | setExceptionSegments | {
"repo_name": "sangohan/gwt-chronoscope",
"path": "chronoscope-api/src/main/java/org/timepedia/chronoscope/client/axis/SegmentedTimeline.java",
"license": "lgpl-2.1",
"size": 61344
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,696,092 |
public void testReadPersistingAsString()
{
performWrite();
TimeZone.setDefault(TimeZone.getTimeZone("GMT+0"));
PersistenceManager pm = pmf.getPersistenceManager();
Transaction tx = pm.currentTransaction();
try
{
tx.begin();
SqlTimeHolder holder = (SqlTimeHolder)pm.getObjectById(SqlTimeHolder.class, generateValue("12:27:00"));
assertEquals(generateValue("20:00:00"), holder.getValue2());
assertEquals(msvalue, holder.getValue2().getTime()); // MS value same
}
finally
{
if (tx.isActive())
{
tx.rollback();
}
pm.close();
}
} | void function() { performWrite(); TimeZone.setDefault(TimeZone.getTimeZone("GMT+0")); PersistenceManager pm = pmf.getPersistenceManager(); Transaction tx = pm.currentTransaction(); try { tx.begin(); SqlTimeHolder holder = (SqlTimeHolder)pm.getObjectById(SqlTimeHolder.class, generateValue(STR)); assertEquals(generateValue(STR), holder.getValue2()); assertEquals(msvalue, holder.getValue2().getTime()); } finally { if (tx.isActive()) { tx.rollback(); } pm.close(); } } | /**
* Test retrieval of Time field as String.
*/ | Test retrieval of Time field as String | testReadPersistingAsString | {
"repo_name": "hopecee/texsts",
"path": "jdo/general/src/test/org/datanucleus/tests/types/SqlTimeTest.java",
"license": "apache-2.0",
"size": 8479
} | [
"java.util.TimeZone",
"javax.jdo.PersistenceManager",
"javax.jdo.Transaction",
"org.jpox.samples.types.sqltime.SqlTimeHolder"
] | import java.util.TimeZone; import javax.jdo.PersistenceManager; import javax.jdo.Transaction; import org.jpox.samples.types.sqltime.SqlTimeHolder; | import java.util.*; import javax.jdo.*; import org.jpox.samples.types.sqltime.*; | [
"java.util",
"javax.jdo",
"org.jpox.samples"
] | java.util; javax.jdo; org.jpox.samples; | 530,435 |
@ApiModelProperty(example = "null", value = "")
public String getType() {
return type;
} | @ApiModelProperty(example = "null", value = "") String function() { return type; } | /**
* Get type
* @return type
**/ | Get type | getType | {
"repo_name": "Metatavu/kunta-api-spec",
"path": "java-client-generated/src/main/java/fi/metatavu/kuntaapi/client/model/Service.java",
"license": "agpl-3.0",
"size": 24169
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 1,937,671 |
public static String[] getItemIdentifiers( List<DimensionItem> items )
{
List<String> itemUids = new ArrayList<>();
if ( items != null && !items.isEmpty() )
{
for ( DimensionItem item : items )
{
itemUids.add( item != null ? item.getItem().getUid() : null );
}
}
return itemUids.toArray( CollectionUtils.STRING_ARR );
} | static String[] function( List<DimensionItem> items ) { List<String> itemUids = new ArrayList<>(); if ( items != null && !items.isEmpty() ) { for ( DimensionItem item : items ) { itemUids.add( item != null ? item.getItem().getUid() : null ); } } return itemUids.toArray( CollectionUtils.STRING_ARR ); } | /**
* Returns an array of identifiers of the dimension items in the given list.
* If no items are given or items are null, an empty array is returned.
*/ | Returns an array of identifiers of the dimension items in the given list. If no items are given or items are null, an empty array is returned | getItemIdentifiers | {
"repo_name": "steffeli/inf5750-tracker-capture",
"path": "dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DimensionItem.java",
"license": "bsd-3-clause",
"size": 7215
} | [
"java.util.ArrayList",
"java.util.List",
"org.hisp.dhis.commons.collection.CollectionUtils"
] | import java.util.ArrayList; import java.util.List; import org.hisp.dhis.commons.collection.CollectionUtils; | import java.util.*; import org.hisp.dhis.commons.collection.*; | [
"java.util",
"org.hisp.dhis"
] | java.util; org.hisp.dhis; | 2,447,488 |
public void changeLocale(Locale locale) {
LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(this.request);
if (localeResolver == null) {
throw new IllegalStateException("Cannot change locale if no LocaleResolver configured");
}
localeResolver.setLocale(this.request, this.response, locale);
this.locale = locale;
} | void function(Locale locale) { LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(this.request); if (localeResolver == null) { throw new IllegalStateException(STR); } localeResolver.setLocale(this.request, this.response, locale); this.locale = locale; } | /**
* Change the current locale to the specified one,
* storing the new locale through the configured {@link LocaleResolver}.
* @param locale the new locale
* @see LocaleResolver#setLocale
* @see #changeLocale(java.util.Locale, java.util.TimeZone)
*/ | Change the current locale to the specified one, storing the new locale through the configured <code>LocaleResolver</code> | changeLocale | {
"repo_name": "QBNemo/spring-mvc-showcase",
"path": "src/main/java/org/springframework/web/servlet/support/RequestContext.java",
"license": "apache-2.0",
"size": 38194
} | [
"java.util.Locale",
"org.springframework.web.servlet.LocaleResolver"
] | import java.util.Locale; import org.springframework.web.servlet.LocaleResolver; | import java.util.*; import org.springframework.web.servlet.*; | [
"java.util",
"org.springframework.web"
] | java.util; org.springframework.web; | 2,708,234 |
protected DbDialect getDialect() {
return _dbConnector.getDialect();
} | DbDialect function() { return _dbConnector.getDialect(); } | /**
* Gets the database dialect.
*
* @return the dialect
*/ | Gets the database dialect | getDialect | {
"repo_name": "McLeodMoores/starling",
"path": "projects/master-db/src/main/java/com/opengamma/masterdb/security/hibernate/HibernateSecurityMasterDetailProvider.java",
"license": "apache-2.0",
"size": 18888
} | [
"com.opengamma.util.db.DbDialect"
] | import com.opengamma.util.db.DbDialect; | import com.opengamma.util.db.*; | [
"com.opengamma.util"
] | com.opengamma.util; | 380,253 |
@Test
public void byteBufferHandleSet() {
Assume.assumeTrue(JavaVersionUtil.JAVA_SPEC >= 16);
ByteBuffer byteBuffer = ByteBuffer.allocate(42).order(ByteOrder.nativeOrder()).putInt(0, 42);
testCommon(new VarHandleTestNode(false, true), "byteArrayHandleSetInt", byteBuffer, 0, 42);
} | void function() { Assume.assumeTrue(JavaVersionUtil.JAVA_SPEC >= 16); ByteBuffer byteBuffer = ByteBuffer.allocate(42).order(ByteOrder.nativeOrder()).putInt(0, 42); testCommon(new VarHandleTestNode(false, true), STR, byteBuffer, 0, 42); } | /**
* Tests partial evaluation of a byte buffer view {@link VarHandle#set}.
*/ | Tests partial evaluation of a byte buffer view <code>VarHandle#set</code> | byteBufferHandleSet | {
"repo_name": "smarr/Truffle",
"path": "compiler/src/org.graalvm.compiler.truffle.test/src/org/graalvm/compiler/truffle/test/VarHandlePartialEvaluationTest.java",
"license": "gpl-2.0",
"size": 5103
} | [
"java.nio.ByteBuffer",
"java.nio.ByteOrder",
"org.graalvm.compiler.serviceprovider.JavaVersionUtil",
"org.junit.Assume"
] | import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.graalvm.compiler.serviceprovider.JavaVersionUtil; import org.junit.Assume; | import java.nio.*; import org.graalvm.compiler.serviceprovider.*; import org.junit.*; | [
"java.nio",
"org.graalvm.compiler",
"org.junit"
] | java.nio; org.graalvm.compiler; org.junit; | 940,103 |
public Map<String, String> getPreviewFormatter() {
Transformer transformer = new Transformer() { | Map<String, String> function() { Transformer transformer = new Transformer() { | /**
* JSP EL accessor method for retrieving the preview formatters.<p>
*
* @return a lazy map for accessing preview formatters
*/ | JSP EL accessor method for retrieving the preview formatters | getPreviewFormatter | {
"repo_name": "mediaworx/opencms-core",
"path": "src/org/opencms/jsp/util/CmsJspStandardContextBean.java",
"license": "lgpl-2.1",
"size": 47397
} | [
"java.util.Map",
"org.apache.commons.collections.Transformer"
] | import java.util.Map; import org.apache.commons.collections.Transformer; | import java.util.*; import org.apache.commons.collections.*; | [
"java.util",
"org.apache.commons"
] | java.util; org.apache.commons; | 2,790,752 |
public void showSuccessDialog() {
messages.reset();
cardManager.makeVisible(successPanel);
}
private final class SuccessPanel extends WContainer {
private SuccessPanel() {
add(new WMessageBox(WMessageBox.SUCCESS, "Everything is valid!"));
| void function() { messages.reset(); cardManager.makeVisible(successPanel); } private final class SuccessPanel extends WContainer { private SuccessPanel() { add(new WMessageBox(WMessageBox.SUCCESS, STR)); | /**
* Displays the success dialog.
*/ | Displays the success dialog | showSuccessDialog | {
"repo_name": "Joshua-Barclay/wcomponents",
"path": "wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/validation/ValidationContainer.java",
"license": "gpl-3.0",
"size": 4642
} | [
"com.github.bordertech.wcomponents.WContainer",
"com.github.bordertech.wcomponents.WMessageBox"
] | import com.github.bordertech.wcomponents.WContainer; import com.github.bordertech.wcomponents.WMessageBox; | import com.github.bordertech.wcomponents.*; | [
"com.github.bordertech"
] | com.github.bordertech; | 1,769,468 |
// -- jmx/management methods--
@Override
public void pause() throws AxisFault {
if (state != BaseConstants.STARTED) return;
try {
for (JMSEndpoint endpoint : getEndpoints()) {
endpoint.getServiceTaskManager().pause();
}
state = BaseConstants.PAUSED;
log.info("Listener paused");
} catch (AxisJMSException e) {
log.error("At least one service could not be paused", e);
}
} | void function() throws AxisFault { if (state != BaseConstants.STARTED) return; try { for (JMSEndpoint endpoint : getEndpoints()) { endpoint.getServiceTaskManager().pause(); } state = BaseConstants.PAUSED; log.info(STR); } catch (AxisJMSException e) { log.error(STR, e); } } | /**
* Pause the listener - Stop accepting/processing new messages, but continues processing existing
* messages until they complete. This helps bring an instance into a maintenence mode
* @throws AxisFault on error
*/ | Pause the listener - Stop accepting/processing new messages, but continues processing existing messages until they complete. This helps bring an instance into a maintenence mode | pause | {
"repo_name": "maheeka/wso2-axis2-transports",
"path": "modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSListener.java",
"license": "apache-2.0",
"size": 12285
} | [
"org.apache.axis2.AxisFault",
"org.apache.axis2.transport.base.BaseConstants"
] | import org.apache.axis2.AxisFault; import org.apache.axis2.transport.base.BaseConstants; | import org.apache.axis2.*; import org.apache.axis2.transport.base.*; | [
"org.apache.axis2"
] | org.apache.axis2; | 639,969 |
public void apply(WriteStream out,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
} | void function(WriteStream out, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { } | /**
* Executes the SSI statement.
*
* @param out the output stream
* @param request the servlet request
* @param response the servlet response
*/ | Executes the SSI statement | apply | {
"repo_name": "christianchristensen/resin",
"path": "modules/resin/src/com/caucho/servlets/ssi/ElseStatement.java",
"license": "gpl-2.0",
"size": 1875
} | [
"com.caucho.vfs.WriteStream",
"java.io.IOException",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import com.caucho.vfs.WriteStream; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; | import com.caucho.vfs.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; | [
"com.caucho.vfs",
"java.io",
"javax.servlet"
] | com.caucho.vfs; java.io; javax.servlet; | 1,575,671 |
public void unreserve(SchedulerRequestKey schedulerKey,
FSSchedulerNode node) {
RMContainer rmContainer = node.getReservedContainer();
unreserveInternal(schedulerKey, node);
node.unreserveResource(this);
clearReservation(node);
getMetrics().unreserveResource(
getUser(), rmContainer.getContainer().getResource());
} | void function(SchedulerRequestKey schedulerKey, FSSchedulerNode node) { RMContainer rmContainer = node.getReservedContainer(); unreserveInternal(schedulerKey, node); node.unreserveResource(this); clearReservation(node); getMetrics().unreserveResource( getUser(), rmContainer.getContainer().getResource()); } | /**
* Remove the reservation on {@code node} at the given SchedulerRequestKey.
* This dispatches SchedulerNode handlers as well.
* @param schedulerKey Scheduler Key
* @param node Node
*/ | Remove the reservation on node at the given SchedulerRequestKey. This dispatches SchedulerNode handlers as well | unreserve | {
"repo_name": "WIgor/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSAppAttempt.java",
"license": "apache-2.0",
"size": 49720
} | [
"org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer",
"org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey"
] | import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; import org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey; | import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.*; import org.apache.hadoop.yarn.server.scheduler.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 709,120 |
public static void mergeFrom(Message.Builder builder, byte[] b) throws IOException {
final CodedInputStream codedInput = CodedInputStream.newInstance(b);
codedInput.setSizeLimit(b.length);
builder.mergeFrom(codedInput);
codedInput.checkLastTagWas(0);
} | static void function(Message.Builder builder, byte[] b) throws IOException { final CodedInputStream codedInput = CodedInputStream.newInstance(b); codedInput.setSizeLimit(b.length); builder.mergeFrom(codedInput); codedInput.checkLastTagWas(0); } | /**
* This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding
* buffers when working with byte arrays
* @param builder current message builder
* @param b byte array
* @throws IOException
*/ | This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding buffers when working with byte arrays | mergeFrom | {
"repo_name": "ultratendency/hbase",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java",
"license": "apache-2.0",
"size": 132790
} | [
"java.io.IOException",
"org.apache.hbase.thirdparty.com.google.protobuf.CodedInputStream",
"org.apache.hbase.thirdparty.com.google.protobuf.Message"
] | import java.io.IOException; import org.apache.hbase.thirdparty.com.google.protobuf.CodedInputStream; import org.apache.hbase.thirdparty.com.google.protobuf.Message; | import java.io.*; import org.apache.hbase.thirdparty.com.google.protobuf.*; | [
"java.io",
"org.apache.hbase"
] | java.io; org.apache.hbase; | 2,562,124 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.