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
|
---|---|---|---|---|---|---|---|---|---|---|---|
this.headers = new HashMap<>();
Iterator<Entry<String, List<String>>> iter = headers.entrySet().iterator();
while(iter.hasNext()) {
Entry<String, List<String>> entry = iter.next();
String key = entry.getKey();
List<String> value = entry.getValue();
int size = value.size();
if(size == 0) {
this.headers.put(key, "");
continue;
}
if(size == 1) {
this.headers.put(key, value.get(0));
continue;
}
String val = "";
for(int i = 0; i < size; i ++)
val = val + value.get(i) + NetworkReferences.COOKIE_SEPARATOR;
val = val.substring(0, val.length() - 1);
this.headers.put(key, val);
}
} | this.headers = new HashMap<>(); Iterator<Entry<String, List<String>>> iter = headers.entrySet().iterator(); while(iter.hasNext()) { Entry<String, List<String>> entry = iter.next(); String key = entry.getKey(); List<String> value = entry.getValue(); int size = value.size(); if(size == 0) { this.headers.put(key, STR"; for(int i = 0; i < size; i ++) val = val + value.get(i) + NetworkReferences.COOKIE_SEPARATOR; val = val.substring(0, val.length() - 1); this.headers.put(key, val); } } | /**
* Populate headers class variable.
* @param headers Map of headers obtained from URL API.
*/ | Populate headers class variable | populateHeaders | {
"repo_name": "siddharth-sahoo/Utilities",
"path": "src/main/java/com/awesome/pro/utilities/network/HTTPResponse.java",
"license": "mit",
"size": 7801
} | [
"java.util.HashMap",
"java.util.Iterator",
"java.util.List",
"java.util.Map"
] | import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 823,808 |
protected void renderOutputBuffer(MediaCodecAdapter codec, int index, long presentationTimeUs) {
maybeNotifyVideoSizeChanged();
TraceUtil.beginSection("releaseOutputBuffer");
codec.releaseOutputBuffer(index, true);
TraceUtil.endSection();
lastRenderRealtimeUs = SystemClock.elapsedRealtime() * 1000;
decoderCounters.renderedOutputBufferCount++;
consecutiveDroppedFrameCount = 0;
maybeNotifyRenderedFirstFrame();
} | void function(MediaCodecAdapter codec, int index, long presentationTimeUs) { maybeNotifyVideoSizeChanged(); TraceUtil.beginSection(STR); codec.releaseOutputBuffer(index, true); TraceUtil.endSection(); lastRenderRealtimeUs = SystemClock.elapsedRealtime() * 1000; decoderCounters.renderedOutputBufferCount++; consecutiveDroppedFrameCount = 0; maybeNotifyRenderedFirstFrame(); } | /**
* Renders the output buffer with the specified index. This method is only called if the platform
* API version of the device is less than 21.
*
* @param codec The codec that owns the output buffer.
* @param index The index of the output buffer to drop.
* @param presentationTimeUs The presentation time of the output buffer, in microseconds.
*/ | Renders the output buffer with the specified index. This method is only called if the platform API version of the device is less than 21 | renderOutputBuffer | {
"repo_name": "ened/ExoPlayer",
"path": "library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java",
"license": "apache-2.0",
"size": 76873
} | [
"android.os.SystemClock",
"com.google.android.exoplayer2.mediacodec.MediaCodecAdapter",
"com.google.android.exoplayer2.util.TraceUtil"
] | import android.os.SystemClock; import com.google.android.exoplayer2.mediacodec.MediaCodecAdapter; import com.google.android.exoplayer2.util.TraceUtil; | import android.os.*; import com.google.android.exoplayer2.mediacodec.*; import com.google.android.exoplayer2.util.*; | [
"android.os",
"com.google.android"
] | android.os; com.google.android; | 1,803,314 |
interface AwsDdbstreamComponentBuilder
extends
ComponentBuilder<DdbStreamComponent> {
default AwsDdbstreamComponentBuilder amazonDynamoDbStreamsClient(
com.amazonaws.services.dynamodbv2.AmazonDynamoDBStreams amazonDynamoDbStreamsClient) {
doSetProperty("amazonDynamoDbStreamsClient", amazonDynamoDbStreamsClient);
return this;
} | interface AwsDdbstreamComponentBuilder extends ComponentBuilder<DdbStreamComponent> { default AwsDdbstreamComponentBuilder amazonDynamoDbStreamsClient( com.amazonaws.services.dynamodbv2.AmazonDynamoDBStreams amazonDynamoDbStreamsClient) { doSetProperty(STR, amazonDynamoDbStreamsClient); return this; } | /**
* Amazon DynamoDB client to use for all requests for this endpoint.
*
* The option is a:
* <code>com.amazonaws.services.dynamodbv2.AmazonDynamoDBStreams</code>
* type.
*
* Group: consumer
*/ | Amazon DynamoDB client to use for all requests for this endpoint. The option is a: <code>com.amazonaws.services.dynamodbv2.AmazonDynamoDBStreams</code> type. Group: consumer | amazonDynamoDbStreamsClient | {
"repo_name": "DariusX/camel",
"path": "core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AwsDdbstreamComponentBuilderFactory.java",
"license": "apache-2.0",
"size": 11673
} | [
"org.apache.camel.builder.component.ComponentBuilder",
"org.apache.camel.component.aws.ddbstream.DdbStreamComponent"
] | import org.apache.camel.builder.component.ComponentBuilder; import org.apache.camel.component.aws.ddbstream.DdbStreamComponent; | import org.apache.camel.builder.component.*; import org.apache.camel.component.aws.ddbstream.*; | [
"org.apache.camel"
] | org.apache.camel; | 2,278,254 |
Class<? extends Page> getAccessDeniedPage(); | Class<? extends Page> getAccessDeniedPage(); | /**
* Gets the access denied page class.
*
* @return Returns the accessDeniedPage.
* @see IApplicationSettings#setAccessDeniedPage(Class)
*/ | Gets the access denied page class | getAccessDeniedPage | {
"repo_name": "mafulafunk/wicket",
"path": "wicket-core/src/main/java/org/apache/wicket/settings/IApplicationSettings.java",
"license": "apache-2.0",
"size": 5180
} | [
"org.apache.wicket.Page"
] | import org.apache.wicket.Page; | import org.apache.wicket.*; | [
"org.apache.wicket"
] | org.apache.wicket; | 756,945 |
public static void clearDefaultBusForAnyThread(final Bus bus) {
synchronized (threadBusses) {
for (final Iterator<Bus> iterator = threadBusses.values().iterator();
iterator.hasNext();) {
Bus itBus = iterator.next();
if (bus == null || itBus == null || bus.equals(itBus)) {
iterator.remove();
}
}
}
} | static void function(final Bus bus) { synchronized (threadBusses) { for (final Iterator<Bus> iterator = threadBusses.values().iterator(); iterator.hasNext();) { Bus itBus = iterator.next(); if (bus == null itBus == null bus.equals(itBus)) { iterator.remove(); } } } } | /**
* Removes a bus from being a thread default bus for any thread.
* <p>
* This is typically done when a bus has ended its lifecycle (i.e.: a call to
* {@link Bus#shutdown(boolean)} was invoked) and it wants to remove any reference to itself for any
* thread.
*
* @param bus the bus to remove
*/ | Removes a bus from being a thread default bus for any thread. This is typically done when a bus has ended its lifecycle (i.e.: a call to <code>Bus#shutdown(boolean)</code> was invoked) and it wants to remove any reference to itself for any thread | clearDefaultBusForAnyThread | {
"repo_name": "zzsoszz/webservice_gzdx",
"path": "opensource_cxf/org/apache/cxf/BusFactory.java",
"license": "apache-2.0",
"size": 12024
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 2,374,524 |
@ApiOperation(value = "Get configuration records",
notes = "Returns all configuration records for the specified endpoint group. Only users with the TENANT_DEVELOPER or TENANT_USER role are " +
"allowed to request this information.")
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid endpointGroupId supplied"),
@ApiResponse(code = 401, message = "The user is not authenticated or invalid credentials were provided"),
@ApiResponse(code = 403, message = "The authenticated user does not have the required role (TENANT_DEVELOPER or TENANT_USER) or the Tenant ID " +
"of the application does not match the Tenant ID of the authenticated user"),
@ApiResponse(code = 404, message = "An endpoint group with the specified endpointGroupId does not exist"),
@ApiResponse(code = 500, message = "An unexpected error occurred on the server side")})
@RequestMapping(value = "configurationRecords", method = RequestMethod.GET)
@ResponseBody
public List<ConfigurationRecordDto> getConfigurationRecordsByEndpointGroupId(
@ApiParam(name = "endpointGroupId", value = "A unique endpoint group identifier", required = true)
@RequestParam(value = "endpointGroupId") String endpointGroupId,
@ApiParam(name = "includeDeprecated", value = "[“true” or ”false”] if “true”, all configuration records will be returned, including deprecated " +
"ones. If “false”, only active and inactive configuration records will be returned", required = true)
@RequestParam(value = "includeDeprecated") boolean includeDeprecated) throws KaaAdminServiceException {
return configurationService.getConfigurationRecordsByEndpointGroupId(endpointGroupId, includeDeprecated);
} | @ApiOperation(value = STR, notes = STR + STR) @ApiResponses(value = { @ApiResponse(code = 400, message = STR), @ApiResponse(code = 401, message = STR), @ApiResponse(code = 403, message = STR + STR), @ApiResponse(code = 404, message = STR), @ApiResponse(code = 500, message = STR)}) @RequestMapping(value = STR, method = RequestMethod.GET) List<ConfigurationRecordDto> function( @ApiParam(name = STR, value = STR, required = true) @RequestParam(value = STR) String endpointGroupId, @ApiParam(name = STR, value = STR + STR, required = true) @RequestParam(value = STR) boolean includeDeprecated) throws KaaAdminServiceException { return configurationService.getConfigurationRecordsByEndpointGroupId(endpointGroupId, includeDeprecated); } | /**
* Gets the configuration records by endpoint group id.
*
* @param endpointGroupId the endpoint group id
* @param includeDeprecated the include deprecated
* @return the list configuration record dto
* @throws KaaAdminServiceException the kaa admin service exception
*/ | Gets the configuration records by endpoint group id | getConfigurationRecordsByEndpointGroupId | {
"repo_name": "Oleh-Kravchenko/kaa",
"path": "server/node/src/main/java/org/kaaproject/kaa/server/admin/controller/ConfigurationController.java",
"license": "apache-2.0",
"size": 34969
} | [
"io.swagger.annotations.ApiOperation",
"io.swagger.annotations.ApiParam",
"io.swagger.annotations.ApiResponse",
"io.swagger.annotations.ApiResponses",
"java.util.List",
"org.kaaproject.kaa.common.dto.ConfigurationRecordDto",
"org.kaaproject.kaa.server.admin.shared.services.KaaAdminServiceException",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.bind.annotation.RequestMethod",
"org.springframework.web.bind.annotation.RequestParam"
] | import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import java.util.List; import org.kaaproject.kaa.common.dto.ConfigurationRecordDto; import org.kaaproject.kaa.server.admin.shared.services.KaaAdminServiceException; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; | import io.swagger.annotations.*; import java.util.*; import org.kaaproject.kaa.common.dto.*; import org.kaaproject.kaa.server.admin.shared.services.*; import org.springframework.web.bind.annotation.*; | [
"io.swagger.annotations",
"java.util",
"org.kaaproject.kaa",
"org.springframework.web"
] | io.swagger.annotations; java.util; org.kaaproject.kaa; org.springframework.web; | 862,270 |
public ResultMatcher isPartialContent() {
return matcher(HttpStatus.PARTIAL_CONTENT);
} | ResultMatcher function() { return matcher(HttpStatus.PARTIAL_CONTENT); } | /**
* Assert the response status code is {@code HttpStatus.PARTIAL_CONTENT} (206).
*/ | Assert the response status code is HttpStatus.PARTIAL_CONTENT (206) | isPartialContent | {
"repo_name": "spring-projects/spring-framework",
"path": "spring-test/src/main/java/org/springframework/test/web/servlet/result/StatusResultMatchers.java",
"license": "apache-2.0",
"size": 17758
} | [
"org.springframework.http.HttpStatus",
"org.springframework.test.web.servlet.ResultMatcher"
] | import org.springframework.http.HttpStatus; import org.springframework.test.web.servlet.ResultMatcher; | import org.springframework.http.*; import org.springframework.test.web.servlet.*; | [
"org.springframework.http",
"org.springframework.test"
] | org.springframework.http; org.springframework.test; | 1,832,987 |
private Future<Boolean> realizarPing2(final String ip, final ExecutorService es) {
return es.submit(new Callable<Boolean>() {
| Future<Boolean> function(final String ip, final ExecutorService es) { return es.submit(new Callable<Boolean>() { | /**
* Este metodo se encarga de realizar ping a la direccion ip recibida por
* parametro pero lo pospone como un
*
* @param ip,
* la ip del host al que se har� ping
* @param es,
* el ejecutor de tareas
* @return un hilo con el resultado
*/ | Este metodo se encarga de realizar ping a la direccion ip recibida por parametro pero lo pospone como un | realizarPing2 | {
"repo_name": "JuanDavidSanchezAroca/Redes",
"path": "ProyectoRedesNmap/src/co/edu/uniquindio/logica/JNetMap.java",
"license": "mit",
"size": 13584
} | [
"java.util.concurrent.Callable",
"java.util.concurrent.ExecutorService",
"java.util.concurrent.Future"
] | import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 837,966 |
protected byte[] getSetting(SonyProjectorItem item) throws SonyProjectorException {
logger.debug("Get setting {}", item.getName());
try {
byte[] result = getResponseData(executeCommand(item, true, DUMMY_DATA));
logger.debug("Get setting {} succeeded: result data: {}", item.getName(), HexUtils.bytesToHex(result));
return result;
} catch (SonyProjectorException e) {
logger.debug("Get setting {} failed: {}", item.getName(), e.getMessage());
throw new SonyProjectorException("Get setting " + item.getName() + " failed: " + e.getMessage());
}
} | byte[] function(SonyProjectorItem item) throws SonyProjectorException { logger.debug(STR, item.getName()); try { byte[] result = getResponseData(executeCommand(item, true, DUMMY_DATA)); logger.debug(STR, item.getName(), HexUtils.bytesToHex(result)); return result; } catch (SonyProjectorException e) { logger.debug(STR, item.getName(), e.getMessage()); throw new SonyProjectorException(STR + item.getName() + STR + e.getMessage()); } } | /**
* Request the projector to get the current value for a setting
*
* @param item the projector setting to get
*
* @return the current value for the setting
*
* @throws SonyProjectorException - In case of any problem
*/ | Request the projector to get the current value for a setting | getSetting | {
"repo_name": "openhab/openhab2",
"path": "bundles/org.openhab.binding.sonyprojector/src/main/java/org/openhab/binding/sonyprojector/internal/communication/SonyProjectorConnector.java",
"license": "epl-1.0",
"size": 43215
} | [
"org.openhab.binding.sonyprojector.internal.SonyProjectorException",
"org.openhab.core.util.HexUtils"
] | import org.openhab.binding.sonyprojector.internal.SonyProjectorException; import org.openhab.core.util.HexUtils; | import org.openhab.binding.sonyprojector.internal.*; import org.openhab.core.util.*; | [
"org.openhab.binding",
"org.openhab.core"
] | org.openhab.binding; org.openhab.core; | 93,732 |
protected String paramString()
{
String title = getTitle();
String resizable = "";
if (isResizable ())
resizable = ",resizable";
String state = "";
switch (getState ())
{
case NORMAL:
state = ",normal";
break;
case ICONIFIED:
state = ",iconified";
break;
case MAXIMIZED_BOTH:
state = ",maximized-both";
break;
case MAXIMIZED_HORIZ:
state = ",maximized-horiz";
break;
case MAXIMIZED_VERT:
state = ",maximized-vert";
break;
}
return super.paramString () + ",title=" + title + resizable + state;
}
private static ArrayList<WeakReference<Frame>> weakFrames =
new ArrayList<WeakReference<Frame>>();
private static ReferenceQueue weakFramesQueue =
new ReferenceQueue<Frame>(); | String function() { String title = getTitle(); String resizable = STR,resizableSTRSTR,normalSTR,iconifiedSTR,maximized-bothSTR,maximized-horizSTR,maximized-vertSTR,title=" + title + resizable + state; } private static ArrayList<WeakReference<Frame>> weakFrames = new ArrayList<WeakReference<Frame>>(); private static ReferenceQueue weakFramesQueue = new ReferenceQueue<Frame>(); | /**
* Returns a debugging string describing this window.
*
* @return a debugging string describing this window
*/ | Returns a debugging string describing this window | paramString | {
"repo_name": "taciano-perez/JamVM-PH",
"path": "src/classpath/java/awt/Frame.java",
"license": "gpl-2.0",
"size": 17494
} | [
"java.lang.ref.ReferenceQueue",
"java.lang.ref.WeakReference",
"java.util.ArrayList"
] | import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; import java.util.ArrayList; | import java.lang.ref.*; import java.util.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 2,366,000 |
@NonNull
public Collection<ArchiveInfo> getDependenciesFor() {
return mDependencyFor;
} | Collection<ArchiveInfo> function() { return mDependencyFor; } | /**
* Returns the list of {@link ArchiveInfo} for which <em>this</em> package is a dependency.
* This means the packages listed here depend on this package.
* <p/>
* Implementation detail: this is the internal mutable list. Callers should not modify it.
* This list can be empty but is never null.
*/ | Returns the list of <code>ArchiveInfo</code> for which this package is a dependency. This means the packages listed here depend on this package. Implementation detail: this is the internal mutable list. Callers should not modify it. This list can be empty but is never null | getDependenciesFor | {
"repo_name": "tranleduy2000/javaide",
"path": "aosp/sdklib/src/main/java/com/android/sdklib/internal/repository/updater/ArchiveInfo.java",
"license": "gpl-3.0",
"size": 6469
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 1,178,824 |
MemberAccountVO getMemberAccountVO(Long memberAccountId); | MemberAccountVO getMemberAccountVO(Long memberAccountId); | /**
* Returns a memberAccountVO for the given member account id.
*/ | Returns a memberAccountVO for the given member account id | getMemberAccountVO | {
"repo_name": "robertoandrade/cyclos",
"path": "src/nl/strohalm/cyclos/services/accounts/AccountService.java",
"license": "gpl-2.0",
"size": 6703
} | [
"nl.strohalm.cyclos.webservices.model.MemberAccountVO"
] | import nl.strohalm.cyclos.webservices.model.MemberAccountVO; | import nl.strohalm.cyclos.webservices.model.*; | [
"nl.strohalm.cyclos"
] | nl.strohalm.cyclos; | 2,794,562 |
public static char parseNextCharacter(final String source,
final ParsePosition pos) {
int index = pos.getIndex();
final int n = source.length();
char ret = 0;
if (index < n) {
char c;
do {
c = source.charAt(index++);
} while (Character.isWhitespace(c) && index < n);
pos.setIndex(index);
if (index < n) {
ret = c;
}
}
return ret;
} | static char function(final String source, final ParsePosition pos) { int index = pos.getIndex(); final int n = source.length(); char ret = 0; if (index < n) { char c; do { c = source.charAt(index++); } while (Character.isWhitespace(c) && index < n); pos.setIndex(index); if (index < n) { ret = c; } } return ret; } | /**
* Parses <code>source</code> until a non-whitespace character is found.
*
* @param source the string to parse
* @param pos input/ouput parsing parameter.
* @return the first non-whitespace character.
*/ | Parses <code>source</code> until a non-whitespace character is found | parseNextCharacter | {
"repo_name": "martingwhite/astor",
"path": "examples/math_50v2/src/main/java/org/apache/commons/math/util/CompositeFormat.java",
"license": "gpl-2.0",
"size": 8056
} | [
"java.text.ParsePosition"
] | import java.text.ParsePosition; | import java.text.*; | [
"java.text"
] | java.text; | 2,877,964 |
public LifecycleBean[] getLifecycleBeans() {
return lifecycleBeans;
} | LifecycleBean[] function() { return lifecycleBeans; } | /**
* Returns a collection of life-cycle beans. These beans will be automatically
* notified of grid life-cycle events. Use life-cycle beans whenever you
* want to perform certain logic before and after grid startup and stopping
* routines.
*
* @return Collection of life-cycle beans.
* @see LifecycleBean
* @see LifecycleEventType
*/ | Returns a collection of life-cycle beans. These beans will be automatically notified of grid life-cycle events. Use life-cycle beans whenever you want to perform certain logic before and after grid startup and stopping routines | getLifecycleBeans | {
"repo_name": "mcherkasov/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java",
"license": "apache-2.0",
"size": 91428
} | [
"org.apache.ignite.lifecycle.LifecycleBean"
] | import org.apache.ignite.lifecycle.LifecycleBean; | import org.apache.ignite.lifecycle.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,940,352 |
List<Object> getTuple(Record record); | List<Object> getTuple(Record record); | /**
* Retrieve the tuple.
* @param record kinesis record
* @return storm tuple to be emitted for this record, null if no tuple should be emitted
*/ | Retrieve the tuple | getTuple | {
"repo_name": "kishorvpatil/incubator-storm",
"path": "external/storm-kinesis/src/main/java/org/apache/storm/kinesis/spout/RecordToTupleMapper.java",
"license": "apache-2.0",
"size": 1352
} | [
"com.amazonaws.services.kinesis.model.Record",
"java.util.List"
] | import com.amazonaws.services.kinesis.model.Record; import java.util.List; | import com.amazonaws.services.kinesis.model.*; import java.util.*; | [
"com.amazonaws.services",
"java.util"
] | com.amazonaws.services; java.util; | 2,214,239 |
@SuppressWarnings("unchecked")
@Override
public String getMasterRequestId(Message request) {
List<SoapHeader> headers = (List<SoapHeader>) ((CxfPayload<?>)request.getBody()).getHeaders();
for (SoapHeader header : headers) {
if (header.getName().getLocalPart().equals("MasterRequestID")) {
Node headerNode = (Node) header.getObject();
return headerNode.getTextContent();
}
}
return null;
} | @SuppressWarnings(STR) String function(Message request) { List<SoapHeader> headers = (List<SoapHeader>) ((CxfPayload<?>)request.getBody()).getHeaders(); for (SoapHeader header : headers) { if (header.getName().getLocalPart().equals(STR)) { Node headerNode = (Node) header.getObject(); return headerNode.getTextContent(); } } return null; } | /**
* Assumes a 'MasterRequestID' SOAP header element. Override for something different.
*/ | Assumes a 'MasterRequestID' SOAP header element. Override for something different | getMasterRequestId | {
"repo_name": "CenturyLinkCloud/mdw",
"path": "mdw-workflow/assets/com/centurylink/mdw/camel/CxfProcessLaunchHandler.java",
"license": "apache-2.0",
"size": 1318
} | [
"java.util.List",
"org.apache.camel.Message",
"org.apache.camel.component.cxf.CxfPayload",
"org.apache.cxf.binding.soap.SoapHeader",
"org.w3c.dom.Node"
] | import java.util.List; import org.apache.camel.Message; import org.apache.camel.component.cxf.CxfPayload; import org.apache.cxf.binding.soap.SoapHeader; import org.w3c.dom.Node; | import java.util.*; import org.apache.camel.*; import org.apache.camel.component.cxf.*; import org.apache.cxf.binding.soap.*; import org.w3c.dom.*; | [
"java.util",
"org.apache.camel",
"org.apache.cxf",
"org.w3c.dom"
] | java.util; org.apache.camel; org.apache.cxf; org.w3c.dom; | 727,420 |
runSort(args, "maxwsort");
JobConf job = runUniformPartition(args, 2);
runCosinePartition(job, args, CosineWeightPartitionMain.class, CosineWeightPartMapper.class);
rewritePartitions(job);
} | runSort(args, STR); JobConf job = runUniformPartition(args, 2); runCosinePartition(job, args, CosineWeightPartitionMain.class, CosineWeightPartMapper.class); rewritePartitions(job); } | /**
* Executes four jobs. Job1 does norm-sorter. Job2 is a regular java program
* to uniformly partitions the records. Job3 runs the cosine partitioner and
* finally Job4 is the organizer to rename files into Gij and remove
* unnecessary partitioning through merging.
*/ | Executes four jobs. Job1 does norm-sorter. Job2 is a regular java program to uniformly partitions the records. Job3 runs the cosine partitioner and finally Job4 is the organizer to rename files into Gij and remove unnecessary partitioning through merging | main | {
"repo_name": "ucsb-similarity/pss",
"path": "src/main/java/edu/ucsb/cs/partitioning/cosine/CosineWeightPartitionMain.java",
"license": "apache-2.0",
"size": 1596
} | [
"org.apache.hadoop.mapred.JobConf"
] | import org.apache.hadoop.mapred.JobConf; | import org.apache.hadoop.mapred.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,828,523 |
public static Flip td(Object X) throws UnsupportedEncodingException {
if (X instanceof Flip) {
return (Flip)X;
}
Dict d = (Dict)X;
Flip a = (Flip)d.x, b = (Flip)d.y;
int m = n(a.x), n = n(b.x);
String[] x = new String[m + n];
System.arraycopy(a.x, 0, x, 0, m);
System.arraycopy(b.x, 0, x, m, n);
Object[] y = new Object[m + n];
System.arraycopy(a.y, 0, y, 0, m);
System.arraycopy(b.y, 0, y, m, n);
return new Flip(new Dict(x, y));
} | static Flip function(Object X) throws UnsupportedEncodingException { if (X instanceof Flip) { return (Flip)X; } Dict d = (Dict)X; Flip a = (Flip)d.x, b = (Flip)d.y; int m = n(a.x), n = n(b.x); String[] x = new String[m + n]; System.arraycopy(a.x, 0, x, 0, m); System.arraycopy(b.x, 0, x, m, n); Object[] y = new Object[m + n]; System.arraycopy(a.y, 0, y, 0, m); System.arraycopy(b.y, 0, y, m, n); return new Flip(new Dict(x, y)); } | /**
* Removes the key from a keyed table.
* <p>
* A keyed table(a.k.a. Flip) is a dictionary where both key and value are tables
* themselves. For ease of processing, this method, td, table from dictionary, can be used to remove the key.
* </p>
*
* @param X A table or keyed table.
* @return A simple table
* @throws UnsupportedEncodingException If the named charset is not supported
*/ | Removes the key from a keyed table. A keyed table(a.k.a. Flip) is a dictionary where both key and value are tables themselves. For ease of processing, this method, td, table from dictionary, can be used to remove the key. | td | {
"repo_name": "a2ndrade/k-intellij-plugin",
"path": "src/main/java/kx/c.java",
"license": "mit",
"size": 53259
} | [
"java.io.UnsupportedEncodingException"
] | import java.io.UnsupportedEncodingException; | import java.io.*; | [
"java.io"
] | java.io; | 1,406,067 |
public void serialize(KXmlSerializer serializer)
throws IOException {
serializer.startTag(CtsXmlResultReporter.ns, TAG);
serializer.attribute(CtsXmlResultReporter.ns, NAME_ATTR, getName());
serializer.attribute(CtsXmlResultReporter.ns, RESULT_ATTR, mResult.getValue());
serializer.attribute(CtsXmlResultReporter.ns, STARTTIME_ATTR, mStartTime);
serializer.attribute(CtsXmlResultReporter.ns, ENDTIME_ATTR, mEndTime);
if (mMessage != null) {
serializer.startTag(CtsXmlResultReporter.ns, SCENE_TAG);
serializer.attribute(CtsXmlResultReporter.ns, MESSAGE_ATTR, mMessage);
if (mStackTrace != null) {
serializer.startTag(CtsXmlResultReporter.ns, STACK_TAG);
serializer.text(mStackTrace);
serializer.endTag(CtsXmlResultReporter.ns, STACK_TAG);
}
if (mDetails != null) {
serializer.startTag(CtsXmlResultReporter.ns, DETAILS_TAG);
serializer.text(mDetails);
serializer.endTag(CtsXmlResultReporter.ns, DETAILS_TAG);
}
serializer.endTag(CtsXmlResultReporter.ns, SCENE_TAG);
}
serializer.endTag(CtsXmlResultReporter.ns, TAG);
} | void function(KXmlSerializer serializer) throws IOException { serializer.startTag(CtsXmlResultReporter.ns, TAG); serializer.attribute(CtsXmlResultReporter.ns, NAME_ATTR, getName()); serializer.attribute(CtsXmlResultReporter.ns, RESULT_ATTR, mResult.getValue()); serializer.attribute(CtsXmlResultReporter.ns, STARTTIME_ATTR, mStartTime); serializer.attribute(CtsXmlResultReporter.ns, ENDTIME_ATTR, mEndTime); if (mMessage != null) { serializer.startTag(CtsXmlResultReporter.ns, SCENE_TAG); serializer.attribute(CtsXmlResultReporter.ns, MESSAGE_ATTR, mMessage); if (mStackTrace != null) { serializer.startTag(CtsXmlResultReporter.ns, STACK_TAG); serializer.text(mStackTrace); serializer.endTag(CtsXmlResultReporter.ns, STACK_TAG); } if (mDetails != null) { serializer.startTag(CtsXmlResultReporter.ns, DETAILS_TAG); serializer.text(mDetails); serializer.endTag(CtsXmlResultReporter.ns, DETAILS_TAG); } serializer.endTag(CtsXmlResultReporter.ns, SCENE_TAG); } serializer.endTag(CtsXmlResultReporter.ns, TAG); } | /**
* Serialize this object and all its contents to XML.
*
* @param serializer
* @throws IOException
*/ | Serialize this object and all its contents to XML | serialize | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "cts/tools/tradefed-host/src/com/android/cts/tradefed/result/Test.java",
"license": "gpl-2.0",
"size": 7002
} | [
"java.io.IOException",
"org.kxml2.io.KXmlSerializer"
] | import java.io.IOException; import org.kxml2.io.KXmlSerializer; | import java.io.*; import org.kxml2.io.*; | [
"java.io",
"org.kxml2.io"
] | java.io; org.kxml2.io; | 393,449 |
public void deleteSite(long siteId, Listener listener, ErrorListener errorListener) {
String path = String.format(Locale.US, "sites/%d/delete", siteId);
post(path, listener, errorListener);
} | void function(long siteId, Listener listener, ErrorListener errorListener) { String path = String.format(Locale.US, STR, siteId); post(path, listener, errorListener); } | /**
* Delete a site
*/ | Delete a site | deleteSite | {
"repo_name": "mzorz/WordPress-Android",
"path": "libs/networking/WordPressNetworking/src/main/java/org/wordpress/android/networking/RestClientUtils.java",
"license": "gpl-2.0",
"size": 17735
} | [
"com.wordpress.rest.RestRequest",
"java.util.Locale"
] | import com.wordpress.rest.RestRequest; import java.util.Locale; | import com.wordpress.rest.*; import java.util.*; | [
"com.wordpress.rest",
"java.util"
] | com.wordpress.rest; java.util; | 1,998,588 |
public void setActiveMessage(MessageReference messageReference) {
mActiveMessage = messageReference;
// Reload message list with modified query that always includes the active message
if (isAdded()) {
restartLoader();
}
// Redraw list immediately
if (mAdapter != null) {
mAdapter.notifyDataSetChanged();
}
} | void function(MessageReference messageReference) { mActiveMessage = messageReference; if (isAdded()) { restartLoader(); } if (mAdapter != null) { mAdapter.notifyDataSetChanged(); } } | /**
* Mark a message as 'active'.
*
* <p>
* The active message is the one currently displayed in the message view portion of the split
* view.
* </p>
*
* @param messageReference
* {@code null} to not mark any message as being 'active'.
*/ | Mark a message as 'active'. The active message is the one currently displayed in the message view portion of the split view. | setActiveMessage | {
"repo_name": "vasyl-khomko/k-9",
"path": "k9mail/src/main/java/com/fsck/k9/fragment/MessageListFragment.java",
"license": "bsd-3-clause",
"size": 124443
} | [
"com.fsck.k9.activity.MessageReference"
] | import com.fsck.k9.activity.MessageReference; | import com.fsck.k9.activity.*; | [
"com.fsck.k9"
] | com.fsck.k9; | 2,243,743 |
public void write(final String tagName, final Object object, final XMLWriter writer,
final String mPlexAttribute, final String mPlexValue)
throws IOException, XMLWriterException {
final BasicStroke stroke = (BasicStroke) object;
final float[] dashArray = stroke.getDashArray();
final float dashPhase = stroke.getDashPhase();
final int endCap = stroke.getEndCap();
final int lineJoin = stroke.getLineJoin();
final float lineWidth = stroke.getLineWidth();
final float miterLimit = stroke.getMiterLimit();
final AttributeList attribs = new AttributeList();
if (mPlexAttribute != null) {
attribs.setAttribute(mPlexAttribute, mPlexValue);
}
attribs.setAttribute("type", "basic");
attribs.setAttribute("endCap", String.valueOf(endCap));
attribs.setAttribute("lineJoin", String.valueOf(lineJoin));
attribs.setAttribute("lineWidth", String.valueOf(lineWidth));
attribs.setAttribute("miterLimit", String.valueOf(miterLimit));
if (dashArray != null) {
attribs.setAttribute("dashArray", toString(dashArray));
attribs.setAttribute("dashPhase", String.valueOf(dashPhase));
}
writer.writeTag(tagName, attribs, true);
} | void function(final String tagName, final Object object, final XMLWriter writer, final String mPlexAttribute, final String mPlexValue) throws IOException, XMLWriterException { final BasicStroke stroke = (BasicStroke) object; final float[] dashArray = stroke.getDashArray(); final float dashPhase = stroke.getDashPhase(); final int endCap = stroke.getEndCap(); final int lineJoin = stroke.getLineJoin(); final float lineWidth = stroke.getLineWidth(); final float miterLimit = stroke.getMiterLimit(); final AttributeList attribs = new AttributeList(); if (mPlexAttribute != null) { attribs.setAttribute(mPlexAttribute, mPlexValue); } attribs.setAttribute("type", "basic"); attribs.setAttribute(STR, String.valueOf(endCap)); attribs.setAttribute(STR, String.valueOf(lineJoin)); attribs.setAttribute(STR, String.valueOf(lineWidth)); attribs.setAttribute(STR, String.valueOf(miterLimit)); if (dashArray != null) { attribs.setAttribute(STR, toString(dashArray)); attribs.setAttribute(STR, String.valueOf(dashPhase)); } writer.writeTag(tagName, attribs, true); } | /**
* Performs the writing of a single object.
*
* @param tagName the tag name.
* @param object the object ({@link BasicStroke} expected).
* @param writer the writer.
* @param mPlexAttribute ??
* @param mPlexValue ??
*
* @throws IOException if there is an I/O problem.
* @throws XMLWriterException if there is a problem with the writer.
*/ | Performs the writing of a single object | write | {
"repo_name": "apetresc/JCommon",
"path": "src/main/java/org/jfree/xml/writer/coretypes/BasicStrokeWriteHandler.java",
"license": "lgpl-2.1",
"size": 4608
} | [
"java.awt.BasicStroke",
"java.io.IOException",
"org.jfree.xml.writer.AttributeList",
"org.jfree.xml.writer.XMLWriter",
"org.jfree.xml.writer.XMLWriterException"
] | import java.awt.BasicStroke; import java.io.IOException; import org.jfree.xml.writer.AttributeList; import org.jfree.xml.writer.XMLWriter; import org.jfree.xml.writer.XMLWriterException; | import java.awt.*; import java.io.*; import org.jfree.xml.writer.*; | [
"java.awt",
"java.io",
"org.jfree.xml"
] | java.awt; java.io; org.jfree.xml; | 2,142,132 |
@Message(id = 54, value = "Invalid code %d")
IllegalArgumentException invalidCode(int code); | @Message(id = 54, value = STR) IllegalArgumentException invalidCode(int code); | /**
* Creates an exception indicating the code is invalid.
*
* @param code the invalid code.
*
* @return an {@link IllegalArgumentException} for the error.
*/ | Creates an exception indicating the code is invalid | invalidCode | {
"repo_name": "JiriOndrusek/wildfly-core",
"path": "host-controller/src/main/java/org/jboss/as/domain/controller/logging/DomainControllerLogger.java",
"license": "lgpl-2.1",
"size": 34701
} | [
"org.jboss.logging.annotations.Message"
] | import org.jboss.logging.annotations.Message; | import org.jboss.logging.annotations.*; | [
"org.jboss.logging"
] | org.jboss.logging; | 336,539 |
public void print(char v)
throws IOException
{
if (_os != null)
_os.print(v);
} | void function(char v) throws IOException { if (_os != null) _os.print(v); } | /**
* Prints a string to a file.
*/ | Prints a string to a file | print | {
"repo_name": "moriyoshi/quercus-gae",
"path": "src/main/java/com/caucho/quercus/lib/file/PopenOutput.java",
"license": "gpl-2.0",
"size": 3559
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,289,242 |
private List<SmlIo<?>> parseInputs(final Inputs inputs) throws OwsExceptionReport {
final List<SmlIo<?>> sosInputs = new ArrayList<SmlIo<?>>(inputs.getInputList().getInputArray().length);
for (final IoComponentPropertyType xbInput : inputs.getInputList().getInputArray()) {
sosInputs.add(parseIoComponentPropertyType(xbInput));
}
return sosInputs;
} | List<SmlIo<?>> function(final Inputs inputs) throws OwsExceptionReport { final List<SmlIo<?>> sosInputs = new ArrayList<SmlIo<?>>(inputs.getInputList().getInputArray().length); for (final IoComponentPropertyType xbInput : inputs.getInputList().getInputArray()) { sosInputs.add(parseIoComponentPropertyType(xbInput)); } return sosInputs; } | /**
* Parses the inputs
*
* @param inputs
* XML inputs
* @return SOS inputs
*
*
* @throws OwsExceptionReport
* * if an error occurs
*/ | Parses the inputs | parseInputs | {
"repo_name": "ahuarte47/SOS",
"path": "coding/sensorML-v101/src/main/java/org/n52/sos/decode/SensorMLDecoderV101.java",
"license": "gpl-2.0",
"size": 48724
} | [
"java.util.ArrayList",
"java.util.List",
"net.opengis.sensorML.x101.InputsDocument",
"net.opengis.sensorML.x101.IoComponentPropertyType",
"org.n52.sos.ogc.ows.OwsExceptionReport",
"org.n52.sos.ogc.sensorML.elements.SmlIo"
] | import java.util.ArrayList; import java.util.List; import net.opengis.sensorML.x101.InputsDocument; import net.opengis.sensorML.x101.IoComponentPropertyType; import org.n52.sos.ogc.ows.OwsExceptionReport; import org.n52.sos.ogc.sensorML.elements.SmlIo; | import java.util.*; import net.opengis.*; import org.n52.sos.ogc.*; import org.n52.sos.ogc.ows.*; | [
"java.util",
"net.opengis",
"org.n52.sos"
] | java.util; net.opengis; org.n52.sos; | 1,254,394 |
default IdentifiedUser getIdentifiedUser() {
return requireNonNull(getUser()).asIdentifiedUser();
} | default IdentifiedUser getIdentifiedUser() { return requireNonNull(getUser()).asIdentifiedUser(); } | /**
* Get the identified user performing the update.
*
* <p>Convenience method for {@code getUser().asIdentifiedUser()}.
*
* @see CurrentUser#asIdentifiedUser()
* @return user.
*/ | Get the identified user performing the update. Convenience method for getUser().asIdentifiedUser() | getIdentifiedUser | {
"repo_name": "GerritCodeReview/gerrit",
"path": "java/com/google/gerrit/server/update/Context.java",
"license": "apache-2.0",
"size": 4938
} | [
"com.google.gerrit.server.IdentifiedUser",
"java.util.Objects"
] | import com.google.gerrit.server.IdentifiedUser; import java.util.Objects; | import com.google.gerrit.server.*; import java.util.*; | [
"com.google.gerrit",
"java.util"
] | com.google.gerrit; java.util; | 1,876,410 |
public void setDisplayName(String displayName) {
Assert.hasLength(displayName, "Display name must not be empty");
this.displayName = displayName;
} | void function(String displayName) { Assert.hasLength(displayName, STR); this.displayName = displayName; } | /**
* Set a friendly name for this context.
* Typically done during initialization of concrete context implementations.
* <p>Default is the object id of the context instance.
*/ | Set a friendly name for this context. Typically done during initialization of concrete context implementations. Default is the object id of the context instance | setDisplayName | {
"repo_name": "qobel/esoguproject",
"path": "spring-framework/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java",
"license": "apache-2.0",
"size": 47683
} | [
"org.springframework.util.Assert"
] | import org.springframework.util.Assert; | import org.springframework.util.*; | [
"org.springframework.util"
] | org.springframework.util; | 2,564,293 |
public String secondaryTable(Class<?> aClass) {
SecondaryTable table = findAnnotation(aClass, SecondaryTable.class);
if (table != null) {
return table.name();
}
return null;
}
/**
* Parses and returns all SecondaryTables on a class. This includes {@link javax.persistence.SecondaryTable @
* SecondaryTable} | String function(Class<?> aClass) { SecondaryTable table = findAnnotation(aClass, SecondaryTable.class); if (table != null) { return table.name(); } return null; } /** * Parses and returns all SecondaryTables on a class. This includes {@link javax.persistence.SecondaryTable @ * SecondaryTable} | /**
* Look for {@link javax.persistence.SecondaryTable @SecondaryTable} annotations and return the name.
*
* @param aClass the class to look for
* @return the table name or null if it doesn't exist
*/ | Look for <code>javax.persistence.SecondaryTable @SecondaryTable</code> annotations and return the name | secondaryTable | {
"repo_name": "amir20/jpile",
"path": "src/main/java/com/opower/persistence/jpile/reflection/PersistenceAnnotationInspector.java",
"license": "mit",
"size": 15427
} | [
"javax.persistence.SecondaryTable",
"javax.persistence.SecondaryTables"
] | import javax.persistence.SecondaryTable; import javax.persistence.SecondaryTables; | import javax.persistence.*; | [
"javax.persistence"
] | javax.persistence; | 1,644,983 |
if (iterable == null) {
return true;
}
if (iterable instanceof Collection && ((Collection<?>) iterable).isEmpty()) {
return true;
}
return !iterable.iterator().hasNext();
} | if (iterable == null) { return true; } if (iterable instanceof Collection && ((Collection<?>) iterable).isEmpty()) { return true; } return !iterable.iterator().hasNext(); } | /**
* Indicates whether the given {@link Iterable} is {@code null} or empty.
*
* @param iterable the given {@code Iterable} to check.
* @return {@code true} if the given {@code Iterable} is {@code null} or empty, otherwise {@code false}.
*/ | Indicates whether the given <code>Iterable</code> is null or empty | isNullOrEmpty | {
"repo_name": "AlexBischof/assertj-core",
"path": "src/main/java/org/assertj/core/util/Iterables.java",
"license": "apache-2.0",
"size": 3491
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 676,288 |
public void i2d() throws IOException
{
d.i2t();
} | void function() throws IOException { d.i2t(); } | /**
* Convert int to double
* <p>Stack: ..., value=>..., result
* @throws IOException
*/ | Convert int to double Stack: ..., value=>..., result | i2d | {
"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,289 |
@Test
public void testCompareNullToSorting() {
Action action = new Action();
Action actionCompare = new Action();
actionCompare.setSorting(1);
assertEquals(1, action.compareTo(actionCompare));
}
| void function() { Action action = new Action(); Action actionCompare = new Action(); actionCompare.setSorting(1); assertEquals(1, action.compareTo(actionCompare)); } | /**
* compare null-value in the sorting with the sorting member.
*/ | compare null-value in the sorting with the sorting member | testCompareNullToSorting | {
"repo_name": "test-editor/test-editor",
"path": "core/org.testeditor.core/src/test/java/org/testeditor/core/model/action/ActionTest.java",
"license": "epl-1.0",
"size": 5105
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,821,064 |
private static SimpleTableDef detectTable(JsonObject metadataProperties, String documentType) {
final ElasticSearchMetaData metaData = JestElasticSearchMetaDataParser.parse(metadataProperties);
return new SimpleTableDef(documentType, metaData.getColumnNames(), metaData.getColumnTypes());
} | static SimpleTableDef function(JsonObject metadataProperties, String documentType) { final ElasticSearchMetaData metaData = JestElasticSearchMetaDataParser.parse(metadataProperties); return new SimpleTableDef(documentType, metaData.getColumnNames(), metaData.getColumnTypes()); } | /**
* Performs an analysis of an available index type in an ElasticSearch
* {@link JestClient} client and tries to detect the index structure based
* on the metadata provided by the java client.
*
* @param metadataProperties
* the ElasticSearch mapping
* @param documentType
* the name of the index type
* @return a table definition for ElasticSearch.
*/ | Performs an analysis of an available index type in an ElasticSearch <code>JestClient</code> client and tries to detect the index structure based on the metadata provided by the java client | detectTable | {
"repo_name": "tomaszguzialek/metamodel",
"path": "elasticsearch/rest/src/main/java/org/apache/metamodel/elasticsearch/rest/ElasticSearchRestDataContext.java",
"license": "apache-2.0",
"size": 15969
} | [
"com.google.gson.JsonObject",
"org.apache.metamodel.elasticsearch.common.ElasticSearchMetaData",
"org.apache.metamodel.util.SimpleTableDef"
] | import com.google.gson.JsonObject; import org.apache.metamodel.elasticsearch.common.ElasticSearchMetaData; import org.apache.metamodel.util.SimpleTableDef; | import com.google.gson.*; import org.apache.metamodel.elasticsearch.common.*; import org.apache.metamodel.util.*; | [
"com.google.gson",
"org.apache.metamodel"
] | com.google.gson; org.apache.metamodel; | 1,176,941 |
public static void squelchJar(JarFile jar) {
try {
if (jar != null) {
jar.close();
}
} catch (IOException ex) {
// intentionally suppressed
}
} | static void function(JarFile jar) { try { if (jar != null) { jar.close(); } } catch (IOException ex) { } } | /**
* Closes a Jar, ignoring any I/O exception. This should only be
* used in finally blocks when it's necessary to avoid throwing an exception
* which might mask a real exception.
*
* @param jar jar to close
*/ | Closes a Jar, ignoring any I/O exception. This should only be used in finally blocks when it's necessary to avoid throwing an exception which might mask a real exception | squelchJar | {
"repo_name": "mehant/incubator-calcite",
"path": "core/src/main/java/org/apache/calcite/util/Util.java",
"license": "apache-2.0",
"size": 63074
} | [
"java.io.IOException",
"java.util.jar.JarFile"
] | import java.io.IOException; import java.util.jar.JarFile; | import java.io.*; import java.util.jar.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,250,762 |
Response getObjectInformation(String memberIdentifier, String uniqueAttributeValue, String objectType); | Response getObjectInformation(String memberIdentifier, String uniqueAttributeValue, String objectType); | /**
* <p>
* A method that retrieves information about the requested object. The information about
* the object are composed of object name and description. The description of the object
* depends purely on the specific implementation.
* </p>
*
* @param memberIdentifier
* unique identifier of federation member in identity federation performing the
* request
*
* @param uniqueAttributeValue
* A unique value of attribute specified by targeted federation member. By this value
* and the value of objectType, requested federation member is able to uniquely
* identify the requested object.
*
* @param objectType
* A String representation of type of the object that this request needs information
* about. This also depends on specific implementation, for example, in Java, this would
* be a canonical name of the class.
*
* @return javax.ws.rs.core.Response
* A HTTP response containing either an object with information about requested
* object (ObjectInformation), if the request was processed
* properly, or a message informing requester about the error that happened
* during request processing. Following HTTP codes may be thrown:
*
* <b>200</b> - response with HTTP code 200 should be returned when request to
* retrieve an org. unit is handled correctly and in this case,
* HTTP response contains requested an org. unit hierarchy in response
* body.
*
* <b>400</b> - response with HTTP cod 400 should be returned when the request is
* malformed, e.g. the memberIdentifier or uniqueAttributeValue is not
* set or there is no existing membership relation between
* requesting and requested federation members. Another situation
* handled as bad request is when there is no org. unit for provided
* unique attribute value.
*
* <b>500</b> - response with HTTP code 500 should be returned when there is an internal
* error on the server side of federation member processing the request, such
* as problems with reading objects in repository.
* */ | A method that retrieves information about the requested object. The information about the object are composed of object name and description. The description of the object depends purely on the specific implementation. | getObjectInformation | {
"repo_name": "eriksuta/fidm",
"path": "fidm/src/main/java/com/esuta/fidm/model/federation/service/IFederationService.java",
"license": "apache-2.0",
"size": 37467
} | [
"javax.ws.rs.core.Response"
] | import javax.ws.rs.core.Response; | import javax.ws.rs.core.*; | [
"javax.ws"
] | javax.ws; | 197,834 |
public static Collection<DistributionLocatorId> asDistributionLocatorIds(
Collection<Locator> locators) throws UnknownHostException {
if (locators.isEmpty()) {
return Collections.emptyList();
}
Collection<DistributionLocatorId> locatorIds = new ArrayList<DistributionLocatorId>();
for (Locator locator : locators) {
DistributionLocatorId locatorId =
new DistributionLocatorId(SocketCreator.getLocalHost(), locator);
locatorIds.add(locatorId);
}
return locatorIds;
} | static Collection<DistributionLocatorId> function( Collection<Locator> locators) throws UnknownHostException { if (locators.isEmpty()) { return Collections.emptyList(); } Collection<DistributionLocatorId> locatorIds = new ArrayList<DistributionLocatorId>(); for (Locator locator : locators) { DistributionLocatorId locatorId = new DistributionLocatorId(SocketCreator.getLocalHost(), locator); locatorIds.add(locatorId); } return locatorIds; } | /**
* Converts a collection of {@link Locator} instances to a collection of DistributionLocatorId
* instances. Note this will use {@link SocketCreator#getLocalHost()} as the host for
* DistributionLocatorId. This is because all instances of Locator are local only.
*
* @param locators collection of Locator instances
* @return collection of DistributionLocatorId instances
* @throws UnknownHostException
* @see Locator
*/ | Converts a collection of <code>Locator</code> instances to a collection of DistributionLocatorId instances. Note this will use <code>SocketCreator#getLocalHost()</code> as the host for DistributionLocatorId. This is because all instances of Locator are local only | asDistributionLocatorIds | {
"repo_name": "prasi-in/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/admin/remote/DistributionLocatorId.java",
"license": "apache-2.0",
"size": 12751
} | [
"java.net.UnknownHostException",
"java.util.ArrayList",
"java.util.Collection",
"java.util.Collections",
"org.apache.geode.distributed.Locator",
"org.apache.geode.internal.net.SocketCreator"
] | import java.net.UnknownHostException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import org.apache.geode.distributed.Locator; import org.apache.geode.internal.net.SocketCreator; | import java.net.*; import java.util.*; import org.apache.geode.distributed.*; import org.apache.geode.internal.net.*; | [
"java.net",
"java.util",
"org.apache.geode"
] | java.net; java.util; org.apache.geode; | 606,406 |
public ConceptList findParentConcepts(Concept concept, PfsParameter pfs)
throws Exception; | ConceptList function(Concept concept, PfsParameter pfs) throws Exception; | /**
* Find parent concepts.
*
* @param concept the concept
* @param pfs the pfs
* @return the concept list
* @throws Exception the exception
*/ | Find parent concepts | findParentConcepts | {
"repo_name": "WestCoastInformatics/SNOMED-Terminology-Server",
"path": "services/src/main/java/org/ihtsdo/otf/ts/services/ContentService.java",
"license": "apache-2.0",
"size": 38037
} | [
"org.ihtsdo.otf.ts.helpers.ConceptList",
"org.ihtsdo.otf.ts.helpers.PfsParameter",
"org.ihtsdo.otf.ts.rf2.Concept"
] | import org.ihtsdo.otf.ts.helpers.ConceptList; import org.ihtsdo.otf.ts.helpers.PfsParameter; import org.ihtsdo.otf.ts.rf2.Concept; | import org.ihtsdo.otf.ts.helpers.*; import org.ihtsdo.otf.ts.rf2.*; | [
"org.ihtsdo.otf"
] | org.ihtsdo.otf; | 784,329 |
void modify(AbstractEpollChannel ch) throws IOException {
assert inEventLoop();
Native.epollCtlMod(epollFd, ch.fd().intValue(), ch.flags);
} | void modify(AbstractEpollChannel ch) throws IOException { assert inEventLoop(); Native.epollCtlMod(epollFd, ch.fd().intValue(), ch.flags); } | /**
* The flags of the given epoll was modified so update the registration
*/ | The flags of the given epoll was modified so update the registration | modify | {
"repo_name": "danbev/netty",
"path": "transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollEventLoop.java",
"license": "apache-2.0",
"size": 15314
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,486,447 |
private void checkCustom(String name) throws Exception {
for (int i = INIT_GRID_NUM; i < 20; i++) {
startGrid(i);
assert PARTITIONED == grid(i).cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getCacheMode();
try (Transaction tx = grid(i).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
GridCacheInternalKey key = new GridCacheInternalKeyImpl(name, "testGroup");
GridCacheAtomicLongValue atomicVal = ((GridCacheAtomicLongValue) grid(i).cache(DEFAULT_CACHE_NAME).get(key));
assertNotNull(atomicVal);
assertEquals("Custom check failed for node: " + i, (long) i, atomicVal.get());
atomicVal.set(i + 1);
grid(i).cache(DEFAULT_CACHE_NAME).put(key, atomicVal);
tx.commit();
}
stopGrid(i);
}
} | void function(String name) throws Exception { for (int i = INIT_GRID_NUM; i < 20; i++) { startGrid(i); assert PARTITIONED == grid(i).cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getCacheMode(); try (Transaction tx = grid(i).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { GridCacheInternalKey key = new GridCacheInternalKeyImpl(name, STR); GridCacheAtomicLongValue atomicVal = ((GridCacheAtomicLongValue) grid(i).cache(DEFAULT_CACHE_NAME).get(key)); assertNotNull(atomicVal); assertEquals(STR + i, (long) i, atomicVal.get()); atomicVal.set(i + 1); grid(i).cache(DEFAULT_CACHE_NAME).put(key, atomicVal); tx.commit(); } stopGrid(i); } } | /**
* Test {@link GridCacheInternalKey}/{@link GridCacheAtomicLongValue}.
* @param name Name.
* @throws Exception If failed.
*/ | Test <code>GridCacheInternalKey</code>/<code>GridCacheAtomicLongValue</code> | checkCustom | {
"repo_name": "samaitra/ignite",
"path": "modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedNodeRestartTxSelfTest.java",
"license": "apache-2.0",
"size": 9387
} | [
"org.apache.ignite.configuration.CacheConfiguration",
"org.apache.ignite.internal.processors.datastructures.GridCacheAtomicLongValue",
"org.apache.ignite.internal.processors.datastructures.GridCacheInternalKey",
"org.apache.ignite.internal.processors.datastructures.GridCacheInternalKeyImpl",
"org.apache.ignite.transactions.Transaction"
] | import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.internal.processors.datastructures.GridCacheAtomicLongValue; import org.apache.ignite.internal.processors.datastructures.GridCacheInternalKey; import org.apache.ignite.internal.processors.datastructures.GridCacheInternalKeyImpl; import org.apache.ignite.transactions.Transaction; | import org.apache.ignite.configuration.*; import org.apache.ignite.internal.processors.datastructures.*; import org.apache.ignite.transactions.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 2,842,132 |
public int getMaxRows() throws SQLException
{
return max_rows;
} | int function() throws SQLException { return max_rows; } | /**
*
* Get the maximum row count that can be returned by a result set.
* @see java.sql.Statement#getMaxRows
* @return the maximum rows
*
*/ | Get the maximum row count that can be returned by a result set | getMaxRows | {
"repo_name": "bharathravi/tinysql",
"path": "src/ORG/as220/tinySQL/tinySQLStatement.java",
"license": "lgpl-2.1",
"size": 18116
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 506,855 |
public Object createLoaderAndCallMethod(
String className, String methodName, File... files)
throws ReflectiveOperationException {
ClassLoader cl = createLoader(files);
Class c = cl.loadClass(className);
Method m = c.getMethod(methodName, (Class[]) null);
return m.invoke(null, (Object[]) null);
} | Object function( String className, String methodName, File... files) throws ReflectiveOperationException { ClassLoader cl = createLoader(files); Class c = cl.loadClass(className); Method m = c.getMethod(methodName, (Class[]) null); return m.invoke(null, (Object[]) null); } | /**
* Helper to construct a new DexClassLoader instance to test, using the
* given files as the class path, and call a named no-argument static
* method on a named class.
*
* @param className The name of the class of the method to call.
* @param methodName The name of the method to call.
* @param files The .dex or .jar files to use for the class path.
*/ | Helper to construct a new DexClassLoader instance to test, using the given files as the class path, and call a named no-argument static method on a named class | createLoaderAndCallMethod | {
"repo_name": "debian-pkg-android-tools/android-platform-libcore",
"path": "luni/src/test/java/dalvik/system/DexClassLoaderTest.java",
"license": "gpl-2.0",
"size": 16472
} | [
"java.io.File",
"java.lang.reflect.Method"
] | import java.io.File; import java.lang.reflect.Method; | import java.io.*; import java.lang.reflect.*; | [
"java.io",
"java.lang"
] | java.io; java.lang; | 2,501,571 |
@Column(name = "created_date", nullable = false)
public LocalDateTime getCreatedDate() {
return (LocalDateTime) get(5);
} | @Column(name = STR, nullable = false) LocalDateTime function() { return (LocalDateTime) get(5); } | /**
* Getter for <code>public.account_oauth.created_date</code>.
*/ | Getter for <code>public.account_oauth.created_date</code> | getCreatedDate | {
"repo_name": "CellarHQ/cellarhq.com",
"path": "model/src/main/generated/com/cellarhq/generated/tables/records/AccountOauthRecord.java",
"license": "mit",
"size": 8854
} | [
"java.time.LocalDateTime",
"javax.persistence.Column"
] | import java.time.LocalDateTime; import javax.persistence.Column; | import java.time.*; import javax.persistence.*; | [
"java.time",
"javax.persistence"
] | java.time; javax.persistence; | 1,870,897 |
public File getComponentFile(String entryName, TestDescription td) {
File entryFile = new File(entryName);
try {
if (entryFile.exists()) {
return entryFile;
}
} catch (SecurityException e) {
}
logger.log(Level.FINEST, "failed existance check on " + entryFile);
for (int i = 0; i < searchList.length; i++) {
String base = searchList[i] + "/";
String fqName;
if (td == null) {
td = getTestDescription();
}
if (td != null) {
String tdDir = td.getName().replace('\\', '/');
tdDir = tdDir.substring(0, tdDir.lastIndexOf("/"));
fqName = canonicalize(base + tdDir + "/" + entryName);
entryFile = new File(fqName);
try {
if (entryFile.exists()) {
return entryFile;
}
} catch (SecurityException e) {
logger.log(Level.FINEST, "Can't access " + entryFile, e);
}
logger.log(Level.FINEST,
"failed existance check on " + entryFile);
}
fqName = base + entryName;
entryFile = new File(fqName);
try {
if (entryFile.exists()) {
return entryFile;
}
} catch (SecurityException e) {
logger.log(Level.FINEST, "Can't access " + entryFile, e);
}
logger.log(Level.FINEST,
"failed existance check on " + entryFile);
}
return null;
} | File function(String entryName, TestDescription td) { File entryFile = new File(entryName); try { if (entryFile.exists()) { return entryFile; } } catch (SecurityException e) { } logger.log(Level.FINEST, STR + entryFile); for (int i = 0; i < searchList.length; i++) { String base = searchList[i] + "/"; String fqName; if (td == null) { td = getTestDescription(); } if (td != null) { String tdDir = td.getName().replace('\\', '/'); tdDir = tdDir.substring(0, tdDir.lastIndexOf("/")); fqName = canonicalize(base + tdDir + "/" + entryName); entryFile = new File(fqName); try { if (entryFile.exists()) { return entryFile; } } catch (SecurityException e) { logger.log(Level.FINEST, STR + entryFile, e); } logger.log(Level.FINEST, STR + entryFile); } fqName = base + entryName; entryFile = new File(fqName); try { if (entryFile.exists()) { return entryFile; } } catch (SecurityException e) { logger.log(Level.FINEST, STR + entryFile, e); } logger.log(Level.FINEST, STR + entryFile); } return null; } | /**
* Return the <code>File</code> associated with <code>entryName</code>.
* The working directory and components of the <code>searchPath</code>
* are searched for a file having the name <code>enterName</code>.
*
* @param entryName the name of the entry to locate, expressed as a
* relative file name
* @return the associated <code>File</code>, or <code>null</code> if no
* file is found
*/ | Return the <code>File</code> associated with <code>entryName</code>. The working directory and components of the <code>searchPath</code> are searched for a file having the name <code>enterName</code> | getComponentFile | {
"repo_name": "pfirmstone/river-internet",
"path": "qa/src/org/apache/river/qa/harness/QAConfig.java",
"license": "apache-2.0",
"size": 110034
} | [
"java.io.File",
"java.util.logging.Level"
] | import java.io.File; import java.util.logging.Level; | import java.io.*; import java.util.logging.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,650,259 |
public final void testIsActive7() {
ProcessorDef arg = create();
Project project = new Project();
project.setProperty("cond", "false");
arg.setProject(project);
arg.setUnless("cond");
try {
boolean isActive = arg.isActive();
} catch (BuildException ex) {
return;
}
fail("Should throw exception for suspicious value");
} | final void function() { ProcessorDef arg = create(); Project project = new Project(); project.setProperty("cond", "false"); arg.setProject(project); arg.setUnless("cond"); try { boolean isActive = arg.isActive(); } catch (BuildException ex) { return; } fail(STR); } | /**
* Tests that evaluating isActive when "unless" references a property with
* the value "false" throws an exception to warn of a suspicious value.
*
*/ | Tests that evaluating isActive when "unless" references a property with the value "false" throws an exception to warn of a suspicious value | testIsActive7 | {
"repo_name": "maven-nar/cpptasks-parallel",
"path": "src/test/java/com/github/maven_nar/cpptasks/TestProcessorDef.java",
"license": "apache-2.0",
"size": 8738
} | [
"com.github.maven_nar.cpptasks.ProcessorDef",
"org.apache.tools.ant.BuildException",
"org.apache.tools.ant.Project"
] | import com.github.maven_nar.cpptasks.ProcessorDef; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; | import com.github.maven_nar.cpptasks.*; import org.apache.tools.ant.*; | [
"com.github.maven_nar",
"org.apache.tools"
] | com.github.maven_nar; org.apache.tools; | 1,330,629 |
@Override
public void removeCheckingPaths(TreePath[] paths) {
for (TreePath path : paths) {
removeCheckingPath(path);
}
} | void function(TreePath[] paths) { for (TreePath path : paths) { removeCheckingPath(path); } } | /**
* Removes the paths from the checked paths set
*
* @param paths the paths to be removed
*/ | Removes the paths from the checked paths set | removeCheckingPaths | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.adempiere.libero.libero/src/main/java/it/cnr/imaa/essi/lablib/gui/checkboxtree/DefaultTreeCheckingModel.java",
"license": "gpl-2.0",
"size": 23860
} | [
"javax.swing.tree.TreePath"
] | import javax.swing.tree.TreePath; | import javax.swing.tree.*; | [
"javax.swing"
] | javax.swing; | 796,888 |
public static boolean supportsDynamicUpdate(final FormatOptions options) {
return options.mVersion >= FormatSpec.FIRST_VERSION_WITH_DYNAMIC_UPDATE
&& options.mSupportsDynamicUpdate;
} | static boolean function(final FormatOptions options) { return options.mVersion >= FormatSpec.FIRST_VERSION_WITH_DYNAMIC_UPDATE && options.mSupportsDynamicUpdate; } | /**
* Helper method to check whether the dictionary can be updated dynamically.
*/ | Helper method to check whether the dictionary can be updated dynamically | supportsDynamicUpdate | {
"repo_name": "renepickhardt/typology-keyboard",
"path": "java/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java",
"license": "gpl-2.0",
"size": 25445
} | [
"com.android.inputmethod.latin.makedict.FormatSpec"
] | import com.android.inputmethod.latin.makedict.FormatSpec; | import com.android.inputmethod.latin.makedict.*; | [
"com.android.inputmethod"
] | com.android.inputmethod; | 2,096,836 |
Point a = new Point(1, 1);
Point b = new Point(2, 1);
Point c = new Point(3, 4);
Triangle triangle = new Triangle(a, b, c);
double result = triangle.area();
double expected = 1.5D;
assertThat(result, closeTo(expected, 0.01));
} | Point a = new Point(1, 1); Point b = new Point(2, 1); Point c = new Point(3, 4); Triangle triangle = new Triangle(a, b, c); double result = triangle.area(); double expected = 1.5D; assertThat(result, closeTo(expected, 0.01)); } | /**
* Testing the situation when triangle is exists.
*/ | Testing the situation when triangle is exists | whenTriangleIsExistsThenReturnArea | {
"repo_name": "enekein/nzenkin",
"path": "chapter_001/src/test/java/ru/job4j/condition/TriangleTest.java",
"license": "apache-2.0",
"size": 1008
} | [
"org.hamcrest.number.IsCloseTo",
"org.junit.Assert"
] | import org.hamcrest.number.IsCloseTo; import org.junit.Assert; | import org.hamcrest.number.*; import org.junit.*; | [
"org.hamcrest.number",
"org.junit"
] | org.hamcrest.number; org.junit; | 2,442,229 |
public CstFieldRef getRef() {
return field;
} | CstFieldRef function() { return field; } | /**
* Gets the constant for the field.
*
* @return {@code non-null;} the constant
*/ | Gets the constant for the field | getRef | {
"repo_name": "alibaba/atlas",
"path": "atlas-gradle-plugin/dexpatch/src/main/java/com/taobao/android/dx/dex/file/EncodedField.java",
"license": "apache-2.0",
"size": 4346
} | [
"com.taobao.android.dx.rop.cst.CstFieldRef"
] | import com.taobao.android.dx.rop.cst.CstFieldRef; | import com.taobao.android.dx.rop.cst.*; | [
"com.taobao.android"
] | com.taobao.android; | 336,880 |
@Test
public void testNoSkipExecution_JUnit3SuiteMethod_ReturnsTestSuite() {
Request request =
builder.addTestClass(JUnit3SuiteMethod_ReturnsTestSuite.class.getName()).build();
JUnitCore testRunner = new JUnitCore();
ensureAllTestsFailed(testRunner.run(request), 1, "broken");
} | void function() { Request request = builder.addTestClass(JUnit3SuiteMethod_ReturnsTestSuite.class.getName()).build(); JUnitCore testRunner = new JUnitCore(); ensureAllTestsFailed(testRunner.run(request), 1, STR); } | /**
* Verify that a JUnit 3 suite method that returns a TestSuite is executed when skipExecution =
* false.
*/ | Verify that a JUnit 3 suite method that returns a TestSuite is executed when skipExecution = false | testNoSkipExecution_JUnit3SuiteMethod_ReturnsTestSuite | {
"repo_name": "android/android-test",
"path": "runner/android_junit_runner/javatests/androidx/test/internal/runner/TestRequestBuilderTest.java",
"license": "apache-2.0",
"size": 63900
} | [
"org.junit.runner.JUnitCore",
"org.junit.runner.Request"
] | import org.junit.runner.JUnitCore; import org.junit.runner.Request; | import org.junit.runner.*; | [
"org.junit.runner"
] | org.junit.runner; | 2,421,700 |
public void setWhenResourceMissingType(WhenResourceMissingTypeEnum whenResourceMissingType);
| void function(WhenResourceMissingTypeEnum whenResourceMissingType); | /**
* Sets the resource missing handling type.
* @param whenResourceMissingType the resource missing handling type
*/ | Sets the resource missing handling type | setWhenResourceMissingType | {
"repo_name": "sikachu/jasperreports",
"path": "src/net/sf/jasperreports/engine/JRDataset.java",
"license": "lgpl-3.0",
"size": 4760
} | [
"net.sf.jasperreports.engine.type.WhenResourceMissingTypeEnum"
] | import net.sf.jasperreports.engine.type.WhenResourceMissingTypeEnum; | import net.sf.jasperreports.engine.type.*; | [
"net.sf.jasperreports"
] | net.sf.jasperreports; | 2,529,672 |
public void updateCompleteRecord(DbKeyValMap recordPks, CompleteRecord replacementRecord)
throws OeDataSourceAccessException; | void function(DbKeyValMap recordPks, CompleteRecord replacementRecord) throws OeDataSourceAccessException; | /**
* Update existing record in the database(having the specified pk values) with the values of the input
* completeRecord
*
* @param recordPks Primary keys for the complete record to update
* @param replacementRecord the replacement CompleteRecord to update the original database record
* @throws edu.jhuapl.openessence.datasource.OeDataSourceAccessException
* if there is a problem executing the update statement.
*/ | Update existing record in the database(having the specified pk values) with the values of the input completeRecord | updateCompleteRecord | {
"repo_name": "sages-health/openessence-demo",
"path": "openessence-datasource/src/main/java/edu/jhuapl/openessence/datasource/entry/OeDataEntrySource.java",
"license": "apache-2.0",
"size": 6520
} | [
"edu.jhuapl.openessence.datasource.OeDataSourceAccessException"
] | import edu.jhuapl.openessence.datasource.OeDataSourceAccessException; | import edu.jhuapl.openessence.datasource.*; | [
"edu.jhuapl.openessence"
] | edu.jhuapl.openessence; | 2,309,327 |
final File folder = new File(path);
final File[] files = folder.listFiles();
final List<File> results = new ArrayList<>();
for (final File file : files) {
if (file.isFile() && file.getName().endsWith(".java")) {
results.add(file);
}
}
return results;
} | final File folder = new File(path); final File[] files = folder.listFiles(); final List<File> results = new ArrayList<>(); for (final File file : files) { if (file.isFile() && file.getName().endsWith(".java")) { results.add(file); } } return results; } | /**
* Returns all Java files in a directory specified by path
*
* @param path
* the current path of a directory
* @return a {@link java.util.List} of {@link java.io.File}s that are Java files
*/ | Returns all Java files in a directory specified by path | returnAllJavaFiles | {
"repo_name": "mdsol/skyfire",
"path": "src/main/java/com/mdsol/skyfire/util/JavaSupporter.java",
"license": "apache-2.0",
"size": 9106
} | [
"java.io.File",
"java.util.ArrayList",
"java.util.List"
] | import java.io.File; import java.util.ArrayList; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 831,527 |
public void putMetadatable(CacheGroup group, Object id, Object object) {
this.cacheManager.putMetadatable(group.toString(), id, object);
} | void function(CacheGroup group, Object id, Object object) { this.cacheManager.putMetadatable(group.toString(), id, object); } | /**
* Puts an object with an ID in the specified {@link CacheGroup} group parameter as metadatable cache item.
* <p>
* The id parameter can be used to retrieve the object from the cache.
*
* @param group the {@link CacheGroup} which the object should be placed in
* @param id the ID of the stored object.
* @param object the object that is going to be stored
*/ | Puts an object with an ID in the specified <code>CacheGroup</code> group parameter as metadatable cache item. The id parameter can be used to retrieve the object from the cache | putMetadatable | {
"repo_name": "craftfire/Bifrost",
"path": "src/main/java/com/craftfire/bifrost/classes/general/Cache.java",
"license": "lgpl-3.0",
"size": 8406
} | [
"com.craftfire.bifrost.enums.CacheGroup"
] | import com.craftfire.bifrost.enums.CacheGroup; | import com.craftfire.bifrost.enums.*; | [
"com.craftfire.bifrost"
] | com.craftfire.bifrost; | 1,414,531 |
public static CSTable extractColumns(CSTable table, String... colNames) {
int[] idx = {};
for (String name : colNames) {
idx = add(idx, columnIndexes(table, name));
}
if (idx.length == 0) {
throw new IllegalArgumentException("No such column names: " + Arrays.toString(colNames));
}
List<String> cols = new ArrayList<String>();
for (String name : colNames) {
cols.addAll(columnNames(table, name));
}
MemoryTable t = new MemoryTable();
t.setName(table.getName());
t.getInfo().putAll(table.getInfo());
// header
t.setColumns(cols.toArray(new String[0]));
for (int i = 0; i < idx.length; i++) {
t.getColumnInfo(i + 1).putAll(table.getColumnInfo(idx[i]));
}
String[] r = new String[idx.length];
for (String[] row : table.rows()) {
rowStringValues(row, idx, r);
t.addRow((Object[]) r);
}
return t;
} | static CSTable function(CSTable table, String... colNames) { int[] idx = {}; for (String name : colNames) { idx = add(idx, columnIndexes(table, name)); } if (idx.length == 0) { throw new IllegalArgumentException(STR + Arrays.toString(colNames)); } List<String> cols = new ArrayList<String>(); for (String name : colNames) { cols.addAll(columnNames(table, name)); } MemoryTable t = new MemoryTable(); t.setName(table.getName()); t.getInfo().putAll(table.getInfo()); t.setColumns(cols.toArray(new String[0])); for (int i = 0; i < idx.length; i++) { t.getColumnInfo(i + 1).putAll(table.getColumnInfo(idx[i])); } String[] r = new String[idx.length]; for (String[] row : table.rows()) { rowStringValues(row, idx, r); t.addRow((Object[]) r); } return t; } | /** Extract the columns and create another table.
*
* @param table the table
* @param colName the names of the columns to extract.
* @return A new Table with the Columns.
*/ | Extract the columns and create another table | extractColumns | {
"repo_name": "formeppe/NewAge-JGrass",
"path": "oms3/src/main/java/oms3/io/DataIO.java",
"license": "gpl-2.0",
"size": 61055
} | [
"java.util.ArrayList",
"java.util.Arrays",
"java.util.List"
] | import java.util.ArrayList; import java.util.Arrays; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,036,499 |
private void fixCtrlH() {
InputMap inputMap = getInputMap();
KeyStroke char010 = KeyStroke.getKeyStroke("typed \010");
InputMap parent = inputMap;
while (parent != null) {
parent.remove(char010);
parent = parent.getParent();
}
KeyStroke backspace = KeyStroke.getKeyStroke("BACK_SPACE");
inputMap.put(backspace, DefaultEditorKit.deletePrevCharAction);
}
| void function() { InputMap inputMap = getInputMap(); KeyStroke char010 = KeyStroke.getKeyStroke(STR); InputMap parent = inputMap; while (parent != null) { parent.remove(char010); parent = parent.getParent(); } KeyStroke backspace = KeyStroke.getKeyStroke(STR); inputMap.put(backspace, DefaultEditorKit.deletePrevCharAction); } | /**
* Removes the "Ctrl+H <=> Backspace" behavior that Java shows, for some
* odd reason...
*/ | Removes the "Ctrl+H Backspace" behavior that Java shows, for some odd reason.. | fixCtrlH | {
"repo_name": "freddy-realirm/BPMNEditor-For-Protege-Essential",
"path": "src/org/fife/ui/rtextarea/RTextArea.java",
"license": "gpl-3.0",
"size": 30911
} | [
"javax.swing.InputMap",
"javax.swing.KeyStroke",
"javax.swing.text.DefaultEditorKit"
] | import javax.swing.InputMap; import javax.swing.KeyStroke; import javax.swing.text.DefaultEditorKit; | import javax.swing.*; import javax.swing.text.*; | [
"javax.swing"
] | javax.swing; | 2,907,376 |
LoadBalancerGetResponse get(String resourceGroupName, String loadBalancerName) throws IOException, ServiceException; | LoadBalancerGetResponse get(String resourceGroupName, String loadBalancerName) throws IOException, ServiceException; | /**
* The Get ntework interface operation retreives information about the
* specified network interface.
*
* @param resourceGroupName Required. The name of the resource group.
* @param loadBalancerName Required. The name of the loadBalancer.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @return Response of a GET Load Balancer operation
*/ | The Get ntework interface operation retreives information about the specified network interface | get | {
"repo_name": "southworkscom/azure-sdk-for-java",
"path": "resource-management/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancerOperations.java",
"license": "apache-2.0",
"size": 11929
} | [
"com.microsoft.azure.management.network.models.LoadBalancerGetResponse",
"com.microsoft.windowsazure.exception.ServiceException",
"java.io.IOException"
] | import com.microsoft.azure.management.network.models.LoadBalancerGetResponse; import com.microsoft.windowsazure.exception.ServiceException; import java.io.IOException; | import com.microsoft.azure.management.network.models.*; import com.microsoft.windowsazure.exception.*; import java.io.*; | [
"com.microsoft.azure",
"com.microsoft.windowsazure",
"java.io"
] | com.microsoft.azure; com.microsoft.windowsazure; java.io; | 1,993,229 |
private void showAdminForm(PrintWriter out, boolean advancedView) {
out.print("<h2>Scheduling Mode</h2>\n");
String curMode = scheduler.getUseFifo() ? "FIFO" : "Fair Sharing";
String otherMode = scheduler.getUseFifo() ? "Fair Sharing" : "FIFO";
String advParam = advancedView ? "?advanced" : "";
out.printf("<form method=\"post\" action=\"/scheduler%s\">\n", advParam);
out.printf("<p>The scheduler is currently using <b>%s mode</b>. " +
"<input type=\"submit\" value=\"Switch to %s mode.\" " +
"onclick=\"return confirm('Are you sure you want to change " +
"scheduling mode to %s?')\" />\n",
curMode, otherMode, otherMode);
out.printf("<input type=\"hidden\" name=\"setFifo\" value=\"%s\" />",
!scheduler.getUseFifo());
out.print("</form>\n");
} | void function(PrintWriter out, boolean advancedView) { out.print(STR); String curMode = scheduler.getUseFifo() ? "FIFO" : STR; String otherMode = scheduler.getUseFifo() ? STR : "FIFO"; String advParam = advancedView ? STR : STR<form method=\"post\" action=\STR>\nSTR<p>The scheduler is currently using <b>%s mode</b>. STR<input type=\STR value=\STR STRonclick=\"return confirm('Are you sure you want to change STRscheduling mode to %s?')\" />\nSTR<input type=\STR name=\STR value=\"%s\" />STR</form>\n"); } | /**
* Print the administration form at the bottom of the page, which currently
* only includes the button for switching between FIFO and Fair Scheduling.
*/ | Print the administration form at the bottom of the page, which currently only includes the button for switching between FIFO and Fair Scheduling | showAdminForm | {
"repo_name": "dhootha/hadoop-common",
"path": "src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java",
"license": "apache-2.0",
"size": 12657
} | [
"java.io.PrintWriter"
] | import java.io.PrintWriter; | import java.io.*; | [
"java.io"
] | java.io; | 269,822 |
public static BatteryLevelPeriodicCollector newBatteryLevelPeriodicCollector(ClientChannel aClientChannel,
Context anApplicationContext,
long aPeriodInMilliseconds) {
return new BatteryLevelPeriodicCollector(aClientChannel, anApplicationContext, aPeriodInMilliseconds);
} | static BatteryLevelPeriodicCollector function(ClientChannel aClientChannel, Context anApplicationContext, long aPeriodInMilliseconds) { return new BatteryLevelPeriodicCollector(aClientChannel, anApplicationContext, aPeriodInMilliseconds); } | /**
* Get a periodic battery level collector
*
* @param aClientChannel
* The client channel that will be used to send the context
* elements
* @param anApplicationContext
* The application context
* @param aPeriodInMilliseconds
* The delay between context updates
*
* @return a BatteryLevelPeriodicCollector instance.
*/ | Get a periodic battery level collector | newBatteryLevelPeriodicCollector | {
"repo_name": "Motwin/ContextAwareLibrary",
"path": "Android/ContextAwareAndroidLib/com.motwin.android.contextaware/src/main/java/com/motwin/android/context/Collectors.java",
"license": "gpl-2.0",
"size": 32970
} | [
"android.content.Context",
"com.motwin.android.context.collector.impl.BatteryLevelPeriodicCollector",
"com.motwin.android.network.clientchannel.ClientChannel"
] | import android.content.Context; import com.motwin.android.context.collector.impl.BatteryLevelPeriodicCollector; import com.motwin.android.network.clientchannel.ClientChannel; | import android.content.*; import com.motwin.android.context.collector.impl.*; import com.motwin.android.network.clientchannel.*; | [
"android.content",
"com.motwin.android"
] | android.content; com.motwin.android; | 1,451,531 |
protected void execFireDisabling(Game p_game)
{
if( isFdComputed() )
{
// save CPU by avoiding recompute fire disabling flags
p_game.getBoardFireCover().addFireDisabling( getFdAdded() );
p_game.getBoardFireCover().removeFireDisabling( getFdRemoved() );
}
else
{
List<FireDisabling> fdRemoved = new ArrayList<FireDisabling>();
List<FireDisabling> fdAdded = new ArrayList<FireDisabling>();
p_game.getBoardFireCover().reComputeFireCover( fdRemoved, fdAdded );
addFdRemoved( fdRemoved );
addFdAdded( fdAdded );
setFdComputed( true );
}
}
| void function(Game p_game) { if( isFdComputed() ) { p_game.getBoardFireCover().addFireDisabling( getFdAdded() ); p_game.getBoardFireCover().removeFireDisabling( getFdRemoved() ); } else { List<FireDisabling> fdRemoved = new ArrayList<FireDisabling>(); List<FireDisabling> fdAdded = new ArrayList<FireDisabling>(); p_game.getBoardFireCover().reComputeFireCover( fdRemoved, fdAdded ); addFdRemoved( fdRemoved ); addFdAdded( fdAdded ); setFdComputed( true ); } } | /**
* recompute fire cover and check for all token his fire disabled flag
* @param p_game
*/ | recompute fire cover and check for all token his fire disabled flag | execFireDisabling | {
"repo_name": "kroc702/fullmetalgalaxy",
"path": "src/com/fullmetalgalaxy/model/persist/gamelog/AnEvent.java",
"license": "agpl-3.0",
"size": 9964
} | [
"com.fullmetalgalaxy.model.persist.FireDisabling",
"com.fullmetalgalaxy.model.persist.Game",
"java.util.ArrayList",
"java.util.List"
] | import com.fullmetalgalaxy.model.persist.FireDisabling; import com.fullmetalgalaxy.model.persist.Game; import java.util.ArrayList; import java.util.List; | import com.fullmetalgalaxy.model.persist.*; import java.util.*; | [
"com.fullmetalgalaxy.model",
"java.util"
] | com.fullmetalgalaxy.model; java.util; | 500,450 |
public Tube createValidationTube(Tube next) {
if (binding instanceof SOAPBinding && binding.isFeatureEnabled(SchemaValidationFeature.class) && wsdlModel!=null)
return new ClientSchemaValidationTube(binding, wsdlModel, next);
else
return next;
} | Tube function(Tube next) { if (binding instanceof SOAPBinding && binding.isFeatureEnabled(SchemaValidationFeature.class) && wsdlModel!=null) return new ClientSchemaValidationTube(binding, wsdlModel, next); else return next; } | /**
* creates a {@link Tube} that validates messages against schema
*/ | creates a <code>Tube</code> that validates messages against schema | createValidationTube | {
"repo_name": "axDev-JDK/jaxws",
"path": "src/share/jaxws_classes/com/sun/xml/internal/ws/api/pipe/ClientTubeAssemblerContext.java",
"license": "gpl-2.0",
"size": 13884
} | [
"com.sun.xml.internal.ws.client.ClientSchemaValidationTube",
"com.sun.xml.internal.ws.developer.SchemaValidationFeature",
"javax.xml.ws.soap.SOAPBinding"
] | import com.sun.xml.internal.ws.client.ClientSchemaValidationTube; import com.sun.xml.internal.ws.developer.SchemaValidationFeature; import javax.xml.ws.soap.SOAPBinding; | import com.sun.xml.internal.ws.client.*; import com.sun.xml.internal.ws.developer.*; import javax.xml.ws.soap.*; | [
"com.sun.xml",
"javax.xml"
] | com.sun.xml; javax.xml; | 1,975,270 |
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred.
mDrawerToggle.syncState();
} | void function(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); mDrawerToggle.syncState(); } | /**
* When using the ActionBarDrawerToggle, you must call it during
* onPostCreate() and onConfigurationChanged()...
*/ | When using the ActionBarDrawerToggle, you must call it during onPostCreate() and onConfigurationChanged().. | onPostCreate | {
"repo_name": "GreenCoders/GuiltTrip",
"path": "src/com/swachhand/android/guilttrip/MainActivity.java",
"license": "gpl-2.0",
"size": 6528
} | [
"android.os.Bundle"
] | import android.os.Bundle; | import android.os.*; | [
"android.os"
] | android.os; | 983,251 |
public Calendar getCurrentCalendar() {
return Calendar.getInstance(DateUtil.UTC);
} | Calendar function() { return Calendar.getInstance(DateUtil.UTC); } | /**
* Testers can override this to provide a consistent test.
*
* @return Calendar instance. Never null.
*/ | Testers can override this to provide a consistent test | getCurrentCalendar | {
"repo_name": "opencadc/core",
"path": "cadc-util/src/main/java/ca/nrc/cadc/auth/SSOCookieManager.java",
"license": "agpl-3.0",
"size": 10567
} | [
"ca.nrc.cadc.date.DateUtil",
"java.util.Calendar"
] | import ca.nrc.cadc.date.DateUtil; import java.util.Calendar; | import ca.nrc.cadc.date.*; import java.util.*; | [
"ca.nrc.cadc",
"java.util"
] | ca.nrc.cadc; java.util; | 2,423,490 |
@Override
public int executeUpdate(String updateSql) throws JdbcServerException {
log.info("Received execute update request: " + updateSql);
Message response = handleMessageAndCheckResponse(JdbcMessage.execute(updateSql));
return Optional.ofNullable(
response.getHeader(JdbcMessageHeaders.JDBC_ROWS_UPDATED))
.map(Object::toString).map(Integer::valueOf)
.orElse(0);
} | int function(String updateSql) throws JdbcServerException { log.info(STR + updateSql); Message response = handleMessageAndCheckResponse(JdbcMessage.execute(updateSql)); return Optional.ofNullable( response.getHeader(JdbcMessageHeaders.JDBC_ROWS_UPDATED)) .map(Object::toString).map(Integer::valueOf) .orElse(0); } | /**
* Executes the given update
* @param updateSql The update statement to be executed
* @throws JdbcServerException In case that the execution was not successful
*/ | Executes the given update | executeUpdate | {
"repo_name": "christophd/citrus",
"path": "endpoints/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java",
"license": "apache-2.0",
"size": 16124
} | [
"com.consol.citrus.db.server.JdbcServerException",
"com.consol.citrus.jdbc.message.JdbcMessage",
"com.consol.citrus.jdbc.message.JdbcMessageHeaders",
"com.consol.citrus.message.Message",
"java.util.Optional"
] | import com.consol.citrus.db.server.JdbcServerException; import com.consol.citrus.jdbc.message.JdbcMessage; import com.consol.citrus.jdbc.message.JdbcMessageHeaders; import com.consol.citrus.message.Message; import java.util.Optional; | import com.consol.citrus.db.server.*; import com.consol.citrus.jdbc.message.*; import com.consol.citrus.message.*; import java.util.*; | [
"com.consol.citrus",
"java.util"
] | com.consol.citrus; java.util; | 437,534 |
public static <T extends HelixProperty> List<ZNRecord> convertToList(List<T> typedInstances) {
if (typedInstances == null) {
return Collections.emptyList();
}
List<ZNRecord> records = new ArrayList<ZNRecord>();
for (T typedInstance : typedInstances) {
records.add(typedInstance.getRecord());
}
return records;
} | static <T extends HelixProperty> List<ZNRecord> function(List<T> typedInstances) { if (typedInstances == null) { return Collections.emptyList(); } List<ZNRecord> records = new ArrayList<ZNRecord>(); for (T typedInstance : typedInstances) { records.add(typedInstance.getRecord()); } return records; } | /**
* Convert typed properties to a list of records
* @param typedInstances objects subclassing HelixProperty
* @return a list of ZNRecord objects
*/ | Convert typed properties to a list of records | convertToList | {
"repo_name": "kishoreg/helix-actors",
"path": "helix-core/src/main/java/org/apache/helix/HelixProperty.java",
"license": "apache-2.0",
"size": 6693
} | [
"java.util.ArrayList",
"java.util.Collections",
"java.util.List"
] | import java.util.ArrayList; import java.util.Collections; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 150,819 |
public final Property<String> name() {
return metaBean().name().createProperty(this);
} | final Property<String> function() { return metaBean().name().createProperty(this); } | /**
* Gets the the {@code name} property.
* @return the property, not null
*/ | Gets the the name property | name | {
"repo_name": "McLeodMoores/starling",
"path": "projects/master-db/src/main/java/com/opengamma/masterdb/security/hibernate/cds/CDSIndexComponentBean.java",
"license": "apache-2.0",
"size": 10684
} | [
"org.joda.beans.Property"
] | import org.joda.beans.Property; | import org.joda.beans.*; | [
"org.joda.beans"
] | org.joda.beans; | 2,557,649 |
public byte[] encodeKey(PrivateKey key) throws EncodingException; | byte[] function(PrivateKey key) throws EncodingException; | /**
* Encode a private key into a byte array
* @param key The key to encode.
* @return The encoded key in the X.509 ASN1Sequence format.
* @throws EncodingException
*/ | Encode a private key into a byte array | encodeKey | {
"repo_name": "tcat-tamu/crypto",
"path": "bundles/edu.tamu.tcat.crypto/src/edu/tamu/tcat/crypto/ASN1SeqKey.java",
"license": "apache-2.0",
"size": 1431
} | [
"java.security.PrivateKey"
] | import java.security.PrivateKey; | import java.security.*; | [
"java.security"
] | java.security; | 2,856,839 |
public boolean makeStash(StoreableBreakdown storedData, String attributeKey, HttpSession session); | boolean function(StoreableBreakdown storedData, String attributeKey, HttpSession session); | /**
* Allows this implementation to optionally handle stashing the cached data
* which cannot be rebuilt into the session immediately
*
* @param storedData the container holding the serialized data from the distributed store
* @param attributeKey the session attribute key name that was supposed to hold this storedData
* @param session the session the data was supposed to be placed into (might not be the user session, may be a tool or context session)
* @return true if the data was handled in this implementation (or is no longer relevant) and the service can dump it,
* false if the data needs to be stashed in the service (for a very limited time)
*/ | Allows this implementation to optionally handle stashing the cached data which cannot be rebuilt into the session immediately | makeStash | {
"repo_name": "conder/sakai",
"path": "kernel/api/src/main/java/org/sakaiproject/tool/api/BreakdownRebuildCallback.java",
"license": "apache-2.0",
"size": 2261
} | [
"javax.servlet.http.HttpSession"
] | import javax.servlet.http.HttpSession; | import javax.servlet.http.*; | [
"javax.servlet"
] | javax.servlet; | 2,802,944 |
public boolean isSaved(Object object) throws HibernateException; | boolean function(Object object) throws HibernateException; | /**
* Was this object already saved to the database?
*/ | Was this object already saved to the database | isSaved | {
"repo_name": "simeshev/parabuild-ci",
"path": "3rdparty/hibernate218/src/net/sf/hibernate/engine/SessionImplementor.java",
"license": "lgpl-3.0",
"size": 9384
} | [
"net.sf.hibernate.HibernateException"
] | import net.sf.hibernate.HibernateException; | import net.sf.hibernate.*; | [
"net.sf.hibernate"
] | net.sf.hibernate; | 1,198,970 |
public List<T> queryByIdentity(Client c, String identity) throws BusinessObjectNotFoundException;
| List<T> function(Client c, String identity) throws BusinessObjectNotFoundException; | /**
* Some entities are only unique by an attribute in conjunction with the client (i.e. ItemData, Lot)
*
* @param c
* @param identity
* @return
* @throws BusinessObjectNotFoundException
*/ | Some entities are only unique by an attribute in conjunction with the client (i.e. ItemData, Lot) | queryByIdentity | {
"repo_name": "Jacksson/mywms",
"path": "server.app/los.common-ejb/src/de/linogistix/los/query/BusinessObjectQueryRemote.java",
"license": "gpl-2.0",
"size": 6696
} | [
"de.linogistix.los.query.exception.BusinessObjectNotFoundException",
"java.util.List",
"org.mywms.model.Client"
] | import de.linogistix.los.query.exception.BusinessObjectNotFoundException; import java.util.List; import org.mywms.model.Client; | import de.linogistix.los.query.exception.*; import java.util.*; import org.mywms.model.*; | [
"de.linogistix.los",
"java.util",
"org.mywms.model"
] | de.linogistix.los; java.util; org.mywms.model; | 1,721,952 |
public static String base64Encode(byte[] data) {
return Base64.getEncoder().encodeToString(data);
} | static String function(byte[] data) { return Base64.getEncoder().encodeToString(data); } | /**
* Encode into Base64
*
* @param data to encode
* @return encoded data
*/ | Encode into Base64 | base64Encode | {
"repo_name": "sbouclier/kraken-java-api-client",
"path": "src/main/java/com/github/sbouclier/utils/Base64Utils.java",
"license": "mit",
"size": 738
} | [
"java.util.Base64"
] | import java.util.Base64; | import java.util.*; | [
"java.util"
] | java.util; | 2,246,927 |
private static void performVersionChecks(String minSpringVersion) {
// Check Spring Compatibility
String springVersion = SpringVersion.getVersion();
String version = getVersion();
if (disableChecks(springVersion, version)) {
return;
}
logger.info("You are running with Spring Security Core " + version);
if (new ComparableVersion(springVersion).compareTo(new ComparableVersion(
minSpringVersion)) < 0) {
logger.warn("**** You are advised to use Spring " + minSpringVersion
+ " or later with this version. You are running: " + springVersion);
}
} | static void function(String minSpringVersion) { String springVersion = SpringVersion.getVersion(); String version = getVersion(); if (disableChecks(springVersion, version)) { return; } logger.info(STR + version); if (new ComparableVersion(springVersion).compareTo(new ComparableVersion( minSpringVersion)) < 0) { logger.warn(STR + minSpringVersion + STR + springVersion); } } | /**
* Perform version checks with specific min Spring Version
*
* @param minSpringVersion
*/ | Perform version checks with specific min Spring Version | performVersionChecks | {
"repo_name": "ajdinhedzic/spring-security",
"path": "core/src/main/java/org/springframework/security/core/SpringSecurityCoreVersion.java",
"license": "apache-2.0",
"size": 2347
} | [
"org.springframework.core.SpringVersion"
] | import org.springframework.core.SpringVersion; | import org.springframework.core.*; | [
"org.springframework.core"
] | org.springframework.core; | 1,921,547 |
private boolean symbolNeedsToBeScope(final Symbol symbol) {
if (symbol.isThis() || symbol.isInternal()) {
return false;
}
final FunctionNode func = lc.getCurrentFunction();
if ( func.allVarsInScope() || (!symbol.isBlockScoped() && func.isProgram())) {
return true;
}
boolean previousWasBlock = false;
for (final Iterator<LexicalContextNode> it = lc.getAllNodes(); it.hasNext();) {
final LexicalContextNode node = it.next();
if (node instanceof FunctionNode || isSplitArray(node)) {
// We reached the function boundary or a splitting boundary without seeing a definition for the symbol.
// It needs to be in scope.
return true;
} else if (node instanceof WithNode) {
if (previousWasBlock) {
// We reached a WithNode; the symbol must be scoped. Note that if the WithNode was not immediately
// preceded by a block, this means we're currently processing its expression, not its body,
// therefore it doesn't count.
return true;
}
previousWasBlock = false;
} else if (node instanceof Block) {
if (((Block)node).getExistingSymbol(symbol.getName()) == symbol) {
// We reached the block that defines the symbol without reaching either the function boundary, or a
// WithNode. The symbol need not be scoped.
return false;
}
previousWasBlock = true;
} else {
previousWasBlock = false;
}
}
throw new AssertionError();
} | boolean function(final Symbol symbol) { if (symbol.isThis() symbol.isInternal()) { return false; } final FunctionNode func = lc.getCurrentFunction(); if ( func.allVarsInScope() (!symbol.isBlockScoped() && func.isProgram())) { return true; } boolean previousWasBlock = false; for (final Iterator<LexicalContextNode> it = lc.getAllNodes(); it.hasNext();) { final LexicalContextNode node = it.next(); if (node instanceof FunctionNode isSplitArray(node)) { return true; } else if (node instanceof WithNode) { if (previousWasBlock) { return true; } previousWasBlock = false; } else if (node instanceof Block) { if (((Block)node).getExistingSymbol(symbol.getName()) == symbol) { return false; } previousWasBlock = true; } else { previousWasBlock = false; } } throw new AssertionError(); } | /**
* Determines if the symbol has to be a scope symbol. In general terms, it has to be a scope symbol if it can only
* be reached from the current block by traversing a function node, a split node, or a with node.
* @param symbol the symbol checked for needing to be a scope symbol
* @return true if the symbol has to be a scope symbol.
*/ | Determines if the symbol has to be a scope symbol. In general terms, it has to be a scope symbol if it can only be reached from the current block by traversing a function node, a split node, or a with node | symbolNeedsToBeScope | {
"repo_name": "malaporte/kaziranga",
"path": "src/jdk/nashorn/internal/codegen/AssignSymbols.java",
"license": "gpl-2.0",
"size": 44741
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 1,374,232 |
public static void fadeOut(final View v) {
if (v.getVisibility() == View.VISIBLE) {
AlphaAnimation fadeOut = new AlphaAnimation(1F, 0F);
fadeOut.setAnimationListener(new AnimationListener() {
| static void function(final View v) { if (v.getVisibility() == View.VISIBLE) { AlphaAnimation fadeOut = new AlphaAnimation(1F, 0F); fadeOut.setAnimationListener(new AnimationListener() { | /**
* Fades the specified view out.
*
* @param v
* the view to fade out
*/ | Fades the specified view out | fadeOut | {
"repo_name": "MadKauz/starcitizeninfoclient",
"path": "starCitizenInformer/src/main/java/de/kauz/starcitizen/informer/utils/ViewHelper.java",
"license": "apache-2.0",
"size": 6501
} | [
"android.view.View",
"android.view.animation.AlphaAnimation",
"android.view.animation.Animation"
] | import android.view.View; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; | import android.view.*; import android.view.animation.*; | [
"android.view"
] | android.view; | 1,103,735 |
public ServiceFuture<Void> reimageAsync(String resourceGroupName, String vmName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(reimageWithServiceResponseAsync(resourceGroupName, vmName), serviceCallback);
} | ServiceFuture<Void> function(String resourceGroupName, String vmName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(reimageWithServiceResponseAsync(resourceGroupName, vmName), serviceCallback); } | /**
* Reimages the virtual machine which has an ephemeral OS disk back to its initial state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Reimages the virtual machine which has an ephemeral OS disk back to its initial state | reimageAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachinesInner.java",
"license": "mit",
"size": 261375
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 1,926,623 |
private static boolean callResultsMaybeUsed(
DefinitionUseSiteFinder defFinder, DefinitionSite definitionSite) {
Definition definition = definitionSite.definition;
// Assume non-function definitions results are used.
Node rValue = definition.getRValue();
if (rValue == null || !rValue.isFunction()) {
return true;
}
// Be conservative, don't try to optimize any declaration that isn't as
// simple function declaration or assignment.
if (!NodeUtil.isSimpleFunctionDeclaration(rValue)) {
return true;
}
if (!defFinder.canModifyDefinition(definition)) {
return true;
}
Collection<UseSite> useSites = defFinder.getUseSites(definition);
for (UseSite site : useSites) {
// Assume indirect definitions references use the result
Node useNodeParent = site.node.getParent();
if (isCall(site)) {
Node callNode = useNodeParent;
Preconditions.checkState(callNode.isCall());
if (NodeUtil.isExpressionResultUsed(callNode)) {
return true;
}
} else {
// Allow a standalone name reference.
// var a;
if (!useNodeParent.isVar()) {
return true;
}
}
}
// No possible use of the definition result
return false;
} | static boolean function( DefinitionUseSiteFinder defFinder, DefinitionSite definitionSite) { Definition definition = definitionSite.definition; Node rValue = definition.getRValue(); if (rValue == null !rValue.isFunction()) { return true; } if (!NodeUtil.isSimpleFunctionDeclaration(rValue)) { return true; } if (!defFinder.canModifyDefinition(definition)) { return true; } Collection<UseSite> useSites = defFinder.getUseSites(definition); for (UseSite site : useSites) { Node useNodeParent = site.node.getParent(); if (isCall(site)) { Node callNode = useNodeParent; Preconditions.checkState(callNode.isCall()); if (NodeUtil.isExpressionResultUsed(callNode)) { return true; } } else { if (!useNodeParent.isVar()) { return true; } } } return false; } | /**
* Determines if a function result might be used. A result might be use if:
* - Function must is exported.
* - The definition is never accessed outside a function call context.
*/ | Determines if a function result might be used. A result might be use if: - Function must is exported. - The definition is never accessed outside a function call context | callResultsMaybeUsed | {
"repo_name": "brad4d/closure-compiler",
"path": "src/com/google/javascript/jscomp/OptimizeReturns.java",
"license": "apache-2.0",
"size": 5311
} | [
"com.google.common.base.Preconditions",
"com.google.javascript.jscomp.DefinitionsRemover",
"com.google.javascript.rhino.Node",
"java.util.Collection"
] | import com.google.common.base.Preconditions; import com.google.javascript.jscomp.DefinitionsRemover; import com.google.javascript.rhino.Node; import java.util.Collection; | import com.google.common.base.*; import com.google.javascript.jscomp.*; import com.google.javascript.rhino.*; import java.util.*; | [
"com.google.common",
"com.google.javascript",
"java.util"
] | com.google.common; com.google.javascript; java.util; | 1,900,586 |
@SneakyThrows
protected SAMLObject encryptAssertion(final Assertion assertion,
final HttpServletRequest request,
final HttpServletResponse response,
final SamlRegisteredService service,
final SamlRegisteredServiceServiceProviderMetadataFacade adaptor) throws SamlException {
if (service.isEncryptAssertions()) {
LOGGER.debug("SAML service [{}] requires assertions to be encrypted", adaptor.getEntityId());
val encrypted = samlResponseBuilderConfigurationContext.getSamlObjectEncrypter().encode(assertion, service, adaptor);
if (encrypted == null) {
LOGGER.debug("SAML registered service [{}] is unable to encrypt assertions", adaptor.getEntityId());
return assertion;
}
return encrypted;
}
LOGGER.debug("SAML registered service [{}] does not require assertions to be encrypted", adaptor.getEntityId());
return assertion;
} | SAMLObject function(final Assertion assertion, final HttpServletRequest request, final HttpServletResponse response, final SamlRegisteredService service, final SamlRegisteredServiceServiceProviderMetadataFacade adaptor) throws SamlException { if (service.isEncryptAssertions()) { LOGGER.debug(STR, adaptor.getEntityId()); val encrypted = samlResponseBuilderConfigurationContext.getSamlObjectEncrypter().encode(assertion, service, adaptor); if (encrypted == null) { LOGGER.debug(STR, adaptor.getEntityId()); return assertion; } return encrypted; } LOGGER.debug(STR, adaptor.getEntityId()); return assertion; } | /**
* Encrypt assertion.
*
* @param assertion the assertion
* @param request the request
* @param response the response
* @param service the service
* @param adaptor the adaptor
* @return the saml object
* @throws SamlException the saml exception
*/ | Encrypt assertion | encryptAssertion | {
"repo_name": "philliprower/cas",
"path": "support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/response/BaseSamlProfileSamlResponseBuilder.java",
"license": "apache-2.0",
"size": 10216
} | [
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.apereo.cas.support.saml.SamlException",
"org.apereo.cas.support.saml.services.SamlRegisteredService",
"org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade",
"org.opensaml.saml.common.SAMLObject",
"org.opensaml.saml.saml2.core.Assertion"
] | import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apereo.cas.support.saml.SamlException; import org.apereo.cas.support.saml.services.SamlRegisteredService; import org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade; import org.opensaml.saml.common.SAMLObject; import org.opensaml.saml.saml2.core.Assertion; | import javax.servlet.http.*; import org.apereo.cas.support.saml.*; import org.apereo.cas.support.saml.services.*; import org.apereo.cas.support.saml.services.idp.metadata.*; import org.opensaml.saml.common.*; import org.opensaml.saml.saml2.core.*; | [
"javax.servlet",
"org.apereo.cas",
"org.opensaml.saml"
] | javax.servlet; org.apereo.cas; org.opensaml.saml; | 184,790 |
public InputStream doHttpPost2(String url, NameValuePair... nameValuePairs)
throws Exception {
HttpPost httpPost = createHttpPost(url, nameValuePairs);
HttpResponse response = executeHttpRequest(httpPost);
switch (response.getStatusLine().getStatusCode()) {
case 200:
try {
return response.getEntity().getContent();
} catch (ParseException e) {
throw new Exception(e.getMessage());
}
case 401:
response.getEntity().consumeContent();
throw new Exception(response.getStatusLine().toString());
case 404:
response.getEntity().consumeContent();
throw new Exception(response.getStatusLine().toString());
default:
response.getEntity().consumeContent();
throw new Exception(response.getStatusLine().toString());
}
} | InputStream function(String url, NameValuePair... nameValuePairs) throws Exception { HttpPost httpPost = createHttpPost(url, nameValuePairs); HttpResponse response = executeHttpRequest(httpPost); switch (response.getStatusLine().getStatusCode()) { case 200: try { return response.getEntity().getContent(); } catch (ParseException e) { throw new Exception(e.getMessage()); } case 401: response.getEntity().consumeContent(); throw new Exception(response.getStatusLine().toString()); case 404: response.getEntity().consumeContent(); throw new Exception(response.getStatusLine().toString()); default: response.getEntity().consumeContent(); throw new Exception(response.getStatusLine().toString()); } } | /**
* execute a HttpPost
* @return InputStream
*/ | execute a HttpPost | doHttpPost2 | {
"repo_name": "haodynasty/BasePlusubLib",
"path": "PlusubBaseLib/src/main/java/com/plusub/lib/net/HttpClient.java",
"license": "apache-2.0",
"size": 15831
} | [
"java.io.InputStream",
"org.apache.http.HttpResponse",
"org.apache.http.NameValuePair",
"org.apache.http.ParseException",
"org.apache.http.client.methods.HttpPost"
] | import java.io.InputStream; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.ParseException; import org.apache.http.client.methods.HttpPost; | import java.io.*; import org.apache.http.*; import org.apache.http.client.methods.*; | [
"java.io",
"org.apache.http"
] | java.io; org.apache.http; | 2,285,686 |
public Object getFromLocalBucket(int bucketId, final Object key, final Object aCallbackArgument,
boolean disableCopyOnRead, boolean preferCD, ClientProxyMembershipID requestingClient,
EntryEventImpl clientEvent, boolean returnTombstones)
throws ForceReattemptException, PRLocallyDestroyedException {
Object obj;
// try reading locally.
InternalDistributedMember readNode = getNodeForBucketRead(bucketId);
if (readNode == null) {
return null; // fixes 51657
}
if (readNode.equals(getMyId())
&& null != (obj = this.dataStore.getLocally(bucketId, key, aCallbackArgument,
disableCopyOnRead, preferCD, requestingClient, clientEvent, returnTombstones, true))) {
if (logger.isTraceEnabled()) {
logger.trace("getFromBucket: Getting key {} ({}) locally - success", key, key.hashCode());
}
return obj;
}
return null;
} | Object function(int bucketId, final Object key, final Object aCallbackArgument, boolean disableCopyOnRead, boolean preferCD, ClientProxyMembershipID requestingClient, EntryEventImpl clientEvent, boolean returnTombstones) throws ForceReattemptException, PRLocallyDestroyedException { Object obj; InternalDistributedMember readNode = getNodeForBucketRead(bucketId); if (readNode == null) { return null; } if (readNode.equals(getMyId()) && null != (obj = this.dataStore.getLocally(bucketId, key, aCallbackArgument, disableCopyOnRead, preferCD, requestingClient, clientEvent, returnTombstones, true))) { if (logger.isTraceEnabled()) { logger.trace(STR, key, key.hashCode()); } return obj; } return null; } | /**
* If a bucket is local, try to fetch the value from it
*/ | If a bucket is local, try to fetch the value from it | getFromLocalBucket | {
"repo_name": "PurelyApplied/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java",
"license": "apache-2.0",
"size": 379321
} | [
"org.apache.geode.distributed.internal.membership.InternalDistributedMember",
"org.apache.geode.internal.cache.partitioned.PRLocallyDestroyedException",
"org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID"
] | import org.apache.geode.distributed.internal.membership.InternalDistributedMember; import org.apache.geode.internal.cache.partitioned.PRLocallyDestroyedException; import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID; | import org.apache.geode.distributed.internal.membership.*; import org.apache.geode.internal.cache.partitioned.*; import org.apache.geode.internal.cache.tier.sockets.*; | [
"org.apache.geode"
] | org.apache.geode; | 762,239 |
@Override public synchronized void cancel() {
super.cancel();
while (!queue.isEmpty()) {
T2<GridFutureAdapter, Runnable> notification = queue.poll();
if (notification != null)
notification.get1().onDone();
}
} | @Override synchronized void function() { super.cancel(); while (!queue.isEmpty()) { T2<GridFutureAdapter, Runnable> notification = queue.poll(); if (notification != null) notification.get1().onDone(); } } | /**
* Cancel thread execution and completes all notification futures.
*/ | Cancel thread execution and completes all notification futures | cancel | {
"repo_name": "SomeFire/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java",
"license": "apache-2.0",
"size": 124677
} | [
"org.apache.ignite.internal.util.future.GridFutureAdapter"
] | import org.apache.ignite.internal.util.future.GridFutureAdapter; | import org.apache.ignite.internal.util.future.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 2,845,282 |
public static final DateFormat getTimeInstance (int style)
{
return getTimeInstance (style, Locale.getDefault());
} | static final DateFormat function (int style) { return getTimeInstance (style, Locale.getDefault()); } | /**
* This method returns an instance of <code>DateFormat</code> that will
* format using the specified formatting style for times.
*
* @param style The type of formatting to perform.
*
* @return A new <code>DateFormat</code> instance.
*/ | This method returns an instance of <code>DateFormat</code> that will format using the specified formatting style for times | getTimeInstance | {
"repo_name": "aosm/gcc_40",
"path": "libjava/java/text/DateFormat.java",
"license": "gpl-2.0",
"size": 20542
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 2,282,463 |
public ResponseContext findResponseForGetOperationWithPath(String path, String parameters) throws IOException, InterruptedException {
LOGGER.debug("About to find response for get operation with path: {}", path);
Configuration configuration = this.configurationSelector.findMatchingConfiguration(path, this.getConfigurations);
if (configuration != null) {
LOGGER.debug("... found, proceeding to the data part...");
SimpleResource resource = null;
// Check for query groups
if (configuration.getQueryGroups() != null && (parameters != null && !parameters.isEmpty())) {
resource = this.findMatchForQueryGroup(configuration.getQueryGroups(), parameters);
}
// Fall back on default when no group match is found
if (resource == null) {
resource = configuration.getSimpleResource();
}
// Load and update cache
LOGGER.debug("About to load data from: {}", resource.getResource());
return this.responseContextGenerator.readResourceCacheOrFile(resource);
}
LOGGER.debug("... not found!");
return null;
} | ResponseContext function(String path, String parameters) throws IOException, InterruptedException { LOGGER.debug(STR, path); Configuration configuration = this.configurationSelector.findMatchingConfiguration(path, this.getConfigurations); if (configuration != null) { LOGGER.debug(STR); SimpleResource resource = null; if (configuration.getQueryGroups() != null && (parameters != null && !parameters.isEmpty())) { resource = this.findMatchForQueryGroup(configuration.getQueryGroups(), parameters); } if (resource == null) { resource = configuration.getSimpleResource(); } LOGGER.debug(STR, resource.getResource()); return this.responseContextGenerator.readResourceCacheOrFile(resource); } LOGGER.debug(STR); return null; } | /**
* Auxiliary method to find a response for a given GET request, based on the path.
*
* @param path
* The path associated with the get request.
* @return
* The response associated with the get request.
*
* @throws IOException
* When reading the response fails.
* @throws InterruptedException
* When delaying the response fails.
*/ | Auxiliary method to find a response for a given GET request, based on the path | findResponseForGetOperationWithPath | {
"repo_name": "Technolords/microservice-mock",
"path": "src/main/java/net/technolords/micro/config/ConfigurationManager.java",
"license": "mit",
"size": 15754
} | [
"java.io.IOException",
"net.technolords.micro.model.ResponseContext",
"net.technolords.micro.model.jaxb.Configuration",
"net.technolords.micro.model.jaxb.resource.SimpleResource"
] | import java.io.IOException; import net.technolords.micro.model.ResponseContext; import net.technolords.micro.model.jaxb.Configuration; import net.technolords.micro.model.jaxb.resource.SimpleResource; | import java.io.*; import net.technolords.micro.model.*; import net.technolords.micro.model.jaxb.*; import net.technolords.micro.model.jaxb.resource.*; | [
"java.io",
"net.technolords.micro"
] | java.io; net.technolords.micro; | 948,436 |
public static void writeContent(CharSequence content, OutputStream os) {
writeContent(content, os, "utf-8");
} | static void function(CharSequence content, OutputStream os) { writeContent(content, os, "utf-8"); } | /**
* Write String content to a stream (always use utf-8)
* @param content The content to write
* @param os The stream to write
*/ | Write String content to a stream (always use utf-8) | writeContent | {
"repo_name": "deanhiller/databus",
"path": "webapp/play1.3.x/framework/src/play/libs/IO.java",
"license": "mpl-2.0",
"size": 10486
} | [
"java.io.OutputStream"
] | import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 650,861 |
public long[] getTrackNumbers() {
List<TrackBox> trackBoxes = this.getBoxes(TrackBox.class);
long[] trackNumbers = new long[trackBoxes.size()];
for (int trackCounter = 0; trackCounter < trackBoxes.size(); trackCounter++) {
trackNumbers[trackCounter] = trackBoxes.get(trackCounter).getTrackHeaderBox().getTrackId();
}
return trackNumbers;
} | long[] function() { List<TrackBox> trackBoxes = this.getBoxes(TrackBox.class); long[] trackNumbers = new long[trackBoxes.size()]; for (int trackCounter = 0; trackCounter < trackBoxes.size(); trackCounter++) { trackNumbers[trackCounter] = trackBoxes.get(trackCounter).getTrackHeaderBox().getTrackId(); } return trackNumbers; } | /**
* Returns the track numbers associated with this <code>MovieBox</code>.
*
* @return the tracknumbers (IDs) of the tracks in their order of appearance in the file
*/ | Returns the track numbers associated with this <code>MovieBox</code> | getTrackNumbers | {
"repo_name": "sannies/mp4parser",
"path": "isoparser/src/main/java/org/mp4parser/boxes/iso14496/part12/MovieBox.java",
"license": "apache-2.0",
"size": 1956
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,669,630 |
@Override
public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) {
Object childFeature = feature;
Object childObject = child;
boolean qualify = childFeature == CorePackage.Literals.CHANGE_SET_BASE__CREATOR ||
childFeature == CorePackage.Literals.CHANGE_SET_BASE__MEMBER ||
childFeature == CorePackage.Literals.CHANGE_SET_BASE__CHANGE_INSTRUCTIONS;
if (qualify) {
return getString("_UI_CreateChild_text2", new Object[] {
getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) });
}
return super.getCreateChildText(owner, feature, child, selection);
} | String function(Object owner, Object feature, Object child, Collection<?> selection) { Object childFeature = feature; Object childObject = child; boolean qualify = childFeature == CorePackage.Literals.CHANGE_SET_BASE__CREATOR childFeature == CorePackage.Literals.CHANGE_SET_BASE__MEMBER childFeature == CorePackage.Literals.CHANGE_SET_BASE__CHANGE_INSTRUCTIONS; if (qualify) { return getString(STR, new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) }); } return super.getCreateChildText(owner, feature, child, selection); } | /**
* This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/ | This returns the label text for <code>org.eclipse.emf.edit.command.CreateChildCommand</code>. | getCreateChildText | {
"repo_name": "drbgfc/mdht",
"path": "cts2/plugins/org.openhealthtools.mdht.cts2.core.edit/src/org/openhealthtools/mdht/cts2/core/provider/ChangeSetBaseItemProvider.java",
"license": "epl-1.0",
"size": 34795
} | [
"java.util.Collection",
"org.openhealthtools.mdht.cts2.core.CorePackage"
] | import java.util.Collection; import org.openhealthtools.mdht.cts2.core.CorePackage; | import java.util.*; import org.openhealthtools.mdht.cts2.core.*; | [
"java.util",
"org.openhealthtools.mdht"
] | java.util; org.openhealthtools.mdht; | 2,782,125 |
public static void main( String[] args )
{
new BeforeDrawAxisTitle( );
}
public BeforeDrawAxisTitle( )
{
final PluginSettings ps = PluginSettings.instance( );
try
{
dRenderer = ps.getDevice( "dv.JPG" );//$NON-NLS-1$
}
catch ( ChartException ex )
{
ex.printStackTrace( );
}
cm = createLineChart( );
BufferedImage img = new BufferedImage(
500,
500,
BufferedImage.TYPE_INT_ARGB );
Graphics g = img.getGraphics( );
Graphics2D g2d = (Graphics2D) g;
dRenderer.setProperty( IDeviceRenderer.GRAPHICS_CONTEXT, g2d );
dRenderer.setProperty( IDeviceRenderer.FILE_IDENTIFIER, this.genOutputFile( OUTPUT ) ); //$NON-NLS-1$
Bounds bo = BoundsImpl.create( 0, 0, 500, 500 );
bo.scale( 72d / dRenderer.getDisplayServer( ).getDpiResolution( ) );
Generator gr = Generator.instance( );
try
{
gcs = gr.build(
dRenderer.getDisplayServer( ),
cm,
bo,
null,
null,
null );
gr.render( dRenderer, gcs );
}
catch ( ChartException e )
{
e.printStackTrace( );
}
} | static void function( String[] args ) { new BeforeDrawAxisTitle( ); } public BeforeDrawAxisTitle( ) { final PluginSettings ps = PluginSettings.instance( ); try { dRenderer = ps.getDevice( STR ); } catch ( ChartException ex ) { ex.printStackTrace( ); } cm = createLineChart( ); BufferedImage img = new BufferedImage( 500, 500, BufferedImage.TYPE_INT_ARGB ); Graphics g = img.getGraphics( ); Graphics2D g2d = (Graphics2D) g; dRenderer.setProperty( IDeviceRenderer.GRAPHICS_CONTEXT, g2d ); dRenderer.setProperty( IDeviceRenderer.FILE_IDENTIFIER, this.genOutputFile( OUTPUT ) ); Bounds bo = BoundsImpl.create( 0, 0, 500, 500 ); bo.scale( 72d / dRenderer.getDisplayServer( ).getDpiResolution( ) ); Generator gr = Generator.instance( ); try { gcs = gr.build( dRenderer.getDisplayServer( ), cm, bo, null, null, null ); gr.render( dRenderer, gcs ); } catch ( ChartException e ) { e.printStackTrace( ); } } | /**
* execute application
*
* @param args
*/ | execute application | main | {
"repo_name": "Charling-Huang/birt",
"path": "testsuites/org.eclipse.birt.report.tests.chart/src/org/eclipse/birt/report/tests/chart/api/script/BeforeDrawAxisTitle.java",
"license": "epl-1.0",
"size": 8818
} | [
"java.awt.Graphics",
"java.awt.Graphics2D",
"java.awt.image.BufferedImage",
"org.eclipse.birt.chart.device.IDeviceRenderer",
"org.eclipse.birt.chart.exception.ChartException",
"org.eclipse.birt.chart.factory.Generator",
"org.eclipse.birt.chart.model.attribute.Bounds",
"org.eclipse.birt.chart.model.attribute.impl.BoundsImpl",
"org.eclipse.birt.chart.util.PluginSettings"
] | import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import org.eclipse.birt.chart.device.IDeviceRenderer; import org.eclipse.birt.chart.exception.ChartException; import org.eclipse.birt.chart.factory.Generator; import org.eclipse.birt.chart.model.attribute.Bounds; import org.eclipse.birt.chart.model.attribute.impl.BoundsImpl; import org.eclipse.birt.chart.util.PluginSettings; | import java.awt.*; import java.awt.image.*; import org.eclipse.birt.chart.device.*; import org.eclipse.birt.chart.exception.*; import org.eclipse.birt.chart.factory.*; import org.eclipse.birt.chart.model.attribute.*; import org.eclipse.birt.chart.model.attribute.impl.*; import org.eclipse.birt.chart.util.*; | [
"java.awt",
"org.eclipse.birt"
] | java.awt; org.eclipse.birt; | 101,779 |
public void add(Writer o) {
addObject(o);
} | void function(Writer o) { addObject(o); } | /**
* Add a Writer to the list.
* @param o the Writer to add
*/ | Add a Writer to the list | add | {
"repo_name": "timp21337/melati-old",
"path": "poem/src/main/java/org/melati/poem/transaction/ToTidyList.java",
"license": "gpl-2.0",
"size": 4554
} | [
"java.io.Writer"
] | import java.io.Writer; | import java.io.*; | [
"java.io"
] | java.io; | 2,403,605 |
protected String getOutputFromJsp(final String jspResource) {
String html = "Error in rendering...";
try {
html = WebContextFactory.get().forwardToString(jspResource);
} catch (ServletException e) {
throw new CaaersSystemException(e.getMessage(), e);
} catch (IOException e) {
throw new CaaersSystemException(e.getMessage(), e);
}
return html;
}
| String function(final String jspResource) { String html = STR; try { html = WebContextFactory.get().forwardToString(jspResource); } catch (ServletException e) { throw new CaaersSystemException(e.getMessage(), e); } catch (IOException e) { throw new CaaersSystemException(e.getMessage(), e); } return html; } | /**
* Build the HTML content for the AJAX call
* */ | Build the HTML content for the AJAX call | getOutputFromJsp | {
"repo_name": "NCIP/caaers",
"path": "caAERS/software/web/src/main/java/gov/nih/nci/cabig/caaers/web/AbstractAjaxFacade.java",
"license": "bsd-3-clause",
"size": 4718
} | [
"gov.nih.nci.cabig.caaers.CaaersSystemException",
"java.io.IOException",
"javax.servlet.ServletException",
"org.directwebremoting.WebContextFactory"
] | import gov.nih.nci.cabig.caaers.CaaersSystemException; import java.io.IOException; import javax.servlet.ServletException; import org.directwebremoting.WebContextFactory; | import gov.nih.nci.cabig.caaers.*; import java.io.*; import javax.servlet.*; import org.directwebremoting.*; | [
"gov.nih.nci",
"java.io",
"javax.servlet",
"org.directwebremoting"
] | gov.nih.nci; java.io; javax.servlet; org.directwebremoting; | 285,019 |
private Environment getEnvironment(HttpServletRequest request, HttpServletResponse response) throws ServletException {
Identity identity;
try {
Realm realm = map.getRealm(request.getServletPath());
identity = getIdentityFromRequest(request, realm);
String stateOfView = StateOfView.AUTHORING;
if (yanelUI.isToolbarEnabled(request)) { // TODO: Is this the only criteria?
stateOfView = StateOfView.AUTHORING;
} else {
stateOfView = StateOfView.LIVE;
}
//log.debug("State of view: " + stateOfView);
Environment environment = new Environment(request, response, identity, stateOfView, null);
if (yanelUI.isToolbarEnabled(request)) { // INFO: Please note that isToolbarEnabled() also checks whether toolbar is suppressed...
environment.setToolbarState(ToolbarState.ON);
} else if (yanelUI.isToolbarSuppressed(request)) {
environment.setToolbarState(ToolbarState.SUPPRESSED);
} else {
environment.setToolbarState(ToolbarState.OFF);
}
return environment;
} catch (Exception e) {
throw new ServletException(e.getMessage(), e);
}
} | Environment function(HttpServletRequest request, HttpServletResponse response) throws ServletException { Identity identity; try { Realm realm = map.getRealm(request.getServletPath()); identity = getIdentityFromRequest(request, realm); String stateOfView = StateOfView.AUTHORING; if (yanelUI.isToolbarEnabled(request)) { stateOfView = StateOfView.AUTHORING; } else { stateOfView = StateOfView.LIVE; } Environment environment = new Environment(request, response, identity, stateOfView, null); if (yanelUI.isToolbarEnabled(request)) { environment.setToolbarState(ToolbarState.ON); } else if (yanelUI.isToolbarSuppressed(request)) { environment.setToolbarState(ToolbarState.SUPPRESSED); } else { environment.setToolbarState(ToolbarState.OFF); } return environment; } catch (Exception e) { throw new ServletException(e.getMessage(), e); } } | /**
* Get environment containing identity , client request, etc.
*/ | Get environment containing identity , client request, etc | getEnvironment | {
"repo_name": "wyona/yanel",
"path": "src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java",
"license": "apache-2.0",
"size": 182219
} | [
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.wyona.security.core.api.Identity",
"org.wyona.yanel.core.Environment",
"org.wyona.yanel.core.StateOfView",
"org.wyona.yanel.core.ToolbarState",
"org.wyona.yanel.core.map.Realm"
] | import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.wyona.security.core.api.Identity; import org.wyona.yanel.core.Environment; import org.wyona.yanel.core.StateOfView; import org.wyona.yanel.core.ToolbarState; import org.wyona.yanel.core.map.Realm; | import javax.servlet.*; import javax.servlet.http.*; import org.wyona.security.core.api.*; import org.wyona.yanel.core.*; import org.wyona.yanel.core.map.*; | [
"javax.servlet",
"org.wyona.security",
"org.wyona.yanel"
] | javax.servlet; org.wyona.security; org.wyona.yanel; | 787,122 |
public static void loadEmergencyClasses() {
PoolImpl.loadEmergencyClasses();
} | static void function() { PoolImpl.loadEmergencyClasses(); } | /**
* Ensure that the ConnectionProxyImpl class gets loaded
*
* @see SystemFailure#loadEmergencyClasses()
*/ | Ensure that the ConnectionProxyImpl class gets loaded | loadEmergencyClasses | {
"repo_name": "papicella/snappy-store",
"path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/GatewayImpl.java",
"license": "apache-2.0",
"size": 88653
} | [
"com.gemstone.gemfire.cache.client.internal.PoolImpl"
] | import com.gemstone.gemfire.cache.client.internal.PoolImpl; | import com.gemstone.gemfire.cache.client.internal.*; | [
"com.gemstone.gemfire"
] | com.gemstone.gemfire; | 1,329,015 |
public Shape getOutline(float x, float y) {
Shape outline = getOutline();
AffineTransform tr = AffineTransform.getTranslateInstance(x,y);
Shape translatedOutline = tr.createTransformedShape(outline);
return translatedOutline;
} | Shape function(float x, float y) { Shape outline = getOutline(); AffineTransform tr = AffineTransform.getTranslateInstance(x,y); Shape translatedOutline = tr.createTransformedShape(outline); return translatedOutline; } | /**
* Returns a Shape whose interior corresponds to the visual representation
* of this GlyphVector, offset to x, y.
*/ | Returns a Shape whose interior corresponds to the visual representation of this GlyphVector, offset to x, y | getOutline | {
"repo_name": "Squeegee/batik",
"path": "sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java",
"license": "apache-2.0",
"size": 27585
} | [
"java.awt.Shape",
"java.awt.geom.AffineTransform"
] | import java.awt.Shape; import java.awt.geom.AffineTransform; | import java.awt.*; import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 278,646 |
private void insert(Connection c) throws SQLException {
if (m_fromDb) {
throw new IllegalStateException("The record already exists in the database");
}
ThreadCategory log = ThreadCategory.getInstance(getClass());
// first extract the next node identifier
StringBuffer names = new StringBuffer("INSERT INTO snmpInterface (nodeID,snmpIfIndex");
StringBuffer values = new StringBuffer("?,?");
if ((m_changed & CHANGED_NETMASK) == CHANGED_NETMASK) {
values.append(",?");
names.append(",snmpIpAdEntNetMask");
}
if ((m_changed & CHANGED_PHYSADDR) == CHANGED_PHYSADDR) {
values.append(",?");
names.append(",snmpPhysAddr");
}
if ((m_changed & CHANGED_DESCRIPTION) == CHANGED_DESCRIPTION) {
values.append(",?");
names.append(",snmpIfDescr");
}
if ((m_changed & CHANGED_IFTYPE) == CHANGED_IFTYPE) {
values.append(",?");
names.append(",snmpIfType");
}
if ((m_changed & CHANGED_IFNAME) == CHANGED_IFNAME) {
values.append(",?");
names.append(",snmpIfName");
}
if ((m_changed & CHANGED_IFSPEED) == CHANGED_IFSPEED) {
values.append(",?");
names.append(",snmpIfSpeed");
}
if ((m_changed & CHANGED_IFADMINSTATUS) == CHANGED_IFADMINSTATUS) {
values.append(",?");
names.append(",snmpIfAdminStatus");
}
if ((m_changed & CHANGED_IFOPERSTATUS) == CHANGED_IFOPERSTATUS) {
values.append(",?");
names.append(",snmpIfOperStatus");
}
if ((m_changed & CHANGED_IFALIAS) == CHANGED_IFALIAS) {
values.append(",?");
names.append(",snmpIfAlias");
}
if ((m_changed & CHANGED_COLLECT) == CHANGED_COLLECT) {
values.append(",?");
names.append(",snmpCollect");
}
names.append(") VALUES (").append(values).append(')');
log.debug("DbSnmpInterfaceEntry.insert: SQL insert statment = "
+ names.toString());
// create the Prepared statement and then start setting the result values
PreparedStatement stmt = null;
final DBUtils d = new DBUtils(getClass());
try {
stmt = c.prepareStatement(names.toString());
d.watch(stmt);
names = null;
int ndx = 1;
stmt.setLong(ndx++, m_nodeId);
stmt.setInt(ndx++, m_ifIndex);
if ((m_changed & CHANGED_NETMASK) == CHANGED_NETMASK) {
stmt.setString(ndx++, InetAddressUtils.str(m_netmask));
}
if ((m_changed & CHANGED_PHYSADDR) == CHANGED_PHYSADDR) {
stmt.setString(ndx++, m_physAddr);
}
if ((m_changed & CHANGED_DESCRIPTION) == CHANGED_DESCRIPTION) {
stmt.setString(ndx++, m_ifDescription);
}
if ((m_changed & CHANGED_IFTYPE) == CHANGED_IFTYPE) {
stmt.setInt(ndx++, m_ifType);
}
if ((m_changed & CHANGED_IFNAME) == CHANGED_IFNAME) {
stmt.setString(ndx++, m_ifName);
}
if ((m_changed & CHANGED_IFSPEED) == CHANGED_IFSPEED) {
stmt.setLong(ndx++, m_ifSpeed);
}
if ((m_changed & CHANGED_IFADMINSTATUS) == CHANGED_IFADMINSTATUS) {
stmt.setInt(ndx++, m_ifAdminStatus);
}
if ((m_changed & CHANGED_IFOPERSTATUS) == CHANGED_IFOPERSTATUS) {
stmt.setInt(ndx++, m_ifOperStatus);
}
if ((m_changed & CHANGED_IFALIAS) == CHANGED_IFALIAS) {
stmt.setString(ndx++, m_ifAlias);
}
if ((m_changed & CHANGED_COLLECT) == CHANGED_COLLECT) {
stmt.setString(ndx++, m_collect);
}
// Run the insert
int rc = stmt.executeUpdate();
log.debug("DbSnmpInterfaceEntry.insert: SQL update result = " + rc);
} catch (SQLException e) {
log.error(String.format("Insertion of snmpinterface entry failed: nodeid = %s, ifIndex = %s", m_nodeId, m_ifIndex));
throw e;
} catch (RuntimeException e) {
log.error(String.format("Insertion of snmpinterface entry failed: nodeid = %s, ifIndex = %s", m_nodeId, m_ifIndex));
throw e;
} finally {
d.cleanUp();
}
// clear the mask and mark as backed by the database
m_fromDb = true;
m_changed = 0;
} | void function(Connection c) throws SQLException { if (m_fromDb) { throw new IllegalStateException(STR); } ThreadCategory log = ThreadCategory.getInstance(getClass()); StringBuffer names = new StringBuffer(STR); StringBuffer values = new StringBuffer("?,?"); if ((m_changed & CHANGED_NETMASK) == CHANGED_NETMASK) { values.append(",?"); names.append(STR); } if ((m_changed & CHANGED_PHYSADDR) == CHANGED_PHYSADDR) { values.append(",?"); names.append(STR); } if ((m_changed & CHANGED_DESCRIPTION) == CHANGED_DESCRIPTION) { values.append(",?"); names.append(STR); } if ((m_changed & CHANGED_IFTYPE) == CHANGED_IFTYPE) { values.append(",?"); names.append(STR); } if ((m_changed & CHANGED_IFNAME) == CHANGED_IFNAME) { values.append(",?"); names.append(STR); } if ((m_changed & CHANGED_IFSPEED) == CHANGED_IFSPEED) { values.append(",?"); names.append(STR); } if ((m_changed & CHANGED_IFADMINSTATUS) == CHANGED_IFADMINSTATUS) { values.append(",?"); names.append(STR); } if ((m_changed & CHANGED_IFOPERSTATUS) == CHANGED_IFOPERSTATUS) { values.append(",?"); names.append(STR); } if ((m_changed & CHANGED_IFALIAS) == CHANGED_IFALIAS) { values.append(",?"); names.append(STR); } if ((m_changed & CHANGED_COLLECT) == CHANGED_COLLECT) { values.append(",?"); names.append(STR); } names.append(STR).append(values).append(')'); log.debug(STR + names.toString()); PreparedStatement stmt = null; final DBUtils d = new DBUtils(getClass()); try { stmt = c.prepareStatement(names.toString()); d.watch(stmt); names = null; int ndx = 1; stmt.setLong(ndx++, m_nodeId); stmt.setInt(ndx++, m_ifIndex); if ((m_changed & CHANGED_NETMASK) == CHANGED_NETMASK) { stmt.setString(ndx++, InetAddressUtils.str(m_netmask)); } if ((m_changed & CHANGED_PHYSADDR) == CHANGED_PHYSADDR) { stmt.setString(ndx++, m_physAddr); } if ((m_changed & CHANGED_DESCRIPTION) == CHANGED_DESCRIPTION) { stmt.setString(ndx++, m_ifDescription); } if ((m_changed & CHANGED_IFTYPE) == CHANGED_IFTYPE) { stmt.setInt(ndx++, m_ifType); } if ((m_changed & CHANGED_IFNAME) == CHANGED_IFNAME) { stmt.setString(ndx++, m_ifName); } if ((m_changed & CHANGED_IFSPEED) == CHANGED_IFSPEED) { stmt.setLong(ndx++, m_ifSpeed); } if ((m_changed & CHANGED_IFADMINSTATUS) == CHANGED_IFADMINSTATUS) { stmt.setInt(ndx++, m_ifAdminStatus); } if ((m_changed & CHANGED_IFOPERSTATUS) == CHANGED_IFOPERSTATUS) { stmt.setInt(ndx++, m_ifOperStatus); } if ((m_changed & CHANGED_IFALIAS) == CHANGED_IFALIAS) { stmt.setString(ndx++, m_ifAlias); } if ((m_changed & CHANGED_COLLECT) == CHANGED_COLLECT) { stmt.setString(ndx++, m_collect); } int rc = stmt.executeUpdate(); log.debug(STR + rc); } catch (SQLException e) { log.error(String.format(STR, m_nodeId, m_ifIndex)); throw e; } catch (RuntimeException e) { log.error(String.format(STR, m_nodeId, m_ifIndex)); throw e; } finally { d.cleanUp(); } m_fromDb = true; m_changed = 0; } | /**
* Inserts the new interface into the ipInterface table of the OpenNMS
* database.
*
* @param c
* The connection to the database.
*
* @throws java.sql.SQLException
* Thrown if an error occurs with the connection
*/ | Inserts the new interface into the ipInterface table of the OpenNMS database | insert | {
"repo_name": "vishwaAbhinav/OpenNMS",
"path": "opennms-services/src/main/java/org/opennms/netmgt/capsd/DbSnmpInterfaceEntry.java",
"license": "gpl-2.0",
"size": 32190
} | [
"java.sql.Connection",
"java.sql.PreparedStatement",
"java.sql.SQLException",
"org.opennms.core.utils.DBUtils",
"org.opennms.core.utils.InetAddressUtils",
"org.opennms.core.utils.ThreadCategory"
] | import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import org.opennms.core.utils.DBUtils; import org.opennms.core.utils.InetAddressUtils; import org.opennms.core.utils.ThreadCategory; | import java.sql.*; import org.opennms.core.utils.*; | [
"java.sql",
"org.opennms.core"
] | java.sql; org.opennms.core; | 878,773 |
public static VariationPoint getBlockAddCase(VariabilityType variabilityType) throws Exception {
VariationPointModel vpm = initializeVariationPointModel("Block_Add");
assertVariationPointStructure(vpm);
VariationPoint variationPoint = vpm.getVariationPointGroups().get(0).getVariationPoints().get(0);
setUpVariationPoint(variationPoint, variabilityType);
return variationPoint;
} | static VariationPoint function(VariabilityType variabilityType) throws Exception { VariationPointModel vpm = initializeVariationPointModel(STR); assertVariationPointStructure(vpm); VariationPoint variationPoint = vpm.getVariationPointGroups().get(0).getVariationPoints().get(0); setUpVariationPoint(variationPoint, variabilityType); return variationPoint; } | /**
* Generates a variation point according to the Block_Add test case.
*
* @param variabilityType
* The {@link VariabilityType} the variation point will have.
* @return The generated {@link VariationPoint}.
* @throws Exception
* In case of an unexpected error.
*/ | Generates a variation point according to the Block_Add test case | getBlockAddCase | {
"repo_name": "kopl/SPLevo",
"path": "JaMoPPCartridge/org.splevo.jamopp.refactoring.java.ifelse.tests/src/org/splevo/jamopp/refactoring/java/ifelse/tests/util/RefactoringTestUtil.java",
"license": "epl-1.0",
"size": 38675
} | [
"org.splevo.vpm.variability.VariabilityType",
"org.splevo.vpm.variability.VariationPoint",
"org.splevo.vpm.variability.VariationPointModel"
] | import org.splevo.vpm.variability.VariabilityType; import org.splevo.vpm.variability.VariationPoint; import org.splevo.vpm.variability.VariationPointModel; | import org.splevo.vpm.variability.*; | [
"org.splevo.vpm"
] | org.splevo.vpm; | 2,701,434 |
static void runIntentInService(Context context, Intent intent) {
// This is called from C2DMBroadcastReceiver and C2DMessaging, there is no init.
WakeLockManager.getInstance(context).acquire(C2DMManager.class, WAKELOCK_TIMEOUT_MS);
intent.setClassName(context, C2DMManager.class.getCanonicalName());
context.startService(intent);
}
public C2DMManager() {
super("C2DMManager");
// Always redeliver intents if evicted while processing
setIntentRedelivery(true);
} | static void runIntentInService(Context context, Intent intent) { WakeLockManager.getInstance(context).acquire(C2DMManager.class, WAKELOCK_TIMEOUT_MS); intent.setClassName(context, C2DMManager.class.getCanonicalName()); context.startService(intent); } public C2DMManager() { super(STR); setIntentRedelivery(true); } | /**
* Called from the broadcast receiver and from any observer wanting to register (observers usually
* go through calling C2DMessaging.register(...). Will process the received intent, call
* handleMessage(), onRegistered(), etc. in background threads, with a wake lock, while keeping
* the service alive.
*
* @param context application to run service in
* @param intent the intent received
*/ | Called from the broadcast receiver and from any observer wanting to register (observers usually go through calling C2DMessaging.register(...). Will process the received intent, call handleMessage(), onRegistered(), etc. in background threads, with a wake lock, while keeping the service alive | runIntentInService | {
"repo_name": "espadrine/opera",
"path": "chromium/src/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android/c2dm/C2DMManager.java",
"license": "bsd-3-clause",
"size": 23454
} | [
"android.content.Context",
"android.content.Intent"
] | import android.content.Context; import android.content.Intent; | import android.content.*; | [
"android.content"
] | android.content; | 484,337 |
int getSegmentId(DeviceId deviceId) throws DeviceConfigNotFoundException; | int getSegmentId(DeviceId deviceId) throws DeviceConfigNotFoundException; | /**
* Returns the segment id of a device to be used in group creation.
*
* @param deviceId device identifier
* @throws DeviceConfigNotFoundException if the device configuration is not found
* @return segment id of a device
*/ | Returns the segment id of a device to be used in group creation | getSegmentId | {
"repo_name": "planoAccess/clonedONOS",
"path": "apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/DeviceProperties.java",
"license": "apache-2.0",
"size": 3235
} | [
"org.onosproject.net.DeviceId"
] | import org.onosproject.net.DeviceId; | import org.onosproject.net.*; | [
"org.onosproject.net"
] | org.onosproject.net; | 1,214,296 |
private void initResourcesInTable() {
if (resourcesInTable == null) {
resourcesInTable = new HashSet<>();
for (IStorageIterator it = sqlStorage.iterate(); it.hasMore(); ) {
Resource r = (Resource)it.nextRecord();
resourcesInTable.add(r.getResourceId());
}
}
} | void function() { if (resourcesInTable == null) { resourcesInTable = new HashSet<>(); for (IStorageIterator it = sqlStorage.iterate(); it.hasMore(); ) { Resource r = (Resource)it.nextRecord(); resourcesInTable.add(r.getResourceId()); } } } | /**
* Load IDs for resources present in table's storage into memory.
*/ | Load IDs for resources present in table's storage into memory | initResourcesInTable | {
"repo_name": "dimagi/commcare-android",
"path": "app/src/org/commcare/engine/resource/AndroidResourceTable.java",
"license": "apache-2.0",
"size": 2209
} | [
"java.util.HashSet",
"org.commcare.resources.model.Resource",
"org.javarosa.core.services.storage.IStorageIterator"
] | import java.util.HashSet; import org.commcare.resources.model.Resource; import org.javarosa.core.services.storage.IStorageIterator; | import java.util.*; import org.commcare.resources.model.*; import org.javarosa.core.services.storage.*; | [
"java.util",
"org.commcare.resources",
"org.javarosa.core"
] | java.util; org.commcare.resources; org.javarosa.core; | 631,437 |
public Version getProvidedPackageVersion(final String pkgName)
{
return packageToVersion.get(pkgName);
}
private final Map<String,String> packageToInfofile = new HashMap<String, String>(); | Version function(final String pkgName) { return packageToVersion.get(pkgName); } private final Map<String,String> packageToInfofile = new HashMap<String, String>(); | /**
* Get the version of a provided package as defined by the
* <code>packageinfo</code>-file in the package-directory.
*
* @param pkgName The package to get the version of.
*
* @return The package version or null if not defined.
*/ | Get the version of a provided package as defined by the <code>packageinfo</code>-file in the package-directory | getProvidedPackageVersion | {
"repo_name": "knopflerfish/knopflerfish.org",
"path": "ant/src/org/knopflerfish/ant/taskdefs/bundle/BundlePackagesInfo.java",
"license": "bsd-3-clause",
"size": 23721
} | [
"java.util.HashMap",
"java.util.Map",
"org.osgi.framework.Version"
] | import java.util.HashMap; import java.util.Map; import org.osgi.framework.Version; | import java.util.*; import org.osgi.framework.*; | [
"java.util",
"org.osgi.framework"
] | java.util; org.osgi.framework; | 1,713,851 |
@Test
public void testBrokerPublishMessageThrottlingInit() throws Exception {
log.info("-- Starting {} test --", methodName);
final String namespace = "my-property/throttling_publish_init";
final String topicName = "persistent://" + namespace + "/brokerThrottlingMessageBlock";
admin.namespaces().createNamespace(namespace, Sets.newHashSet("test"));
// create producer and topic
ProducerImpl<byte[]> producer = (ProducerImpl<byte[]>) pulsarClient.newProducer()
.topic(topicName)
.enableBatching(false)
.maxPendingMessages(30000).create();
PersistentTopic topic = (PersistentTopic) pulsar.getBrokerService().getTopicIfExists(topicName).get().get();
// (1) verify message-rate is initialized when value configured in broker
Assert.assertNotEquals(topic.getBrokerPublishRateLimiter(), PublishRateLimiter.DISABLED_RATE_LIMITER);
log.info("Get broker configuration: brokerTick {}, MaxMessageRate {}, MaxByteRate {}",
pulsar.getConfiguration().getBrokerPublisherThrottlingTickTimeMillis(),
pulsar.getConfiguration().getBrokerPublisherThrottlingMaxMessageRate(),
pulsar.getConfiguration().getBrokerPublisherThrottlingMaxByteRate());
Assert.assertNotEquals(topic.getBrokerPublishRateLimiter(), PublishRateLimiter.DISABLED_RATE_LIMITER);
Producer prod = topic.getProducers().values().iterator().next();
// reset counter
prod.updateRates();
int total = 100;
for (int i = 0; i < total; i++) {
producer.send(new byte[80]);
}
// calculate rates and due to throttling rate should be < total per-second
prod.updateRates();
double rateIn = prod.getStats().msgRateIn;
log.info("1-st rate in: {}, total: {} ", rateIn, total);
assertTrue(rateIn < total);
// disable throttling
admin.brokers()
.updateDynamicConfiguration("brokerPublisherThrottlingMaxMessageRate", Integer.toString(0));
Awaitility.await().untilAsserted(() ->
Assert.assertEquals(topic.getBrokerPublishRateLimiter(), PublishRateLimiter.DISABLED_RATE_LIMITER));
// reset counter
prod.updateRates();
for (int i = 0; i < total; i++) {
producer.send(new byte[80]);
}
prod.updateRates();
rateIn = prod.getStats().msgRateIn;
log.info("2-nd rate in: {}, total: {} ", rateIn, total);
assertTrue(rateIn > total);
producer.close();
} | void function() throws Exception { log.info(STR, methodName); final String namespace = STR; final String topicName = STRtestSTRGet broker configuration: brokerTick {}, MaxMessageRate {}, MaxByteRate {}STR1-st rate in: {}, total: {} STRbrokerPublisherThrottlingMaxMessageRateSTR2-nd rate in: {}, total: {} ", rateIn, total); assertTrue(rateIn > total); producer.close(); } | /**
* Verifies Broker publish rate limiting enabled by broker conf.
* Broker publish throttle enabled / topic publish throttle disabled
* @throws Exception
*/ | Verifies Broker publish rate limiting enabled by broker conf. Broker publish throttle enabled / topic publish throttle disabled | testBrokerPublishMessageThrottlingInit | {
"repo_name": "massakam/pulsar",
"path": "pulsar-broker/src/test/java/org/apache/pulsar/client/impl/TopicPublishThrottlingInitTest.java",
"license": "apache-2.0",
"size": 5021
} | [
"org.testng.Assert"
] | import org.testng.Assert; | import org.testng.*; | [
"org.testng"
] | org.testng; | 1,683,325 |
@Deprecated
public static void setRegionCachePrefetch(final byte[] tableName,
final boolean enable) throws IOException {
} | static void function(final byte[] tableName, final boolean enable) throws IOException { } | /**
* Enable or disable region cache prefetch for the table. It will be
* applied for the given table's all HTable instances who share the same
* connection. By default, the cache prefetch is enabled.
* @param tableName name of table to configure.
* @param enable Set to true to enable region cache prefetch. Or set to
* false to disable it.
* @throws IOException
* @deprecated does nothing since 0.99
*/ | Enable or disable region cache prefetch for the table. It will be applied for the given table's all HTable instances who share the same connection. By default, the cache prefetch is enabled | setRegionCachePrefetch | {
"repo_name": "zshao/hbase-1.0.0-cdh5.4.1",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java",
"license": "apache-2.0",
"size": 71077
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,126,384 |
private Iterator<?> findProteinProperties(boolean restrictToPrimaryGoTermsOnly)
throws ObjectStoreException {
Query q = new Query();
q.setDistinct(false);
QueryClass qcGene = new QueryClass(Gene.class);
q.addFrom(qcGene);
q.addToSelect(qcGene);
q.addToOrderBy(qcGene);
QueryClass qcProtein = new QueryClass(Protein.class);
q.addFrom(qcProtein);
QueryClass qcAnnotation = new QueryClass(GOAnnotation.class);
q.addFrom(qcAnnotation);
q.addToSelect(qcAnnotation);
ConstraintSet cs = new ConstraintSet(ConstraintOp.AND);
QueryCollectionReference geneProtRef = new QueryCollectionReference(qcProtein, "genes");
cs.addConstraint(new ContainsConstraint(geneProtRef, ConstraintOp.CONTAINS, qcGene));
QueryObjectReference annSubjectRef =
new QueryObjectReference(qcAnnotation, "subject");
cs.addConstraint(new ContainsConstraint(annSubjectRef, ConstraintOp.CONTAINS, qcProtein));
q.setConstraint(cs);
((ObjectStoreInterMineImpl) os).precompute(q, Constants.PRECOMPUTE_CATEGORY);
Results res = os.execute(q, 5000, true, true, true);
return res.iterator();
} | Iterator<?> function(boolean restrictToPrimaryGoTermsOnly) throws ObjectStoreException { Query q = new Query(); q.setDistinct(false); QueryClass qcGene = new QueryClass(Gene.class); q.addFrom(qcGene); q.addToSelect(qcGene); q.addToOrderBy(qcGene); QueryClass qcProtein = new QueryClass(Protein.class); q.addFrom(qcProtein); QueryClass qcAnnotation = new QueryClass(GOAnnotation.class); q.addFrom(qcAnnotation); q.addToSelect(qcAnnotation); ConstraintSet cs = new ConstraintSet(ConstraintOp.AND); QueryCollectionReference geneProtRef = new QueryCollectionReference(qcProtein, "genes"); cs.addConstraint(new ContainsConstraint(geneProtRef, ConstraintOp.CONTAINS, qcGene)); QueryObjectReference annSubjectRef = new QueryObjectReference(qcAnnotation, STR); cs.addConstraint(new ContainsConstraint(annSubjectRef, ConstraintOp.CONTAINS, qcProtein)); q.setConstraint(cs); ((ObjectStoreInterMineImpl) os).precompute(q, Constants.PRECOMPUTE_CATEGORY); Results res = os.execute(q, 5000, true, true, true); return res.iterator(); } | /**
* Query Gene->Protein->Annotation->GOTerm and return an iterator over the Gene,
* Protein and GOTerm.
*
* @param restrictToPrimaryGoTermsOnly Only get primary Annotation items linking the gene
* and the go term.
*/ | Query Gene->Protein->Annotation->GOTerm and return an iterator over the Gene, Protein and GOTerm | findProteinProperties | {
"repo_name": "julie-sullivan/phytomine",
"path": "bio/sources/go-annotation/main/src/org/intermine/bio/postprocess/GoPostprocess.java",
"license": "lgpl-2.1",
"size": 8237
} | [
"java.util.Iterator",
"org.intermine.bio.util.Constants",
"org.intermine.metadata.ConstraintOp",
"org.intermine.model.bio.GOAnnotation",
"org.intermine.model.bio.Gene",
"org.intermine.model.bio.Protein",
"org.intermine.objectstore.ObjectStoreException",
"org.intermine.objectstore.intermine.ObjectStoreInterMineImpl",
"org.intermine.objectstore.query.ConstraintSet",
"org.intermine.objectstore.query.ContainsConstraint",
"org.intermine.objectstore.query.Query",
"org.intermine.objectstore.query.QueryClass",
"org.intermine.objectstore.query.QueryCollectionReference",
"org.intermine.objectstore.query.QueryObjectReference",
"org.intermine.objectstore.query.Results"
] | import java.util.Iterator; import org.intermine.bio.util.Constants; import org.intermine.metadata.ConstraintOp; import org.intermine.model.bio.GOAnnotation; import org.intermine.model.bio.Gene; import org.intermine.model.bio.Protein; import org.intermine.objectstore.ObjectStoreException; import org.intermine.objectstore.intermine.ObjectStoreInterMineImpl; import org.intermine.objectstore.query.ConstraintSet; import org.intermine.objectstore.query.ContainsConstraint; import org.intermine.objectstore.query.Query; import org.intermine.objectstore.query.QueryClass; import org.intermine.objectstore.query.QueryCollectionReference; import org.intermine.objectstore.query.QueryObjectReference; import org.intermine.objectstore.query.Results; | import java.util.*; import org.intermine.bio.util.*; import org.intermine.metadata.*; import org.intermine.model.bio.*; import org.intermine.objectstore.*; import org.intermine.objectstore.intermine.*; import org.intermine.objectstore.query.*; | [
"java.util",
"org.intermine.bio",
"org.intermine.metadata",
"org.intermine.model",
"org.intermine.objectstore"
] | java.util; org.intermine.bio; org.intermine.metadata; org.intermine.model; org.intermine.objectstore; | 879,081 |
private static Node buildResultExpression(
Node expr, boolean needResult, String tempName) {
if (needResult) {
return IR.assign(
IR.name(tempName),
expr).srcrefTree(expr);
} else {
return expr;
}
} | static Node function( Node expr, boolean needResult, String tempName) { if (needResult) { return IR.assign( IR.name(tempName), expr).srcrefTree(expr); } else { return expr; } } | /**
* Create an expression tree for an expression.
* If the result of the expression is needed, then:
* ASSIGN
* tempName
* expr
* otherwise, simply:
* expr
*/ | Create an expression tree for an expression. If the result of the expression is needed, then: ASSIGN tempName expr otherwise, simply: expr | buildResultExpression | {
"repo_name": "Pimm/closure-compiler",
"path": "src/com/google/javascript/jscomp/ExpressionDecomposer.java",
"license": "apache-2.0",
"size": 31942
} | [
"com.google.javascript.rhino.IR",
"com.google.javascript.rhino.Node"
] | import com.google.javascript.rhino.IR; import com.google.javascript.rhino.Node; | import com.google.javascript.rhino.*; | [
"com.google.javascript"
] | com.google.javascript; | 1,660,527 |
void doTheMagic(PerunSession sess, Member member) throws WrongAttributeValueException, WrongReferenceAttributeValueException; | void doTheMagic(PerunSession sess, Member member) throws WrongAttributeValueException, WrongReferenceAttributeValueException; | /**
* Same as doTheMagic(sess, member, false);
*/ | Same as doTheMagic(sess, member, false) | doTheMagic | {
"repo_name": "zlamalp/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/bl/AttributesManagerBl.java",
"license": "bsd-2-clause",
"size": 244560
} | [
"cz.metacentrum.perun.core.api.Member",
"cz.metacentrum.perun.core.api.PerunSession",
"cz.metacentrum.perun.core.api.exceptions.WrongAttributeValueException",
"cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException"
] | import cz.metacentrum.perun.core.api.Member; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.exceptions.WrongAttributeValueException; import cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException; | import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; | [
"cz.metacentrum.perun"
] | cz.metacentrum.perun; | 1,814,222 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.