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
|
---|---|---|---|---|---|---|---|---|---|---|---|
void onCredentailsRevoked(String applicationId, String credentialsId) throws ControlServiceException; | void onCredentailsRevoked(String applicationId, String credentialsId) throws ControlServiceException; | /**
* Notifies the Kaa cluster about security credentials revocation. If an
* endpoint is already registered with the specified credentials, this API
* call launches an asynchronous process to terminate all active sessions of
* the corresponding endpoint.
*
* @param applicationId The application ID
* @param credentialsId The credentials ID
*
* @throws ControlServiceException - if an exception occures.
*/ | Notifies the Kaa cluster about security credentials revocation. If an endpoint is already registered with the specified credentials, this API call launches an asynchronous process to terminate all active sessions of the corresponding endpoint | onCredentailsRevoked | {
"repo_name": "Oleh-Kravchenko/kaa",
"path": "server/node/src/main/java/org/kaaproject/kaa/server/control/service/ControlService.java",
"license": "apache-2.0",
"size": 64761
} | [
"org.kaaproject.kaa.server.control.service.exception.ControlServiceException"
] | import org.kaaproject.kaa.server.control.service.exception.ControlServiceException; | import org.kaaproject.kaa.server.control.service.exception.*; | [
"org.kaaproject.kaa"
] | org.kaaproject.kaa; | 2,395,782 |
protected void statusUpdate(StatusUpdate message) {
taskMonitor.tell(message, selfActor);
reconciliationCoordinator.tell(message, selfActor);
schedulerDriver.acknowledgeStatusUpdate(message.status());
}
protected void frameworkMessage(FrameworkMessage message) {} | void function(StatusUpdate message) { taskMonitor.tell(message, selfActor); reconciliationCoordinator.tell(message, selfActor); schedulerDriver.acknowledgeStatusUpdate(message.status()); } protected void frameworkMessage(FrameworkMessage message) {} | /**
* Handles a task status update from Mesos.
*/ | Handles a task status update from Mesos | statusUpdate | {
"repo_name": "zhangminglei/flink",
"path": "flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/MesosResourceManager.java",
"license": "apache-2.0",
"size": 30505
} | [
"org.apache.flink.mesos.scheduler.messages.FrameworkMessage",
"org.apache.flink.mesos.scheduler.messages.StatusUpdate"
] | import org.apache.flink.mesos.scheduler.messages.FrameworkMessage; import org.apache.flink.mesos.scheduler.messages.StatusUpdate; | import org.apache.flink.mesos.scheduler.messages.*; | [
"org.apache.flink"
] | org.apache.flink; | 1,901,923 |
@Override public void enterCatchType(@NotNull JavaParser.CatchTypeContext ctx) { }
| @Override public void enterCatchType(@NotNull JavaParser.CatchTypeContext ctx) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | exitVariableDeclarators | {
"repo_name": "martinaguero/deep",
"path": "src/org/trimatek/deep/lexer/JavaBaseListener.java",
"license": "apache-2.0",
"size": 39286
} | [
"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; | 1,030,598 |
public void fsub() throws IOException
{
f.tsub();
} | void function() throws IOException { f.tsub(); } | /**
* Subtract float
* <p>Stack: ..., value1, value2=>..., result
* @throws IOException
*/ | Subtract float Stack: ..., value1, value2=>..., result | fsub | {
"repo_name": "tvesalainen/bcc",
"path": "src/main/java/org/vesalainen/bcc/Assembler.java",
"license": "gpl-3.0",
"size": 53751
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 713,264 |
@Deprecated Properties getConfig(); | @Deprecated Properties getConfig(); | /**
* Access the configuration properties used when configuring components.
*
* @deprecated This method is redundant, not used by any known client, would expose implementation details,
* and will be removed in a future release. Use the ServerConfigurationService instead.
*
* @return null
*/ | Access the configuration properties used when configuring components | getConfig | {
"repo_name": "harfalm/Sakai-10.1",
"path": "kernel/component-manager/src/main/java/org/sakaiproject/component/api/ComponentManager.java",
"license": "apache-2.0",
"size": 4029
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 2,430,524 |
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<TagValueInner> createOrUpdateValueWithResponse(String tagName, String tagValue, Context context) {
return createOrUpdateValueWithResponseAsync(tagName, tagValue, context).block();
} | @ServiceMethod(returns = ReturnType.SINGLE) Response<TagValueInner> function(String tagName, String tagValue, Context context) { return createOrUpdateValueWithResponseAsync(tagName, tagValue, context).block(); } | /**
* This operation allows adding a value to the list of predefined values for an existing predefined tag name. A tag
* value can have a maximum of 256 characters.
*
* @param tagName The name of the tag.
* @param tagValue The value of the tag to create.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return tag information.
*/ | This operation allows adding a value to the list of predefined values for an existing predefined tag name. A tag value can have a maximum of 256 characters | createOrUpdateValueWithResponse | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/implementation/TagOperationsClientImpl.java",
"license": "mit",
"size": 71642
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context",
"com.azure.resourcemanager.resources.fluent.models.TagValueInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.resources.fluent.models.TagValueInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.resources.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 2,714,815 |
public boolean equals(Object obj) {
if (obj == null) return false;
if (this == obj) // quick check
return true;
if (getClass() != obj.getClass())
return false;
ChoiceFormat other = (ChoiceFormat) obj;
return (Arrays.equals(choiceLimits, other.choiceLimits)
&& Arrays.equals(choiceFormats, other.choiceFormats));
} | boolean function(Object obj) { if (obj == null) return false; if (this == obj) return true; if (getClass() != obj.getClass()) return false; ChoiceFormat other = (ChoiceFormat) obj; return (Arrays.equals(choiceLimits, other.choiceLimits) && Arrays.equals(choiceFormats, other.choiceFormats)); } | /**
* Equality comparison between two
*/ | Equality comparison between two | equals | {
"repo_name": "dmlloyd/openjdk-modules",
"path": "jdk/src/java.base/share/classes/java/text/ChoiceFormat.java",
"license": "gpl-2.0",
"size": 24725
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 217,937 |
public CompletableFuture<JobStatus> getTerminationFuture() {
return terminationFuture;
} | CompletableFuture<JobStatus> function() { return terminationFuture; } | /**
* Returns the termination future of this {@link ExecutionGraph}. The termination future
* is completed with the terminal {@link JobStatus} once the ExecutionGraph reaches this
* terminal state and all {@link Execution} have been terminated.
*
* @return Termination future of this {@link ExecutionGraph}.
*/ | Returns the termination future of this <code>ExecutionGraph</code>. The termination future is completed with the terminal <code>JobStatus</code> once the ExecutionGraph reaches this terminal state and all <code>Execution</code> have been terminated | getTerminationFuture | {
"repo_name": "fhueske/flink",
"path": "flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java",
"license": "apache-2.0",
"size": 64112
} | [
"java.util.concurrent.CompletableFuture",
"org.apache.flink.runtime.jobgraph.JobStatus"
] | import java.util.concurrent.CompletableFuture; import org.apache.flink.runtime.jobgraph.JobStatus; | import java.util.concurrent.*; import org.apache.flink.runtime.jobgraph.*; | [
"java.util",
"org.apache.flink"
] | java.util; org.apache.flink; | 2,079,298 |
@Test
public void testFilter() {
MetricRegistry filtered;
MetricRegistry full = new MetricRegistry();
full.meter(METRIC_NAME1);
full.meter(METRIC_NAME2);
full.meter(METRIC_NAME3);
full.meter(METRIC_NAME4);
gmr.monitorAll = true;
filtered = gmr.filter(full);
assertTrue(filtered.getNames()
.containsAll(ImmutableSet.of(METRIC_NAME1, METRIC_NAME2,
METRIC_NAME3, METRIC_NAME4)));
gmr.monitorAll = false;
gmr.metricNames = PREFIXES1;
filtered = gmr.filter(full);
assertTrue(filtered.getNames()
.containsAll(ImmutableSet.of(METRIC_NAME1, METRIC_NAME2)));
assertFalse(filtered.getNames()
.containsAll(ImmutableSet.of(METRIC_NAME3, METRIC_NAME4)));
gmr.metricNames = PREFIXES2;
filtered = gmr.filter(full);
assertFalse(filtered.getNames().containsAll(ImmutableSet.of(METRIC_NAME1)));
gmr.metricNames = PREFIXES3;
filtered = gmr.filter(full);
assertTrue(filtered.getNames().containsAll(ImmutableSet.of(METRIC_NAME1)));
assertFalse(filtered.getNames().containsAll(ImmutableSet.of(METRIC_NAME2)));
gmr.metricNames = PREFIXES4;
filtered = gmr.filter(full);
assertTrue(filtered.getNames()
.containsAll(ImmutableSet.of(METRIC_NAME1, METRIC_NAME2,
METRIC_NAME3, METRIC_NAME4)));
} | void function() { MetricRegistry filtered; MetricRegistry full = new MetricRegistry(); full.meter(METRIC_NAME1); full.meter(METRIC_NAME2); full.meter(METRIC_NAME3); full.meter(METRIC_NAME4); gmr.monitorAll = true; filtered = gmr.filter(full); assertTrue(filtered.getNames() .containsAll(ImmutableSet.of(METRIC_NAME1, METRIC_NAME2, METRIC_NAME3, METRIC_NAME4))); gmr.monitorAll = false; gmr.metricNames = PREFIXES1; filtered = gmr.filter(full); assertTrue(filtered.getNames() .containsAll(ImmutableSet.of(METRIC_NAME1, METRIC_NAME2))); assertFalse(filtered.getNames() .containsAll(ImmutableSet.of(METRIC_NAME3, METRIC_NAME4))); gmr.metricNames = PREFIXES2; filtered = gmr.filter(full); assertFalse(filtered.getNames().containsAll(ImmutableSet.of(METRIC_NAME1))); gmr.metricNames = PREFIXES3; filtered = gmr.filter(full); assertTrue(filtered.getNames().containsAll(ImmutableSet.of(METRIC_NAME1))); assertFalse(filtered.getNames().containsAll(ImmutableSet.of(METRIC_NAME2))); gmr.metricNames = PREFIXES4; filtered = gmr.filter(full); assertTrue(filtered.getNames() .containsAll(ImmutableSet.of(METRIC_NAME1, METRIC_NAME2, METRIC_NAME3, METRIC_NAME4))); } | /**
* Tests whether the filter method can always return the correct result.
*/ | Tests whether the filter method can always return the correct result | testFilter | {
"repo_name": "sdnwiselab/onos",
"path": "apps/graphitemetrics/src/test/java/org/onosproject/graphitemetrics/GraphiteMetricsReporterTest.java",
"license": "apache-2.0",
"size": 4224
} | [
"com.codahale.metrics.MetricRegistry",
"com.google.common.collect.ImmutableSet",
"org.junit.Assert"
] | import com.codahale.metrics.MetricRegistry; import com.google.common.collect.ImmutableSet; import org.junit.Assert; | import com.codahale.metrics.*; import com.google.common.collect.*; import org.junit.*; | [
"com.codahale.metrics",
"com.google.common",
"org.junit"
] | com.codahale.metrics; com.google.common; org.junit; | 575,302 |
if (connection == null)
return null;
InBandBytestreamManager manager = managers.get(connection);
if (manager == null) {
manager = new InBandBytestreamManager(connection);
managers.put(connection, manager);
}
return manager;
}
private InBandBytestreamManager(Connection connection) {
this.connection = connection;
// register bytestream open packet listener
this.initiationListener = new InitiationListener(this);
this.connection.addPacketListener(this.initiationListener,
this.initiationListener.getFilter());
// register bytestream data packet listener
this.dataListener = new DataListener(this);
this.connection.addPacketListener(this.dataListener, this.dataListener.getFilter());
// register bytestream close packet listener
this.closeListener = new CloseListener(this);
this.connection.addPacketListener(this.closeListener, this.closeListener.getFilter());
} | if (connection == null) return null; InBandBytestreamManager manager = managers.get(connection); if (manager == null) { manager = new InBandBytestreamManager(connection); managers.put(connection, manager); } return manager; } private InBandBytestreamManager(Connection connection) { this.connection = connection; this.initiationListener = new InitiationListener(this); this.connection.addPacketListener(this.initiationListener, this.initiationListener.getFilter()); this.dataListener = new DataListener(this); this.connection.addPacketListener(this.dataListener, this.dataListener.getFilter()); this.closeListener = new CloseListener(this); this.connection.addPacketListener(this.closeListener, this.closeListener.getFilter()); } | /**
* Returns the InBandBytestreamManager to handle In-Band Bytestreams for a given
* {@link Connection}.
*
* @param connection the XMPP connection
* @return the InBandBytestreamManager for the given XMPP connection
*/ | Returns the InBandBytestreamManager to handle In-Band Bytestreams for a given <code>Connection</code> | getByteStreamManager | {
"repo_name": "jtietema/telegraph",
"path": "app/libs/asmack-android-16-source/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManager.java",
"license": "gpl-3.0",
"size": 21281
} | [
"org.jivesoftware.smack.Connection"
] | import org.jivesoftware.smack.Connection; | import org.jivesoftware.smack.*; | [
"org.jivesoftware.smack"
] | org.jivesoftware.smack; | 2,578,933 |
private void testClientConfiguredGzipContentEncodingAndConnectionReuse(TransferKind transferKind,
boolean tls) throws Exception {
if (tls) {
SSLSocketFactory socketFactory = sslClient.socketFactory;
RecordingHostnameVerifier hostnameVerifier = new RecordingHostnameVerifier();
server.useHttps(socketFactory, false);
urlFactory.setClient(urlFactory.client().newBuilder()
.sslSocketFactory(socketFactory, sslClient.trustManager)
.hostnameVerifier(hostnameVerifier)
.build());
}
MockResponse responseOne = new MockResponse();
responseOne.addHeader("Content-Encoding: gzip");
transferKind.setBody(responseOne, gzip("one (gzipped)"), 5);
server.enqueue(responseOne);
MockResponse responseTwo = new MockResponse();
transferKind.setBody(responseTwo, "two (identity)", 5);
server.enqueue(responseTwo);
HttpURLConnection connection1 = urlFactory.open(server.url("/").url());
connection1.addRequestProperty("Accept-Encoding", "gzip");
InputStream gunzippedIn = new GZIPInputStream(connection1.getInputStream());
assertEquals("one (gzipped)", readAscii(gunzippedIn, Integer.MAX_VALUE));
assertEquals(0, server.takeRequest().getSequenceNumber());
HttpURLConnection connection2 = urlFactory.open(server.url("/").url());
assertEquals("two (identity)", readAscii(connection2.getInputStream(), Integer.MAX_VALUE));
assertEquals(1, server.takeRequest().getSequenceNumber());
} | void function(TransferKind transferKind, boolean tls) throws Exception { if (tls) { SSLSocketFactory socketFactory = sslClient.socketFactory; RecordingHostnameVerifier hostnameVerifier = new RecordingHostnameVerifier(); server.useHttps(socketFactory, false); urlFactory.setClient(urlFactory.client().newBuilder() .sslSocketFactory(socketFactory, sslClient.trustManager) .hostnameVerifier(hostnameVerifier) .build()); } MockResponse responseOne = new MockResponse(); responseOne.addHeader(STR); transferKind.setBody(responseOne, gzip(STR), 5); server.enqueue(responseOne); MockResponse responseTwo = new MockResponse(); transferKind.setBody(responseTwo, STR, 5); server.enqueue(responseTwo); HttpURLConnection connection1 = urlFactory.open(server.url("/").url()); connection1.addRequestProperty(STR, "gzip"); InputStream gunzippedIn = new GZIPInputStream(connection1.getInputStream()); assertEquals(STR, readAscii(gunzippedIn, Integer.MAX_VALUE)); assertEquals(0, server.takeRequest().getSequenceNumber()); HttpURLConnection connection2 = urlFactory.open(server.url("/").url()); assertEquals(STR, readAscii(connection2.getInputStream(), Integer.MAX_VALUE)); assertEquals(1, server.takeRequest().getSequenceNumber()); } | /**
* Test a bug where gzip input streams weren't exhausting the input stream, which corrupted the
* request that followed or prevented connection reuse.
* http://code.google.com/p/android/issues/detail?id=7059
* http://code.google.com/p/android/issues/detail?id=38817
*/ | Test a bug where gzip input streams weren't exhausting the input stream, which corrupted the request that followed or prevented connection reuse. HREF HREF | testClientConfiguredGzipContentEncodingAndConnectionReuse | {
"repo_name": "weiwenqiang/GitHub",
"path": "expert/okhttp/okhttp-tests/src/test/java/okhttp3/URLConnectionTest.java",
"license": "apache-2.0",
"size": 151984
} | [
"java.io.InputStream",
"java.net.HttpURLConnection",
"java.util.zip.GZIPInputStream",
"javax.net.ssl.SSLSocketFactory",
"org.junit.Assert"
] | import java.io.InputStream; import java.net.HttpURLConnection; import java.util.zip.GZIPInputStream; import javax.net.ssl.SSLSocketFactory; import org.junit.Assert; | import java.io.*; import java.net.*; import java.util.zip.*; import javax.net.ssl.*; import org.junit.*; | [
"java.io",
"java.net",
"java.util",
"javax.net",
"org.junit"
] | java.io; java.net; java.util; javax.net; org.junit; | 1,803,904 |
private static ImmutableSet<String> getFunctionParameterSet(Node fnNode) {
ImmutableSet.Builder<String> builder = ImmutableSet.builder();
for (Node n : NodeUtil.getFunctionParameters(fnNode).children()) {
if (n.isRest()){
builder.add(REST_MARKER);
} else if (n.isDefaultValue() || n.isObjectPattern() || n.isArrayPattern()) {
throw new IllegalStateException("Not supported: " + n);
} else {
builder.add(n.getString());
}
}
return builder.build();
} | static ImmutableSet<String> function(Node fnNode) { ImmutableSet.Builder<String> builder = ImmutableSet.builder(); for (Node n : NodeUtil.getFunctionParameters(fnNode).children()) { if (n.isRest()){ builder.add(REST_MARKER); } else if (n.isDefaultValue() n.isObjectPattern() n.isArrayPattern()) { throw new IllegalStateException(STR + n); } else { builder.add(n.getString()); } } return builder.build(); } | /**
* Get a set of function parameter names.
*/ | Get a set of function parameter names | getFunctionParameterSet | {
"repo_name": "tiobe/closure-compiler",
"path": "src/com/google/javascript/jscomp/FunctionArgumentInjector.java",
"license": "apache-2.0",
"size": 20287
} | [
"com.google.common.collect.ImmutableSet",
"com.google.javascript.rhino.Node"
] | import com.google.common.collect.ImmutableSet; import com.google.javascript.rhino.Node; | import com.google.common.collect.*; import com.google.javascript.rhino.*; | [
"com.google.common",
"com.google.javascript"
] | com.google.common; com.google.javascript; | 2,355,725 |
private String exportXDSI() {
FolderForm folderForm = (FolderForm) getForm();
try {
if ( !checkStickiesForStudyPermission(StudyPermissionDTO.EXPORT_ACTION, true) ) {
folderForm.setPopupMsg("folder.export_denied",(String)null);
return FOLDER;
}
xdsiDelegate = XDSIExportDelegate.getInstance(getCtx());
Set instances = FolderUtil.getSelectedInstances(folderForm.getStickyPatients(),
folderForm.getStickyStudies(),
folderForm.getStickySeries(),
folderForm.getStickyInstances());
if ( log.isDebugEnabled() ) log.debug("Selected Instances:"+instances);
XDSIModel xdsiModel = XDSIModel.getModel( getCtx().getRequest() );
xdsiModel.setInstances(instances);
xdsiModel.setSourcePatient( FolderUtil.getInstanceInfo((String)instances.iterator().next()));
} catch ( Exception x ) {
log.error("Error in XDSI export! :", x);
folderForm.setPopupMsg("folder.err_xdsi",x.getMessage());
return FOLDER;
}
return XDSI_EXPORT;
} | String function() { FolderForm folderForm = (FolderForm) getForm(); try { if ( !checkStickiesForStudyPermission(StudyPermissionDTO.EXPORT_ACTION, true) ) { folderForm.setPopupMsg(STR,(String)null); return FOLDER; } xdsiDelegate = XDSIExportDelegate.getInstance(getCtx()); Set instances = FolderUtil.getSelectedInstances(folderForm.getStickyPatients(), folderForm.getStickyStudies(), folderForm.getStickySeries(), folderForm.getStickyInstances()); if ( log.isDebugEnabled() ) log.debug(STR+instances); XDSIModel xdsiModel = XDSIModel.getModel( getCtx().getRequest() ); xdsiModel.setInstances(instances); xdsiModel.setSourcePatient( FolderUtil.getInstanceInfo((String)instances.iterator().next())); } catch ( Exception x ) { log.error(STR, x); folderForm.setPopupMsg(STR,x.getMessage()); return FOLDER; } return XDSI_EXPORT; } | /**
* Export selected instances to a XDS Repository.
* <p>
*
* @return the name of the next view.
*/ | Export selected instances to a XDS Repository. | exportXDSI | {
"repo_name": "medicayun/medicayundicom",
"path": "dcm4jboss-all/trunk/dcm4jboss-web/src/java/org/dcm4chex/archive/web/maverick/FolderSubmitCtrl.java",
"license": "apache-2.0",
"size": 26860
} | [
"java.util.Set",
"org.dcm4chex.archive.ejb.interfaces.StudyPermissionDTO",
"org.dcm4chex.archive.web.maverick.xdsi.XDSIExportDelegate",
"org.dcm4chex.archive.web.maverick.xdsi.XDSIModel"
] | import java.util.Set; import org.dcm4chex.archive.ejb.interfaces.StudyPermissionDTO; import org.dcm4chex.archive.web.maverick.xdsi.XDSIExportDelegate; import org.dcm4chex.archive.web.maverick.xdsi.XDSIModel; | import java.util.*; import org.dcm4chex.archive.ejb.interfaces.*; import org.dcm4chex.archive.web.maverick.xdsi.*; | [
"java.util",
"org.dcm4chex.archive"
] | java.util; org.dcm4chex.archive; | 902,142 |
List<HoursWorkedPerWorkerInAMonthDTO> getWorkingHoursPerWorker(Integer year, Integer month); | List<HoursWorkedPerWorkerInAMonthDTO> getWorkingHoursPerWorker(Integer year, Integer month); | /**
* Returns all {@link HoursWorkedPerWorkerInAMonthDTO} in year and month
*
* @param year
* @param month
* @return
*/ | Returns all <code>HoursWorkedPerWorkerInAMonthDTO</code> in year and month | getWorkingHoursPerWorker | {
"repo_name": "bolobr/IEBT-Libreplan",
"path": "libreplan-business/src/main/java/org/libreplan/business/resources/daos/IResourceDAO.java",
"license": "agpl-3.0",
"size": 3508
} | [
"java.util.List",
"org.libreplan.business.reports.dtos.HoursWorkedPerWorkerInAMonthDTO"
] | import java.util.List; import org.libreplan.business.reports.dtos.HoursWorkedPerWorkerInAMonthDTO; | import java.util.*; import org.libreplan.business.reports.dtos.*; | [
"java.util",
"org.libreplan.business"
] | java.util; org.libreplan.business; | 2,792,047 |
ActionFuture<SimulatePipelineResponse> simulatePipeline(SimulatePipelineRequest request); | ActionFuture<SimulatePipelineResponse> simulatePipeline(SimulatePipelineRequest request); | /**
* Simulates an ingest pipeline
*/ | Simulates an ingest pipeline | simulatePipeline | {
"repo_name": "ern/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/client/ClusterAdminClient.java",
"license": "apache-2.0",
"size": 28517
} | [
"org.elasticsearch.action.ActionFuture",
"org.elasticsearch.action.ingest.SimulatePipelineRequest",
"org.elasticsearch.action.ingest.SimulatePipelineResponse"
] | import org.elasticsearch.action.ActionFuture; import org.elasticsearch.action.ingest.SimulatePipelineRequest; import org.elasticsearch.action.ingest.SimulatePipelineResponse; | import org.elasticsearch.action.*; import org.elasticsearch.action.ingest.*; | [
"org.elasticsearch.action"
] | org.elasticsearch.action; | 737,663 |
public static void bind(MouseTrapHandler callback, String... commands) {
JsArrayString values = JsArrayString.createArray().cast();
for (String c : commands) {
values.push(c);
}
bind(values, callback);
} | static void function(MouseTrapHandler callback, String... commands) { JsArrayString values = JsArrayString.createArray().cast(); for (String c : commands) { values.push(c); } bind(values, callback); } | /**
* If you want to bind multiple key commands to the same callback you can pass in an array for the first argument
*/ | If you want to bind multiple key commands to the same callback you can pass in an array for the first argument | bind | {
"repo_name": "ahome-it/ahome-mousetrap",
"path": "ahome-mousetrap/src/main/java/com/ait/toolkit/mousetrap/client/MouseTrap.java",
"license": "apache-2.0",
"size": 9557
} | [
"com.google.gwt.core.client.JsArrayString"
] | import com.google.gwt.core.client.JsArrayString; | import com.google.gwt.core.client.*; | [
"com.google.gwt"
] | com.google.gwt; | 1,818,486 |
DataFormatResolver getDataFormatResolver(); | DataFormatResolver getDataFormatResolver(); | /**
* Gets the current data format resolver
*
* @return the resolver
*/ | Gets the current data format resolver | getDataFormatResolver | {
"repo_name": "shuliangtao/apache-camel-2.13.0-src",
"path": "camel-core/src/main/java/org/apache/camel/CamelContext.java",
"license": "apache-2.0",
"size": 47147
} | [
"org.apache.camel.spi.DataFormatResolver"
] | import org.apache.camel.spi.DataFormatResolver; | import org.apache.camel.spi.*; | [
"org.apache.camel"
] | org.apache.camel; | 1,214,636 |
public DateTime getCalendarStartTime() {
return calendarStartTime;
} | DateTime function() { return calendarStartTime; } | /**
* {@link #calendarStartTime} accessor.
* @return The value.
**/ | <code>#calendarStartTime</code> accessor | getCalendarStartTime | {
"repo_name": "skyvers/wildcat",
"path": "skyve-ejb/src/generated/java/modules/admin/domain/Communication.java",
"license": "lgpl-2.1",
"size": 31898
} | [
"org.skyve.domain.types.DateTime"
] | import org.skyve.domain.types.DateTime; | import org.skyve.domain.types.*; | [
"org.skyve.domain"
] | org.skyve.domain; | 1,996,676 |
public static void assertPathExists(FileSystem fileSystem, String message,
Path path) throws IOException {
if (!fileSystem.exists(path)) {
//failure, report it
ls(fileSystem, path.getParent());
throw new FileNotFoundException(message + ": not found " + path
+ " in " + path.getParent());
}
} | static void function(FileSystem fileSystem, String message, Path path) throws IOException { if (!fileSystem.exists(path)) { ls(fileSystem, path.getParent()); throw new FileNotFoundException(message + STR + path + STR + path.getParent()); } } | /**
* Assert that a path exists -but make no assertions as to the
* type of that entry
*
* @param fileSystem filesystem to examine
* @param message message to include in the assertion failure message
* @param path path in the filesystem
* @throws FileNotFoundException raised if the path is missing
* @throws IOException IO problems
*/ | Assert that a path exists -but make no assertions as to the type of that entry | assertPathExists | {
"repo_name": "tseen/Federated-HDFS",
"path": "tseenliu/FedHDFS-hadoop-src/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/ContractTestUtils.java",
"license": "apache-2.0",
"size": 25377
} | [
"java.io.FileNotFoundException",
"java.io.IOException",
"org.apache.hadoop.fs.FileSystem",
"org.apache.hadoop.fs.Path"
] | import java.io.FileNotFoundException; import java.io.IOException; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; | import java.io.*; import org.apache.hadoop.fs.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 693,329 |
public Collection<GroupSystem> getReloadSurvivors() {
Collection<GroupSystem> reloadSurvivors = new ArrayList<>();
for (GroupSystem system : this.systems) {
if (system.keepOnReload()) {
reloadSurvivors.add(system);
}
}
return reloadSurvivors;
} | Collection<GroupSystem> function() { Collection<GroupSystem> reloadSurvivors = new ArrayList<>(); for (GroupSystem system : this.systems) { if (system.keepOnReload()) { reloadSurvivors.add(system); } } return reloadSurvivors; } | /**
* Gets all groups that must be kept on reload.
*
* @return All groups that must be kept.
*/ | Gets all groups that must be kept on reload | getReloadSurvivors | {
"repo_name": "rutgerkok/BlockLocker",
"path": "src/main/java/nl/rutgerkok/blocklocker/group/CombinedGroupSystem.java",
"license": "mit",
"size": 2553
} | [
"java.util.ArrayList",
"java.util.Collection"
] | import java.util.ArrayList; import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 61,637 |
public final List<Edge> returnUnsortedBorders() {
final List<Edge> edges = new ArrayList<>();
// Select every edges of the mesh.
for (final Triangle tri : this) {
for (final Edge edge : tri.getEdges()) {
if (edge.isBorder(this)) {
edges.add(edge);
}
}
}
return edges;
} | final List<Edge> function() { final List<Edge> edges = new ArrayList<>(); for (final Triangle tri : this) { for (final Edge edge : tri.getEdges()) { if (edge.isBorder(this)) { edges.add(edge); } } } return edges; } | /**
* Searches for all the edges which belong to borders. If an edge contains
* only one triangle in this mesh, then it is part of a border.
* @return list of every border edges
*/ | Searches for all the edges which belong to borders. If an edge contains only one triangle in this mesh, then it is part of a border | returnUnsortedBorders | {
"repo_name": "DanielLefevre/Nantes-1900-Maven",
"path": "src/main/java/fr/nantes1900/models/basis/Mesh.java",
"license": "gpl-3.0",
"size": 19284
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,045,412 |
protected NodeFigure createMainFigure() {
nodeFigure = createNodePlate();
nodeFigure.setLayoutManager(new StackLayout());
IFigure shape = createNodeShape();
shape.setBorder(null);
nodeFigure.add(shape);
nodeFigure.setBorder(null);
addLeftConnectorLabel();
contentPane = setupContentPane(shape);
return nodeFigure;
} | NodeFigure function() { nodeFigure = createNodePlate(); nodeFigure.setLayoutManager(new StackLayout()); IFigure shape = createNodeShape(); shape.setBorder(null); nodeFigure.add(shape); nodeFigure.setBorder(null); addLeftConnectorLabel(); contentPane = setupContentPane(shape); return nodeFigure; } | /**
* Creates figure for this edit part.
*
* Body of this method does not depend on settings in generation model
* so you may safely remove <i>generated</i> tag and modify it.
*
* @generated NOT
*/ | Creates figure for this edit part. Body of this method does not depend on settings in generation model so you may safely remove generated tag and modify it | createMainFigure | {
"repo_name": "prabushi/devstudio-tooling-esb",
"path": "plugins/org.wso2.developerstudio.visualdatamapper.diagram/src/org/wso2/developerstudio/datamapper/diagram/edit/parts/OperatorLeftConnectorEditPart.java",
"license": "apache-2.0",
"size": 9246
} | [
"org.eclipse.draw2d.IFigure",
"org.eclipse.draw2d.StackLayout",
"org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure"
] | import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.StackLayout; import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; | import org.eclipse.draw2d.*; import org.eclipse.gmf.runtime.gef.ui.figures.*; | [
"org.eclipse.draw2d",
"org.eclipse.gmf"
] | org.eclipse.draw2d; org.eclipse.gmf; | 389,962 |
public Extraction extract (PipeInputIterator source); | Extraction function (PipeInputIterator source); | /**
* Performs extraction on a a set of raw documents. The
* Instances output from source will be passed through
* both the tokentization pipe and the feature extraction
* pipe.
* @param source A source of raw documents
* @return Extraction the results of performing extraction
*/ | Performs extraction on a a set of raw documents. The Instances output from source will be passed through both the tokentization pipe and the feature extraction pipe | extract | {
"repo_name": "sistanlp/banner",
"path": "src/main/java/edu/umass/cs/mallet/base/extract/Extractor.java",
"license": "epl-1.0",
"size": 3822
} | [
"edu.umass.cs.mallet.base.pipe.iterator.PipeInputIterator"
] | import edu.umass.cs.mallet.base.pipe.iterator.PipeInputIterator; | import edu.umass.cs.mallet.base.pipe.iterator.*; | [
"edu.umass.cs"
] | edu.umass.cs; | 884,753 |
protected static Object cyclePropertyValue(Collection values, Object currentValue)
{
Iterator iterator = values.iterator();
do
{
if (!iterator.hasNext())
{
return iterator.next();
}
}
while (!iterator.next().equals(currentValue));
if (iterator.hasNext())
{
return iterator.next();
}
else
{
return values.iterator().next();
}
} | static Object function(Collection values, Object currentValue) { Iterator iterator = values.iterator(); do { if (!iterator.hasNext()) { return iterator.next(); } } while (!iterator.next().equals(currentValue)); if (iterator.hasNext()) { return iterator.next(); } else { return values.iterator().next(); } } | /**
* Helper method for cycleProperty.
*
* @param values The collection of values
* @param currentValue The current value
*/ | Helper method for cycleProperty | cyclePropertyValue | {
"repo_name": "trixmot/mod1",
"path": "build/tmp/recompileMc/sources/net/minecraft/block/state/BlockStateBase.java",
"license": "lgpl-2.1",
"size": 2896
} | [
"java.util.Collection",
"java.util.Iterator"
] | import java.util.Collection; import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 1,711,243 |
protected void synchronizeChildren() {
// no need to synchronize again
needsSyncChildren(false);
DocumentType doctype;
NamedNodeMap entities;
EntityImpl entDef;
if (null != (doctype = getOwnerDocument().getDoctype()) &&
null != (entities = doctype.getEntities())) {
entDef = (EntityImpl)entities.getNamedItem(getNodeName());
// No Entity by this name, stop here.
if (entDef == null)
return;
// If entity's definition exists, clone its kids
isReadOnly(false);
for (Node defkid = entDef.getFirstChild();
defkid != null;
defkid = defkid.getNextSibling()) {
Node newkid = defkid.cloneNode(true);
insertBefore(newkid, null);
}
setReadOnly(true, true);
}
} | void function() { needsSyncChildren(false); DocumentType doctype; NamedNodeMap entities; EntityImpl entDef; if (null != (doctype = getOwnerDocument().getDoctype()) && null != (entities = doctype.getEntities())) { entDef = (EntityImpl)entities.getNamedItem(getNodeName()); if (entDef == null) return; isReadOnly(false); for (Node defkid = entDef.getFirstChild(); defkid != null; defkid = defkid.getNextSibling()) { Node newkid = defkid.cloneNode(true); insertBefore(newkid, null); } setReadOnly(true, true); } } | /**
* EntityReference's children are a reflection of those defined in the
* named Entity. This method creates them if they haven't been created yet.
* This doesn't support editing the Entity though, since this only called
* once for all.
*/ | EntityReference's children are a reflection of those defined in the named Entity. This method creates them if they haven't been created yet. This doesn't support editing the Entity though, since this only called once for all | synchronizeChildren | {
"repo_name": "openjdk/jdk8u",
"path": "jaxp/src/com/sun/org/apache/xerces/internal/dom/EntityReferenceImpl.java",
"license": "gpl-2.0",
"size": 13914
} | [
"org.w3c.dom.DocumentType",
"org.w3c.dom.NamedNodeMap",
"org.w3c.dom.Node"
] | import org.w3c.dom.DocumentType; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 985,650 |
private boolean isInHashCodeMethod(DetailAST aAST)
{
// if not in a code block, can't be in hashCode()
if (!ScopeUtils.inCodeBlock(aAST)) {
return false;
}
// find the method definition AST
DetailAST methodDefAST = aAST.getParent();
while ((null != methodDefAST)
&& (TokenTypes.METHOD_DEF != methodDefAST.getType()))
{
methodDefAST = methodDefAST.getParent();
}
if (null == methodDefAST) {
return false;
}
// Check for 'hashCode' name.
final DetailAST identAST =
methodDefAST.findFirstToken(TokenTypes.IDENT);
if (!"hashCode".equals(identAST.getText())) {
return false;
}
// Check for no arguments.
final DetailAST paramAST =
methodDefAST.findFirstToken(TokenTypes.PARAMETERS);
if (0 != paramAST.getChildCount()) {
return false;
}
// we are in a 'public int hashCode()' method! The compiler will ensure
// the method returns an 'int' and is public.
return true;
} | boolean function(DetailAST aAST) { if (!ScopeUtils.inCodeBlock(aAST)) { return false; } DetailAST methodDefAST = aAST.getParent(); while ((null != methodDefAST) && (TokenTypes.METHOD_DEF != methodDefAST.getType())) { methodDefAST = methodDefAST.getParent(); } if (null == methodDefAST) { return false; } final DetailAST identAST = methodDefAST.findFirstToken(TokenTypes.IDENT); if (!STR.equals(identAST.getText())) { return false; } final DetailAST paramAST = methodDefAST.findFirstToken(TokenTypes.PARAMETERS); if (0 != paramAST.getChildCount()) { return false; } return true; } | /**
* Determines whether or not the given AST is in a valid hash code method.
* A valid hash code method is considered to be a method of the signature
* {@code public int hashCode()}.
*
* @param aAST the AST from which to search for an enclosing hash code
* method definition
*
* @return {@code true} if {@code aAST} is in the scope of a valid hash
* code method
*/ | Determines whether or not the given AST is in a valid hash code method. A valid hash code method is considered to be a method of the signature public int hashCode() | isInHashCodeMethod | {
"repo_name": "lhanson/checkstyle",
"path": "src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.java",
"license": "lgpl-2.1",
"size": 9607
} | [
"com.puppycrawl.tools.checkstyle.api.DetailAST",
"com.puppycrawl.tools.checkstyle.api.ScopeUtils",
"com.puppycrawl.tools.checkstyle.api.TokenTypes"
] | import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes; | import com.puppycrawl.tools.checkstyle.api.*; | [
"com.puppycrawl.tools"
] | com.puppycrawl.tools; | 1,387,956 |
private static void logScrape(ObjectName mbeanName, MBeanAttributeInfo attr, String msg) {
logScrape(mbeanName + "'_'" + attr.getName(), msg);
} | static void function(ObjectName mbeanName, MBeanAttributeInfo attr, String msg) { logScrape(mbeanName + "'_'" + attr.getName(), msg); } | /**
* For debugging.
*/ | For debugging | logScrape | {
"repo_name": "midonet/jmx_exporter",
"path": "collector/src/main/java/io/prometheus/jmx/JmxScraper.java",
"license": "apache-2.0",
"size": 12955
} | [
"javax.management.MBeanAttributeInfo",
"javax.management.ObjectName"
] | import javax.management.MBeanAttributeInfo; import javax.management.ObjectName; | import javax.management.*; | [
"javax.management"
] | javax.management; | 1,351,806 |
void persist(Writer writer) throws IOException {
final SolrQueryResponse response = new SolrQueryResponse();
response.add(IndexSchema.SCHEMA, getNamedPropertyValues());
final NamedList args = new NamedList(Arrays.<Object>asList("indent", "on"));
final LocalSolrQueryRequest req = new LocalSolrQueryRequest(null, args);
final SchemaXmlWriter schemaXmlWriter = new SchemaXmlWriter(writer, req, response);
schemaXmlWriter.setEmitManagedSchemaDoNotEditWarning(true);
schemaXmlWriter.writeResponse();
schemaXmlWriter.close();
} | void persist(Writer writer) throws IOException { final SolrQueryResponse response = new SolrQueryResponse(); response.add(IndexSchema.SCHEMA, getNamedPropertyValues()); final NamedList args = new NamedList(Arrays.<Object>asList(STR, "on")); final LocalSolrQueryRequest req = new LocalSolrQueryRequest(null, args); final SchemaXmlWriter schemaXmlWriter = new SchemaXmlWriter(writer, req, response); schemaXmlWriter.setEmitManagedSchemaDoNotEditWarning(true); schemaXmlWriter.writeResponse(); schemaXmlWriter.close(); } | /**
* Writes the schema in schema.xml format to the given writer
*/ | Writes the schema in schema.xml format to the given writer | persist | {
"repo_name": "pengzong1111/solr4",
"path": "solr/core/src/java/org/apache/solr/schema/IndexSchema.java",
"license": "apache-2.0",
"size": 60164
} | [
"java.io.IOException",
"java.io.Writer",
"java.util.Arrays",
"org.apache.solr.common.util.NamedList",
"org.apache.solr.request.LocalSolrQueryRequest",
"org.apache.solr.response.SchemaXmlWriter",
"org.apache.solr.response.SolrQueryResponse"
] | import java.io.IOException; import java.io.Writer; import java.util.Arrays; import org.apache.solr.common.util.NamedList; import org.apache.solr.request.LocalSolrQueryRequest; import org.apache.solr.response.SchemaXmlWriter; import org.apache.solr.response.SolrQueryResponse; | import java.io.*; import java.util.*; import org.apache.solr.common.util.*; import org.apache.solr.request.*; import org.apache.solr.response.*; | [
"java.io",
"java.util",
"org.apache.solr"
] | java.io; java.util; org.apache.solr; | 2,044,099 |
public static IJavaModelStatus validateClasspathEntry(IJavaProject project, IClasspathEntry entry, boolean checkSourceAttachment, boolean referredByContainer){
if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
JavaModelManager.getJavaModelManager().removeFromInvalidArchiveCache(entry.getPath());
}
IJavaModelStatus status = validateClasspathEntry(project, entry, null, checkSourceAttachment, referredByContainer);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=171136 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=300136
// Ignore class path errors from optional entries.
int statusCode = status.getCode();
if ( (statusCode == IJavaModelStatusConstants.INVALID_CLASSPATH ||
statusCode == IJavaModelStatusConstants.CP_CONTAINER_PATH_UNBOUND ||
statusCode == IJavaModelStatusConstants.CP_VARIABLE_PATH_UNBOUND ||
statusCode == IJavaModelStatusConstants.INVALID_PATH) &&
((ClasspathEntry) entry).isOptional())
return JavaModelStatus.VERIFIED_OK;
return status;
}
| static IJavaModelStatus function(IJavaProject project, IClasspathEntry entry, boolean checkSourceAttachment, boolean referredByContainer){ if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { JavaModelManager.getJavaModelManager().removeFromInvalidArchiveCache(entry.getPath()); } IJavaModelStatus status = validateClasspathEntry(project, entry, null, checkSourceAttachment, referredByContainer); int statusCode = status.getCode(); if ( (statusCode == IJavaModelStatusConstants.INVALID_CLASSPATH statusCode == IJavaModelStatusConstants.CP_CONTAINER_PATH_UNBOUND statusCode == IJavaModelStatusConstants.CP_VARIABLE_PATH_UNBOUND statusCode == IJavaModelStatusConstants.INVALID_PATH) && ((ClasspathEntry) entry).isOptional()) return JavaModelStatus.VERIFIED_OK; return status; } | /**
* Returns a Java model status describing the problem related to this classpath entry if any,
* a status object with code <code>IStatus.OK</code> if the entry is fine (that is, if the
* given classpath entry denotes a valid element to be referenced onto a classpath).
*
* @param project the given java project
* @param entry the given classpath entry
* @param checkSourceAttachment a flag to determine if source attachment should be checked
* @param referredByContainer flag indicating whether the given entry is referred by a classpath container
* @return a java model status describing the problem related to this classpath entry if any, a status object with code <code>IStatus.OK</code> if the entry is fine
*/ | Returns a Java model status describing the problem related to this classpath entry if any, a status object with code <code>IStatus.OK</code> if the entry is fine (that is, if the given classpath entry denotes a valid element to be referenced onto a classpath) | validateClasspathEntry | {
"repo_name": "elucash/eclipse-oxygen",
"path": "org.eclipse.jdt.core/src/org/eclipse/jdt/internal/core/ClasspathEntry.java",
"license": "epl-1.0",
"size": 97949
} | [
"org.eclipse.jdt.core.IClasspathEntry",
"org.eclipse.jdt.core.IJavaModelStatus",
"org.eclipse.jdt.core.IJavaModelStatusConstants",
"org.eclipse.jdt.core.IJavaProject"
] | import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.core.IJavaModelStatus; import org.eclipse.jdt.core.IJavaModelStatusConstants; import org.eclipse.jdt.core.IJavaProject; | import org.eclipse.jdt.core.*; | [
"org.eclipse.jdt"
] | org.eclipse.jdt; | 1,458,002 |
@NotNull
@Required(value = false, nonEmpty = true)
GenericDomValue<Boolean> getOptional(); | @Required(value = false, nonEmpty = true) GenericDomValue<Boolean> getOptional(); | /**
* Returns the value of the optional child.
* <pre>
* <h3>Element http://maven.apache.org/POM/4.0.0:optional documentation</h3>
* 4.0.0
* </pre>
*
* @return the value of the optional child.
*/ | Returns the value of the optional child. <code> Element HREF documentation 4.0.0 </code> | getOptional | {
"repo_name": "siosio/intellij-community",
"path": "plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/model/MavenDomDependency.java",
"license": "apache-2.0",
"size": 3939
} | [
"com.intellij.util.xml.GenericDomValue",
"com.intellij.util.xml.Required"
] | import com.intellij.util.xml.GenericDomValue; import com.intellij.util.xml.Required; | import com.intellij.util.xml.*; | [
"com.intellij.util"
] | com.intellij.util; | 1,923,775 |
@Test
public void reparseReplace() {
final String oldText = " NOP\n BLOCK0\n MOVE #0,D0\n ENDBLOCK0\n NOP";
final int replaceOffset = 20;
final int lengthToRemove = 1;
final String textToInsert = "123";
final Document oldDocument = new Document(oldText);
final SourceNode oldNode = TestParser.TEST_PARSER.parse(oldDocument);
final Document newDocument = oldDocument.replace(replaceOffset, lengthToRemove, textToInsert);
assertThat(newDocument.toString(), is(" NOP\n BLOCK0\n MOVE #123,D0\n ENDBLOCK0\n NOP"));
final SourceNode newNode = TestParser.TEST_PARSER.reparse(newDocument, oldNode, replaceOffset, lengthToRemove,
textToInsert.length());
assertThat(newNode.getLength(), is(42));
} | void function() { final String oldText = STR; final int replaceOffset = 20; final int lengthToRemove = 1; final String textToInsert = "123"; final Document oldDocument = new Document(oldText); final SourceNode oldNode = TestParser.TEST_PARSER.parse(oldDocument); final Document newDocument = oldDocument.replace(replaceOffset, lengthToRemove, textToInsert); assertThat(newDocument.toString(), is(STR)); final SourceNode newNode = TestParser.TEST_PARSER.reparse(newDocument, oldNode, replaceOffset, lengthToRemove, textToInsert.length()); assertThat(newNode.getLength(), is(42)); } | /**
* Asserts that {@link Parser#reparse(Document, SourceNode, int, int, int)} reparses a document.
*/ | Asserts that <code>Parser#reparse(Document, SourceNode, int, int, int)</code> reparses a document | reparseReplace | {
"repo_name": "reasm/reasm-commons",
"path": "src/test/java/org/reasm/commons/source/ParserTest.java",
"license": "mit",
"size": 12821
} | [
"ca.fragag.text.Document",
"org.hamcrest.Matchers",
"org.junit.Assert",
"org.reasm.source.SourceNode"
] | import ca.fragag.text.Document; import org.hamcrest.Matchers; import org.junit.Assert; import org.reasm.source.SourceNode; | import ca.fragag.text.*; import org.hamcrest.*; import org.junit.*; import org.reasm.source.*; | [
"ca.fragag.text",
"org.hamcrest",
"org.junit",
"org.reasm.source"
] | ca.fragag.text; org.hamcrest; org.junit; org.reasm.source; | 1,651,691 |
public Collection<String> getOutputSites() {
return mOutputSites;
} | Collection<String> function() { return mOutputSites; } | /**
* Returns the names of the execution sites where the concrete workflow can be run.
*
* @return <code>Set</code> of output site names.
*/ | Returns the names of the execution sites where the concrete workflow can be run | getOutputSites | {
"repo_name": "pegasus-isi/pegasus",
"path": "src/edu/isi/pegasus/planner/classes/PlannerOptions.java",
"license": "apache-2.0",
"size": 50453
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,026,583 |
private void parseMimeEntry(String entry) {
entry = entry.trim();
if (entry.isEmpty() || entry.charAt(0) == '#')
return;
entry = entry.replaceAll("\\s*#.*", "");
int equalIdx = entry.indexOf('=');
if (equalIdx > 0) {
// Parse a mime-types command having the key-value pair format
final String TYPEEQUAL = "type=";
String typeRegex = "\\b" + TYPEEQUAL +
"(\"\\p{Graph}+?/\\p{Graph}+?\"|\\p{Graph}+/\\p{Graph}+\\b)";
Pattern typePattern = Pattern.compile(typeRegex);
Matcher typeMatcher = typePattern.matcher(entry);
if (typeMatcher.find()) {
String type = typeMatcher.group().substring(TYPEEQUAL.length());
if (type.charAt(0) == '"') {
type = type.substring(1, type.length() - 1);
}
final String EXTEQUAL = "exts=";
String extRegex = "\\b" + EXTEQUAL +
"(\"[\\p{Graph}\\p{Blank}]+?\"|\\p{Graph}+\\b)";
Pattern extPattern = Pattern.compile(extRegex);
Matcher extMatcher = extPattern.matcher(entry);
if (extMatcher.find()) {
String exts =
extMatcher.group().substring(EXTEQUAL.length());
if (exts.charAt(0) == '"') {
exts = exts.substring(1, exts.length() - 1);
}
String[] extList = exts.split("[\\p{Blank}\\p{Punct}]+");
for (String ext : extList) {
putIfAbsent(ext, type);
}
}
}
} else {
// Parse a mime-types command having the space-delimited format
String[] elements = entry.split("\\s+");
int i = 1;
while (i < elements.length) {
putIfAbsent(elements[i++], elements[0]);
}
}
} | void function(String entry) { entry = entry.trim(); if (entry.isEmpty() entry.charAt(0) == '#') return; entry = entry.replaceAll(STR, STRtype=STR\\bSTR(\STR \\p{Graph}+/\\p{Graph}+\\b)STR') { type = type.substring(1, type.length() - 1); } final String EXTEQUAL = "exts="; String extRegex = "\\b" + EXTEQUAL + "(\"[\\p{Graph}\\p{Blank}]+?\STR; Pattern extPattern = Pattern.compile(extRegex); Matcher extMatcher = extPattern.matcher(entry); if (extMatcher.find()) { String exts = extMatcher.group().substring(EXTEQUAL.length()); if (exts.charAt(0) == 'STR[\\p{Blank}\\p{Punct}]+STR\\s+"); int i = 1; while (i < elements.length) { putIfAbsent(elements[i++], elements[0]); } } } | /**
* Parse a mime-types entry, which can have the following formats.
* 1) Simple space-delimited format
* image/jpeg jpeg jpg jpe JPG
*
* 2) Netscape key-value pair format
* type=application/x-java-jnlp-file desc="Java Web Start" exts="jnlp"
* or
* type=text/html exts=htm,html
*/ | Parse a mime-types entry, which can have the following formats. 1) Simple space-delimited format image/jpeg jpeg jpg jpe JPG 2) Netscape key-value pair format type=application/x-java-jnlp-file desc="Java Web Start" exts="jnlp" or type=text/html exts=htm,html | parseMimeEntry | {
"repo_name": "mirkosertic/Bytecoder",
"path": "classlib/java.base/src/main/resources/META-INF/modules/java.base/classes/sun/nio/fs/MimeTypesFileTypeDetector.java",
"license": "apache-2.0",
"size": 7197
} | [
"java.util.regex.Matcher",
"java.util.regex.Pattern"
] | import java.util.regex.Matcher; import java.util.regex.Pattern; | import java.util.regex.*; | [
"java.util"
] | java.util; | 2,202,251 |
default AdvancedSshEndpointConsumerBuilder pollStrategy(
PollingConsumerPollStrategy pollStrategy) {
setProperty("pollStrategy", pollStrategy);
return this;
} | default AdvancedSshEndpointConsumerBuilder pollStrategy( PollingConsumerPollStrategy pollStrategy) { setProperty(STR, pollStrategy); return this; } | /**
* A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing
* you to provide your custom implementation to control error handling
* usually occurred during the poll operation before an Exchange have
* been created and being routed in Camel.
*
* The option is a:
* <code>org.apache.camel.spi.PollingConsumerPollStrategy</code> type.
*
* Group: consumer (advanced)
*/ | A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel. The option is a: <code>org.apache.camel.spi.PollingConsumerPollStrategy</code> type. Group: consumer (advanced) | pollStrategy | {
"repo_name": "Fabryprog/camel",
"path": "core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/SshEndpointBuilderFactory.java",
"license": "apache-2.0",
"size": 54843
} | [
"org.apache.camel.spi.PollingConsumerPollStrategy"
] | import org.apache.camel.spi.PollingConsumerPollStrategy; | import org.apache.camel.spi.*; | [
"org.apache.camel"
] | org.apache.camel; | 688,295 |
private void checkNameVisibility(NodeTraversal t, Node name, Node parent) {
Var var = t.getScope().getVar(name.getString());
if (var != null) {
JSDocInfo docInfo = var.getJSDocInfo();
if (docInfo != null) {
// If a name is private, make sure that we're in the same file.
Visibility visibility = docInfo.getVisibility();
if (visibility == Visibility.PRIVATE &&
!t.getInput().getName().equals(docInfo.getSourceName())) {
if (docInfo.isConstructor() &&
isValidPrivateConstructorAccess(parent)) {
return;
}
compiler.report(
t.makeError(name, BAD_PRIVATE_GLOBAL_ACCESS,
name.getString(), docInfo.getSourceName()));
}
}
}
} | void function(NodeTraversal t, Node name, Node parent) { Var var = t.getScope().getVar(name.getString()); if (var != null) { JSDocInfo docInfo = var.getJSDocInfo(); if (docInfo != null) { Visibility visibility = docInfo.getVisibility(); if (visibility == Visibility.PRIVATE && !t.getInput().getName().equals(docInfo.getSourceName())) { if (docInfo.isConstructor() && isValidPrivateConstructorAccess(parent)) { return; } compiler.report( t.makeError(name, BAD_PRIVATE_GLOBAL_ACCESS, name.getString(), docInfo.getSourceName())); } } } } | /**
* Determines whether the given name is visible in the current context.
* @param t The current traversal.
* @param name The name node.
*/ | Determines whether the given name is visible in the current context | checkNameVisibility | {
"repo_name": "JonathanWalsh/Granule-Closure-Compiler",
"path": "src/com/google/javascript/jscomp/CheckAccessControls.java",
"license": "apache-2.0",
"size": 22275
} | [
"com.google.javascript.jscomp.Scope",
"com.google.javascript.rhino.JSDocInfo",
"com.google.javascript.rhino.Node"
] | import com.google.javascript.jscomp.Scope; import com.google.javascript.rhino.JSDocInfo; import com.google.javascript.rhino.Node; | import com.google.javascript.jscomp.*; import com.google.javascript.rhino.*; | [
"com.google.javascript"
] | com.google.javascript; | 2,713,103 |
public Builder addExternalIncludeDirs(Iterable<PathFragment> externalIncludeDirs) {
this.externalIncludeDirs.addAll(externalIncludeDirs);
return this;
} | Builder function(Iterable<PathFragment> externalIncludeDirs) { this.externalIncludeDirs.addAll(externalIncludeDirs); return this; } | /**
* Mark specified include directories as external, coming from an external workspace. These can
* be added with "-isystem" (GCC) or --system-header-prefix (Clang) to suppress warnings coming
* from external files.
*/ | Mark specified include directories as external, coming from an external workspace. These can be added with "-isystem" (GCC) or --system-header-prefix (Clang) to suppress warnings coming from external files | addExternalIncludeDirs | {
"repo_name": "meteorcloudy/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationContext.java",
"license": "apache-2.0",
"size": 59940
} | [
"com.google.devtools.build.lib.vfs.PathFragment"
] | import com.google.devtools.build.lib.vfs.PathFragment; | import com.google.devtools.build.lib.vfs.*; | [
"com.google.devtools"
] | com.google.devtools; | 1,250,527 |
protected BufferedWebResponse renderPage(Url targetUrl, RequestCycle requestCycle)
{
// get the page before checking for a scheduled request handler because
// the page may call setResponsePage in its constructor
IRequestablePage requestablePage = getPage();
IRequestHandler scheduled = requestCycle.getRequestHandlerScheduledAfterCurrent();
if (scheduled != null)
{
// no need to render
return null;
}
// keep the original response
final WebResponse originalResponse = (WebResponse)requestCycle.getResponse();
// buffered web response for page
BufferedWebResponse response = new BufferedWebResponse(originalResponse);
// keep the original base URL
Url originalBaseUrl = requestCycle.getUrlRenderer().setBaseUrl(targetUrl);
try
{
requestCycle.setResponse(response);
requestablePage.renderPage();
if (requestCycle.getRequestHandlerScheduledAfterCurrent() != null)
{
// This is a special case.
// During page render another request handler got scheduled and will want to
// overwrite the response, so we need to let it.
// Just preserve the meta data headers. Clear the initial actions because they are
// already copied into the new response's actions
originalResponse.reset();
response.writeMetaData(originalResponse);
return null;
}
else
{
return response;
}
}
finally
{
// restore original response and base URL
requestCycle.setResponse(originalResponse);
requestCycle.getUrlRenderer().setBaseUrl(originalBaseUrl);
}
} | BufferedWebResponse function(Url targetUrl, RequestCycle requestCycle) { IRequestablePage requestablePage = getPage(); IRequestHandler scheduled = requestCycle.getRequestHandlerScheduledAfterCurrent(); if (scheduled != null) { return null; } final WebResponse originalResponse = (WebResponse)requestCycle.getResponse(); BufferedWebResponse response = new BufferedWebResponse(originalResponse); Url originalBaseUrl = requestCycle.getUrlRenderer().setBaseUrl(targetUrl); try { requestCycle.setResponse(response); requestablePage.renderPage(); if (requestCycle.getRequestHandlerScheduledAfterCurrent() != null) { originalResponse.reset(); response.writeMetaData(originalResponse); return null; } else { return response; } } finally { requestCycle.setResponse(originalResponse); requestCycle.getUrlRenderer().setBaseUrl(originalBaseUrl); } } | /**
* Renders page to a {@link BufferedWebResponse}. All URLs in page will be rendered relative to
* <code>targetUrl</code>
*
* @param targetUrl
* @param requestCycle
* @return BufferedWebResponse containing page body
*/ | Renders page to a <code>BufferedWebResponse</code>. All URLs in page will be rendered relative to <code>targetUrl</code> | renderPage | {
"repo_name": "freiheit-com/wicket",
"path": "wicket-core/src/main/java/org/apache/wicket/request/handler/render/WebPageRenderer.java",
"license": "apache-2.0",
"size": 12037
} | [
"org.apache.wicket.protocol.http.BufferedWebResponse",
"org.apache.wicket.request.IRequestHandler",
"org.apache.wicket.request.Url",
"org.apache.wicket.request.component.IRequestablePage",
"org.apache.wicket.request.cycle.RequestCycle",
"org.apache.wicket.request.http.WebResponse"
] | import org.apache.wicket.protocol.http.BufferedWebResponse; import org.apache.wicket.request.IRequestHandler; import org.apache.wicket.request.Url; import org.apache.wicket.request.component.IRequestablePage; import org.apache.wicket.request.cycle.RequestCycle; import org.apache.wicket.request.http.WebResponse; | import org.apache.wicket.protocol.http.*; import org.apache.wicket.request.*; import org.apache.wicket.request.component.*; import org.apache.wicket.request.cycle.*; import org.apache.wicket.request.http.*; | [
"org.apache.wicket"
] | org.apache.wicket; | 40,642 |
public static java.util.List extractStatusWorkflowConfigList(ims.domain.ILightweightDomainFactory domainFactory, ims.emergency.vo.StatusWorkflowConfigVoCollection voCollection)
{
return extractStatusWorkflowConfigList(domainFactory, voCollection, null, new HashMap());
}
| static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.emergency.vo.StatusWorkflowConfigVoCollection voCollection) { return extractStatusWorkflowConfigList(domainFactory, voCollection, null, new HashMap()); } | /**
* Create the ims.emergency.configuration.domain.objects.StatusWorkflowConfig list from the value object collection.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param voCollection - the collection of value objects
*/ | Create the ims.emergency.configuration.domain.objects.StatusWorkflowConfig list from the value object collection | extractStatusWorkflowConfigList | {
"repo_name": "open-health-hub/openMAXIMS",
"path": "openmaxims_workspace/ValueObjects/src/ims/emergency/vo/domain/StatusWorkflowConfigVoAssembler.java",
"license": "agpl-3.0",
"size": 21439
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 2,794,538 |
public List<top.zbeboy.isy.domain.tables.pojos.DefenseGroup> fetchBySchoolroomId(Integer... values) {
return fetch(DefenseGroup.DEFENSE_GROUP.SCHOOLROOM_ID, values);
} | List<top.zbeboy.isy.domain.tables.pojos.DefenseGroup> function(Integer... values) { return fetch(DefenseGroup.DEFENSE_GROUP.SCHOOLROOM_ID, values); } | /**
* Fetch records that have <code>schoolroom_id IN (values)</code>
*/ | Fetch records that have <code>schoolroom_id IN (values)</code> | fetchBySchoolroomId | {
"repo_name": "zbeboy/ISY",
"path": "src/main/java/top/zbeboy/isy/domain/tables/daos/DefenseGroupDao.java",
"license": "mit",
"size": 3962
} | [
"java.util.List",
"top.zbeboy.isy.domain.tables.DefenseGroup"
] | import java.util.List; import top.zbeboy.isy.domain.tables.DefenseGroup; | import java.util.*; import top.zbeboy.isy.domain.tables.*; | [
"java.util",
"top.zbeboy.isy"
] | java.util; top.zbeboy.isy; | 1,071,972 |
private void fromExpression(PatternDescrBuilder<?> pattern) throws RecognitionException {
String expr = conditionalOrExpression();
if (state.failed)
return;
if (state.backtracking == 0) {
pattern.from().expression(expr);
if (input.LA(1) != DRL6Lexer.EOF) {
helper.emit(Location.LOCATION_LHS_BEGIN_OF_CONDITION);
}
}
} | void function(PatternDescrBuilder<?> pattern) throws RecognitionException { String expr = conditionalOrExpression(); if (state.failed) return; if (state.backtracking == 0) { pattern.from().expression(expr); if (input.LA(1) != DRL6Lexer.EOF) { helper.emit(Location.LOCATION_LHS_BEGIN_OF_CONDITION); } } } | /**
* fromExpression := conditionalOrExpression
*
* @param pattern
* @throws org.antlr.runtime.RecognitionException
*/ | fromExpression := conditionalOrExpression | fromExpression | {
"repo_name": "amckee23/drools",
"path": "drools-compiler/src/main/java/org/drools/compiler/lang/DRL6Parser.java",
"license": "apache-2.0",
"size": 172886
} | [
"org.antlr.runtime.RecognitionException",
"org.drools.compiler.lang.api.PatternDescrBuilder"
] | import org.antlr.runtime.RecognitionException; import org.drools.compiler.lang.api.PatternDescrBuilder; | import org.antlr.runtime.*; import org.drools.compiler.lang.api.*; | [
"org.antlr.runtime",
"org.drools.compiler"
] | org.antlr.runtime; org.drools.compiler; | 2,425,088 |
public static void setAppThisVersionCodeLaunchCount(Context context, long appThisVersionCodeLaunchCount) {
SharedPreferences prefs = getSharedPreferences(context);
SharedPreferences.Editor prefsEditor = prefs.edit();
prefsEditor.putLong(PREF_KEY_APP_LAUNCH_COUNT, appThisVersionCodeLaunchCount);
prefsEditor.commit();
} | static void function(Context context, long appThisVersionCodeLaunchCount) { SharedPreferences prefs = getSharedPreferences(context); SharedPreferences.Editor prefsEditor = prefs.edit(); prefsEditor.putLong(PREF_KEY_APP_LAUNCH_COUNT, appThisVersionCodeLaunchCount); prefsEditor.commit(); } | /**
* Modify internal value.
* <p/>
* If you use this method, you might need to have a good understanding of this class code.
*
* @param context Context
* @param appThisVersionCodeLaunchCount Launch count of This application current version.
*/ | Modify internal value. If you use this method, you might need to have a good understanding of this class code | setAppThisVersionCodeLaunchCount | {
"repo_name": "recruit-mp/android-RMP-Appirater",
"path": "library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java",
"license": "apache-2.0",
"size": 28037
} | [
"android.content.Context",
"android.content.SharedPreferences"
] | import android.content.Context; import android.content.SharedPreferences; | import android.content.*; | [
"android.content"
] | android.content; | 2,167,992 |
public Properties getPostMarkProperties(){
return POSTMARK_PROPERTIES;
} | Properties function(){ return POSTMARK_PROPERTIES; } | /**
* Getter method for Postmark Properties
* @return POSTMARK_PROPERTIES
*/ | Getter method for Postmark Properties | getPostMarkProperties | {
"repo_name": "sejpalsaurabh/postmark",
"path": "src/main/java/com/sejpalsaurabh/postmark/util/ProjectUtil.java",
"license": "mit",
"size": 3612
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 2,518,390 |
public List<User> search( SortCriteria crit ) throws DataAccException {
return super.list(User.class,crit);
} | List<User> function( SortCriteria crit ) throws DataAccException { return super.list(User.class,crit); } | /**
* Get all User objects from database sorted by the given criteria
* @param crit the sorting criteria
* @return a list with all existing User objects
* @throws DataAccException on error
*/ | Get all User objects from database sorted by the given criteria | search | {
"repo_name": "autentia/TNTConcept",
"path": "tntconcept-core/src/main/java/com/autentia/tnt/dao/hibernate/UserDAO.java",
"license": "gpl-3.0",
"size": 5174
} | [
"com.autentia.tnt.businessobject.User",
"com.autentia.tnt.dao.DataAccException",
"com.autentia.tnt.dao.SortCriteria",
"java.util.List"
] | import com.autentia.tnt.businessobject.User; import com.autentia.tnt.dao.DataAccException; import com.autentia.tnt.dao.SortCriteria; import java.util.List; | import com.autentia.tnt.businessobject.*; import com.autentia.tnt.dao.*; import java.util.*; | [
"com.autentia.tnt",
"java.util"
] | com.autentia.tnt; java.util; | 903,079 |
public void setDeadline(LocalDate deadline) {
this.deadline = deadline;
} | void function(LocalDate deadline) { this.deadline = deadline; } | /**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column m_prj_project.deadline
*
* @param deadline the value for m_prj_project.deadline
*
* @mbg.generated Sat Apr 20 17:20:23 CDT 2019
*/ | This method was generated by MyBatis Generator. This method sets the value of the database column m_prj_project.deadline | setDeadline | {
"repo_name": "esofthead/mycollab",
"path": "mycollab-services/src/main/java/com/mycollab/module/project/domain/Project.java",
"license": "agpl-3.0",
"size": 39256
} | [
"java.time.LocalDate"
] | import java.time.LocalDate; | import java.time.*; | [
"java.time"
] | java.time; | 823,351 |
private void updateLdapSettingsBean(Map<String, String> overrides) throws IOException {
Properties props = new Properties();
props.put("bindDn", "uid=" + LDAP_USER1_UID + "," + LDAP_ROOT_PARTITION);
props.put("bindDnPassword", LDAP_USER1_PASSWORD);
props.put("callerBaseDn", "");
props.put("callerNameAttribute", "uid");
props.put("callerSearchBase", LDAP_ROOT_PARTITION);
props.put("callerSearchFilter", "(&(objectclass=person)(uid=%s))");
props.put("callerSearchScope", "SUBTREE");
props.put("groupMemberAttribute", "member");
props.put("groupMemberOfAttribute", "");
props.put("groupNameAttribute", "cn");
props.put("groupSearchBase", LDAP_ROOT_PARTITION);
props.put("groupSearchFilter", "(objectclass=groupofnames)");
props.put("groupSearchScope", "SUBTREE");
props.put("maxResults", "1000");
props.put("priority", "0");
props.put("readTimeout", "0");
props.put("url", "ldap://localhost:" + System.getProperty("ldap.1.port"));
props.put("useFor", "VALIDATE PROVIDE_GROUPS");
props.putAll(overrides);
FileOutputStream fout = new FileOutputStream(server.getServerRoot() + "/LdapSettingsBean.props");
props.store(fout, "");
fout.close();
if (!overrides.isEmpty()) {
for (int i = 0; i < 3; i++) { // if the build machines are struggling, we can have timing issues reading in updated values.
Properties checkProps = new Properties();
FileReader fr = new FileReader(server.getServerRoot() + "/LdapSettingsBean.props");
try {
checkProps.load(fr);
} finally {
if (fr != null) {
fr.close();
}
}
boolean allprops = true;
for (String prop : overrides.keySet()) {
String fileProp = (String) checkProps.get(prop);
if (fileProp == null) {
Log.info(logClass, "updateLdapSettingsBean", "could not find " + prop + " in LdapSettingsBean.props");
allprops = false;
break;
} else if (!fileProp.equals(overrides.get(prop))) {
Log.info(LdapSettingsBean.class, "updateLdapSettingsBean", "did not change " + prop + " to " + overrides.get(prop) + " yet.");
allprops = false;
break;
} else {
Log.info(logClass, "updateLdapSettingsBean", prop + " set to " + fileProp);
}
}
if (allprops) {
Log.info(logClass, "updateLdapSettingsBean", "LdapSettingsBean.props are good.");
break;
}
if (i == 3) {
throw new IllegalStateException("Failed to update LdapSettingsBean.props for EL testing");
}
Log.info(logClass, "updateLdapSettingsBean", "sleep and check LdapSettingsBean.props again.");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
}
} | void function(Map<String, String> overrides) throws IOException { Properties props = new Properties(); props.put(STR, "uid=" + LDAP_USER1_UID + "," + LDAP_ROOT_PARTITION); props.put(STR, LDAP_USER1_PASSWORD); props.put(STR, STRcallerNameAttributeSTRuidSTRcallerSearchBaseSTRcallerSearchFilterSTR(&(objectclass=person)(uid=%s))STRcallerSearchScopeSTRSUBTREESTRgroupMemberAttributeSTRmemberSTRgroupMemberOfAttribute", STRgroupNameAttributeSTRcnSTRgroupSearchBaseSTRgroupSearchFilterSTR(objectclass=groupofnames)STRgroupSearchScopeSTRSUBTREESTRmaxResultsSTR1000STRprioritySTR0STRreadTimeoutSTR0STRurlSTRldap: props.put("useForSTRVALIDATE PROVIDE_GROUPS"); props.putAll(overrides); FileOutputStream fout = new FileOutputStream(server.getServerRoot() + STR); props.store(fout, ""); fout.close(); if (!overrides.isEmpty()) { for (int i = 0; i < 3; i++) { Properties checkProps = new Properties(); FileReader fr = new FileReader(server.getServerRoot() + STR); try { checkProps.load(fr); } finally { if (fr != null) { fr.close(); } } boolean allprops = true; for (String prop : overrides.keySet()) { String fileProp = (String) checkProps.get(prop); if (fileProp == null) { Log.info(logClass, "updateLdapSettingsBeanSTRcould not find STR in LdapSettingsBean.propsSTRupdateLdapSettingsBeanSTRdid not change STR to STR yet.STRupdateLdapSettingsBeanSTR set to STRupdateLdapSettingsBeanSTRLdapSettingsBean.props are good.STRFailed to update LdapSettingsBean.props for EL testingSTRupdateLdapSettingsBeanSTRsleep and check LdapSettingsBean.props again."); try { Thread.sleep(1000); } catch (InterruptedException e) { } } } } | /**
* Update the {@link LdapSettingsBean} settings that can be read back by the deferred EL expressions
* set in the servlet's annotations.
*
* @param overrides The properties to override the default value(s) of.
* @throws IOException If there was an error writing to the backing file.
*/ | Update the <code>LdapSettingsBean</code> settings that can be read back by the deferred EL expressions set in the servlet's annotations | updateLdapSettingsBean | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.security.javaeesec_fat/fat/src/com/ibm/ws/security/javaeesec/fat/LdapIdentityStoreDeferredSettingsTest.java",
"license": "epl-1.0",
"size": 57809
} | [
"com.ibm.websphere.simplicity.log.Log",
"java.io.FileOutputStream",
"java.io.FileReader",
"java.io.IOException",
"java.util.Map",
"java.util.Properties"
] | import com.ibm.websphere.simplicity.log.Log; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.util.Map; import java.util.Properties; | import com.ibm.websphere.simplicity.log.*; import java.io.*; import java.util.*; | [
"com.ibm.websphere",
"java.io",
"java.util"
] | com.ibm.websphere; java.io; java.util; | 1,705,819 |
public static XMLReader createXMLReader (String className)
throws SAXException
{
try {
return (XMLReader)(Class.forName(className).newInstance());
} catch (ClassNotFoundException e1) {
throw new SAXException("SAX2 driver class " + className +
" not found", e1);
} catch (IllegalAccessException e2) {
throw new SAXException("SAX2 driver class " + className +
" found but cannot be loaded", e2);
} catch (InstantiationException e3) {
throw new SAXException("SAX2 driver class " + className +
" loaded but cannot be instantiated (no empty public constructor?)",
e3);
} catch (ClassCastException e4) {
throw new SAXException("SAX2 driver class " + className +
" does not implement XMLReader", e4);
}
}
}
| static XMLReader function (String className) throws SAXException { try { return (XMLReader)(Class.forName(className).newInstance()); } catch (ClassNotFoundException e1) { throw new SAXException(STR + className + STR, e1); } catch (IllegalAccessException e2) { throw new SAXException(STR + className + STR, e2); } catch (InstantiationException e3) { throw new SAXException(STR + className + STR, e3); } catch (ClassCastException e4) { throw new SAXException(STR + className + STR, e4); } } } | /**
* Attempt to create an XML reader from a class name.
*
* <p>Given a class name, this method attempts to load
* and instantiate the class as an XML reader.</p>
*
* @return A new XML reader.
* @exception org.xml.sax.SAXException If the class cannot be
* loaded, instantiated, and cast to XMLReader.
* @see #createXMLReader()
*/ | Attempt to create an XML reader from a class name. Given a class name, this method attempts to load and instantiate the class as an XML reader | createXMLReader | {
"repo_name": "aosm/gcc3",
"path": "libjava/org/xml/sax/helpers/XMLReaderFactory.java",
"license": "gpl-2.0",
"size": 4322
} | [
"org.xml.sax.SAXException",
"org.xml.sax.XMLReader"
] | import org.xml.sax.SAXException; import org.xml.sax.XMLReader; | import org.xml.sax.*; | [
"org.xml.sax"
] | org.xml.sax; | 1,579,398 |
public void testTwentyFourHourToString() {
Alarm at = alarmTimeFromNow(0, AlarmTest.HOURS_OF_DAY);
String toMatch = "Alarm is set for 24 hours from now.";
assertEquals(at.getTimeToNextAlarmString(), toMatch);
} | void function() { Alarm at = alarmTimeFromNow(0, AlarmTest.HOURS_OF_DAY); String toMatch = STR; assertEquals(at.getTimeToNextAlarmString(), toMatch); } | /**
* Test method to test formated strings with 24 hours. Edge case.
*/ | Test method to test formated strings with 24 hours. Edge case | testTwentyFourHourToString | {
"repo_name": "abjugard/DAT255-EpiClock",
"path": "AlarmedTestTest/src/edu/chalmers/dat255/group09/Alarmed/test/model/AlarmTest.java",
"license": "apache-2.0",
"size": 15484
} | [
"edu.chalmers.dat255.group09.Alarmed"
] | import edu.chalmers.dat255.group09.Alarmed; | import edu.chalmers.dat255.group09.*; | [
"edu.chalmers.dat255"
] | edu.chalmers.dat255; | 1,837,816 |
void sendPacket(C connection, BasePacket packet); | void sendPacket(C connection, BasePacket packet); | /**
* Sends a packet via the defined connection.
*
* @param connection the connection to send the packet via
* @param packet the packet to be sent
*/ | Sends a packet via the defined connection | sendPacket | {
"repo_name": "JBou/PluginMessageFramework",
"path": "pmf-core/src/main/java/com/ikeirnez/pluginmessageframework/gateway/Gateway.java",
"license": "mit",
"size": 2216
} | [
"com.ikeirnez.pluginmessageframework.packet.BasePacket"
] | import com.ikeirnez.pluginmessageframework.packet.BasePacket; | import com.ikeirnez.pluginmessageframework.packet.*; | [
"com.ikeirnez.pluginmessageframework"
] | com.ikeirnez.pluginmessageframework; | 1,111,653 |
public CollectionOfDirectoryObject5 withAdditionalProperties(Map<String, Object> additionalProperties) {
this.additionalProperties = additionalProperties;
return this;
} | CollectionOfDirectoryObject5 function(Map<String, Object> additionalProperties) { this.additionalProperties = additionalProperties; return this; } | /**
* Set the additionalProperties property: Collection of directoryObject.
*
* @param additionalProperties the additionalProperties value to set.
* @return the CollectionOfDirectoryObject5 object itself.
*/ | Set the additionalProperties property: Collection of directoryObject | withAdditionalProperties | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-authorization/src/main/java/com/azure/resourcemanager/authorization/fluent/models/CollectionOfDirectoryObject5.java",
"license": "mit",
"size": 3509
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,089,867 |
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (PhraseCrazeApplication.DEBUG) {
Log.d(TAG, "onCreateOptionsMenu()");
}
menu.add(0, R.string.menu_ChangeScores, 0, "Change Scores");
menu.add(0, R.string.menu_EndGame, 0, "End Game");
menu.add(0, R.string.menu_Rules, 0, "Rules");
return true;
} | boolean function(Menu menu) { if (PhraseCrazeApplication.DEBUG) { Log.d(TAG, STR); } menu.add(0, R.string.menu_ChangeScores, 0, STR); menu.add(0, R.string.menu_EndGame, 0, STR); menu.add(0, R.string.menu_Rules, 0, "Rules"); return true; } | /**
* Creates the menu items for the options menu
*/ | Creates the menu items for the options menu | onCreateOptionsMenu | {
"repo_name": "siramix/phrasecraze",
"path": "src/com/siramix/phrasecraze/TurnSummary.java",
"license": "gpl-3.0",
"size": 18450
} | [
"android.util.Log",
"android.view.Menu"
] | import android.util.Log; import android.view.Menu; | import android.util.*; import android.view.*; | [
"android.util",
"android.view"
] | android.util; android.view; | 500,406 |
private DatabaseStatus createUpdateFiles(IDatabase database) {
List<TillLateContainer> cdob = (List<TillLateContainer>) database.createElement(updatecontList);
List<EncryptedFileDob> fdob =(List<EncryptedFileDob>) database.createElement(updatefileList);
List<EncryptedFileDob> sdob =(List<EncryptedFileDob>) database.createElement(updateshareMemberList);
if(cdob.isEmpty() || fdob.isEmpty() || sdob.isEmpty()){
return DatabaseStatus.TRANSACTION_FAILED;
}
return DatabaseStatus.OK;
} | DatabaseStatus function(IDatabase database) { List<TillLateContainer> cdob = (List<TillLateContainer>) database.createElement(updatecontList); List<EncryptedFileDob> fdob =(List<EncryptedFileDob>) database.createElement(updatefileList); List<EncryptedFileDob> sdob =(List<EncryptedFileDob>) database.createElement(updateshareMemberList); if(cdob.isEmpty() fdob.isEmpty() sdob.isEmpty()){ return DatabaseStatus.TRANSACTION_FAILED; } return DatabaseStatus.OK; } | /**
* Create UpdateXML (Use update DB must be created before)
* @param database
*/ | Create UpdateXML (Use update DB must be created before) | createUpdateFiles | {
"repo_name": "dev131/DropTillLate_Application",
"path": "ch.droptilllate.application/src/ch/droptilllate/application/share/ShareManager.java",
"license": "epl-1.0",
"size": 13336
} | [
"ch.droptilllate.application.dnb.TillLateContainer",
"ch.droptilllate.application.model.EncryptedFileDob",
"ch.droptilllate.database.api.IDatabase",
"ch.droptilllate.database.exceptions.DatabaseStatus",
"java.util.List"
] | import ch.droptilllate.application.dnb.TillLateContainer; import ch.droptilllate.application.model.EncryptedFileDob; import ch.droptilllate.database.api.IDatabase; import ch.droptilllate.database.exceptions.DatabaseStatus; import java.util.List; | import ch.droptilllate.application.dnb.*; import ch.droptilllate.application.model.*; import ch.droptilllate.database.api.*; import ch.droptilllate.database.exceptions.*; import java.util.*; | [
"ch.droptilllate.application",
"ch.droptilllate.database",
"java.util"
] | ch.droptilllate.application; ch.droptilllate.database; java.util; | 234,031 |
@Test
public void transferTest() {
AccountManager manager = new AccountManager();
User user1 = new User("Sasha", 12456578);
User user2 = new User("Vasia", 78564523);
manager.addUser(user1);
manager.addUser(user2);
Account account1 = new Account(15000, 15264879);
Account account2 = new Account(30000, 45897856);
manager.addAccountToUser(manager.getUserByName("Sasha"), account1);
manager.addAccountToUser(manager.getUserByName("Vasia"), account2);
manager.transferMoney(user1, account1, user2, account2, 10000);
Map<User, List<Account>> result = manager.getDB();
assertThat(result.get(user1).get(0).getValue(), closeTo (5000, 0.1));
} | void function() { AccountManager manager = new AccountManager(); User user1 = new User("Sasha", 12456578); User user2 = new User("Vasia", 78564523); manager.addUser(user1); manager.addUser(user2); Account account1 = new Account(15000, 15264879); Account account2 = new Account(30000, 45897856); manager.addAccountToUser(manager.getUserByName("Sasha"), account1); manager.addAccountToUser(manager.getUserByName("Vasia"), account2); manager.transferMoney(user1, account1, user2, account2, 10000); Map<User, List<Account>> result = manager.getDB(); assertThat(result.get(user1).get(0).getValue(), closeTo (5000, 0.1)); } | /**
* Transfer ops test.
*/ | Transfer ops test | transferTest | {
"repo_name": "danailKondov/dkondov",
"path": "chapter_003/src/test/java/ru/job4j/taskfortest/AccountManagerTest.java",
"license": "apache-2.0",
"size": 3700
} | [
"java.util.List",
"java.util.Map",
"org.junit.Assert"
] | import java.util.List; import java.util.Map; import org.junit.Assert; | import java.util.*; import org.junit.*; | [
"java.util",
"org.junit"
] | java.util; org.junit; | 459,047 |
public static ApesFile open()
{
try
{
// Chose file.
JFileChooser fileChooser = new JFileChooser();
fileChooser.setCurrentDirectory(new File("."));
int returnVal = fileChooser.showOpenDialog(null);
if(returnVal == JFileChooser.APPROVE_OPTION)
{
File file = fileChooser.getSelectedFile();
return new ApesFile(file);
}
}
catch(UnidentifiedLanguageException e)
{
ApesError.unsupportedFormat();
}
catch(Exception e)
{
e.printStackTrace();
}
return null;
} | static ApesFile function() { try { JFileChooser fileChooser = new JFileChooser(); fileChooser.setCurrentDirectory(new File(".")); int returnVal = fileChooser.showOpenDialog(null); if(returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); return new ApesFile(file); } } catch(UnidentifiedLanguageException e) { ApesError.unsupportedFormat(); } catch(Exception e) { e.printStackTrace(); } return null; } | /**
* Opens a file with a graphical interface.
*
* @return An <code>ApesFile</code> for the selected file, or null of no file
* was selected.
*/ | Opens a file with a graphical interface | open | {
"repo_name": "rejeep/apes",
"path": "src/apes/lib/ApesFile.java",
"license": "gpl-3.0",
"size": 2484
} | [
"java.io.File",
"javax.swing.JFileChooser"
] | import java.io.File; import javax.swing.JFileChooser; | import java.io.*; import javax.swing.*; | [
"java.io",
"javax.swing"
] | java.io; javax.swing; | 319,718 |
final int localHelpCC(CountedCompleter<?> task, int limit) {
int status = 0;
if (task != null && (status = task.status) >= 0) {
for (;;) {
boolean help = false;
int b = base, s = top, al; ForkJoinTask<?>[] a;
if ((a = array) != null && b != s && (al = a.length) > 0) {
int index = (al - 1) & (s - 1);
ForkJoinTask<?> o = (ForkJoinTask<?>)
QA.get(a, index);
if (o instanceof CountedCompleter) {
CountedCompleter<?> t = (CountedCompleter<?>)o;
for (CountedCompleter<?> f = t;;) {
if (f != task) {
if ((f = f.completer) == null) // try parent
break;
}
else {
if (QA.compareAndSet(a, index, t, null)) {
top = s - 1;
VarHandle.releaseFence();
t.doExec();
help = true;
}
break;
}
}
}
}
if ((status = task.status) < 0 || !help ||
(limit != 0 && --limit == 0))
break;
}
}
return status;
}
// Operations on shared queues | final int localHelpCC(CountedCompleter<?> task, int limit) { int status = 0; if (task != null && (status = task.status) >= 0) { for (;;) { boolean help = false; int b = base, s = top, al; ForkJoinTask<?>[] a; if ((a = array) != null && b != s && (al = a.length) > 0) { int index = (al - 1) & (s - 1); ForkJoinTask<?> o = (ForkJoinTask<?>) QA.get(a, index); if (o instanceof CountedCompleter) { CountedCompleter<?> t = (CountedCompleter<?>)o; for (CountedCompleter<?> f = t;;) { if (f != task) { if ((f = f.completer) == null) break; } else { if (QA.compareAndSet(a, index, t, null)) { top = s - 1; VarHandle.releaseFence(); t.doExec(); help = true; } break; } } } } if ((status = task.status) < 0 !help (limit != 0 && --limit == 0)) break; } } return status; } | /**
* Tries to steal and run tasks within the target's
* computation until done, not found, or limit exceeded.
*
* @param task root of CountedCompleter computation
* @param limit max runs, or zero for no limit
* @return task status on exit
*/ | Tries to steal and run tasks within the target's computation until done, not found, or limit exceeded | localHelpCC | {
"repo_name": "YouDiSN/OpenJDK-Research",
"path": "jdk9/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java",
"license": "gpl-2.0",
"size": 142181
} | [
"java.lang.invoke.VarHandle"
] | import java.lang.invoke.VarHandle; | import java.lang.invoke.*; | [
"java.lang"
] | java.lang; | 1,889,176 |
private void readObject(ObjectInputStream s) throws InvalidObjectException {
throw new InvalidObjectException("Deserialization via serialization delegate");
} | void function(ObjectInputStream s) throws InvalidObjectException { throw new InvalidObjectException(STR); } | /**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/ | Defend against malicious streams | readObject | {
"repo_name": "DavidAlphaFox/jdk8u",
"path": "jdk/src/share/classes/java/time/chrono/HijrahChronology.java",
"license": "gpl-2.0",
"size": 41354
} | [
"java.io.InvalidObjectException",
"java.io.ObjectInputStream"
] | import java.io.InvalidObjectException; import java.io.ObjectInputStream; | import java.io.*; | [
"java.io"
] | java.io; | 653,958 |
private void setFactorJoinKeys(
LoptMultiJoin multiJoin,
List<RexNode> filters,
ImmutableBitSet joinFactors,
int factorStart,
int nFields,
ImmutableBitSet.Builder joinKeys) {
for (RexNode joinFilter : filters) {
ImmutableBitSet filterFactors =
multiJoin.getFactorsRefByJoinFilter(joinFilter);
// if all factors in the join filter are in the bitmap containing
// the factors in a join tree, then from that filter, add the
// fields corresponding to the specified factor to the join key
// bitmap; in doing so, adjust the join keys so they start at
// offset 0
if (joinFactors.contains(filterFactors)) {
ImmutableBitSet joinFields =
multiJoin.getFieldsRefByJoinFilter(joinFilter);
for (int field = joinFields.nextSetBit(factorStart);
(field >= 0)
&& (field < (factorStart + nFields));
field = joinFields.nextSetBit(field + 1)) {
joinKeys.set(field - factorStart);
}
}
}
} | void function( LoptMultiJoin multiJoin, List<RexNode> filters, ImmutableBitSet joinFactors, int factorStart, int nFields, ImmutableBitSet.Builder joinKeys) { for (RexNode joinFilter : filters) { ImmutableBitSet filterFactors = multiJoin.getFactorsRefByJoinFilter(joinFilter); if (joinFactors.contains(filterFactors)) { ImmutableBitSet joinFields = multiJoin.getFieldsRefByJoinFilter(joinFilter); for (int field = joinFields.nextSetBit(factorStart); (field >= 0) && (field < (factorStart + nFields)); field = joinFields.nextSetBit(field + 1)) { joinKeys.set(field - factorStart); } } } } | /**
* Locates from a list of filters those that correspond to a particular join
* tree. Then, for each of those filters, extracts the fields corresponding
* to a particular factor, setting them in a bitmap.
*
* @param multiJoin join factors being optimized
* @param filters list of join filters
* @param joinFactors bitmap containing the factors in a particular join
* tree
* @param factorStart the initial offset of the factor whose join keys will
* be extracted
* @param nFields the number of fields in the factor whose join keys will be
* extracted
* @param joinKeys the bitmap that will be set with the join keys
*/ | Locates from a list of filters those that correspond to a particular join tree. Then, for each of those filters, extracts the fields corresponding to a particular factor, setting them in a bitmap | setFactorJoinKeys | {
"repo_name": "wanglan/calcite",
"path": "core/src/main/java/org/apache/calcite/rel/rules/LoptOptimizeJoinRule.java",
"license": "apache-2.0",
"size": 73624
} | [
"java.util.List",
"org.apache.calcite.rex.RexNode",
"org.apache.calcite.util.ImmutableBitSet"
] | import java.util.List; import org.apache.calcite.rex.RexNode; import org.apache.calcite.util.ImmutableBitSet; | import java.util.*; import org.apache.calcite.rex.*; import org.apache.calcite.util.*; | [
"java.util",
"org.apache.calcite"
] | java.util; org.apache.calcite; | 1,700,079 |
@Override
public void testFailure(Failure failure) {
LoggingUtils.getEvoLogger().info("* Failure: " + failure.getMessage());
for (StackTraceElement s : failure.getException().getStackTrace()) {
LoggingUtils.getEvoLogger().info(" " + s.toString());
}
this.testResult.setSuccessful(false);
this.testResult.setTrace(failure.getTrace());
this.testResult.incrementFailureCount();
} | void function(Failure failure) { LoggingUtils.getEvoLogger().info(STR + failure.getMessage()); for (StackTraceElement s : failure.getException().getStackTrace()) { LoggingUtils.getEvoLogger().info(" " + s.toString()); } this.testResult.setSuccessful(false); this.testResult.setTrace(failure.getTrace()); this.testResult.incrementFailureCount(); } | /**
* Called when an atomic test fails
*/ | Called when an atomic test fails | testFailure | {
"repo_name": "claudejin/evosuite",
"path": "client/src/main/java/org/evosuite/junit/JUnitRunListener.java",
"license": "lgpl-3.0",
"size": 3723
} | [
"org.evosuite.utils.LoggingUtils",
"org.junit.runner.notification.Failure"
] | import org.evosuite.utils.LoggingUtils; import org.junit.runner.notification.Failure; | import org.evosuite.utils.*; import org.junit.runner.notification.*; | [
"org.evosuite.utils",
"org.junit.runner"
] | org.evosuite.utils; org.junit.runner; | 1,526,878 |
public void unregisterForRingbackTone(Handler h){
mRingbackToneRegistrants.remove(h);
} | void function(Handler h){ mRingbackToneRegistrants.remove(h); } | /**
* Unregisters for ringback tone notification.
*/ | Unregisters for ringback tone notification | unregisterForRingbackTone | {
"repo_name": "mateor/pdroid",
"path": "android-4.0.3_r1/trunk/frameworks/base/telephony/java/com/android/internal/telephony/CallManager.java",
"license": "gpl-3.0",
"size": 66119
} | [
"android.os.Handler"
] | import android.os.Handler; | import android.os.*; | [
"android.os"
] | android.os; | 102,139 |
@SuppressWarnings("deprecation")
@SideOnly(Side.CLIENT)
public SpriteColor[] getSpriteAndColor() {
SpriteColor[] spriteColors = new SpriteColor[2];
int noItems = itemHandler.getStackInSlot(0).isEmpty() ? 0 : itemHandler.getStackInSlot(0).getCount();
if (noItems == 0 && !currentItem.isValid() && tank.getFluidAmount() == 0) //Empty!
return spriteColors;
FluidStack fluid = tank.getFluid();
if (fluid != null && fluid.amount > 0) //Nothing being melted.
{
Color color = new Color(fluid.getFluid().getColor(), false);
spriteColors[1] = new SpriteColor(Util.getTextureFromFluidStack(fluid), color);
}
IBlockState block = null;
Color color = Util.whiteColor;
if (currentItem.isValid()) {
Meltable meltable = crucibleRegistry.getMeltable(currentItem);
BlockInfo override = meltable.getTextureOverride();
if (override.isValid())
block = override.getBlockState();
else block = currentItem.getBlockState();
color = new Color(Minecraft.getMinecraft().getBlockColors().colorMultiplier(block, world, pos, 0), true);
}
if (block != null) {
spriteColors[0] = new SpriteColor(Util.getTextureFromBlockState(block), color);
}
return spriteColors;
} | @SuppressWarnings(STR) @SideOnly(Side.CLIENT) SpriteColor[] function() { SpriteColor[] spriteColors = new SpriteColor[2]; int noItems = itemHandler.getStackInSlot(0).isEmpty() ? 0 : itemHandler.getStackInSlot(0).getCount(); if (noItems == 0 && !currentItem.isValid() && tank.getFluidAmount() == 0) return spriteColors; FluidStack fluid = tank.getFluid(); if (fluid != null && fluid.amount > 0) { Color color = new Color(fluid.getFluid().getColor(), false); spriteColors[1] = new SpriteColor(Util.getTextureFromFluidStack(fluid), color); } IBlockState block = null; Color color = Util.whiteColor; if (currentItem.isValid()) { Meltable meltable = crucibleRegistry.getMeltable(currentItem); BlockInfo override = meltable.getTextureOverride(); if (override.isValid()) block = override.getBlockState(); else block = currentItem.getBlockState(); color = new Color(Minecraft.getMinecraft().getBlockColors().colorMultiplier(block, world, pos, 0), true); } if (block != null) { spriteColors[0] = new SpriteColor(Util.getTextureFromBlockState(block), color); } return spriteColors; } | /**
* Returns array of FLUID color and Item Color
* ITEMCOLOR is index 0
* FLUIDCOLOR is index 1
*/ | Returns array of FLUID color and Item Color ITEMCOLOR is index 0 FLUIDCOLOR is index 1 | getSpriteAndColor | {
"repo_name": "BloodWorkXGaming/ExNihiloCreatio",
"path": "src/main/java/exnihilocreatio/tiles/TileCrucibleBase.java",
"license": "mit",
"size": 8436
} | [
"net.minecraft.block.state.IBlockState",
"net.minecraft.client.Minecraft",
"net.minecraftforge.fluids.FluidStack",
"net.minecraftforge.fml.relauncher.Side",
"net.minecraftforge.fml.relauncher.SideOnly"
] | import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; | import net.minecraft.block.state.*; import net.minecraft.client.*; import net.minecraftforge.fluids.*; import net.minecraftforge.fml.relauncher.*; | [
"net.minecraft.block",
"net.minecraft.client",
"net.minecraftforge.fluids",
"net.minecraftforge.fml"
] | net.minecraft.block; net.minecraft.client; net.minecraftforge.fluids; net.minecraftforge.fml; | 123,165 |
public String getStyleClass() {
if (this.styleClass != null) {
return this.styleClass;
}
if (this.styleClasses.isEmpty()) {
return null;
} else if (this.styleClasses.size() == 1) {
this.styleClass = this.styleClasses.iterator().next();
} else {
final StringBuilder builder = new StringBuilder();
for (final String one : this.styleClasses) {
builder.append(one);
builder.append(StringUtil.SPACE);
}
this.styleClass = builder.substring(0, builder.length() - 1);
}
return this.styleClass;
} | String function() { if (this.styleClass != null) { return this.styleClass; } if (this.styleClasses.isEmpty()) { return null; } else if (this.styleClasses.size() == 1) { this.styleClass = this.styleClasses.iterator().next(); } else { final StringBuilder builder = new StringBuilder(); for (final String one : this.styleClasses) { builder.append(one); builder.append(StringUtil.SPACE); } this.styleClass = builder.substring(0, builder.length() - 1); } return this.styleClass; } | /**
* Return the style class.
* @return the style class.
*/ | Return the style class | getStyleClass | {
"repo_name": "qjafcunuas/jbromo",
"path": "jbromo-webapp/jbromo-webapp-jsf/jbromo-webapp-jsf-lib/src/main/java/org/jbromo/webapp/jsf/component/model/AbstractComponentModel.java",
"license": "apache-2.0",
"size": 3451
} | [
"org.jbromo.common.StringUtil"
] | import org.jbromo.common.StringUtil; | import org.jbromo.common.*; | [
"org.jbromo.common"
] | org.jbromo.common; | 2,397,937 |
public AbstractMarshalRecord createRecord(String rootName, Node parent, AbstractSession session) {
NodeRecord nRec = new NodeRecord(rootName, getNamespaceResolver(), parent);
nRec.setSession(session);
return nRec;
} | AbstractMarshalRecord function(String rootName, Node parent, AbstractSession session) { NodeRecord nRec = new NodeRecord(rootName, getNamespaceResolver(), parent); nRec.setSession(session); return nRec; } | /**
* Create a new row/record for the object builder with the given name.
* This allows subclasses to define different record types.
*/ | Create a new row/record for the object builder with the given name. This allows subclasses to define different record types | createRecord | {
"repo_name": "RallySoftware/eclipselink.runtime",
"path": "foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/oxm/TreeObjectBuilder.java",
"license": "epl-1.0",
"size": 9674
} | [
"org.eclipse.persistence.internal.oxm.record.AbstractMarshalRecord",
"org.eclipse.persistence.internal.sessions.AbstractSession",
"org.eclipse.persistence.oxm.record.NodeRecord",
"org.w3c.dom.Node"
] | import org.eclipse.persistence.internal.oxm.record.AbstractMarshalRecord; import org.eclipse.persistence.internal.sessions.AbstractSession; import org.eclipse.persistence.oxm.record.NodeRecord; import org.w3c.dom.Node; | import org.eclipse.persistence.internal.oxm.record.*; import org.eclipse.persistence.internal.sessions.*; import org.eclipse.persistence.oxm.record.*; import org.w3c.dom.*; | [
"org.eclipse.persistence",
"org.w3c.dom"
] | org.eclipse.persistence; org.w3c.dom; | 1,142,706 |
private void setupRainChart(List<MeteoRecord> meteo) {
// Setup data
List<Entry> entries = new ArrayList<>();
// Add as first entry a copy of the first rain record
// First relative timestamp is 0
entries.add(new Entry(0, (float) meteo.get(0).getRain()));
// Add all rain records
float maxRain = Float.MIN_VALUE;
for (MeteoRecord meteoRecord : meteo) {
// Convert timestamp to seconds and relative to first timestamp
long timestamp = meteoRecord.getTimestamp().getTime() / 1000 - referenceTimestamp;
float rain = (float) meteoRecord.getRain();
entries.add(new Entry(timestamp, rain));
// Get max and min temperature
if (rain > maxRain) {
maxRain = rain;
}
}
// Add as last entry a copy of the last rain record
entries.add(new Entry(lastTimestamp, (float) meteo.get(meteo.size() - 1).getRain()));
// Style char lines (type, color, etc.)
RainValueFormatter rainValueFormatter = new RainValueFormatter(RainValueFormatter.Unit.MM);
rainChart.setData(new LineData(
configureWeatherChart(rainChart, R.string.rain,
R.color.colorLineRainChart, R.color.colorFillRainChart,
entries, rainValueFormatter, 0, maxRain + 1)
));
}
| void function(List<MeteoRecord> meteo) { List<Entry> entries = new ArrayList<>(); entries.add(new Entry(0, (float) meteo.get(0).getRain())); float maxRain = Float.MIN_VALUE; for (MeteoRecord meteoRecord : meteo) { long timestamp = meteoRecord.getTimestamp().getTime() / 1000 - referenceTimestamp; float rain = (float) meteoRecord.getRain(); entries.add(new Entry(timestamp, rain)); if (rain > maxRain) { maxRain = rain; } } entries.add(new Entry(lastTimestamp, (float) meteo.get(meteo.size() - 1).getRain())); RainValueFormatter rainValueFormatter = new RainValueFormatter(RainValueFormatter.Unit.MM); rainChart.setData(new LineData( configureWeatherChart(rainChart, R.string.rain, R.color.colorLineRainChart, R.color.colorFillRainChart, entries, rainValueFormatter, 0, maxRain + 1) )); } | /**
* Configure rain chart and the data.
*
* @param meteo meteo records.
*/ | Configure rain chart and the data | setupRainChart | {
"repo_name": "davidmigloz/go-bees",
"path": "app/src/main/java/com/davidmiguel/gobees/recording/RecordingFragment.java",
"license": "gpl-3.0",
"size": 19797
} | [
"com.davidmiguel.gobees.data.model.MeteoRecord",
"com.davidmiguel.gobees.utils.RainValueFormatter",
"com.github.mikephil.charting.data.Entry",
"com.github.mikephil.charting.data.LineData",
"java.util.ArrayList",
"java.util.List"
] | import com.davidmiguel.gobees.data.model.MeteoRecord; import com.davidmiguel.gobees.utils.RainValueFormatter; import com.github.mikephil.charting.data.Entry; import com.github.mikephil.charting.data.LineData; import java.util.ArrayList; import java.util.List; | import com.davidmiguel.gobees.data.model.*; import com.davidmiguel.gobees.utils.*; import com.github.mikephil.charting.data.*; import java.util.*; | [
"com.davidmiguel.gobees",
"com.github.mikephil",
"java.util"
] | com.davidmiguel.gobees; com.github.mikephil; java.util; | 2,335,630 |
public void startResourceManager() throws Exception {
resourceManager.start();
rmServices.grantLeadership();
// drain probe events
verify(rmServices.schedulerDriver).start();
resourceManager.connectionMonitor.expectMsgClass(ConnectionMonitor.Start.class);
} | void function() throws Exception { resourceManager.start(); rmServices.grantLeadership(); verify(rmServices.schedulerDriver).start(); resourceManager.connectionMonitor.expectMsgClass(ConnectionMonitor.Start.class); } | /**
* Start the resource manager and grant leadership to it.
*/ | Start the resource manager and grant leadership to it | startResourceManager | {
"repo_name": "mylog00/flink",
"path": "flink-mesos/src/test/java/org/apache/flink/mesos/runtime/clusterframework/MesosResourceManagerTest.java",
"license": "apache-2.0",
"size": 33027
} | [
"org.apache.flink.mesos.scheduler.ConnectionMonitor",
"org.mockito.Mockito"
] | import org.apache.flink.mesos.scheduler.ConnectionMonitor; import org.mockito.Mockito; | import org.apache.flink.mesos.scheduler.*; import org.mockito.*; | [
"org.apache.flink",
"org.mockito"
] | org.apache.flink; org.mockito; | 1,686,907 |
public DirectRowSet rowSet() throws RpcException {
VectorContainer batch = null;
try (QueryBatchIterator iter = new QueryBatchIterator(client.allocator(), withEventListener())) {
while (iter.next()) {
batch = iter.batch();
if (batch.getRecordCount() != 0) {
iter.retainData();
break;
}
}
iter.retainData();
}
if (batch == null) {
return null;
} else {
return DirectRowSet.fromContainer(batch);
}
} | DirectRowSet function() throws RpcException { VectorContainer batch = null; try (QueryBatchIterator iter = new QueryBatchIterator(client.allocator(), withEventListener())) { while (iter.next()) { batch = iter.batch(); if (batch.getRecordCount() != 0) { iter.retainData(); break; } } iter.retainData(); } if (batch == null) { return null; } else { return DirectRowSet.fromContainer(batch); } } | /**
* Run the query and return the first non-empty batch as a
* {@link DirectRowSet} object that can be inspected directly
* by the code using a {@link RowSetReader}.
*
* @see #rowSetIterator() for a version that reads a series of
* batches as row sets.
* @return a row set that represents the first non-empty batch returned from
* the query, or {@code null} if the query returns no data (no batches)
* @throws RpcException if anything goes wrong
*/ | Run the query and return the first non-empty batch as a <code>DirectRowSet</code> object that can be inspected directly by the code using a <code>RowSetReader</code> | rowSet | {
"repo_name": "apache/drill",
"path": "exec/java-exec/src/test/java/org/apache/drill/test/QueryBuilder.java",
"license": "apache-2.0",
"size": 26636
} | [
"org.apache.drill.exec.physical.rowSet.DirectRowSet",
"org.apache.drill.exec.record.VectorContainer",
"org.apache.drill.exec.rpc.RpcException"
] | import org.apache.drill.exec.physical.rowSet.DirectRowSet; import org.apache.drill.exec.record.VectorContainer; import org.apache.drill.exec.rpc.RpcException; | import org.apache.drill.exec.physical.*; import org.apache.drill.exec.record.*; import org.apache.drill.exec.rpc.*; | [
"org.apache.drill"
] | org.apache.drill; | 2,518,145 |
void addSystem(AbstractComponentSystem system); | void addSystem(AbstractComponentSystem system); | /**
* Adds a {@link AbstractComponentSystem} to this {@link IECSManager}.
*
* @param system the system to add
*/ | Adds a <code>AbstractComponentSystem</code> to this <code>IECSManager</code> | addSystem | {
"repo_name": "OmniKryptec/OmniKryptec-Engine",
"path": "src/main/java/de/omnikryptec/ecs/IECSManager.java",
"license": "apache-2.0",
"size": 5185
} | [
"de.omnikryptec.ecs.system.AbstractComponentSystem"
] | import de.omnikryptec.ecs.system.AbstractComponentSystem; | import de.omnikryptec.ecs.system.*; | [
"de.omnikryptec.ecs"
] | de.omnikryptec.ecs; | 1,452,367 |
public void doCancel(RunData data)
{
SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid());
// clean up state
cleanupState(state);
} | void function(RunData data) { SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid()); cleanupState(state); } | /**
* Handle the eventSubmit_doCancel command to abort the edits.
*/ | Handle the eventSubmit_doCancel command to abort the edits | doCancel | {
"repo_name": "marktriggs/nyu-sakai-10.4",
"path": "authz/authz-tool/tool/src/java/org/sakaiproject/authz/tool/PermissionsHelperAction.java",
"license": "apache-2.0",
"size": 19633
} | [
"org.sakaiproject.cheftool.JetspeedRunData",
"org.sakaiproject.cheftool.RunData",
"org.sakaiproject.event.api.SessionState"
] | import org.sakaiproject.cheftool.JetspeedRunData; import org.sakaiproject.cheftool.RunData; import org.sakaiproject.event.api.SessionState; | import org.sakaiproject.cheftool.*; import org.sakaiproject.event.api.*; | [
"org.sakaiproject.cheftool",
"org.sakaiproject.event"
] | org.sakaiproject.cheftool; org.sakaiproject.event; | 1,102,340 |
public DocumentHeader getDocumentHeader();
| DocumentHeader function(); | /**
* Returns a document header associated with this general ledger posting helper
* @return a document header, having information which should be put into the generated GeneralLedgerPendingEntry records
*/ | Returns a document header associated with this general ledger posting helper | getDocumentHeader | {
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "work/src/org/kuali/kfs/sys/document/GeneralLedgerPendingEntrySource.java",
"license": "agpl-3.0",
"size": 5650
} | [
"org.kuali.rice.krad.bo.DocumentHeader"
] | import org.kuali.rice.krad.bo.DocumentHeader; | import org.kuali.rice.krad.bo.*; | [
"org.kuali.rice"
] | org.kuali.rice; | 81,345 |
public static Metric<AbstractILMultiDimensional> createHeightMetric(AggregateFunction function) {
return __MetricV2.createHeightMetric(function);
} | static Metric<AbstractILMultiDimensional> function(AggregateFunction function) { return __MetricV2.createHeightMetric(function); } | /**
* Creates an instance of the height metric.
* This metric will respect attribute weights defined in the configuration.
*
* @param function The aggregate function to use for comparing results
*
* @return
*/ | Creates an instance of the height metric. This metric will respect attribute weights defined in the configuration | createHeightMetric | {
"repo_name": "TheRealRasu/arx",
"path": "src/main/org/deidentifier/arx/metric/Metric.java",
"license": "apache-2.0",
"size": 38625
} | [
"org.deidentifier.arx.metric.v2.AbstractILMultiDimensional"
] | import org.deidentifier.arx.metric.v2.AbstractILMultiDimensional; | import org.deidentifier.arx.metric.v2.*; | [
"org.deidentifier.arx"
] | org.deidentifier.arx; | 310,461 |
public void checkBrowserType(final HttpServletRequest request) {
String reqpar = request.getParameter(getBrowserTypeRequestName());
if (reqpar != null) {
if (reqpar.equals("!")) {
// Go back to unsticky browser type
setBrowserTypeSticky(false);
} else {
setBrowserType(reqpar);
setBrowserTypeSticky(false);
}
}
reqpar = request.getParameter(getBrowserTypeStickyRequestName());
if (reqpar != null) {
if (reqpar.equals("!")) {
// Go back to unsticky browser type
setBrowserTypeSticky(false);
} else {
setBrowserType(reqpar);
setBrowserTypeSticky(true);
}
}
} | void function(final HttpServletRequest request) { String reqpar = request.getParameter(getBrowserTypeRequestName()); if (reqpar != null) { if (reqpar.equals("!")) { setBrowserTypeSticky(false); } else { setBrowserType(reqpar); setBrowserTypeSticky(false); } } reqpar = request.getParameter(getBrowserTypeStickyRequestName()); if (reqpar != null) { if (reqpar.equals("!")) { setBrowserTypeSticky(false); } else { setBrowserType(reqpar); setBrowserTypeSticky(true); } } } | /** Allow user to explicitly set the browser type.
*
* @param request Needed to locate parameters
*/ | Allow user to explicitly set the browser type | checkBrowserType | {
"repo_name": "nblair/bw-util",
"path": "bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/PresentationState.java",
"license": "apache-2.0",
"size": 17181
} | [
"javax.servlet.http.HttpServletRequest"
] | import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.*; | [
"javax.servlet"
] | javax.servlet; | 2,793,265 |
public static boolean isSuInstalled() {
File subin = new File("/system/bin/su"),
suxbin = new File("/system/xbin/su"),
susbin = new File("/sbin/su");
return subin.exists()
|| suxbin.exists()
|| susbin.exists();
} | static boolean function() { File subin = new File(STR), suxbin = new File(STR), susbin = new File(STR); return subin.exists() suxbin.exists() susbin.exists(); } | /**
* Check if su binary exists
* @return True if exists, false if not
*/ | Check if su binary exists | isSuInstalled | {
"repo_name": "xdevs23/Cornowser",
"path": "app/src/main/java/org/xdevs23/root/utils/RootController.java",
"license": "mit",
"size": 5372
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,963,012 |
protected Repository getRepository() {
IStructuredSelection selection = getSelection();
return getRepository(false, selection, null);
} | Repository function() { IStructuredSelection selection = getSelection(); return getRepository(false, selection, null); } | /**
* Figure out which repository to use. All selected resources must map to
* the same Git repository.
*
* @return repository for current project, or null
*/ | Figure out which repository to use. All selected resources must map to the same Git repository | getRepository | {
"repo_name": "rickard-von-essen/egit",
"path": "org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RepositoryActionHandler.java",
"license": "epl-1.0",
"size": 16176
} | [
"org.eclipse.jface.viewers.IStructuredSelection",
"org.eclipse.jgit.lib.Repository"
] | import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jgit.lib.Repository; | import org.eclipse.jface.viewers.*; import org.eclipse.jgit.lib.*; | [
"org.eclipse.jface",
"org.eclipse.jgit"
] | org.eclipse.jface; org.eclipse.jgit; | 1,846,628 |
public static Metric<AbstractILMultiDimensional> createPrecisionMetric(boolean monotonic, double gsFactor) {
return __MetricV2.createPrecisionMetric(monotonic, gsFactor);
} | static Metric<AbstractILMultiDimensional> function(boolean monotonic, double gsFactor) { return __MetricV2.createPrecisionMetric(monotonic, gsFactor); } | /**
* Creates an instance of the precision metric.
* The default aggregate function, which is the arithmetic mean, will be used.
* This metric will respect attribute weights defined in the configuration.
*
* @param monotonic If set to true, the monotonic variant of the metric will be created
* @param gsFactor A factor [0,1] weighting generalization and suppression.
* The default value is 0.5, which means that generalization
* and suppression will be treated equally. A factor of 0
* will favor suppression, and a factor of 1 will favor
* generalization. The values in between can be used for
* balancing both methods.
*
* @return
*/ | Creates an instance of the precision metric. The default aggregate function, which is the arithmetic mean, will be used. This metric will respect attribute weights defined in the configuration | createPrecisionMetric | {
"repo_name": "jgaupp/arx",
"path": "src/main/org/deidentifier/arx/metric/Metric.java",
"license": "apache-2.0",
"size": 71459
} | [
"org.deidentifier.arx.metric.v2.AbstractILMultiDimensional"
] | import org.deidentifier.arx.metric.v2.AbstractILMultiDimensional; | import org.deidentifier.arx.metric.v2.*; | [
"org.deidentifier.arx"
] | org.deidentifier.arx; | 1,826,229 |
private void assertEqualRevisionLists(List<MwRevision> list1,
List<MwRevision> list2, String test) {
assertEquals("[" + test + "] Size of revision lists does not match:",
list1.size(), list2.size());
for (int i = 0; i < list1.size(); i++) {
assertEqualRevisions(list1.get(i), list2.get(i), test + "-item" + i);
}
} | void function(List<MwRevision> list1, List<MwRevision> list2, String test) { assertEquals("[" + test + STR, list1.size(), list2.size()); for (int i = 0; i < list1.size(); i++) { assertEqualRevisions(list1.get(i), list2.get(i), test + "-item" + i); } } | /**
* Assert that two lists contain the same revisions in the same order.
*
* @param list1
* @param list2
*/ | Assert that two lists contain the same revisions in the same order | assertEqualRevisionLists | {
"repo_name": "GlorimarCastro/glorimar-wikidata-toolkit",
"path": "wdtk-dumpfiles/src/test/java/org/wikidata/wdtk/dumpfiles/MwDumpFileProcessingTest.java",
"license": "apache-2.0",
"size": 17793
} | [
"java.util.List",
"org.junit.Assert"
] | import java.util.List; import org.junit.Assert; | import java.util.*; import org.junit.*; | [
"java.util",
"org.junit"
] | java.util; org.junit; | 767,720 |
private static Boolean orientationFromString(String orientation) {
if (orientation == null) {
return null;
}
orientation = orientation.toLowerCase(Locale.ROOT);
switch (orientation) {
case "right":
case "counterclockwise":
case "ccw":
return true;
case "left":
case "clockwise":
case "cw":
return false;
default:
throw new IllegalArgumentException("Unknown orientation [" + orientation + "]");
}
} | static Boolean function(String orientation) { if (orientation == null) { return null; } orientation = orientation.toLowerCase(Locale.ROOT); switch (orientation) { case "right": case STR: case "ccw": return true; case "left": case STR: case "cw": return false; default: throw new IllegalArgumentException(STR + orientation + "]"); } } | /**
* Returns true for right orientation and false for left
*/ | Returns true for right orientation and false for left | orientationFromString | {
"repo_name": "HonzaKral/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/common/geo/GeoJson.java",
"license": "apache-2.0",
"size": 25289
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 1,192,569 |
public DrawerBuilder drawerListener(DrawerLayout.DrawerListener drawerListener) {
this.drawerListener = drawerListener;
return this;
} | DrawerBuilder function(DrawerLayout.DrawerListener drawerListener) { this.drawerListener = drawerListener; return this; } | /**
* Add listener for DrawerLayout operations.
*/ | Add listener for DrawerLayout operations | drawerListener | {
"repo_name": "xu6148152/InstagramWithMaterialDesign",
"path": "app/src/main/java/demo/binea/com/instagramwithmaterialdesign/Utils/DrawerLayoutInstaller.java",
"license": "mit",
"size": 4917
} | [
"android.support.v4.widget.DrawerLayout"
] | import android.support.v4.widget.DrawerLayout; | import android.support.v4.widget.*; | [
"android.support"
] | android.support; | 494,794 |
EAttribute getTextSource_Text(); | EAttribute getTextSource_Text(); | /**
* Returns the meta object for the attribute '{@link org.nasdanika.amur.lang.TextSource#getText <em>Text</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Text</em>'.
* @see org.nasdanika.amur.lang.TextSource#getText()
* @see #getTextSource()
* @generated
*/ | Returns the meta object for the attribute '<code>org.nasdanika.amur.lang.TextSource#getText Text</code>'. | getTextSource_Text | {
"repo_name": "Nasdanika/amur-lang",
"path": "org.nasdanika.amur.lang/src/org/nasdanika/amur/lang/LangPackage.java",
"license": "epl-1.0",
"size": 45409
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,873,898 |
public static int[] getMidiFileTypes()
{
// We only support a max of 3 MIDI file types.
boolean supported[] = new boolean[3];
// The number of supported formats.
int count = 0;
Iterator<MidiFileWriter> writers =
ServiceFactory.lookupProviders(MidiFileWriter.class);
while (writers.hasNext())
{
MidiFileWriter fw = writers.next();
int types[] = fw.getMidiFileTypes();
for (int i = types.length; i > 0;)
{
int type = types[--i];
if (supported[type] == false)
{
count++;
supported[type] = true;
}
}
}
int result[] = new int[count];
for (int i = supported.length; i > 0;)
{
if (supported[--i])
result[--count] = i;
}
return result;
} | static int[] function() { boolean supported[] = new boolean[3]; int count = 0; Iterator<MidiFileWriter> writers = ServiceFactory.lookupProviders(MidiFileWriter.class); while (writers.hasNext()) { MidiFileWriter fw = writers.next(); int types[] = fw.getMidiFileTypes(); for (int i = types.length; i > 0;) { int type = types[--i]; if (supported[type] == false) { count++; supported[type] = true; } } } int result[] = new int[count]; for (int i = supported.length; i > 0;) { if (supported[--i]) result[--count] = i; } return result; } | /**
* Return an array of supported MIDI file types on this system.
*
* @return the array of supported MIDI file types
*/ | Return an array of supported MIDI file types on this system | getMidiFileTypes | {
"repo_name": "selmentdev/selment-toolchain",
"path": "source/gcc-latest/libjava/classpath/javax/sound/midi/MidiSystem.java",
"license": "gpl-3.0",
"size": 19315
} | [
"gnu.classpath.ServiceFactory",
"java.util.Iterator",
"javax.sound.midi.spi.MidiFileWriter"
] | import gnu.classpath.ServiceFactory; import java.util.Iterator; import javax.sound.midi.spi.MidiFileWriter; | import gnu.classpath.*; import java.util.*; import javax.sound.midi.spi.*; | [
"gnu.classpath",
"java.util",
"javax.sound"
] | gnu.classpath; java.util; javax.sound; | 1,670,269 |
public WifiInfo getConnectionInfo() {
try {
return mService.getConnectionInfo();
} catch (RemoteException e) {
return null;
}
} | WifiInfo function() { try { return mService.getConnectionInfo(); } catch (RemoteException e) { return null; } } | /**
* Return dynamic information about the current Wi-Fi connection, if any is active.
* @return the Wi-Fi information, contained in {@link WifiInfo}.
*/ | Return dynamic information about the current Wi-Fi connection, if any is active | getConnectionInfo | {
"repo_name": "Ant-Droid/android_frameworks_base_OLD",
"path": "wifi/java/android/net/wifi/WifiManager.java",
"license": "apache-2.0",
"size": 103390
} | [
"android.os.RemoteException"
] | import android.os.RemoteException; | import android.os.*; | [
"android.os"
] | android.os; | 335,554 |
public void generateOpenNetworkConfig() {
if (security != SECURITY_NONE)
throw new IllegalStateException();
if (mConfig != null)
return;
mConfig = new WifiConfiguration();
mConfig.SSID = AccessPoint.convertToQuotedString(ssid);
mConfig.allowedKeyManagement.set(KeyMgmt.NONE);
} | void function() { if (security != SECURITY_NONE) throw new IllegalStateException(); if (mConfig != null) return; mConfig = new WifiConfiguration(); mConfig.SSID = AccessPoint.convertToQuotedString(ssid); mConfig.allowedKeyManagement.set(KeyMgmt.NONE); } | /**
* Generate and save a default wifiConfiguration with common values.
* Can only be called for unsecured networks.
*/ | Generate and save a default wifiConfiguration with common values. Can only be called for unsecured networks | generateOpenNetworkConfig | {
"repo_name": "DSttr/SystemUI",
"path": "SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java",
"license": "apache-2.0",
"size": 34231
} | [
"android.net.wifi.WifiConfiguration"
] | import android.net.wifi.WifiConfiguration; | import android.net.wifi.*; | [
"android.net"
] | android.net; | 774,405 |
public MetaProperty<Country> region() {
return region;
} | MetaProperty<Country> function() { return region; } | /**
* The meta-property for the {@code region} property.
* @return the meta-property, not null
*/ | The meta-property for the region property | region | {
"repo_name": "jmptrader/Strata",
"path": "modules/basics/src/main/java/com/opengamma/strata/basics/index/ImmutablePriceIndex.java",
"license": "apache-2.0",
"size": 17306
} | [
"com.opengamma.strata.basics.location.Country",
"org.joda.beans.MetaProperty"
] | import com.opengamma.strata.basics.location.Country; import org.joda.beans.MetaProperty; | import com.opengamma.strata.basics.location.*; import org.joda.beans.*; | [
"com.opengamma.strata",
"org.joda.beans"
] | com.opengamma.strata; org.joda.beans; | 2,856,954 |
public static MozuClient<com.mozu.api.contracts.commerceruntime.returns.Return> createReturnItemClient(com.mozu.api.contracts.commerceruntime.returns.ReturnItem returnItem, String returnId) throws Exception
{
return createReturnItemClient( returnItem, returnId, null);
} | static MozuClient<com.mozu.api.contracts.commerceruntime.returns.Return> function(com.mozu.api.contracts.commerceruntime.returns.ReturnItem returnItem, String returnId) throws Exception { return createReturnItemClient( returnItem, returnId, null); } | /**
* Adds a return item to the return.
* <p><pre><code>
* MozuClient<com.mozu.api.contracts.commerceruntime.returns.Return> mozuClient=CreateReturnItemClient( returnItem, returnId);
* client.setBaseAddress(url);
* client.executeRequest();
* Return return = client.Result();
* </code></pre></p>
* @param returnId Unique identifier of the return whose items you want to get.
* @param returnItem Properties of a previously fulfilled item associated with a return.
* @return Mozu.Api.MozuClient <com.mozu.api.contracts.commerceruntime.returns.Return>
* @see com.mozu.api.contracts.commerceruntime.returns.Return
* @see com.mozu.api.contracts.commerceruntime.returns.ReturnItem
*/ | Adds a return item to the return. <code><code> MozuClient mozuClient=CreateReturnItemClient( returnItem, returnId); client.setBaseAddress(url); client.executeRequest(); Return return = client.Result(); </code></code> | createReturnItemClient | {
"repo_name": "bhewett/mozu-java",
"path": "mozu-java-core/src/main/java/com/mozu/api/clients/commerce/ReturnClient.java",
"license": "mit",
"size": 38320
} | [
"com.mozu.api.MozuClient"
] | import com.mozu.api.MozuClient; | import com.mozu.api.*; | [
"com.mozu.api"
] | com.mozu.api; | 675,232 |
public static void isPositive(Value value, Object extracted) {
Number number = (Number) extracted;
if (isNegative(number)) {
throw new IllegalArgumentException("extracted value is not positive");
}
} | static void function(Value value, Object extracted) { Number number = (Number) extracted; if (isNegative(number)) { throw new IllegalArgumentException(STR); } } | /**
* If the given <tt>extracted</tt> value is a <tt>Number</tt> and the number is positive,
* the method returns gracefully, otherwise an {@link IllegalArgumentException} is thrown
* if the value is negative.
*
* @param value the value to test
* @param extracted the extracted value
*/ | If the given extracted value is a Number and the number is positive, the method returns gracefully, otherwise an <code>IllegalArgumentException</code> is thrown if the value is negative | isPositive | {
"repo_name": "noctarius/borabora",
"path": "src/main/java/com/noctarius/borabora/spi/ValueValidators.java",
"license": "apache-2.0",
"size": 4677
} | [
"com.noctarius.borabora.Value"
] | import com.noctarius.borabora.Value; | import com.noctarius.borabora.*; | [
"com.noctarius.borabora"
] | com.noctarius.borabora; | 239,345 |
public List<String> getColumn(String key)
{
return getRawColumn(keyIndexMap.get(key));
} | List<String> function(String key) { return getRawColumn(keyIndexMap.get(key)); } | /**
* Returns the string data values of a given column
* @param key string representation of the column
* @return list of string data values in the column
*/ | Returns the string data values of a given column | getColumn | {
"repo_name": "fredizzimo/keyboardlayout",
"path": "smac/src/aeatk/ca/ubc/cs/beta/aeatk/misc/csvhelpers/ConfigCSVFileHelper.java",
"license": "gpl-2.0",
"size": 11574
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,367,615 |
NetSuiteDatasetRuntime getDatasetRuntime(RuntimeContainer container, NetSuiteProvideConnectionProperties properties); | NetSuiteDatasetRuntime getDatasetRuntime(RuntimeContainer container, NetSuiteProvideConnectionProperties properties); | /**
* Get {@link NetSuiteDatasetRuntime} for given connection properties.
*
* @param properties connection properties
* @param container runtime container for sharing information
* @return {@code NetSuiteDatasetRuntime} object
*/ | Get <code>NetSuiteDatasetRuntime</code> for given connection properties | getDatasetRuntime | {
"repo_name": "Talend/components",
"path": "components/components-netsuite/components-netsuite-definition/src/main/java/org/talend/components/netsuite/NetSuiteRuntime.java",
"license": "apache-2.0",
"size": 2701
} | [
"org.talend.components.api.container.RuntimeContainer"
] | import org.talend.components.api.container.RuntimeContainer; | import org.talend.components.api.container.*; | [
"org.talend.components"
] | org.talend.components; | 223,463 |
public String getBuiltDescription(){
StringBuilder b = new StringBuilder();
if(description != null){
b.append(description).append("\n\n");
}
b.append("Modes: (a mode must be the first argument) \n");
for(String mode : suite.keySet()){
b.append("\t").append(TermColors.BOLD).append(mode);
if(aliases.containsValue(mode)){
List<String> keys = new ArrayList<>();
for(String alias : aliases.keySet()){
if(aliases.get(alias).equals(mode)){
keys.add(alias);
}
}
b.append(TermColors.RESET).append(" (Alias");
if(keys.size() != 1){
b.append("es");
}
b.append(": ").append(StringUtils.Join(keys, ", ")).append(")");
}
b.append(TermColors.RESET).append(": ").append(suite.get(mode).getDescription()).append("\n");
}
return b.toString();
}
| String function(){ StringBuilder b = new StringBuilder(); if(description != null){ b.append(description).append("\n\n"); } b.append(STR); for(String mode : suite.keySet()){ b.append("\t").append(TermColors.BOLD).append(mode); if(aliases.containsValue(mode)){ List<String> keys = new ArrayList<>(); for(String alias : aliases.keySet()){ if(aliases.get(alias).equals(mode)){ keys.add(alias); } } b.append(TermColors.RESET).append(STR); if(keys.size() != 1){ b.append("es"); } b.append(STR).append(StringUtils.Join(keys, STR)).append(")"); } b.append(TermColors.RESET).append(STR).append(suite.get(mode).getDescription()).append("\n"); } return b.toString(); } | /**
* Returns a built description of this ArgumentSuite, which would be appropriate
* to display if no arguments are passed in (or the mode name is help, -help, --help, etc)
* @return
*/ | Returns a built description of this ArgumentSuite, which would be appropriate to display if no arguments are passed in (or the mode name is help, -help, --help, etc) | getBuiltDescription | {
"repo_name": "KamranMackey/CommandHelper",
"path": "src/main/java/com/laytonsmith/PureUtilities/ArgumentSuite.java",
"license": "mit",
"size": 10038
} | [
"com.laytonsmith.PureUtilities",
"java.util.ArrayList",
"java.util.List"
] | import com.laytonsmith.PureUtilities; import java.util.ArrayList; import java.util.List; | import com.laytonsmith.*; import java.util.*; | [
"com.laytonsmith",
"java.util"
] | com.laytonsmith; java.util; | 2,042,102 |
@Override
public void setNextProcessor(Processor processor) {
next = processor;
} | void function(Processor processor) { next = processor; } | /**
* Set next processor element in processor chain
*
* @param processor Processor to be set as next element of processor chain
*/ | Set next processor element in processor chain | setNextProcessor | {
"repo_name": "codemogroup/siddhi",
"path": "modules/siddhi-core/src/main/java/org/wso2/siddhi/core/query/input/stream/single/EntryValveProcessor.java",
"license": "apache-2.0",
"size": 2772
} | [
"org.wso2.siddhi.core.query.processor.Processor"
] | import org.wso2.siddhi.core.query.processor.Processor; | import org.wso2.siddhi.core.query.processor.*; | [
"org.wso2.siddhi"
] | org.wso2.siddhi; | 1,034,279 |
Pair<List<? extends Cluster>, Integer> searchForClusters(ListClustersCmd c); | Pair<List<? extends Cluster>, Integer> searchForClusters(ListClustersCmd c); | /**
* Searches for Clusters by the specified search criteria
*
* @param c
* @return
*/ | Searches for Clusters by the specified search criteria | searchForClusters | {
"repo_name": "MissionCriticalCloud/cosmic",
"path": "cosmic-core/api/src/main/java/com/cloud/server/ManagementService.java",
"license": "apache-2.0",
"size": 14634
} | [
"com.cloud.api.command.admin.cluster.ListClustersCmd",
"com.cloud.legacymodel.dc.Cluster",
"com.cloud.legacymodel.utils.Pair",
"java.util.List"
] | import com.cloud.api.command.admin.cluster.ListClustersCmd; import com.cloud.legacymodel.dc.Cluster; import com.cloud.legacymodel.utils.Pair; import java.util.List; | import com.cloud.api.command.admin.cluster.*; import com.cloud.legacymodel.dc.*; import com.cloud.legacymodel.utils.*; import java.util.*; | [
"com.cloud.api",
"com.cloud.legacymodel",
"java.util"
] | com.cloud.api; com.cloud.legacymodel; java.util; | 1,025,309 |
public static FastDateFormat getInstance(final String pattern, final TimeZone timeZone) {
return cache.getInstance(pattern, timeZone, null);
} | static FastDateFormat function(final String pattern, final TimeZone timeZone) { return cache.getInstance(pattern, timeZone, null); } | /**
* <p>Gets a formatter instance using the specified pattern and
* time zone.</p>
*
* @param pattern {@link java.text.SimpleDateFormat} compatible
* pattern
* @param timeZone optional time zone, overrides time zone of
* formatted date
* @return a pattern based date/time formatter
* @throws IllegalArgumentException if pattern is invalid
*/ | Gets a formatter instance using the specified pattern and time zone | getInstance | {
"repo_name": "Blaez/ZiosGram",
"path": "TMessagesProj/src/main/java/org/telegram/messenger/time/FastDateFormat.java",
"license": "gpl-2.0",
"size": 22294
} | [
"java.util.TimeZone"
] | import java.util.TimeZone; | import java.util.*; | [
"java.util"
] | java.util; | 1,206,560 |
public static String addXMLEntry(Document doc, String queryPhrase, boolean formatDate)
{
// Make the entry
ResultEntry entry = ResultEntry
.newBuild()
.setType(ResultEntry.XML)
.setBoost(doc.get("boost"))
.setBoostGravity(doc.get("boostwithgravity"))
.setContentBlocks(getContentBlocks(doc.get("segment"), doc.get("url")))
.setContentLength(doc.get("contentlength"))
.setDigest(doc.get("digest"))
.setExtension(doc.get("filetype"))
.setFetchTime(processDate(formatDate, doc.get("fetchtime")))
.setFileType(doc.get("filetype"))
.setGravity(doc.get("gravity"))
.setIndexTime(processDate(formatDate, doc.get("indextime")))
.setLanguage(doc.get("lang"))
.setLastModified(doc.get("lastmodified"))
.setSegment(doc.get("segment"))
.setSummary(getSummary(doc.get("segment"), doc.get("url"), new Text(queryPhrase), new Text(doc.get("lang"))))
.setTitle(doc.get("title"))
.setURL(doc.get("url"));
// Prepare XML
StringBuilder xmlEntry = new StringBuilder();
xmlEntry.append("<result>");
xmlEntry.append(entry.getBoost());
xmlEntry.append(entry.getBoostGravity());
xmlEntry.append(entry.getContentBlocks());
xmlEntry.append(entry.getContentLength());
xmlEntry.append(entry.getDigest());
xmlEntry.append(entry.getExtension());
xmlEntry.append(entry.getFetchTime());
xmlEntry.append(entry.getFileType());
xmlEntry.append(entry.getGravity());
xmlEntry.append(entry.getIndexTime());
xmlEntry.append(entry.getLanguage());
xmlEntry.append(entry.getLastModified());
xmlEntry.append(entry.getSegment());
xmlEntry.append(entry.getSummary());
xmlEntry.append(entry.getTitle());
xmlEntry.append(entry.getURL());
xmlEntry.append("</result>");
return xmlEntry.toString();
} | static String function(Document doc, String queryPhrase, boolean formatDate) { ResultEntry entry = ResultEntry .newBuild() .setType(ResultEntry.XML) .setBoost(doc.get("boost")) .setBoostGravity(doc.get(STR)) .setContentBlocks(getContentBlocks(doc.get(STR), doc.get("url"))) .setContentLength(doc.get(STR)) .setDigest(doc.get(STR)) .setExtension(doc.get(STR)) .setFetchTime(processDate(formatDate, doc.get(STR))) .setFileType(doc.get(STR)) .setGravity(doc.get(STR)) .setIndexTime(processDate(formatDate, doc.get(STR))) .setLanguage(doc.get("lang")) .setLastModified(doc.get(STR)) .setSegment(doc.get(STR)) .setSummary(getSummary(doc.get(STR), doc.get("url"), new Text(queryPhrase), new Text(doc.get("lang")))) .setTitle(doc.get("title")) .setURL(doc.get("url")); StringBuilder xmlEntry = new StringBuilder(); xmlEntry.append(STR); xmlEntry.append(entry.getBoost()); xmlEntry.append(entry.getBoostGravity()); xmlEntry.append(entry.getContentBlocks()); xmlEntry.append(entry.getContentLength()); xmlEntry.append(entry.getDigest()); xmlEntry.append(entry.getExtension()); xmlEntry.append(entry.getFetchTime()); xmlEntry.append(entry.getFileType()); xmlEntry.append(entry.getGravity()); xmlEntry.append(entry.getIndexTime()); xmlEntry.append(entry.getLanguage()); xmlEntry.append(entry.getLastModified()); xmlEntry.append(entry.getSegment()); xmlEntry.append(entry.getSummary()); xmlEntry.append(entry.getTitle()); xmlEntry.append(entry.getURL()); xmlEntry.append(STR); return xmlEntry.toString(); } | /**
* This method construct a new entry in the XML response. An XML entry
* corresponds to an individual result.
*
* @param doc The Lucene document from which to construct the XML entry.
* @param queryPhrase The query phrase.
* @param formatDate TRUE if the dates should be formatted using the
* PrettyTime library, FALSE we should return the raw
* timestamp in milliseconds.
*
* @return A String containing the XML entry.
*/ | This method construct a new entry in the XML response. An XML entry corresponds to an individual result | addXMLEntry | {
"repo_name": "k-zen/Quary",
"path": "src/net/apkc/quary/reactor/Result.java",
"license": "bsd-2-clause",
"size": 13008
} | [
"org.apache.hadoop.io.Text",
"org.apache.lucene.document.Document"
] | import org.apache.hadoop.io.Text; import org.apache.lucene.document.Document; | import org.apache.hadoop.io.*; import org.apache.lucene.document.*; | [
"org.apache.hadoop",
"org.apache.lucene"
] | org.apache.hadoop; org.apache.lucene; | 375,716 |
@Test
public void testPriority() {
assertEquals(CONVERTER.getPriority(), EXPECTED_PRIORITY);
} | void function() { assertEquals(CONVERTER.getPriority(), EXPECTED_PRIORITY); } | /**
* Tests the expected priority.
*/ | Tests the expected priority | testPriority | {
"repo_name": "McLeodMoores/xl4j",
"path": "xll-core/src/test/java/com/mcleodmoores/xl4j/v1/typeconvert/converters/FloatXLNumberTypeConverterTest.java",
"license": "gpl-3.0",
"size": 4723
} | [
"org.testng.Assert"
] | import org.testng.Assert; | import org.testng.*; | [
"org.testng"
] | org.testng; | 1,015,960 |
public void dialog(Context context, String action,
DialogListener listener) {
dialog(context, action, new Bundle(), listener);
} | void function(Context context, String action, DialogListener listener) { dialog(context, action, new Bundle(), listener); } | /**
* Generate a UI dialog for the request action in the given Android context.
*
* Note that this method is asynchronous and the callback will be invoked in
* the original calling thread (not in a background thread).
*
* @param context
* The Android context in which we will generate this dialog.
* @param action
* String representation of the desired method: e.g. "login",
* "stream.publish", ...
* @param listener
* Callback interface to notify the application when the dialog
* has completed.
*/ | Generate a UI dialog for the request action in the given Android context. Note that this method is asynchronous and the callback will be invoked in the original calling thread (not in a background thread) | dialog | {
"repo_name": "coffbr01/eyekabob",
"path": "android/app/src/main/java/com/eyekabob/util/facebook/Facebook.java",
"license": "apache-2.0",
"size": 38630
} | [
"android.content.Context",
"android.os.Bundle"
] | import android.content.Context; import android.os.Bundle; | import android.content.*; import android.os.*; | [
"android.content",
"android.os"
] | android.content; android.os; | 77,279 |
public static MozuUrl changePackageFileNameOrPathUrl(Integer applicationVersionId, Integer packageId)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/developer/applications/applicationVersions/{applicationVersionId}/packages/{packageId}/files/change-name-or-path");
formatter.formatUrl("applicationVersionId", applicationVersionId);
formatter.formatUrl("packageId", packageId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ;
} | static MozuUrl function(Integer applicationVersionId, Integer packageId) { UrlFormatter formatter = new UrlFormatter(STR); formatter.formatUrl(STR, applicationVersionId); formatter.formatUrl(STR, packageId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ; } | /**
* Get Resource Url for ChangePackageFileNameOrPath
* @param applicationVersionId
* @param packageId
* @return String Resource Url
*/ | Get Resource Url for ChangePackageFileNameOrPath | changePackageFileNameOrPathUrl | {
"repo_name": "carsonreinke/mozu-java-sdk",
"path": "src/main/java/com/mozu/api/urls/platform/developer/ApplicationVersionUrl.java",
"license": "mit",
"size": 9434
} | [
"com.mozu.api.MozuUrl",
"com.mozu.api.utils.UrlFormatter"
] | import com.mozu.api.MozuUrl; import com.mozu.api.utils.UrlFormatter; | import com.mozu.api.*; import com.mozu.api.utils.*; | [
"com.mozu.api"
] | com.mozu.api; | 770,372 |
public static <T extends TransitiveInfoProvider> ImmutableList<T>
getProvidersFromListOfJavaProviders(
Class<T> providerClass, Iterable<JavaProvider> javaProviders) {
ImmutableList.Builder<T> providersList = new ImmutableList.Builder<>();
for (JavaProvider javaProvider : javaProviders) {
T provider = javaProvider.getProvider(providerClass);
if (provider != null) {
providersList.add(provider);
}
}
return providersList.build();
}
private JavaProvider(TransitiveInfoProviderMap providers) {
super(JAVA_PROVIDER, ImmutableMap.<String, Object>of(
"transitive_runtime_jars", SkylarkNestedSet.of(
Artifact.class,
providers.getProvider(JavaCompilationArgsProvider.class)
.getRecursiveJavaCompilationArgs().getRuntimeJars()),
"transitive_compile_time_jars", SkylarkNestedSet.of(
Artifact.class,
providers.getProvider(JavaCompilationArgsProvider.class)
.getRecursiveJavaCompilationArgs().getCompileTimeJars()),
"compile_jars", SkylarkNestedSet.of(
Artifact.class,
providers.getProvider(JavaCompilationArgsProvider.class)
.getJavaCompilationArgs().getCompileTimeJars())
));
this.providers = providers;
}
public static class Builder {
TransitiveInfoProviderMapBuilder providerMap;
private Builder(TransitiveInfoProviderMapBuilder providerMap) {
this.providerMap = providerMap;
} | static <T extends TransitiveInfoProvider> ImmutableList<T> function( Class<T> providerClass, Iterable<JavaProvider> javaProviders) { ImmutableList.Builder<T> providersList = new ImmutableList.Builder<>(); for (JavaProvider javaProvider : javaProviders) { T provider = javaProvider.getProvider(providerClass); if (provider != null) { providersList.add(provider); } } return providersList.build(); } private JavaProvider(TransitiveInfoProviderMap providers) { super(JAVA_PROVIDER, ImmutableMap.<String, Object>of( STR, SkylarkNestedSet.of( Artifact.class, providers.getProvider(JavaCompilationArgsProvider.class) .getRecursiveJavaCompilationArgs().getRuntimeJars()), STR, SkylarkNestedSet.of( Artifact.class, providers.getProvider(JavaCompilationArgsProvider.class) .getRecursiveJavaCompilationArgs().getCompileTimeJars()), STR, SkylarkNestedSet.of( Artifact.class, providers.getProvider(JavaCompilationArgsProvider.class) .getJavaCompilationArgs().getCompileTimeJars()) )); this.providers = providers; } public static class Builder { TransitiveInfoProviderMapBuilder providerMap; private Builder(TransitiveInfoProviderMapBuilder providerMap) { this.providerMap = providerMap; } | /**
* Returns a list of the given provider class with all the said providers retrieved from the
* given {@link JavaProvider}s.
*/ | Returns a list of the given provider class with all the said providers retrieved from the given <code>JavaProvider</code>s | getProvidersFromListOfJavaProviders | {
"repo_name": "variac/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/java/JavaProvider.java",
"license": "apache-2.0",
"size": 9609
} | [
"com.google.common.collect.ImmutableList",
"com.google.common.collect.ImmutableMap",
"com.google.devtools.build.lib.actions.Artifact",
"com.google.devtools.build.lib.analysis.TransitiveInfoProvider",
"com.google.devtools.build.lib.analysis.TransitiveInfoProviderMap",
"com.google.devtools.build.lib.analysis.TransitiveInfoProviderMapBuilder",
"com.google.devtools.build.lib.syntax.SkylarkNestedSet"
] | import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.analysis.TransitiveInfoProvider; import com.google.devtools.build.lib.analysis.TransitiveInfoProviderMap; import com.google.devtools.build.lib.analysis.TransitiveInfoProviderMapBuilder; import com.google.devtools.build.lib.syntax.SkylarkNestedSet; | import com.google.common.collect.*; import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.analysis.*; import com.google.devtools.build.lib.syntax.*; | [
"com.google.common",
"com.google.devtools"
] | com.google.common; com.google.devtools; | 2,902,956 |
public CompilationLevel getCompilationLevel() {
return compilationLevel;
}
| CompilationLevel function() { return compilationLevel; } | /**
* Gets the compilationLevel.
*
* @return the compilationLevel
*/ | Gets the compilationLevel | getCompilationLevel | {
"repo_name": "ryarnyah/minify-maven-plugin",
"path": "src/main/java/com/samaxes/maven/minify/common/ClosureConfig.java",
"license": "apache-2.0",
"size": 4120
} | [
"com.google.javascript.jscomp.CompilationLevel"
] | import com.google.javascript.jscomp.CompilationLevel; | import com.google.javascript.jscomp.*; | [
"com.google.javascript"
] | com.google.javascript; | 110,989 |
public boolean isNormalPositionFor(int i, int j) {
// called in extended ring!
int ip = list.ring.nvar - 1 - i;
int jp = list.ring.nvar - 1 - j;
boolean iOK = false;
boolean jOK = false;
for (GenPolynomial<C> p : getList()) {
ExpVector e = p.leadingExpVector();
int[] dov = e.dependencyOnVariables();
//System.out.println("dov = " + Arrays.toString(dov));
if (dov.length == 0) {
throw new IllegalArgumentException("ideal dimension is not zero");
}
if (dov[0] == ip) {
if (e.totalDeg() != 1) {
return false;
}
iOK = true;
} else if (dov[0] == jp) {
if (e.totalDeg() != 1) {
return false;
}
jOK = true;
}
if (iOK && jOK) {
return true;
}
}
return iOK && jOK;
} | boolean function(int i, int j) { int ip = list.ring.nvar - 1 - i; int jp = list.ring.nvar - 1 - j; boolean iOK = false; boolean jOK = false; for (GenPolynomial<C> p : getList()) { ExpVector e = p.leadingExpVector(); int[] dov = e.dependencyOnVariables(); if (dov.length == 0) { throw new IllegalArgumentException(STR); } if (dov[0] == ip) { if (e.totalDeg() != 1) { return false; } iOK = true; } else if (dov[0] == jp) { if (e.totalDeg() != 1) { return false; } jOK = true; } if (iOK && jOK) { return true; } } return iOK && jOK; } | /**
* Test if this ideal is in normal position for variables i and j.
* @param i first variable index
* @param j second variable index
* @return true if this is in normal position with respect to i and j
*/ | Test if this ideal is in normal position for variables i and j | isNormalPositionFor | {
"repo_name": "breandan/java-algebra-system",
"path": "src/edu/jas/application/Ideal.java",
"license": "gpl-2.0",
"size": 106207
} | [
"edu.jas.poly.ExpVector",
"edu.jas.poly.GenPolynomial"
] | import edu.jas.poly.ExpVector; import edu.jas.poly.GenPolynomial; | import edu.jas.poly.*; | [
"edu.jas.poly"
] | edu.jas.poly; | 2,448,409 |
public Set<String> getCurves() {
return _sensitivity.keySet();
} | Set<String> function() { return _sensitivity.keySet(); } | /**
* Returns the set of curve names in the interest rate sensitivities.
* @return The set of curve names.
*/ | Returns the set of curve names in the interest rate sensitivities | getCurves | {
"repo_name": "charles-cooper/idylfin",
"path": "src/com/opengamma/analytics/financial/interestrate/InterestRateCurveSensitivity.java",
"license": "apache-2.0",
"size": 6686
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,274,009 |
public Collection<ApplicationListener<?>> getApplicationListeners() {
return this.applicationListeners;
} | Collection<ApplicationListener<?>> function() { return this.applicationListeners; } | /**
* Return the list of statically specified ApplicationListeners.
*/ | Return the list of statically specified ApplicationListeners | getApplicationListeners | {
"repo_name": "lamsfoundation/lams",
"path": "3rdParty_sources/spring/org/springframework/context/support/AbstractApplicationContext.java",
"license": "gpl-2.0",
"size": 50710
} | [
"java.util.Collection",
"org.springframework.context.ApplicationListener"
] | import java.util.Collection; import org.springframework.context.ApplicationListener; | import java.util.*; import org.springframework.context.*; | [
"java.util",
"org.springframework.context"
] | java.util; org.springframework.context; | 1,039,395 |
private void testAuthToken(final String username, final String password)
throws ApiException {
// No username.
try {
api.getAuthenticationToken(null, password, Controller.CLIENT);
throw new IllegalStateException("Failed: No username.");
}
catch(RequestErrorException e) {
if(! ErrorCode.AUTHENTICATION_FAILED.equals(e.getErrorCode())) {
throw new IllegalStateException("Failed: No username: " + ErrorCode.AUTHENTICATION_FAILED, e);
}
}
// Invalid username.
try {
api.getAuthenticationToken("blah", password, Controller.CLIENT);
throw new IllegalStateException("Failed: Invalid username.");
}
catch(RequestErrorException e) {
if(! ErrorCode.AUTHENTICATION_FAILED.equals(e.getErrorCode())) {
throw new IllegalStateException("Failed: Invalid username: " + ErrorCode.AUTHENTICATION_FAILED, e);
}
}
// No password
try {
api.getAuthenticationToken(username, null, Controller.CLIENT);
throw new IllegalStateException("Failed: No password.");
}
catch(RequestErrorException e) {
if(! ErrorCode.AUTHENTICATION_FAILED.equals(e.getErrorCode())) {
throw new IllegalStateException("Failed: No password: " + ErrorCode.AUTHENTICATION_FAILED, e);
}
}
// Invalid password
try {
api.getAuthenticationToken(username, "blah", Controller.CLIENT);
throw new IllegalStateException("Failed: Invalid password.");
}
catch(RequestErrorException e) {
if(! ErrorCode.AUTHENTICATION_FAILED.equals(e.getErrorCode())) {
throw new IllegalStateException("Failed: Invalid password: " + ErrorCode.AUTHENTICATION_FAILED, e);
}
}
// No client.
try {
api.getAuthenticationToken(username, password, null);
throw new IllegalStateException("Failed: No client.");
}
catch(RequestErrorException e) {
if(! ErrorCode.SERVER_INVALID_CLIENT.equals(e.getErrorCode())) {
throw new IllegalStateException("Failed: No client: " + ErrorCode.AUTHENTICATION_FAILED, e);
}
}
// This request should be valid.
try {
api.getAuthenticationToken(username, password, Controller.CLIENT);
}
catch(RequestErrorException e) {
throw new IllegalStateException("Failed: Valid request.", e);
}
} | void function(final String username, final String password) throws ApiException { try { api.getAuthenticationToken(null, password, Controller.CLIENT); throw new IllegalStateException(STR); } catch(RequestErrorException e) { if(! ErrorCode.AUTHENTICATION_FAILED.equals(e.getErrorCode())) { throw new IllegalStateException(STR + ErrorCode.AUTHENTICATION_FAILED, e); } } try { api.getAuthenticationToken("blah", password, Controller.CLIENT); throw new IllegalStateException(STR); } catch(RequestErrorException e) { if(! ErrorCode.AUTHENTICATION_FAILED.equals(e.getErrorCode())) { throw new IllegalStateException(STR + ErrorCode.AUTHENTICATION_FAILED, e); } } try { api.getAuthenticationToken(username, null, Controller.CLIENT); throw new IllegalStateException(STR); } catch(RequestErrorException e) { if(! ErrorCode.AUTHENTICATION_FAILED.equals(e.getErrorCode())) { throw new IllegalStateException(STR + ErrorCode.AUTHENTICATION_FAILED, e); } } try { api.getAuthenticationToken(username, "blah", Controller.CLIENT); throw new IllegalStateException(STR); } catch(RequestErrorException e) { if(! ErrorCode.AUTHENTICATION_FAILED.equals(e.getErrorCode())) { throw new IllegalStateException(STR + ErrorCode.AUTHENTICATION_FAILED, e); } } try { api.getAuthenticationToken(username, password, null); throw new IllegalStateException(STR); } catch(RequestErrorException e) { if(! ErrorCode.SERVER_INVALID_CLIENT.equals(e.getErrorCode())) { throw new IllegalStateException(STR + ErrorCode.AUTHENTICATION_FAILED, e); } } try { api.getAuthenticationToken(username, password, Controller.CLIENT); } catch(RequestErrorException e) { throw new IllegalStateException(STR, e); } } | /**
* Tests the different possibilities for getting an authentication token.
*
* @param username The username of the user to test.
*
* @param password The password of the user to test.
*
* @throws ApiException Thrown if an incorrect error code is returned or
* there is a bug in the library.
*
* @throws IllegalStateException Thrown if the test fails.
*/ | Tests the different possibilities for getting an authentication token | testAuthToken | {
"repo_name": "HaiJiaoXinHeng/server-1",
"path": "test/org/ohmage/test/auth/AuthenticationApiTest.java",
"license": "apache-2.0",
"size": 6922
} | [
"org.ohmage.annotator.Annotator",
"org.ohmage.lib.exception.ApiException",
"org.ohmage.lib.exception.RequestErrorException",
"org.ohmage.test.Controller"
] | import org.ohmage.annotator.Annotator; import org.ohmage.lib.exception.ApiException; import org.ohmage.lib.exception.RequestErrorException; import org.ohmage.test.Controller; | import org.ohmage.annotator.*; import org.ohmage.lib.exception.*; import org.ohmage.test.*; | [
"org.ohmage.annotator",
"org.ohmage.lib",
"org.ohmage.test"
] | org.ohmage.annotator; org.ohmage.lib; org.ohmage.test; | 214,610 |
public SpdxFileDifference[] getFileDifferences(int docindex1, int docindex2) throws SpdxCompareException {
this.checkDocsField();
this.checkInProgress();
this.checkDocsIndex(docindex1);
this.checkDocsIndex(docindex2);
Map<SpdxDocument, SpdxFileDifference[]> uniqueMap = this.fileDifferences.get(this.spdxDocs[docindex1]);
if (uniqueMap == null) {
return new SpdxFileDifference[0];
}
SpdxFileDifference[] retval = uniqueMap.get(this.spdxDocs[docindex2]);
if (retval == null) {
return new SpdxFileDifference[0];
}
return retval;
}
| SpdxFileDifference[] function(int docindex1, int docindex2) throws SpdxCompareException { this.checkDocsField(); this.checkInProgress(); this.checkDocsIndex(docindex1); this.checkDocsIndex(docindex2); Map<SpdxDocument, SpdxFileDifference[]> uniqueMap = this.fileDifferences.get(this.spdxDocs[docindex1]); if (uniqueMap == null) { return new SpdxFileDifference[0]; } SpdxFileDifference[] retval = uniqueMap.get(this.spdxDocs[docindex2]); if (retval == null) { return new SpdxFileDifference[0]; } return retval; } | /**
* Returns any file differences found between the first and second SPDX documents
* as specified by the document index
* @param docindex1
* @param docindex2
* @return
* @throws SpdxCompareException
*/ | Returns any file differences found between the first and second SPDX documents as specified by the document index | getFileDifferences | {
"repo_name": "goneall/SPDX-Tools",
"path": "src/org/spdx/compare/SpdxComparer.java",
"license": "apache-2.0",
"size": 68207
} | [
"java.util.Map",
"org.spdx.rdfparser.model.SpdxDocument"
] | import java.util.Map; import org.spdx.rdfparser.model.SpdxDocument; | import java.util.*; import org.spdx.rdfparser.model.*; | [
"java.util",
"org.spdx.rdfparser"
] | java.util; org.spdx.rdfparser; | 2,461,038 |
protected JTextField getSerialNumberTextField() {
return serialNumberTextField;
} | JTextField function() { return serialNumberTextField; } | /**
* Get the serialNumberTextField object. This method should be
* used only by the ViewHelper object.
* @return The serialNumberTextField object.
*/ | Get the serialNumberTextField object. This method should be used only by the ViewHelper object | getSerialNumberTextField | {
"repo_name": "danielfm/obexftp-frontend",
"path": "obexftp-frontend-core/src/main/java/net/sourceforge/obexftpfrontend/gui/DeviceInfoDialog.java",
"license": "gpl-2.0",
"size": 14730
} | [
"javax.swing.JTextField"
] | import javax.swing.JTextField; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 1,338,974 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.