method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
list | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
list | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
@BeforeClass
public static void initStaticData() throws Exception
{
overrideDefaults();
readData();
dumpJVMInfo();
controller = ControllerFactory.createPooling();
} | static void function() throws Exception { overrideDefaults(); readData(); dumpJVMInfo(); controller = ControllerFactory.createPooling(); } | /**
* Initialize static data.
*/ | Initialize static data | initStaticData | {
"repo_name": "MjAbuz/carrot2",
"path": "applications/carrot2-benchmarks/src-test/org/carrot2/core/benchmarks/memtime/MemTimeBenchmark.java",
"license": "bsd-3-clause",
"size": 10241
} | [
"org.carrot2.core.ControllerFactory"
] | import org.carrot2.core.ControllerFactory; | import org.carrot2.core.*; | [
"org.carrot2.core"
] | org.carrot2.core; | 391,450 |
private MessageToUser createMessageWithThrottle(UserInfo userInfo, String subject, String fileHandleId, Set<String> recipients, String inReplyTo) throws InterruptedException, NotFoundException {
assertNotNull(userInfo);
MessageToUser dto = new MessageToUser();
// Note: ID is auto generated
// Note: CreatedBy is derived from userInfo
dto.setFileHandleId(fileHandleId);
// Note: CreatedOn is set by the DAO
dto.setSubject(subject);
dto.setRecipients(recipients);
dto.setInReplyTo(inReplyTo);
dto.setNotificationUnsubscribeEndpoint("https://www.synapse.org/#unsubscribeEndpoint:");
// Note: InReplyToRoot is calculated by the DAO
// Insert the message
dto = messageManager.createMessageWithThrottle(userInfo, dto);
assertNotNull(dto.getId());
cleanup.add(dto.getId());
assertEquals(userInfo.getId().toString(), dto.getCreatedBy());
assertNotNull(dto.getCreatedOn());
assertNotNull(dto.getInReplyToRoot());
// Make sure the timestamps on the messages are different
Thread.sleep(5L); // just 5 milliseconds
return messageManager.getMessage(userInfo, dto.getId());
}
| MessageToUser function(UserInfo userInfo, String subject, String fileHandleId, Set<String> recipients, String inReplyTo) throws InterruptedException, NotFoundException { assertNotNull(userInfo); MessageToUser dto = new MessageToUser(); dto.setFileHandleId(fileHandleId); dto.setSubject(subject); dto.setRecipients(recipients); dto.setInReplyTo(inReplyTo); dto.setNotificationUnsubscribeEndpoint("https: dto = messageManager.createMessageWithThrottle(userInfo, dto); assertNotNull(dto.getId()); cleanup.add(dto.getId()); assertEquals(userInfo.getId().toString(), dto.getCreatedBy()); assertNotNull(dto.getCreatedOn()); assertNotNull(dto.getInReplyToRoot()); Thread.sleep(5L); return messageManager.getMessage(userInfo, dto.getId()); } | /**
* Creates a message row
*/ | Creates a message row | createMessageWithThrottle | {
"repo_name": "xschildw/Synapse-Repository-Services",
"path": "services/repository-managers/src/test/java/org/sagebionetworks/repo/manager/MessageManagerImplTest.java",
"license": "apache-2.0",
"size": 38168
} | [
"java.util.Set",
"org.junit.jupiter.api.Assertions",
"org.sagebionetworks.repo.model.UserInfo",
"org.sagebionetworks.repo.model.message.MessageToUser",
"org.sagebionetworks.repo.web.NotFoundException"
] | import java.util.Set; import org.junit.jupiter.api.Assertions; import org.sagebionetworks.repo.model.UserInfo; import org.sagebionetworks.repo.model.message.MessageToUser; import org.sagebionetworks.repo.web.NotFoundException; | import java.util.*; import org.junit.jupiter.api.*; import org.sagebionetworks.repo.model.*; import org.sagebionetworks.repo.model.message.*; import org.sagebionetworks.repo.web.*; | [
"java.util",
"org.junit.jupiter",
"org.sagebionetworks.repo"
] | java.util; org.junit.jupiter; org.sagebionetworks.repo; | 166,762 |
public static INDArrayIndex[] adjustIndices(int[] originalShape, INDArrayIndex... indexes) {
if (Shape.isVector(originalShape) && indexes.length == 1)
return indexes;
if (indexes.length < originalShape.length)
indexes = fillIn(originalShape, indexes);
if (indexes.length > originalShape.length) {
INDArrayIndex[] ret = new INDArrayIndex[originalShape.length];
System.arraycopy(indexes, 0, ret, 0, originalShape.length);
return ret;
}
if (indexes.length == originalShape.length)
return indexes;
for (int i = 0; i < indexes.length; i++) {
if (indexes[i].end() >= originalShape[i] || indexes[i] instanceof NDArrayIndexAll)
indexes[i] = NDArrayIndex.interval(0, originalShape[i] - 1);
}
return indexes;
} | static INDArrayIndex[] function(int[] originalShape, INDArrayIndex... indexes) { if (Shape.isVector(originalShape) && indexes.length == 1) return indexes; if (indexes.length < originalShape.length) indexes = fillIn(originalShape, indexes); if (indexes.length > originalShape.length) { INDArrayIndex[] ret = new INDArrayIndex[originalShape.length]; System.arraycopy(indexes, 0, ret, 0, originalShape.length); return ret; } if (indexes.length == originalShape.length) return indexes; for (int i = 0; i < indexes.length; i++) { if (indexes[i].end() >= originalShape[i] indexes[i] instanceof NDArrayIndexAll) indexes[i] = NDArrayIndex.interval(0, originalShape[i] - 1); } return indexes; } | /**
* Prunes indices of greater length than the shape
* and fills in missing indices if there are any
*
* @param originalShape the original shape to adjust to
* @param indexes the indexes to adjust
* @return the adjusted indices
*/ | Prunes indices of greater length than the shape and fills in missing indices if there are any | adjustIndices | {
"repo_name": "huitseeker/nd4j",
"path": "nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/Indices.java",
"license": "apache-2.0",
"size": 17620
} | [
"org.nd4j.linalg.api.shape.Shape"
] | import org.nd4j.linalg.api.shape.Shape; | import org.nd4j.linalg.api.shape.*; | [
"org.nd4j.linalg"
] | org.nd4j.linalg; | 1,519,406 |
Point3i getOffset();
/**
* Get the material to place at the specified relative coordinates. Should
* only be invoked for coordinates for which {@link #getMask(int, int, int)} | Point3i getOffset(); /** * Get the material to place at the specified relative coordinates. Should * only be invoked for coordinates for which {@link #getMask(int, int, int)} | /**
* Get the offset to apply to this object when placing it. In other words
* these are the reverse of the coordinates of the "anchor" block of this
* object.
*
* <p>This is a convenience method which must return the same as invoking
* <code>getAttribute(ATTRIBUTE_OFFSET)</code>. See
* {@link #getAttribute(String, Serializable)} and
* {@link #ATTRIBUTE_OFFSET}.
*
* @return The offset to apply to this object when placing it.
*/ | Get the offset to apply to this object when placing it. In other words these are the reverse of the coordinates of the "anchor" block of this object. This is a convenience method which must return the same as invoking <code>getAttribute(ATTRIBUTE_OFFSET)</code>. See <code>#getAttribute(String, Serializable)</code> and <code>#ATTRIBUTE_OFFSET</code> | getOffset | {
"repo_name": "frogocomics/WorldPainter",
"path": "WorldPainter/WPCore/src/main/java/org/pepsoft/worldpainter/objects/WPObject.java",
"license": "gpl-3.0",
"size": 9235
} | [
"javax.vecmath.Point3i"
] | import javax.vecmath.Point3i; | import javax.vecmath.*; | [
"javax.vecmath"
] | javax.vecmath; | 2,499,075 |
public void scrollTo (float x, float y, float width, float height, boolean centerHorizontal, boolean centerVertical) {
float amountX = this.amountX;
if (centerHorizontal) {
amountX = x - areaWidth / 2 + width / 2;
} else {
if (x + width > amountX + areaWidth) amountX = x + width - areaWidth;
if (x < amountX) amountX = x;
}
scrollX(MathUtils.clamp(amountX, 0, maxX));
float amountY = this.amountY;
if (centerVertical) {
amountY = maxY - y + areaHeight / 2 - height / 2;
} else {
if (amountY > maxY - y - height + areaHeight) amountY = maxY - y - height + areaHeight;
if (amountY < maxY - y) amountY = maxY - y;
}
scrollY(MathUtils.clamp(amountY, 0, maxY));
} | void function (float x, float y, float width, float height, boolean centerHorizontal, boolean centerVertical) { float amountX = this.amountX; if (centerHorizontal) { amountX = x - areaWidth / 2 + width / 2; } else { if (x + width > amountX + areaWidth) amountX = x + width - areaWidth; if (x < amountX) amountX = x; } scrollX(MathUtils.clamp(amountX, 0, maxX)); float amountY = this.amountY; if (centerVertical) { amountY = maxY - y + areaHeight / 2 - height / 2; } else { if (amountY > maxY - y - height + areaHeight) amountY = maxY - y - height + areaHeight; if (amountY < maxY - y) amountY = maxY - y; } scrollY(MathUtils.clamp(amountY, 0, maxY)); } | /** Sets the scroll offset so the specified rectangle is fully in view, and optionally centered vertically and/or horizontally,
* if possible. Coordinates are in the scroll pane widget's coordinate system. */ | Sets the scroll offset so the specified rectangle is fully in view, and optionally centered vertically and/or horizontally | scrollTo | {
"repo_name": "srpepperoni/libGDX",
"path": "gdx/src/com/badlogic/gdx/scenes/scene2d/ui/ScrollPane.java",
"license": "apache-2.0",
"size": 36261
} | [
"com.badlogic.gdx.math.MathUtils"
] | import com.badlogic.gdx.math.MathUtils; | import com.badlogic.gdx.math.*; | [
"com.badlogic.gdx"
] | com.badlogic.gdx; | 1,033,104 |
@ApiModelProperty(
required = true,
value =
"volume id used to identify the volume in cinder. More info: https://examples.k8s.io/mysql-cinder-pd/README.md")
public String getVolumeID() {
return volumeID;
} | @ApiModelProperty( required = true, value = "volume id used to identify the volume in cinder. More info: https: String function() { return volumeID; } | /**
* volume id used to identify the volume in cinder. More info:
* https://examples.k8s.io/mysql-cinder-pd/README.md
*
* @return volumeID
*/ | volume id used to identify the volume in cinder. More info: HREF | getVolumeID | {
"repo_name": "kubernetes-client/java",
"path": "kubernetes/src/main/java/io/kubernetes/client/openapi/models/V1CinderPersistentVolumeSource.java",
"license": "apache-2.0",
"size": 6233
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 1,193,847 |
@Override
public String getAddColumnStatement( String tablename, ValueMetaInterface v, String tk, boolean use_autoinc,
String pk, boolean semicolon ) {
return "ALTER TABLE " + tablename + " ADD " + getFieldDefinition( v, tk, pk, use_autoinc, true, false );
} | String function( String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon ) { return STR + tablename + STR + getFieldDefinition( v, tk, pk, use_autoinc, true, false ); } | /**
* Generates the SQL statement to add a column to the specified table
*
* @param tablename
* The table to add
* @param v
* The column defined as a value
* @param tk
* the name of the technical key field
* @param use_autoinc
* whether or not this field uses auto increment
* @param pk
* the name of the primary key field
* @param semicolon
* whether or not to add a semi-colon behind the statement.
* @return the SQL statement to add a column to the specified table
*/ | Generates the SQL statement to add a column to the specified table | getAddColumnStatement | {
"repo_name": "alina-ipatina/pentaho-kettle",
"path": "core/src/org/pentaho/di/core/database/ExtenDBDatabaseMeta.java",
"license": "apache-2.0",
"size": 8154
} | [
"org.pentaho.di.core.row.ValueMetaInterface"
] | import org.pentaho.di.core.row.ValueMetaInterface; | import org.pentaho.di.core.row.*; | [
"org.pentaho.di"
] | org.pentaho.di; | 383,350 |
public EncounterType saveEncounterType(EncounterType encounterType);
| EncounterType function(EncounterType encounterType); | /**
* Save an Encounter Type
*
* @param encounterType
*/ | Save an Encounter Type | saveEncounterType | {
"repo_name": "sintjuri/openmrs-core",
"path": "api/src/main/java/org/openmrs/api/db/EncounterDAO.java",
"license": "mpl-2.0",
"size": 8662
} | [
"org.openmrs.EncounterType"
] | import org.openmrs.EncounterType; | import org.openmrs.*; | [
"org.openmrs"
] | org.openmrs; | 475,316 |
@Test(expected = IllegalArgumentException.class)
public void testUpdateSubnetWithNullId() {
final Subnet testSubnet = NeutronSubnet.builder()
.networkId(NETWORK_ID)
.cidr("192.168.0.0/24")
.build();
target.updateSubnet(testSubnet);
} | @Test(expected = IllegalArgumentException.class) void function() { final Subnet testSubnet = NeutronSubnet.builder() .networkId(NETWORK_ID) .cidr(STR) .build(); target.updateSubnet(testSubnet); } | /**
* Tests if updating a subnet with null ID fails with an exception.
*/ | Tests if updating a subnet with null ID fails with an exception | testUpdateSubnetWithNullId | {
"repo_name": "oplinkoms/onos",
"path": "apps/openstacknetworking/app/src/test/java/org/onosproject/openstacknetworking/impl/OpenstackNetworkManagerTest.java",
"license": "apache-2.0",
"size": 25526
} | [
"org.junit.Test",
"org.openstack4j.model.network.Subnet",
"org.openstack4j.openstack.networking.domain.NeutronSubnet"
] | import org.junit.Test; import org.openstack4j.model.network.Subnet; import org.openstack4j.openstack.networking.domain.NeutronSubnet; | import org.junit.*; import org.openstack4j.model.network.*; import org.openstack4j.openstack.networking.domain.*; | [
"org.junit",
"org.openstack4j.model",
"org.openstack4j.openstack"
] | org.junit; org.openstack4j.model; org.openstack4j.openstack; | 834,652 |
public void addStaticLinkToBreadcrumb(String linkName, int linkWeight) {
NavigationHelper nh = BeanUtils.getNavigationHelper(); // TODO
addStaticLinkToBreadcrumb(linkName, nh.getCurrentPrettyUrl(), linkWeight);
} | void function(String linkName, int linkWeight) { NavigationHelper nh = BeanUtils.getNavigationHelper(); addStaticLinkToBreadcrumb(linkName, nh.getCurrentPrettyUrl(), linkWeight); } | /**
* Adds a link to the breadcrumbs using the current PrettyURL. Can be called from XHTML.
*
* @param linkName a {@link java.lang.String} object.
* @param linkWeight a int.
*/ | Adds a link to the breadcrumbs using the current PrettyURL. Can be called from XHTML | addStaticLinkToBreadcrumb | {
"repo_name": "intranda/goobi-viewer-core",
"path": "goobi-viewer-core/src/main/java/io/goobi/viewer/managedbeans/BreadcrumbBean.java",
"license": "gpl-2.0",
"size": 24161
} | [
"io.goobi.viewer.managedbeans.utils.BeanUtils"
] | import io.goobi.viewer.managedbeans.utils.BeanUtils; | import io.goobi.viewer.managedbeans.utils.*; | [
"io.goobi.viewer"
] | io.goobi.viewer; | 2,135,851 |
public static String convertSerializableToString(Serializable obj) {
ByteArrayOutputStream baos = null;
ObjectOutputStream oos = null;
try {
baos = new ByteArrayOutputStream();
oos = new ObjectOutputStream(baos);
oos.writeObject(obj);
return new String(baos.toByteArray());
} catch (IOException e) {
return null;
} finally {
closeQuietly(baos, oos);
closeQuietly(oos);
}
} | static String function(Serializable obj) { ByteArrayOutputStream baos = null; ObjectOutputStream oos = null; try { baos = new ByteArrayOutputStream(); oos = new ObjectOutputStream(baos); oos.writeObject(obj); return new String(baos.toByteArray()); } catch (IOException e) { return null; } finally { closeQuietly(baos, oos); closeQuietly(oos); } } | /**
* Helper method to write a serializable object into a String.
* @param obj the Serializable object
* @return a String representation of obj.
*/ | Helper method to write a serializable object into a String | convertSerializableToString | {
"repo_name": "seema-at-box/box-android-sdk",
"path": "box-content-sdk/src/main/java/com/box/androidsdk/content/utils/SdkUtils.java",
"license": "apache-2.0",
"size": 29044
} | [
"java.io.ByteArrayOutputStream",
"java.io.IOException",
"java.io.ObjectOutputStream",
"java.io.Serializable"
] | import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.Serializable; | import java.io.*; | [
"java.io"
] | java.io; | 638,910 |
public static void Write (String nFile){
int i, j;
String contents;
contents = "\n\n";
contents+= "--------------------------------------------\n";
contents+= "| Semantics for the continuous variables |\n";
contents+= "--------------------------------------------\n";
for (i=0; i<StCalculate.num_vars; i++) {
if (StCalculate.var[i].continua==true) {
contents+= "Fuzzy sets parameters for variable " + i + "\n";
for (j=0; j<StCalculate.var[i].n_etiq; j++) {
contents+= "\tEtq " + j + ": " + StCalculate.BaseDatos[i][j].x0 + " " + StCalculate.BaseDatos[i][j].x1 + " " + StCalculate.BaseDatos[i][j].x3 + "\n";
}
contents+= "\tPoints for the computation of the info gain: ";
for (j=0; j<StCalculate.var[i].n_etiq; j++)
contents += StCalculate.intervalos[i][j] + " ";
contents+= "\n";
}
}
contents+= "\n";
Files.addToFile(nFile, contents);
} | static void function (String nFile){ int i, j; String contents; contents = "\n\n"; contents+= STR; contents+= STR; contents+= STR; for (i=0; i<StCalculate.num_vars; i++) { if (StCalculate.var[i].continua==true) { contents+= STR + i + "\n"; for (j=0; j<StCalculate.var[i].n_etiq; j++) { contents+= STR + j + STR + StCalculate.BaseDatos[i][j].x0 + " " + StCalculate.BaseDatos[i][j].x1 + " " + StCalculate.BaseDatos[i][j].x3 + "\n"; } contents+= STR; for (j=0; j<StCalculate.var[i].n_etiq; j++) contents += StCalculate.intervalos[i][j] + " "; contents+= "\n"; } } contents+= "\n"; Files.addToFile(nFile, contents); } | /**
* <p>
* This method writes the semantics of the linguistic variables at the file specified
* </p>
* @param nFile Fichero to write Semantics
**/ | This method writes the semantics of the linguistic variables at the file specified | Write | {
"repo_name": "SCI2SUGR/KEEL",
"path": "src/keel/Algorithms/Subgroup_Discovery/NMEEFSD/Calculate/Semantics.java",
"license": "gpl-3.0",
"size": 4323
} | [
"org.core.Files"
] | import org.core.Files; | import org.core.*; | [
"org.core"
] | org.core; | 1,169,723 |
Map<DatanodeStorage, BlockListAsLongs> getBlockReports(String bpid); | Map<DatanodeStorage, BlockListAsLongs> getBlockReports(String bpid); | /**
* Returns one block report per volume.
* @param bpid Block Pool Id
* @return - a map of DatanodeStorage to block report for the volume.
*/ | Returns one block report per volume | getBlockReports | {
"repo_name": "steveloughran/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/FsDatasetSpi.java",
"license": "apache-2.0",
"size": 22838
} | [
"java.util.Map",
"org.apache.hadoop.hdfs.protocol.BlockListAsLongs",
"org.apache.hadoop.hdfs.server.protocol.DatanodeStorage"
] | import java.util.Map; import org.apache.hadoop.hdfs.protocol.BlockListAsLongs; import org.apache.hadoop.hdfs.server.protocol.DatanodeStorage; | import java.util.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.hdfs.server.protocol.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 2,646,475 |
protected void popTilesContext()
{
ComponentContext context = (ComponentContext)this.contextStack.pop();
ComponentContext.setContext(context, this.request);
}
| void function() { ComponentContext context = (ComponentContext)this.contextStack.pop(); ComponentContext.setContext(context, this.request); } | /**
* Pops the tiles sub-context off the context-stack after the lower level
* tiles have been rendered.
*/ | Pops the tiles sub-context off the context-stack after the lower level tiles have been rendered | popTilesContext | {
"repo_name": "dotCMS/core",
"path": "dotCMS/src/main/java/org/apache/velocity/tools/struts/TilesTool.java",
"license": "gpl-3.0",
"size": 17371
} | [
"com.dotcms.repackage.org.apache.struts.tiles.ComponentContext"
] | import com.dotcms.repackage.org.apache.struts.tiles.ComponentContext; | import com.dotcms.repackage.org.apache.struts.tiles.*; | [
"com.dotcms.repackage"
] | com.dotcms.repackage; | 1,633,689 |
private void addResponse(BasicOCSPRespBuilder responseBuilder, Req request) throws OCSPException{
CertificateID certificateID = request.getCertID();
// Build Extensions
Extensions extensions = new Extensions(new Extension[]{});
Extensions requestExtensions = request.getSingleRequestExtensions();
if (requestExtensions != null) {
Extension nonceExtension = requestExtensions.getExtension(OCSPObjectIdentifiers.id_pkix_ocsp_nonce);
if (nonceExtension != null) {
extensions = new Extensions(nonceExtension);
}
}
// Check issuer
boolean matchesIssuer = certificateID.matchesIssuer(issuingCertificate, digestCalculatorProvider);
if (!matchesIssuer) {
addResponseForCertificateRequest(responseBuilder,
certificateID,
new OCSPCertificateStatusWrapper(getUnknownStatus(),
DateTime.now(),
DateTime.now().plusSeconds(certificateManager.getRefreshSeconds())),
extensions);
} else {
CertificateSummary certificateSummary = certificateManager.getSummary(certificateID.getSerialNumber());
addResponseForCertificateRequest(responseBuilder,
request.getCertID(),
getOCSPCertificateStatus(certificateSummary),
extensions);
}
} | void function(BasicOCSPRespBuilder responseBuilder, Req request) throws OCSPException{ CertificateID certificateID = request.getCertID(); Extensions extensions = new Extensions(new Extension[]{}); Extensions requestExtensions = request.getSingleRequestExtensions(); if (requestExtensions != null) { Extension nonceExtension = requestExtensions.getExtension(OCSPObjectIdentifiers.id_pkix_ocsp_nonce); if (nonceExtension != null) { extensions = new Extensions(nonceExtension); } } boolean matchesIssuer = certificateID.matchesIssuer(issuingCertificate, digestCalculatorProvider); if (!matchesIssuer) { addResponseForCertificateRequest(responseBuilder, certificateID, new OCSPCertificateStatusWrapper(getUnknownStatus(), DateTime.now(), DateTime.now().plusSeconds(certificateManager.getRefreshSeconds())), extensions); } else { CertificateSummary certificateSummary = certificateManager.getSummary(certificateID.getSerialNumber()); addResponseForCertificateRequest(responseBuilder, request.getCertID(), getOCSPCertificateStatus(certificateSummary), extensions); } } | /**
* Adds response for specific cert OCSP request
*
* @param responseBuilder The builder containing the full response
* @param request The specific cert request
*/ | Adds response for specific cert OCSP request | addResponse | {
"repo_name": "wdawson/revoker",
"path": "src/main/java/wdawson/samples/revoker/resources/OCSPResponderResource.java",
"license": "apache-2.0",
"size": 16988
} | [
"org.bouncycastle.asn1.ocsp.OCSPObjectIdentifiers",
"org.bouncycastle.asn1.x509.Extension",
"org.bouncycastle.asn1.x509.Extensions",
"org.bouncycastle.cert.ocsp.BasicOCSPRespBuilder",
"org.bouncycastle.cert.ocsp.CertificateID",
"org.bouncycastle.cert.ocsp.OCSPException",
"org.bouncycastle.cert.ocsp.Req",
"org.joda.time.DateTime"
] | import org.bouncycastle.asn1.ocsp.OCSPObjectIdentifiers; import org.bouncycastle.asn1.x509.Extension; import org.bouncycastle.asn1.x509.Extensions; import org.bouncycastle.cert.ocsp.BasicOCSPRespBuilder; import org.bouncycastle.cert.ocsp.CertificateID; import org.bouncycastle.cert.ocsp.OCSPException; import org.bouncycastle.cert.ocsp.Req; import org.joda.time.DateTime; | import org.bouncycastle.asn1.ocsp.*; import org.bouncycastle.asn1.x509.*; import org.bouncycastle.cert.ocsp.*; import org.joda.time.*; | [
"org.bouncycastle.asn1",
"org.bouncycastle.cert",
"org.joda.time"
] | org.bouncycastle.asn1; org.bouncycastle.cert; org.joda.time; | 1,353,832 |
final Object res;
final EObject eObject = IdeMappingUtils.adapt(selected, EObject.class);
if (eObject instanceof DSemanticDecorator) {
res = ((DSemanticDecorator)eObject).getTarget();
} else {
res = null;
}
return res;
} | final Object res; final EObject eObject = IdeMappingUtils.adapt(selected, EObject.class); if (eObject instanceof DSemanticDecorator) { res = ((DSemanticDecorator)eObject).getTarget(); } else { res = null; } return res; } | /**
* Gets the {@link DSemanticDecorator#getTarget() semantic element} from the given selected {@link Object}
* .
*
* @param selected
* the selected {@link Object}
* @return the {@link DSemanticDecorator#getTarget() semantic element} from the given selected
* {@link Object} if any, <code>null</code> otherwise
*/ | Gets the <code>DSemanticDecorator#getTarget() semantic element</code> from the given selected <code>Object</code> | getSemanticElementFromSelectedObject | {
"repo_name": "ModelWriter/Source",
"path": "plugins/org.eclipse.mylyn.docs.intent.mapping.sirius.ide.ui/src/org/eclipse/mylyn/docs/intent/mapping/sirius/ide/ui/command/SiriusMappingUtils.java",
"license": "epl-1.0",
"size": 1686
} | [
"org.eclipse.emf.ecore.EObject",
"org.eclipse.mylyn.docs.intent.mapping.ide.IdeMappingUtils",
"org.eclipse.sirius.viewpoint.DSemanticDecorator"
] | import org.eclipse.emf.ecore.EObject; import org.eclipse.mylyn.docs.intent.mapping.ide.IdeMappingUtils; import org.eclipse.sirius.viewpoint.DSemanticDecorator; | import org.eclipse.emf.ecore.*; import org.eclipse.mylyn.docs.intent.mapping.ide.*; import org.eclipse.sirius.viewpoint.*; | [
"org.eclipse.emf",
"org.eclipse.mylyn",
"org.eclipse.sirius"
] | org.eclipse.emf; org.eclipse.mylyn; org.eclipse.sirius; | 1,677,193 |
protected String getPrefix() throws ConfigurationException {
if (null != prefix) {
return prefix;
} else {
throw new ConfigurationException("No prefix (not even default \"\") is associated with the "
+ "configuration element \"" + getName() + "\" at " + getLocation());
}
} | String function() throws ConfigurationException { if (null != prefix) { return prefix; } else { throw new ConfigurationException(STR\STR + STRSTR\STR + getLocation()); } } | /**
* Returns the prefix of the namespace
*/ | Returns the prefix of the namespace | getPrefix | {
"repo_name": "baboune/compass",
"path": "src/main/src/org/compass/core/util/config/PlainConfigurationHelper.java",
"license": "apache-2.0",
"size": 14139
} | [
"org.compass.core.config.ConfigurationException"
] | import org.compass.core.config.ConfigurationException; | import org.compass.core.config.*; | [
"org.compass.core"
] | org.compass.core; | 565,724 |
public void fireTreeWillExpand(TreePath path) throws ExpandVetoException
{
TreeExpansionEvent event = new TreeExpansionEvent(this, path);
TreeWillExpandListener[] listeners = getTreeWillExpandListeners();
for (int index = 0; index < listeners.length; ++index)
listeners[index].treeWillExpand(event);
} | void function(TreePath path) throws ExpandVetoException { TreeExpansionEvent event = new TreeExpansionEvent(this, path); TreeWillExpandListener[] listeners = getTreeWillExpandListeners(); for (int index = 0; index < listeners.length; ++index) listeners[index].treeWillExpand(event); } | /**
* Notifies all listeners that the tree will expand.
*
* @param path the path to the node that will expand
*/ | Notifies all listeners that the tree will expand | fireTreeWillExpand | {
"repo_name": "SanDisk-Open-Source/SSD_Dashboard",
"path": "uefi/gcc/gcc-4.6.3/libjava/classpath/javax/swing/JTree.java",
"license": "gpl-2.0",
"size": 83318
} | [
"javax.swing.event.TreeExpansionEvent",
"javax.swing.event.TreeWillExpandListener",
"javax.swing.tree.ExpandVetoException",
"javax.swing.tree.TreePath"
] | import javax.swing.event.TreeExpansionEvent; import javax.swing.event.TreeWillExpandListener; import javax.swing.tree.ExpandVetoException; import javax.swing.tree.TreePath; | import javax.swing.event.*; import javax.swing.tree.*; | [
"javax.swing"
] | javax.swing; | 2,075,669 |
public List<String> getMRes() {
return mRes;
} | List<String> function() { return mRes; } | /**
* Get the list of resource for the contact.
* @return the mRes
*/ | Get the list of resource for the contact | getMRes | {
"repo_name": "abmobilesoftware/TxtFeedbackStaffAndroidApp",
"path": "src/com/beem/project/beem/service/Contact.java",
"license": "gpl-3.0",
"size": 11430
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,846,905 |
public final ActionMode.Callback getCustomSelectionActionModeCallback() {
return getView().getCustomSelectionActionModeCallback();
} | final ActionMode.Callback function() { return getView().getCustomSelectionActionModeCallback(); } | /**
* Retrieves the value set in {@link #setCustomSelectionActionModeCallback}. Default is null.
*
* @return The current custom selection callback.
*/ | Retrieves the value set in <code>#setCustomSelectionActionModeCallback</code>. Default is null | getCustomSelectionActionModeCallback | {
"repo_name": "michael-rapp/AndroidMaterialValidation",
"path": "library/src/main/java/de/mrapp/android/validation/EditText.java",
"license": "apache-2.0",
"size": 89149
} | [
"android.view.ActionMode"
] | import android.view.ActionMode; | import android.view.*; | [
"android.view"
] | android.view; | 2,803,965 |
static Set<HTableDescriptor> updateRootWithNewRegionInfo(
final MasterServices masterServices)
throws IOException {
MigratingVisitor v = new MigratingVisitor(masterServices);
MetaReader.fullScan(masterServices.getCatalogTracker(), v, null, true);
return v.htds;
}
static class MigratingVisitor implements Visitor {
private final MasterServices services;
final Set<HTableDescriptor> htds = new HashSet<HTableDescriptor>();
MigratingVisitor(final MasterServices services) {
this.services = services;
} | static Set<HTableDescriptor> updateRootWithNewRegionInfo( final MasterServices masterServices) throws IOException { MigratingVisitor v = new MigratingVisitor(masterServices); MetaReader.fullScan(masterServices.getCatalogTracker(), v, null, true); return v.htds; } static class MigratingVisitor implements Visitor { private final MasterServices services; final Set<HTableDescriptor> htds = new HashSet<HTableDescriptor>(); MigratingVisitor(final MasterServices services) { this.services = services; } | /**
* Update the ROOT with new HRI. (HRI with no HTD)
* @param masterServices
* @return List of table descriptors
* @throws IOException
*/ | Update the ROOT with new HRI. (HRI with no HTD) | updateRootWithNewRegionInfo | {
"repo_name": "zqxjjj/NobidaBase",
"path": "target/hbase-0.94.9/hbase-0.94.9/src/main/java/org/apache/hadoop/hbase/catalog/MetaMigrationRemovingHTD.java",
"license": "apache-2.0",
"size": 10453
} | [
"java.io.IOException",
"java.util.HashSet",
"java.util.Set",
"org.apache.hadoop.hbase.HTableDescriptor",
"org.apache.hadoop.hbase.catalog.MetaReader",
"org.apache.hadoop.hbase.master.MasterServices"
] | import java.io.IOException; import java.util.HashSet; import java.util.Set; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.catalog.MetaReader; import org.apache.hadoop.hbase.master.MasterServices; | import java.io.*; import java.util.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.catalog.*; import org.apache.hadoop.hbase.master.*; | [
"java.io",
"java.util",
"org.apache.hadoop"
] | java.io; java.util; org.apache.hadoop; | 556,194 |
public StackFrameDump dumpStackFrame() throws DebuggerStateException, DebuggerException {
StackFrameDump dump = DtoFactory.getInstance().createDto(StackFrameDump.class);
boolean existInformation = true;
JdiLocalVariable[] variables = new JdiLocalVariable[0];
try {
variables = getCurrentFrame().getLocalVariables();
} catch (DebuggerAbsentInformationException e) {
existInformation = false;
}
for (JdiField f : getCurrentFrame().getFields()) {
dump.getFields().add((Field)DtoFactory.getInstance().createDto(Field.class)
.withIsFinal(f.isFinal())
.withIsStatic(f.isStatic())
.withIsTransient(f.isTransient())
.withIsVolatile(f.isVolatile())
.withName(f.getName())
.withExistInformation(existInformation)
.withValue(f.getValue().getAsString())
.withType(f.getTypeName())
.withVariablePath(
DtoFactory.getInstance().createDto(VariablePath.class)
.withPath(Arrays.asList(f.isStatic() ? "static" : "this", f.getName()))
)
.withPrimitive(f.isPrimitive()));
}
for (JdiLocalVariable var : variables) {
dump.getLocalVariables().add(DtoFactory.getInstance().createDto(Variable.class)
.withName(var.getName())
.withExistInformation(existInformation)
.withValue(var.getValue().getAsString())
.withType(var.getTypeName())
.withVariablePath(
DtoFactory.getInstance().createDto(VariablePath.class)
.withPath(Collections.singletonList(var.getName()))
)
.withPrimitive(var.isPrimitive()));
}
return dump;
}
/**
* Get value of variable with specified path. Each item in path is name of variable.
* <p/>
* Path must be specified according to the following rules:
* <ol>
* <li>If need to get field of this object of current frame then first element in array always should be
* 'this'.</li>
* <li>If need to get static field in current frame then first element in array always should be 'static'.</li>
* <li>If need to get local variable in current frame then first element should be the name of local variable.</li>
* </ol>
* <p/>
* Here is example. <br/>
* Assume we have next hierarchy of classes and breakpoint set in line: <i>// breakpoint</i>:
* <pre>
* class A {
* private String str;
* ...
* }
*
* class B {
* private A a;
* ....
*
* void method() {
* A var = new A();
* var.setStr(...);
* a = var;
* // breakpoint
* }
* } | StackFrameDump function() throws DebuggerStateException, DebuggerException { StackFrameDump dump = DtoFactory.getInstance().createDto(StackFrameDump.class); boolean existInformation = true; JdiLocalVariable[] variables = new JdiLocalVariable[0]; try { variables = getCurrentFrame().getLocalVariables(); } catch (DebuggerAbsentInformationException e) { existInformation = false; } for (JdiField f : getCurrentFrame().getFields()) { dump.getFields().add((Field)DtoFactory.getInstance().createDto(Field.class) .withIsFinal(f.isFinal()) .withIsStatic(f.isStatic()) .withIsTransient(f.isTransient()) .withIsVolatile(f.isVolatile()) .withName(f.getName()) .withExistInformation(existInformation) .withValue(f.getValue().getAsString()) .withType(f.getTypeName()) .withVariablePath( DtoFactory.getInstance().createDto(VariablePath.class) .withPath(Arrays.asList(f.isStatic() ? STR : "this", f.getName())) ) .withPrimitive(f.isPrimitive())); } for (JdiLocalVariable var : variables) { dump.getLocalVariables().add(DtoFactory.getInstance().createDto(Variable.class) .withName(var.getName()) .withExistInformation(existInformation) .withValue(var.getValue().getAsString()) .withType(var.getTypeName()) .withVariablePath( DtoFactory.getInstance().createDto(VariablePath.class) .withPath(Collections.singletonList(var.getName())) ) .withPrimitive(var.isPrimitive())); } return dump; } /** * Get value of variable with specified path. Each item in path is name of variable. * <p/> * Path must be specified according to the following rules: * <ol> * <li>If need to get field of this object of current frame then first element in array always should be * 'this'.</li> * <li>If need to get static field in current frame then first element in array always should be 'static'.</li> * <li>If need to get local variable in current frame then first element should be the name of local variable.</li> * </ol> * <p/> * Here is example. <br/> * Assume we have next hierarchy of classes and breakpoint set in line: <i> * <pre> * class A { * private String str; * ... * } * * class B { * private A a; * .... * * void method() { * A var = new A(); * var.setStr(...); * a = var; * * } * } | /**
* Get dump of fields and local variable of current object and current frame.
*
* @return dump of current stack frame
* @throws DebuggerStateException
* when target JVM is not suspended
* @throws DebuggerException
* when any other errors occur when try to access the current state of target JVM
*/ | Get dump of fields and local variable of current object and current frame | dumpStackFrame | {
"repo_name": "codenvy/che-plugins",
"path": "plugin-java/che-plugin-java-ext-debugger-java-server/src/main/java/org/eclipse/che/ide/ext/java/jdi/server/Debugger.java",
"license": "epl-1.0",
"size": 36874
} | [
"java.util.Arrays",
"java.util.Collections",
"org.eclipse.che.dto.server.DtoFactory",
"org.eclipse.che.ide.ext.java.jdi.shared.Field",
"org.eclipse.che.ide.ext.java.jdi.shared.StackFrameDump",
"org.eclipse.che.ide.ext.java.jdi.shared.Variable",
"org.eclipse.che.ide.ext.java.jdi.shared.VariablePath"
] | import java.util.Arrays; import java.util.Collections; import org.eclipse.che.dto.server.DtoFactory; import org.eclipse.che.ide.ext.java.jdi.shared.Field; import org.eclipse.che.ide.ext.java.jdi.shared.StackFrameDump; import org.eclipse.che.ide.ext.java.jdi.shared.Variable; import org.eclipse.che.ide.ext.java.jdi.shared.VariablePath; | import java.util.*; import org.eclipse.che.dto.server.*; import org.eclipse.che.ide.ext.java.jdi.shared.*; | [
"java.util",
"org.eclipse.che"
] | java.util; org.eclipse.che; | 1,775,077 |
Collection<Feature> getSubFeatures(CoreFeature feature); | Collection<Feature> getSubFeatures(CoreFeature feature); | /**
* Return all the sub features of this menu for the specified CoreFeature.
*
* @param feature The core feature.
*
* @return A Collection containing all the sub features of this core feature.
*/ | Return all the sub features of this menu for the specified CoreFeature | getSubFeatures | {
"repo_name": "wichtounet/jtheque-core",
"path": "jtheque-features/src/main/java/org/jtheque/features/Menu.java",
"license": "apache-2.0",
"size": 1459
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,783,377 |
public long copyScreen(String userId, long projectId, String targetFormFileId, String fileId) {
List<String> sourceFiles = storageIo.getProjectSourceFiles(userId, projectId);
if (!sourceFiles.contains(fileId)) {
storageIo.addSourceFilesToProject(userId, projectId, false, fileId);
}
return storageIo.uploadRawFileForce(projectId, fileId, userId, new byte[0]);
} | long function(String userId, long projectId, String targetFormFileId, String fileId) { List<String> sourceFiles = storageIo.getProjectSourceFiles(userId, projectId); if (!sourceFiles.contains(fileId)) { storageIo.addSourceFilesToProject(userId, projectId, false, fileId); } return storageIo.uploadRawFileForce(projectId, fileId, userId, new byte[0]); } | /**
* Adds a new screen to the given project.
*
* @param userId the user id
* @param projectId project ID
* @param fileId ID of file to delete
* @return modification date for project
*/ | Adds a new screen to the given project | copyScreen | {
"repo_name": "mit-dig/punya",
"path": "appinventor/appengine/src/com/google/appinventor/server/project/CommonProjectService.java",
"license": "apache-2.0",
"size": 12239
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,302,010 |
public static void systemCallSoundFmodChannelSetPriority(
int channelID, int priority,
Wrapper<ReturnCode> outReturnCode, Wrapper<SoundReturnCode> outSoundReturnCode, Wrapper<FmodResult> outFmodResult
){
List<Parameter> params = new ArrayList<>();
params.add(Parameter.createInt(channelID));
params.add(Parameter.createInt(priority));
QAMessage response = Kernel.systemCall("de.silveryard.basesystem.systemcall.sound.fmodchannel.setpriority", params);
outReturnCode.value = ReturnCode.getEnumValue(response.getParameters().get(0).getInt());
outSoundReturnCode.value = SoundReturnCode.getEnumValue(response.getParameters().get(1).getInt());
outFmodResult.value = FmodResult.getEnumValue(response.getParameters().get(2).getInt());
} | static void function( int channelID, int priority, Wrapper<ReturnCode> outReturnCode, Wrapper<SoundReturnCode> outSoundReturnCode, Wrapper<FmodResult> outFmodResult ){ List<Parameter> params = new ArrayList<>(); params.add(Parameter.createInt(channelID)); params.add(Parameter.createInt(priority)); QAMessage response = Kernel.systemCall(STR, params); outReturnCode.value = ReturnCode.getEnumValue(response.getParameters().get(0).getInt()); outSoundReturnCode.value = SoundReturnCode.getEnumValue(response.getParameters().get(1).getInt()); outFmodResult.value = FmodResult.getEnumValue(response.getParameters().get(2).getInt()); } | /**
* Sets the priority value of a given channel
* @param channelID The given channels id
* @param priority Priority value
* @param outReturnCode General Return Code
* @param outSoundReturnCode Sound Return Code
* @param outFmodResult Fmod Result
*/ | Sets the priority value of a given channel | systemCallSoundFmodChannelSetPriority | {
"repo_name": "Silveryard/BaseSystem",
"path": "Libraries/App/Java/AppSDK/src/main/java/de/silveryard/basesystem/sdk/kernel/sound/FmodChannel.java",
"license": "mit",
"size": 23930
} | [
"de.silveryard.basesystem.sdk.kernel.Kernel",
"de.silveryard.basesystem.sdk.kernel.ReturnCode",
"de.silveryard.basesystem.sdk.kernel.Wrapper",
"de.silveryard.transport.Parameter",
"de.silveryard.transport.highlevelprotocols.qa.QAMessage",
"java.util.ArrayList",
"java.util.List"
] | import de.silveryard.basesystem.sdk.kernel.Kernel; import de.silveryard.basesystem.sdk.kernel.ReturnCode; import de.silveryard.basesystem.sdk.kernel.Wrapper; import de.silveryard.transport.Parameter; import de.silveryard.transport.highlevelprotocols.qa.QAMessage; import java.util.ArrayList; import java.util.List; | import de.silveryard.basesystem.sdk.kernel.*; import de.silveryard.transport.*; import de.silveryard.transport.highlevelprotocols.qa.*; import java.util.*; | [
"de.silveryard.basesystem",
"de.silveryard.transport",
"java.util"
] | de.silveryard.basesystem; de.silveryard.transport; java.util; | 2,723,969 |
void configureConnectionInformation(String namenodeHost, String namenodePort, String jobtrackerHost,
String jobtrackerPort, Configuration conf, List<String> logMessages) throws Exception; | void configureConnectionInformation(String namenodeHost, String namenodePort, String jobtrackerHost, String jobtrackerPort, Configuration conf, List<String> logMessages) throws Exception; | /**
* Setup the config object based on the supplied information with
* respect to the specific distribution
*
* @param namenodeHost
* @param namenodePort
* @param jobtrackerHost
* @param jobtrackerPort
* @param conf Configuration to update
* @param logMessages Any basic log messages that should be logged
* @throws Exception Error configuring with the provided connection information
*/ | Setup the config object based on the supplied information with respect to the specific distribution | configureConnectionInformation | {
"repo_name": "mtseu/pentaho-hadoop-shims",
"path": "api/src/org/pentaho/hadoop/shim/spi/HadoopShim.java",
"license": "apache-2.0",
"size": 7001
} | [
"java.util.List",
"org.pentaho.hadoop.shim.api.Configuration"
] | import java.util.List; import org.pentaho.hadoop.shim.api.Configuration; | import java.util.*; import org.pentaho.hadoop.shim.api.*; | [
"java.util",
"org.pentaho.hadoop"
] | java.util; org.pentaho.hadoop; | 2,634,976 |
public Point2D onRectangle(Rectangle2D rectangle) {
return this == CENTER ? new Point2D.Double(rectangle.getCenterX(), rectangle.getCenterY())
: new Point2D.Double(rectangle.getCenterX() + xOff * rectangle.getWidth(), rectangle.getCenterY() + yOff * rectangle.getHeight());
} | Point2D function(Rectangle2D rectangle) { return this == CENTER ? new Point2D.Double(rectangle.getCenterX(), rectangle.getCenterY()) : new Point2D.Double(rectangle.getCenterX() + xOff * rectangle.getWidth(), rectangle.getCenterY() + yOff * rectangle.getHeight()); } | /**
* Returns the absolute location of an anchor point on a rectangle of given size.
* @param rectangle the rectangle
* @return anchor point location
*/ | Returns the absolute location of an anchor point on a rectangle of given size | onRectangle | {
"repo_name": "triathematician/blaisemath",
"path": "blaise-common/src/main/java/com/googlecode/blaisemath/primitive/Anchor.java",
"license": "apache-2.0",
"size": 5640
} | [
"java.awt.geom.Point2D",
"java.awt.geom.Rectangle2D"
] | import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; | import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 2,741,421 |
public ContainerCreateHeaders withLastModified(OffsetDateTime lastModified) {
if (lastModified == null) {
this.lastModified = null;
} else {
this.lastModified = new DateTimeRfc1123(lastModified);
}
return this;
} | ContainerCreateHeaders function(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { this.lastModified = new DateTimeRfc1123(lastModified); } return this; } | /**
* Set the lastModified value.
*
* @param lastModified the lastModified value to set.
* @return the ContainerCreateHeaders object itself.
*/ | Set the lastModified value | withLastModified | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerCreateHeaders.java",
"license": "mit",
"size": 4527
} | [
"com.microsoft.rest.v2.DateTimeRfc1123",
"java.time.OffsetDateTime"
] | import com.microsoft.rest.v2.DateTimeRfc1123; import java.time.OffsetDateTime; | import com.microsoft.rest.v2.*; import java.time.*; | [
"com.microsoft.rest",
"java.time"
] | com.microsoft.rest; java.time; | 2,109,528 |
@Test(timeout = 120000)
public void testSetXAttr() throws Exception {
FileSystem.mkdirs(fs, path, FsPermission.createImmutable((short)0750));
fs.setXAttr(path, name1, value1, EnumSet.of(XAttrSetFlag.CREATE,
XAttrSetFlag.REPLACE));
Map<String, byte[]> xattrs = fs.getXAttrs(path);
Assert.assertEquals(xattrs.size(), 1);
Assert.assertArrayEquals(value1, xattrs.get(name1));
fs.removeXAttr(path, name1);
// Set xattr with null name
try {
fs.setXAttr(path, null, value1, EnumSet.of(XAttrSetFlag.CREATE,
XAttrSetFlag.REPLACE));
Assert.fail("Setting xattr with null name should fail.");
} catch (NullPointerException e) {
GenericTestUtils.assertExceptionContains("XAttr name cannot be null", e);
} catch (RemoteException e) {
GenericTestUtils.assertExceptionContains("XAttr name cannot be null", e);
}
// Set xattr with empty name: "user."
try {
fs.setXAttr(path, "user.", value1, EnumSet.of(XAttrSetFlag.CREATE,
XAttrSetFlag.REPLACE));
Assert.fail("Setting xattr with empty name should fail.");
} catch (RemoteException e) {
assertEquals("Unexpected RemoteException: " + e, e.getClassName(),
HadoopIllegalArgumentException.class.getCanonicalName());
GenericTestUtils.assertExceptionContains("XAttr name cannot be empty", e);
} catch (HadoopIllegalArgumentException e) {
GenericTestUtils.assertExceptionContains("XAttr name cannot be empty", e);
}
// Set xattr with invalid name: "a1"
try {
fs.setXAttr(path, "a1", value1, EnumSet.of(XAttrSetFlag.CREATE,
XAttrSetFlag.REPLACE));
Assert.fail("Setting xattr with invalid name prefix or without " +
"name prefix should fail.");
} catch (RemoteException e) {
assertEquals("Unexpected RemoteException: " + e, e.getClassName(),
HadoopIllegalArgumentException.class.getCanonicalName());
GenericTestUtils.assertExceptionContains("XAttr name must be prefixed", e);
} catch (HadoopIllegalArgumentException e) {
GenericTestUtils.assertExceptionContains("XAttr name must be prefixed", e);
}
// Set xattr without XAttrSetFlag
fs.setXAttr(path, name1, value1);
xattrs = fs.getXAttrs(path);
Assert.assertEquals(xattrs.size(), 1);
Assert.assertArrayEquals(value1, xattrs.get(name1));
fs.removeXAttr(path, name1);
// XAttr exists, and replace it using CREATE|REPLACE flag.
fs.setXAttr(path, name1, value1, EnumSet.of(XAttrSetFlag.CREATE));
fs.setXAttr(path, name1, newValue1, EnumSet.of(XAttrSetFlag.CREATE,
XAttrSetFlag.REPLACE));
xattrs = fs.getXAttrs(path);
Assert.assertEquals(xattrs.size(), 1);
Assert.assertArrayEquals(newValue1, xattrs.get(name1));
fs.removeXAttr(path, name1);
// Total number exceeds max limit
fs.setXAttr(path, name1, value1);
fs.setXAttr(path, name2, value2);
fs.setXAttr(path, name3, null);
try {
fs.setXAttr(path, name4, null);
Assert.fail("Setting xattr should fail if total number of xattrs " +
"for inode exceeds max limit.");
} catch (IOException e) {
GenericTestUtils.assertExceptionContains("Cannot add additional XAttr", e);
}
fs.removeXAttr(path, name1);
fs.removeXAttr(path, name2);
fs.removeXAttr(path, name3);
// Name length exceeds max limit
String longName = "user.0123456789abcdefX";
try {
fs.setXAttr(path, longName, null);
Assert.fail("Setting xattr should fail if name is too long.");
} catch (IOException e) {
GenericTestUtils.assertExceptionContains("XAttr is too big", e);
GenericTestUtils.assertExceptionContains("total size is 17", e);
}
// Value length exceeds max limit
byte[] longValue = new byte[MAX_SIZE];
try {
fs.setXAttr(path, "user.a", longValue);
Assert.fail("Setting xattr should fail if value is too long.");
} catch (IOException e) {
GenericTestUtils.assertExceptionContains("XAttr is too big", e);
GenericTestUtils.assertExceptionContains("total size is 17", e);
}
// Name + value exactly equal the limit
String name = "user.111";
byte[] value = new byte[MAX_SIZE-3];
fs.setXAttr(path, name, value);
} | @Test(timeout = 120000) void function() throws Exception { FileSystem.mkdirs(fs, path, FsPermission.createImmutable((short)0750)); fs.setXAttr(path, name1, value1, EnumSet.of(XAttrSetFlag.CREATE, XAttrSetFlag.REPLACE)); Map<String, byte[]> xattrs = fs.getXAttrs(path); Assert.assertEquals(xattrs.size(), 1); Assert.assertArrayEquals(value1, xattrs.get(name1)); fs.removeXAttr(path, name1); try { fs.setXAttr(path, null, value1, EnumSet.of(XAttrSetFlag.CREATE, XAttrSetFlag.REPLACE)); Assert.fail(STR); } catch (NullPointerException e) { GenericTestUtils.assertExceptionContains(STR, e); } catch (RemoteException e) { GenericTestUtils.assertExceptionContains(STR, e); } try { fs.setXAttr(path, "user.", value1, EnumSet.of(XAttrSetFlag.CREATE, XAttrSetFlag.REPLACE)); Assert.fail(STR); } catch (RemoteException e) { assertEquals(STR + e, e.getClassName(), HadoopIllegalArgumentException.class.getCanonicalName()); GenericTestUtils.assertExceptionContains(STR, e); } catch (HadoopIllegalArgumentException e) { GenericTestUtils.assertExceptionContains(STR, e); } try { fs.setXAttr(path, "a1", value1, EnumSet.of(XAttrSetFlag.CREATE, XAttrSetFlag.REPLACE)); Assert.fail(STR + STR); } catch (RemoteException e) { assertEquals(STR + e, e.getClassName(), HadoopIllegalArgumentException.class.getCanonicalName()); GenericTestUtils.assertExceptionContains(STR, e); } catch (HadoopIllegalArgumentException e) { GenericTestUtils.assertExceptionContains(STR, e); } fs.setXAttr(path, name1, value1); xattrs = fs.getXAttrs(path); Assert.assertEquals(xattrs.size(), 1); Assert.assertArrayEquals(value1, xattrs.get(name1)); fs.removeXAttr(path, name1); fs.setXAttr(path, name1, value1, EnumSet.of(XAttrSetFlag.CREATE)); fs.setXAttr(path, name1, newValue1, EnumSet.of(XAttrSetFlag.CREATE, XAttrSetFlag.REPLACE)); xattrs = fs.getXAttrs(path); Assert.assertEquals(xattrs.size(), 1); Assert.assertArrayEquals(newValue1, xattrs.get(name1)); fs.removeXAttr(path, name1); fs.setXAttr(path, name1, value1); fs.setXAttr(path, name2, value2); fs.setXAttr(path, name3, null); try { fs.setXAttr(path, name4, null); Assert.fail(STR + STR); } catch (IOException e) { GenericTestUtils.assertExceptionContains(STR, e); } fs.removeXAttr(path, name1); fs.removeXAttr(path, name2); fs.removeXAttr(path, name3); String longName = STR; try { fs.setXAttr(path, longName, null); Assert.fail(STR); } catch (IOException e) { GenericTestUtils.assertExceptionContains(STR, e); GenericTestUtils.assertExceptionContains(STR, e); } byte[] longValue = new byte[MAX_SIZE]; try { fs.setXAttr(path, STR, longValue); Assert.fail(STR); } catch (IOException e) { GenericTestUtils.assertExceptionContains(STR, e); GenericTestUtils.assertExceptionContains(STR, e); } String name = STR; byte[] value = new byte[MAX_SIZE-3]; fs.setXAttr(path, name, value); } | /**
* Tests for setting xattr
* 1. Set xattr with XAttrSetFlag.CREATE|XAttrSetFlag.REPLACE flag.
* 2. Set xattr with illegal name.
* 3. Set xattr without XAttrSetFlag.
* 4. Set xattr and total number exceeds max limit.
* 5. Set xattr and name is too long.
* 6. Set xattr and value is too long.
*/ | Tests for setting xattr 1. Set xattr with XAttrSetFlag.CREATE|XAttrSetFlag.REPLACE flag. 2. Set xattr with illegal name. 3. Set xattr without XAttrSetFlag. 4. Set xattr and total number exceeds max limit. 5. Set xattr and name is too long. 6. Set xattr and value is too long | testSetXAttr | {
"repo_name": "tseen/Federated-HDFS",
"path": "tseenliu/FedHDFS-hadoop-src/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/FSXAttrBaseTest.java",
"license": "apache-2.0",
"size": 36115
} | [
"java.io.IOException",
"java.util.EnumSet",
"java.util.Map",
"org.apache.hadoop.HadoopIllegalArgumentException",
"org.apache.hadoop.fs.FileSystem",
"org.apache.hadoop.fs.XAttrSetFlag",
"org.apache.hadoop.fs.permission.FsPermission",
"org.apache.hadoop.ipc.RemoteException",
"org.apache.hadoop.test.GenericTestUtils",
"org.junit.Assert",
"org.junit.Test"
] | import java.io.IOException; import java.util.EnumSet; import java.util.Map; import org.apache.hadoop.HadoopIllegalArgumentException; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.XAttrSetFlag; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.ipc.RemoteException; import org.apache.hadoop.test.GenericTestUtils; import org.junit.Assert; import org.junit.Test; | import java.io.*; import java.util.*; import org.apache.hadoop.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.fs.permission.*; import org.apache.hadoop.ipc.*; import org.apache.hadoop.test.*; import org.junit.*; | [
"java.io",
"java.util",
"org.apache.hadoop",
"org.junit"
] | java.io; java.util; org.apache.hadoop; org.junit; | 1,826,538 |
public ExecRow getNextRowCore() throws StandardException {
if( isXplainOnlyMode() )
return null;
if ( isOpen ) {
if ( ! next ) {
next = true;
if (SanityManager.DEBUG)
SanityManager.ASSERT(! cursor.isClosed(), "cursor closed");
ExecRow cursorRow = cursor.getCurrentRow();
// requalify the current row
if (cursorRow == null) {
throw StandardException.newException(SQLState.NO_CURRENT_ROW);
}
// we know it will be requested, may as well get it now.
rowLocation = cursor.getRowLocation();
// get the row from the base table, which is the real result
// row for the CurrentOfResultSet
currentRow = target.getCurrentRow();
// if the source result set is a ScrollInsensitiveResultSet, and
// the current row has been deleted (while the cursor was
// opened), the cursor result set (scroll insensitive) will
// return the cached row, while the target result set will
// return null (row has been deleted under owr feet).
if (rowLocation == null ||
(cursorRow != null && currentRow == null)) {
activation.addWarning(StandardException.
newWarning(SQLState.CURSOR_OPERATION_CONFLICT));
return null;
}
if (target instanceof TableScanResultSet)
{
TableScanResultSet scan = (TableScanResultSet) target;
if (scan.indexCols != null && currentRow != null)
currentRow = getSparseRow(currentRow, scan.indexCols);
}
// REMIND: verify the row is still there
// at present we get an ugly exception from the store,
// Hopefully someday we can just do this:
//
// if (!rowLocation.rowExists())
// throw StandardException.newException(SQLState.LANG_NO_CURRENT_ROW, cursorName);
}
else {
currentRow = null;
rowLocation = null;
}
}
else {
currentRow = null;
rowLocation = null;
}
setCurrentRow(currentRow);
return currentRow;
} | ExecRow function() throws StandardException { if( isXplainOnlyMode() ) return null; if ( isOpen ) { if ( ! next ) { next = true; if (SanityManager.DEBUG) SanityManager.ASSERT(! cursor.isClosed(), STR); ExecRow cursorRow = cursor.getCurrentRow(); if (cursorRow == null) { throw StandardException.newException(SQLState.NO_CURRENT_ROW); } rowLocation = cursor.getRowLocation(); currentRow = target.getCurrentRow(); if (rowLocation == null (cursorRow != null && currentRow == null)) { activation.addWarning(StandardException. newWarning(SQLState.CURSOR_OPERATION_CONFLICT)); return null; } if (target instanceof TableScanResultSet) { TableScanResultSet scan = (TableScanResultSet) target; if (scan.indexCols != null && currentRow != null) currentRow = getSparseRow(currentRow, scan.indexCols); } } else { currentRow = null; rowLocation = null; } } else { currentRow = null; rowLocation = null; } setCurrentRow(currentRow); return currentRow; } | /**
* If open and not returned yet, returns the row.
*
* @exception StandardException thrown on failure.
*/ | If open and not returned yet, returns the row | getNextRowCore | {
"repo_name": "trejkaz/derby",
"path": "java/engine/org/apache/derby/impl/sql/execute/CurrentOfResultSet.java",
"license": "apache-2.0",
"size": 9962
} | [
"org.apache.derby.iapi.error.StandardException",
"org.apache.derby.iapi.reference.SQLState",
"org.apache.derby.iapi.sql.execute.ExecRow",
"org.apache.derby.shared.common.sanity.SanityManager"
] | import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.reference.SQLState; import org.apache.derby.iapi.sql.execute.ExecRow; import org.apache.derby.shared.common.sanity.SanityManager; | import org.apache.derby.iapi.error.*; import org.apache.derby.iapi.reference.*; import org.apache.derby.iapi.sql.execute.*; import org.apache.derby.shared.common.sanity.*; | [
"org.apache.derby"
] | org.apache.derby; | 448,037 |
public static void setBeanInstances(Vector beanInstances,
JComponent container) {
reset(container);
if (container != null) {
for (int i = 0; i < beanInstances.size(); i++) {
Object bean = ((BeanInstance)beanInstances.elementAt(i)).getBean();
if (Beans.isInstanceOf(bean, JComponent.class)) {
container.add((JComponent)bean);
}
}
container.revalidate();
container.repaint();
}
COMPONENTS = beanInstances;
} | static void function(Vector beanInstances, JComponent container) { reset(container); if (container != null) { for (int i = 0; i < beanInstances.size(); i++) { Object bean = ((BeanInstance)beanInstances.elementAt(i)).getBean(); if (Beans.isInstanceOf(bean, JComponent.class)) { container.add((JComponent)bean); } } container.revalidate(); container.repaint(); } COMPONENTS = beanInstances; } | /**
* Describe <code>setBeanInstances</code> method here.
*
* @param beanInstances a <code>Vector</code> value
* @param container a <code>JComponent</code> value
*/ | Describe <code>setBeanInstances</code> method here | setBeanInstances | {
"repo_name": "paolopavan/cfr",
"path": "src/weka/gui/BEANS/BeanInstance.java",
"license": "gpl-3.0",
"size": 11247
} | [
"java.beans.Beans",
"java.util.Vector",
"javax.swing.JComponent"
] | import java.beans.Beans; import java.util.Vector; import javax.swing.JComponent; | import java.beans.*; import java.util.*; import javax.swing.*; | [
"java.beans",
"java.util",
"javax.swing"
] | java.beans; java.util; javax.swing; | 1,787,659 |
int delete(String id) throws SQLException; | int delete(String id) throws SQLException; | /**
* Executes a mapped SQL DELETE statement.
* Delete returns the number of rows effected.
* <p/>
* This overload assumes no parameter is needed.
*
* @param id The name of the statement to execute.
* @return The number of rows effected.
* @throws java.sql.SQLException If an error occurs.
*/ | Executes a mapped SQL DELETE statement. Delete returns the number of rows effected. This overload assumes no parameter is needed | delete | {
"repo_name": "mashuai/Open-Source-Research",
"path": "iBATIS/src/com/ibatis/sqlmap/client/SqlMapExecutor.java",
"license": "apache-2.0",
"size": 15752
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 775,398 |
protected void testScan(String start, String stop, String last)
throws IOException, InterruptedException, ClassNotFoundException {
String jobName = "Scan" + (start != null ? start.toUpperCase() : "Empty")
+ "To" + (stop != null ? stop.toUpperCase() : "Empty");
LOG.info("Before map/reduce startup - job " + jobName);
Configuration c = new Configuration(TEST_UTIL.getConfiguration());
Scan scan = new Scan();
scan.addFamily(INPUT_FAMILY);
if (start != null) {
scan.setStartRow(Bytes.toBytes(start));
}
c.set(KEY_STARTROW, start != null ? start : "");
if (stop != null) {
scan.setStopRow(Bytes.toBytes(stop));
}
c.set(KEY_LASTROW, last != null ? last : "");
LOG.info("scan before: " + scan);
Job job = new Job(c, jobName);
FileSystem fs = FileSystem.get(c);
Path tmpDir = new Path("/" + UUID.randomUUID());
fs.mkdirs(tmpDir);
try {
TableMapReduceUtil.initTableSnapshotMapperJob(Bytes.toString(SNAPSHOT_NAME),
scan, TestTableInputFormatScanBase.ScanMapper.class,
ImmutableBytesWritable.class, ImmutableBytesWritable.class, job,
false, tmpDir);
job.setReducerClass(TestTableInputFormatScanBase.ScanReducer.class);
job.setNumReduceTasks(1); // one to get final "first" and "last" key
FileOutputFormat.setOutputPath(job, new Path(job.getJobName()));
LOG.info("Started " + job.getJobName());
assertTrue(job.waitForCompletion(true));
LOG.info("After map/reduce completion - job " + jobName);
} finally {
fs.delete(tmpDir, true);
}
} | void function(String start, String stop, String last) throws IOException, InterruptedException, ClassNotFoundException { String jobName = "Scan" + (start != null ? start.toUpperCase() : "Empty") + "To" + (stop != null ? stop.toUpperCase() : "Empty"); LOG.info(STR + jobName); Configuration c = new Configuration(TEST_UTIL.getConfiguration()); Scan scan = new Scan(); scan.addFamily(INPUT_FAMILY); if (start != null) { scan.setStartRow(Bytes.toBytes(start)); } c.set(KEY_STARTROW, start != null ? start : STRSTRscan before: STR/STRStarted STRAfter map/reduce completion - job " + jobName); } finally { fs.delete(tmpDir, true); } } | /**
* Tests a MR scan using specific start and stop rows.
*
* @throws IOException
* @throws ClassNotFoundException
* @throws InterruptedException
*/ | Tests a MR scan using specific start and stop rows | testScan | {
"repo_name": "JichengSong/hbase",
"path": "src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableSnapshotInputFormatScan.java",
"license": "apache-2.0",
"size": 7009
} | [
"java.io.IOException",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.hbase.client.Scan",
"org.apache.hadoop.hbase.util.Bytes"
] | import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.util.Bytes; | import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.util.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,300,789 |
public Map<String, Map<String, String>> getGroupMap() {
return _configGroupMap;
} | Map<String, Map<String, String>> function() { return _configGroupMap; } | /**
* Gets the map of config groups by short key.
*
* @return the map, not null
*/ | Gets the map of config groups by short key | getGroupMap | {
"repo_name": "McLeodMoores/starling",
"path": "projects/web/src/main/java/com/opengamma/web/config/ConfigTypesProvider.java",
"license": "apache-2.0",
"size": 4877
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,822,957 |
public ClntIdent getClientID() {
return clientID;
} | ClntIdent function() { return clientID; } | /**
* client ID. Works only for read_attribute(s), write_attribute(s), write_read_attribute(s), command_inout and IDL
* >=4 and when request is not performed by the polling threads.
*
* @return the client id
*/ | client ID. Works only for read_attribute(s), write_attribute(s), write_read_attribute(s), command_inout and IDL >=4 and when request is not performed by the polling threads | getClientID | {
"repo_name": "tango-controls/JTango",
"path": "server/src/main/java/org/tango/server/InvocationContext.java",
"license": "lgpl-3.0",
"size": 5926
} | [
"fr.esrf.Tango"
] | import fr.esrf.Tango; | import fr.esrf.*; | [
"fr.esrf"
] | fr.esrf; | 1,817,875 |
public ArrayList<TextView> clickInRecyclerView(int line) {
return clickInRecyclerView(line, 0, 0, false, 0);
}
| ArrayList<TextView> function(int line) { return clickInRecyclerView(line, 0, 0, false, 0); } | /**
* Clicks on a certain list line and returns the {@link TextView}s that
* the list line is showing. Will use the first list it finds.
*
* @param line the line that should be clicked
* @return a {@code List} of the {@code TextView}s located in the list line
*/ | Clicks on a certain list line and returns the <code>TextView</code>s that the list line is showing. Will use the first list it finds | clickInRecyclerView | {
"repo_name": "RobotiumTech/robotium",
"path": "robotium-solo/src/main/java/com/robotium/solo/Clicker.java",
"license": "apache-2.0",
"size": 21594
} | [
"android.widget.TextView",
"java.util.ArrayList"
] | import android.widget.TextView; import java.util.ArrayList; | import android.widget.*; import java.util.*; | [
"android.widget",
"java.util"
] | android.widget; java.util; | 1,423,713 |
ImmutableList<StoreFile> close() throws IOException {
this.lock.writeLock().lock();
try {
ImmutableList<StoreFile> result = storefiles;
// Clear so metrics doesn't find them.
storefiles = ImmutableList.of();
if (!result.isEmpty()) {
// initialize the thread pool for closing store files in parallel.
ThreadPoolExecutor storeFileCloserThreadPool = this.region
.getStoreFileOpenAndCloseThreadPool("StoreFileCloserThread-"
+ this.family.getNameAsString()); | ImmutableList<StoreFile> close() throws IOException { this.lock.writeLock().lock(); try { ImmutableList<StoreFile> result = storefiles; storefiles = ImmutableList.of(); if (!result.isEmpty()) { ThreadPoolExecutor storeFileCloserThreadPool = this.region .getStoreFileOpenAndCloseThreadPool(STR + this.family.getNameAsString()); | /**
* Close all the readers
*
* We don't need to worry about subsequent requests because the HRegion holds
* a write lock that will prevent any more reads or writes.
*
* @throws IOException
*/ | Close all the readers We don't need to worry about subsequent requests because the HRegion holds a write lock that will prevent any more reads or writes | close | {
"repo_name": "indi60/hbase-pmc",
"path": "target/hbase-0.94.1/hbase-0.94.1/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java",
"license": "apache-2.0",
"size": 86038
} | [
"com.google.common.collect.ImmutableList",
"java.io.IOException",
"java.util.concurrent.ThreadPoolExecutor"
] | import com.google.common.collect.ImmutableList; import java.io.IOException; import java.util.concurrent.ThreadPoolExecutor; | import com.google.common.collect.*; import java.io.*; import java.util.concurrent.*; | [
"com.google.common",
"java.io",
"java.util"
] | com.google.common; java.io; java.util; | 2,700,463 |
@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(ServerRequestNotSupported.class)
@ResponseBody
public static ApiMessageResponse handleServerRequestNotSupported(
final ServerRequestNotSupported ex) {
return new ApiMessageResponse("Server does not support request");
} | @ResponseStatus(HttpStatus.NOT_FOUND) @ExceptionHandler(ServerRequestNotSupported.class) static ApiMessageResponse function( final ServerRequestNotSupported ex) { return new ApiMessageResponse(STR); } | /**
* ServerRequestNotSupported handler.
* @param ex ServerRequestNotSupported
* @return ApiStringResponse
*/ | ServerRequestNotSupported handler | handleServerRequestNotSupported | {
"repo_name": "formkiq/formkiq-server",
"path": "core/src/main/java/com/formkiq/core/api/ErrorHandlingController.java",
"license": "apache-2.0",
"size": 16517
} | [
"com.formkiq.core.service.ServerRequestNotSupported",
"com.formkiq.core.service.dto.ApiMessageResponse",
"org.springframework.http.HttpStatus",
"org.springframework.web.bind.annotation.ExceptionHandler",
"org.springframework.web.bind.annotation.ResponseStatus"
] | import com.formkiq.core.service.ServerRequestNotSupported; import com.formkiq.core.service.dto.ApiMessageResponse; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; | import com.formkiq.core.service.*; import com.formkiq.core.service.dto.*; import org.springframework.http.*; import org.springframework.web.bind.annotation.*; | [
"com.formkiq.core",
"org.springframework.http",
"org.springframework.web"
] | com.formkiq.core; org.springframework.http; org.springframework.web; | 2,702,285 |
@CheckForNull
V refresh(K key, int hash, CacheLoader<? super K, V> loader, boolean checkTime) {
final LoadingValueReference<K, V> loadingValueReference =
insertLoadingValueReference(key, hash, checkTime);
if (loadingValueReference == null) {
return null;
}
ListenableFuture<V> result = loadAsync(key, hash, loadingValueReference, loader);
if (result.isDone()) {
try {
return Uninterruptibles.getUninterruptibly(result);
} catch (Throwable t) {
// don't let refresh exceptions propagate; error was already logged
}
}
return null;
} | V refresh(K key, int hash, CacheLoader<? super K, V> loader, boolean checkTime) { final LoadingValueReference<K, V> loadingValueReference = insertLoadingValueReference(key, hash, checkTime); if (loadingValueReference == null) { return null; } ListenableFuture<V> result = loadAsync(key, hash, loadingValueReference, loader); if (result.isDone()) { try { return Uninterruptibles.getUninterruptibly(result); } catch (Throwable t) { } } return null; } | /**
* Refreshes the value associated with {@code key}, unless another thread is already doing so.
* Returns the newly refreshed value associated with {@code key} if it was refreshed inline, or
* {@code null} if another thread is performing the refresh or if an error occurs during
* refresh.
*/ | Refreshes the value associated with key, unless another thread is already doing so. Returns the newly refreshed value associated with key if it was refreshed inline, or null if another thread is performing the refresh or if an error occurs during refresh | refresh | {
"repo_name": "mosoft521/guava",
"path": "android/guava/src/com/google/common/cache/LocalCache.java",
"license": "apache-2.0",
"size": 146176
} | [
"com.google.common.util.concurrent.ListenableFuture",
"com.google.common.util.concurrent.Uninterruptibles"
] | import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.Uninterruptibles; | import com.google.common.util.concurrent.*; | [
"com.google.common"
] | com.google.common; | 1,066,683 |
Map<String, Throwable> getFailures(); | Map<String, Throwable> getFailures(); | /**
* Gets the authentication failure map.
*
* @return Non -null authentication failure map.
*/ | Gets the authentication failure map | getFailures | {
"repo_name": "pdrados/cas",
"path": "api/cas-server-core-api-authentication/src/main/java/org/apereo/cas/authentication/AuthenticationBuilder.java",
"license": "apache-2.0",
"size": 6310
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 431,308 |
@Override
public BInputPort connectTo(BOperatorInvocation receivingBop, boolean functional,
BInputPort input) {
// We go through the JavaFunctional code to ensure
// that we correctly add the dependent jars into the
// class path of the operator.
if (functional)
return JavaFunctional.connectTo(this, output(), getTupleType(),
receivingBop, input);
return receivingBop.inputFrom(output, input);
} | BInputPort function(BOperatorInvocation receivingBop, boolean functional, BInputPort input) { if (functional) return JavaFunctional.connectTo(this, output(), getTupleType(), receivingBop, input); return receivingBop.inputFrom(output, input); } | /**
* Connect this stream to a downstream operator. If input is null then a new
* input port will be created, otherwise it will be used to connect to this
* stream. Returns input or the new port if input was null.
*/ | Connect this stream to a downstream operator. If input is null then a new input port will be created, otherwise it will be used to connect to this stream. Returns input or the new port if input was null | connectTo | {
"repo_name": "ibmkendrick/streamsx.topology",
"path": "java/src/com/ibm/streamsx/topology/internal/core/StreamImpl.java",
"license": "apache-2.0",
"size": 25456
} | [
"com.ibm.streamsx.topology.builder.BInputPort",
"com.ibm.streamsx.topology.builder.BOperatorInvocation"
] | import com.ibm.streamsx.topology.builder.BInputPort; import com.ibm.streamsx.topology.builder.BOperatorInvocation; | import com.ibm.streamsx.topology.builder.*; | [
"com.ibm.streamsx"
] | com.ibm.streamsx; | 1,557,944 |
public ProfileInner withEnabledState(State enabledState) {
this.enabledState = enabledState;
return this;
} | ProfileInner function(State enabledState) { this.enabledState = enabledState; return this; } | /**
* Set the enabledState property: The state of the Experiment.
*
* @param enabledState the enabledState value to set.
* @return the ProfileInner object itself.
*/ | Set the enabledState property: The state of the Experiment | withEnabledState | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/frontdoor/azure-resourcemanager-frontdoor/src/main/java/com/azure/resourcemanager/frontdoor/fluent/models/ProfileInner.java",
"license": "mit",
"size": 3172
} | [
"com.azure.resourcemanager.frontdoor.models.State"
] | import com.azure.resourcemanager.frontdoor.models.State; | import com.azure.resourcemanager.frontdoor.models.*; | [
"com.azure.resourcemanager"
] | com.azure.resourcemanager; | 2,098,526 |
@Test
public void testInvalidBypassRules() throws Exception {
String[] invalidBypassRules = {
null,
"", // empty
"http://", // no valid host/port
"20:example.com", // bad port
"example.com:-20" // bad port
};
for (String bypassRule : invalidBypassRules) {
try {
setProxyOverrideSync(new ProxyConfig.Builder()
.addBypassRule(bypassRule).build());
fail("No exception for invalid bypass rule: " + bypassRule);
} catch (IllegalArgumentException e) {
// Expected
}
}
} | void function() throws Exception { String[] invalidBypassRules = { null, STRhttp: STR, STR }; for (String bypassRule : invalidBypassRules) { try { setProxyOverrideSync(new ProxyConfig.Builder() .addBypassRule(bypassRule).build()); fail(STR + bypassRule); } catch (IllegalArgumentException e) { } } } | /**
* This test should have an equivalent in CTS when this is implemented in the framework.
*/ | This test should have an equivalent in CTS when this is implemented in the framework | testInvalidBypassRules | {
"repo_name": "AndroidX/androidx",
"path": "webkit/webkit/src/androidTest/java/androidx/webkit/ProxyControllerTest.java",
"license": "apache-2.0",
"size": 12169
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,544,821 |
private void onActionMenuAbout() {
AlertDialog.Builder actionAbout = new AlertDialog.Builder(this);
LayoutInflater layoutInflater = this.getLayoutInflater();
actionAbout.setView(layoutInflater.inflate(R.layout.dialog_about, null))
.setTitle(R.string.app_name)
.create()
.show();
} | void function() { AlertDialog.Builder actionAbout = new AlertDialog.Builder(this); LayoutInflater layoutInflater = this.getLayoutInflater(); actionAbout.setView(layoutInflater.inflate(R.layout.dialog_about, null)) .setTitle(R.string.app_name) .create() .show(); } | /**
* Create dialog about app
*/ | Create dialog about app | onActionMenuAbout | {
"repo_name": "mogsev/CurrencyConvertor",
"path": "app/src/main/java/com/mogsev/currencyconvertor/MainActivity.java",
"license": "apache-2.0",
"size": 3413
} | [
"android.app.AlertDialog",
"android.view.LayoutInflater"
] | import android.app.AlertDialog; import android.view.LayoutInflater; | import android.app.*; import android.view.*; | [
"android.app",
"android.view"
] | android.app; android.view; | 751,722 |
public List<String> parseStatements(String sqlScript) {
List<SqlScriptStatement> scriptStatements = getSqlScriptStatements(sqlScript);
List<String> statements = new ArrayList<String>();
for (SqlScriptStatement scriptStatement : scriptStatements) {
statements.add(scriptStatement.getStatement());
}
return statements;
}
| List<String> function(String sqlScript) { List<SqlScriptStatement> scriptStatements = getSqlScriptStatements(sqlScript); List<String> statements = new ArrayList<String>(); for (SqlScriptStatement scriptStatement : scriptStatements) { statements.add(scriptStatement.getStatement()); } return statements; } | /**
* Parse all possible statements from the provided SQL script.
*
* @param sqlScript Raw SQL Script to be parsed into executable statements.
* @return List of parsed SQL statements to be executed separately.
*/ | Parse all possible statements from the provided SQL script | parseStatements | {
"repo_name": "jjeb/kettle-trunk",
"path": "db/src/org/pentaho/di/core/database/BaseDatabaseMeta.java",
"license": "apache-2.0",
"size": 63985
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,327,944 |
EReference getTableRowStart_End(); | EReference getTableRowStart_End(); | /**
* Returns the meta object for the reference '{@link org.lunifera.doc.dsl.doccompiler.TableRowStart#getEnd <em>End</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>End</em>'.
* @see org.lunifera.doc.dsl.doccompiler.TableRowStart#getEnd()
* @see #getTableRowStart()
* @generated
*/ | Returns the meta object for the reference '<code>org.lunifera.doc.dsl.doccompiler.TableRowStart#getEnd End</code>'. | getTableRowStart_End | {
"repo_name": "lunifera/lunifera-doc",
"path": "org.lunifera.doc.dsl.semantic/src/org/lunifera/doc/dsl/doccompiler/DocCompilerPackage.java",
"license": "epl-1.0",
"size": 267430
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 428,079 |
private void fillLevelTreeMap(Map<String, LevelTree> rightsMap, XWikiDocument preferences,
List<String> levelsToMatch, boolean global, boolean direct, XWikiContext context) throws XWikiException
{
List<String> levelInherited = null;
if (levelsToMatch == null) {
levelInherited = new ArrayList<String>();
}
if (!preferences.isNew()) {
String rightsClass = global ? GLOBAL_RIGHTS_CLASS : RIGHTS_CLASS;
List<BaseObject> vobj = preferences.getObjects(rightsClass);
if (vobj != null) {
for (BaseObject bobj : vobj) {
fillLevelTreeMap(rightsMap, levelInherited, bobj, levelsToMatch, direct, context);
}
}
}
fillLevelTreeMapInherited(rightsMap, levelInherited, preferences, levelsToMatch, global, context);
} | void function(Map<String, LevelTree> rightsMap, XWikiDocument preferences, List<String> levelsToMatch, boolean global, boolean direct, XWikiContext context) throws XWikiException { List<String> levelInherited = null; if (levelsToMatch == null) { levelInherited = new ArrayList<String>(); } if (!preferences.isNew()) { String rightsClass = global ? GLOBAL_RIGHTS_CLASS : RIGHTS_CLASS; List<BaseObject> vobj = preferences.getObjects(rightsClass); if (vobj != null) { for (BaseObject bobj : vobj) { fillLevelTreeMap(rightsMap, levelInherited, bobj, levelsToMatch, direct, context); } } } fillLevelTreeMapInherited(rightsMap, levelInherited, preferences, levelsToMatch, global, context); } | /**
* Fill the {@link LevelTree} {@link Map}.
*
* @param rightsMap the {@link LevelTree} {@link Map} to fill.
* @param preferences the document containing rights preferences.
* @param levelsToMatch the levels names to check ("view", "edit", etc.).
* @param global indicate it is global rights (wiki or space) or document rights.
* @param direct if true fill the {@link LevelTree#direct} field, otherwise fill the {@link LevelTree#inherited}.
* @param context the XWiki context.
* @throws XWikiException error when browsing rights preferences.
*/ | Fill the <code>LevelTree</code> <code>Map</code> | fillLevelTreeMap | {
"repo_name": "xwiki-labs/sankoreorg",
"path": "xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/plugin/rightsmanager/RightsManager.java",
"license": "lgpl-2.1",
"size": 50867
} | [
"com.xpn.xwiki.XWikiContext",
"com.xpn.xwiki.XWikiException",
"com.xpn.xwiki.doc.XWikiDocument",
"com.xpn.xwiki.objects.BaseObject",
"com.xpn.xwiki.plugin.rightsmanager.utils.LevelTree",
"java.util.ArrayList",
"java.util.List",
"java.util.Map"
] | import com.xpn.xwiki.XWikiContext; import com.xpn.xwiki.XWikiException; import com.xpn.xwiki.doc.XWikiDocument; import com.xpn.xwiki.objects.BaseObject; import com.xpn.xwiki.plugin.rightsmanager.utils.LevelTree; import java.util.ArrayList; import java.util.List; import java.util.Map; | import com.xpn.xwiki.*; import com.xpn.xwiki.doc.*; import com.xpn.xwiki.objects.*; import com.xpn.xwiki.plugin.rightsmanager.utils.*; import java.util.*; | [
"com.xpn.xwiki",
"java.util"
] | com.xpn.xwiki; java.util; | 1,106,627 |
@Override
public final Align getAlign() {
return getValue(Property.ALIGN, Align.values(), defaultOptions.getAlign());
}
| final Align function() { return getValue(Property.ALIGN, Align.values(), defaultOptions.getAlign()); } | /**
* Returns the position of the label relative to the anchor point position and orientation.
*
* @return the position of the label relative to the anchor point position and orientation.
*/ | Returns the position of the label relative to the anchor point position and orientation | getAlign | {
"repo_name": "pepstock-org/Charba",
"path": "src/org/pepstock/charba/client/datalabels/LabelItem.java",
"license": "apache-2.0",
"size": 61828
} | [
"org.pepstock.charba.client.datalabels.enums.Align"
] | import org.pepstock.charba.client.datalabels.enums.Align; | import org.pepstock.charba.client.datalabels.enums.*; | [
"org.pepstock.charba"
] | org.pepstock.charba; | 429,095 |
public HashSet<String> getEphemerals(long sessionId) {
return dataTree.getEphemerals(sessionId);
} | HashSet<String> function(long sessionId) { return dataTree.getEphemerals(sessionId); } | /**
* the paths for ephemeral session id
* @param sessionId the session id for which paths match to
* @return the paths for a session id
*/ | the paths for ephemeral session id | getEphemerals | {
"repo_name": "sdw2330976/zookeeper-3.3.4-source",
"path": "zookeeper-release-3.3.4/src/java/main/org/apache/zookeeper/server/ZKDatabase.java",
"license": "apache-2.0",
"size": 16076
} | [
"java.util.HashSet"
] | import java.util.HashSet; | import java.util.*; | [
"java.util"
] | java.util; | 37,837 |
private String addDefaultProfile() {
String profile = System.getProperty("spring.profiles.active");
if (profile != null) {
log.info("Running with Spring profile(s) : {}", profile);
return profile;
}
log.warn("No Spring profile configured, running with default configuration");
return Constants.SPRING_PROFILE_DEVELOPMENT;
} | String function() { String profile = System.getProperty(STR); if (profile != null) { log.info(STR, profile); return profile; } log.warn(STR); return Constants.SPRING_PROFILE_DEVELOPMENT; } | /**
* Set a default profile if it has not been set.
* <p/>
* <p>
* Please use -Dspring.profiles.active=dev
* </p>
*/ | Set a default profile if it has not been set. Please use -Dspring.profiles.active=dev | addDefaultProfile | {
"repo_name": "MarcoCeccarini/teknoservice",
"path": "src/main/java/org/mce/teknoservice/ApplicationWebXml.java",
"license": "mit",
"size": 1316
} | [
"org.mce.teknoservice.config.Constants"
] | import org.mce.teknoservice.config.Constants; | import org.mce.teknoservice.config.*; | [
"org.mce.teknoservice"
] | org.mce.teknoservice; | 2,628,833 |
@Test
public void testNumberOfFields() {
List<Field> fields = IndexTestUtils.getFields(INDEX_NO_DESCRIPTION.getClass());
assertEquals(15, fields.size());
fields = IndexTestUtils.getFields(INDEX_WITH_DESCRIPTION.getClass());
assertEquals(15, fields.size());
} | void function() { List<Field> fields = IndexTestUtils.getFields(INDEX_NO_DESCRIPTION.getClass()); assertEquals(15, fields.size()); fields = IndexTestUtils.getFields(INDEX_WITH_DESCRIPTION.getClass()); assertEquals(15, fields.size()); } | /**
* Tests the number of fields in the index. Will pick up additions / removals.
*/ | Tests the number of fields in the index. Will pick up additions / removals | testNumberOfFields | {
"repo_name": "jeorme/OG-Platform",
"path": "projects/OG-FinancialTypes/src/test/java/com/opengamma/financial/security/index/EquityIndexTest.java",
"license": "apache-2.0",
"size": 3552
} | [
"java.lang.reflect.Field",
"java.util.List",
"org.testng.AssertJUnit"
] | import java.lang.reflect.Field; import java.util.List; import org.testng.AssertJUnit; | import java.lang.reflect.*; import java.util.*; import org.testng.*; | [
"java.lang",
"java.util",
"org.testng"
] | java.lang; java.util; org.testng; | 1,707,736 |
public static List<SBuildType> getOwnBuildTypes(SProject project) {
try {
return project.getOwnBuildTypes();
} catch (NoSuchMethodError ex){
LOGGER.log(Level.INFO,ex.getMessage(),ex);
return project.getBuildTypes();
}
} | static List<SBuildType> function(SProject project) { try { return project.getOwnBuildTypes(); } catch (NoSuchMethodError ex){ LOGGER.log(Level.INFO,ex.getMessage(),ex); return project.getBuildTypes(); } } | /**
* Finds builds that belong the referenced project. Uses new method getOwnBuildTypes() if available.
* Does not find builds in sub-projects.
* @param project
* @return List of BuildTypes corresponding to what is configured in the project.
*/ | Finds builds that belong the referenced project. Uses new method getOwnBuildTypes() if available. Does not find builds in sub-projects | getOwnBuildTypes | {
"repo_name": "PeteGoo/tcSlackBuildNotifier",
"path": "tcslackbuildnotifier-core/src/main/java/slacknotifications/teamcity/TeamCityIdResolver.java",
"license": "mit",
"size": 4030
} | [
"java.util.List",
"java.util.logging.Level"
] | import java.util.List; import java.util.logging.Level; | import java.util.*; import java.util.logging.*; | [
"java.util"
] | java.util; | 397,676 |
public void refresh() {
final String json = JsonUtil.load(JsonUtil.MARQUES_PAGE_PATH);
final Gson gson = Constantes.GSON;
listMarquesPage.clear();
@SuppressWarnings("unchecked")
final List<MarquePage> marquesPages = gson.fromJson(json, List.class);
if (marquesPages != null) {
listMarquesPage.addAll(marquesPages);
}
}
| void function() { final String json = JsonUtil.load(JsonUtil.MARQUES_PAGE_PATH); final Gson gson = Constantes.GSON; listMarquesPage.clear(); @SuppressWarnings(STR) final List<MarquePage> marquesPages = gson.fromJson(json, List.class); if (marquesPages != null) { listMarquesPage.addAll(marquesPages); } } | /**
* Permet de raffraichir les donnees
*/ | Permet de raffraichir les donnees | refresh | {
"repo_name": "Mastersnes/AEFerrets",
"path": "src/main/java/bdd/MarquesPageDAO.java",
"license": "apache-2.0",
"size": 1136
} | [
"com.google.gson.Gson",
"java.util.List"
] | import com.google.gson.Gson; import java.util.List; | import com.google.gson.*; import java.util.*; | [
"com.google.gson",
"java.util"
] | com.google.gson; java.util; | 202,182 |
public Insets getEdgeInsets() {
return edgeInsets;
} | Insets function() { return edgeInsets; } | /**
* Get the bounds insets
*
* @return the bounds insets
*/ | Get the bounds insets | getEdgeInsets | {
"repo_name": "JonathanGeoffroy/RoundTripModeler",
"path": "src/main/java/opl/modeler/panels/ComponentMover.java",
"license": "gpl-2.0",
"size": 8960
} | [
"java.awt.Insets"
] | import java.awt.Insets; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,894,166 |
@Transactional(readOnly = true)
public PlatformType findPlatformTypeByName(String type) throws PlatformNotFoundException {
PlatformType ptype = platformTypeDAO.findByName(type);
if (ptype == null) {
throw new PlatformNotFoundException(type);
}
return ptype;
} | @Transactional(readOnly = true) PlatformType function(String type) throws PlatformNotFoundException { PlatformType ptype = platformTypeDAO.findByName(type); if (ptype == null) { throw new PlatformNotFoundException(type); } return ptype; } | /**
* Find a platform type by name
*
* @param type - name of the platform type
* @return platformTypeValue
*
*/ | Find a platform type by name | findPlatformTypeByName | {
"repo_name": "cc14514/hq6",
"path": "hq-server/src/main/java/org/hyperic/hq/appdef/server/session/PlatformManagerImpl.java",
"license": "unlicense",
"size": 81973
} | [
"org.hyperic.hq.appdef.shared.PlatformNotFoundException",
"org.springframework.transaction.annotation.Transactional"
] | import org.hyperic.hq.appdef.shared.PlatformNotFoundException; import org.springframework.transaction.annotation.Transactional; | import org.hyperic.hq.appdef.shared.*; import org.springframework.transaction.annotation.*; | [
"org.hyperic.hq",
"org.springframework.transaction"
] | org.hyperic.hq; org.springframework.transaction; | 1,155,705 |
public void checkUserLogIn(final String mail, final String password) {
AsyncHttpClient client = new AsyncHttpClient();
RequestParams params = new RequestParams();
params.put("email", mail);
params.put("password", password);
Log.i("LOGIN check", mail);
//lock screen orientation
int currentOrientation = getResources().getConfiguration().orientation;
if (currentOrientation == Configuration.ORIENTATION_PORTRAIT) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} | void function(final String mail, final String password) { AsyncHttpClient client = new AsyncHttpClient(); RequestParams params = new RequestParams(); params.put("email", mail); params.put(STR, password); Log.i(STR, mail); int currentOrientation = getResources().getConfiguration().orientation; if (currentOrientation == Configuration.ORIENTATION_PORTRAIT) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } | /**
* check if user is already register in remote database
*/ | check if user is already register in remote database | checkUserLogIn | {
"repo_name": "kikitsa/csd-Thesis",
"path": "app/src/main/java/kiki__000/walkingstoursapp/LogIn.java",
"license": "mit",
"size": 7960
} | [
"android.content.pm.ActivityInfo",
"android.content.res.Configuration",
"android.util.Log",
"com.loopj.android.http.AsyncHttpClient",
"com.loopj.android.http.RequestParams"
] | import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.util.Log; import com.loopj.android.http.AsyncHttpClient; import com.loopj.android.http.RequestParams; | import android.content.pm.*; import android.content.res.*; import android.util.*; import com.loopj.android.http.*; | [
"android.content",
"android.util",
"com.loopj.android"
] | android.content; android.util; com.loopj.android; | 2,873,842 |
@Test
public void testSurplusResourcesAreBufferedUnderAnyHost() throws Exception {
containerAllocator.requestResources(new HashMap<String, String>() {
{
put("0", "abc");
put("1", "xyz");
}
});
assertNotNull(requestState.getResourcesOnAHost("abc"));
assertEquals(0, requestState.getResourcesOnAHost("abc").size());
assertNotNull(requestState.getResourcesOnAHost("xyz"));
assertEquals(0, requestState.getResourcesOnAHost("xyz").size());
assertNull(requestState.getResourcesOnAHost(ResourceRequestState.ANY_HOST));
containerAllocator.addResource(new SamzaResource(1, 10, "abc", "ID1"));
containerAllocator.addResource(new SamzaResource(1, 10, "xyz", "ID2"));
// surplus resources for host - "abc"
containerAllocator.addResource(new SamzaResource(1, 10, "abc", "ID3"));
containerAllocator.addResource(new SamzaResource(1, 10, "abc", "ID4"));
containerAllocator.addResource(new SamzaResource(1, 10, "abc", "ID5"));
containerAllocator.addResource(new SamzaResource(1, 10, "abc", "ID6"));
assertNotNull(requestState.getResourcesOnAHost("abc"));
assertEquals(1, requestState.getResourcesOnAHost("abc").size());
assertNotNull(requestState.getResourcesOnAHost("xyz"));
assertEquals(1, requestState.getResourcesOnAHost("xyz").size());
assertNotNull(requestState.getResourcesOnAHost(ResourceRequestState.ANY_HOST));
// assert that the surplus resources goto the ANY_HOST buffer
assertTrue(requestState.getResourcesOnAHost(ResourceRequestState.ANY_HOST).size() == 4);
assertEquals("ID3", requestState.getResourcesOnAHost(ResourceRequestState.ANY_HOST).get(0).getResourceID());
} | void function() throws Exception { containerAllocator.requestResources(new HashMap<String, String>() { { put("0", "abc"); put("1", "xyz"); } }); assertNotNull(requestState.getResourcesOnAHost("abc")); assertEquals(0, requestState.getResourcesOnAHost("abc").size()); assertNotNull(requestState.getResourcesOnAHost("xyz")); assertEquals(0, requestState.getResourcesOnAHost("xyz").size()); assertNull(requestState.getResourcesOnAHost(ResourceRequestState.ANY_HOST)); containerAllocator.addResource(new SamzaResource(1, 10, "abc", "ID1")); containerAllocator.addResource(new SamzaResource(1, 10, "xyz", "ID2")); containerAllocator.addResource(new SamzaResource(1, 10, "abc", "ID3")); containerAllocator.addResource(new SamzaResource(1, 10, "abc", "ID4")); containerAllocator.addResource(new SamzaResource(1, 10, "abc", "ID5")); containerAllocator.addResource(new SamzaResource(1, 10, "abc", "ID6")); assertNotNull(requestState.getResourcesOnAHost("abc")); assertEquals(1, requestState.getResourcesOnAHost("abc").size()); assertNotNull(requestState.getResourcesOnAHost("xyz")); assertEquals(1, requestState.getResourcesOnAHost("xyz").size()); assertNotNull(requestState.getResourcesOnAHost(ResourceRequestState.ANY_HOST)); assertTrue(requestState.getResourcesOnAHost(ResourceRequestState.ANY_HOST).size() == 4); assertEquals("ID3", requestState.getResourcesOnAHost(ResourceRequestState.ANY_HOST).get(0).getResourceID()); } | /**
* Test that extra resources are buffered under ANY_HOST
*/ | Test that extra resources are buffered under ANY_HOST | testSurplusResourcesAreBufferedUnderAnyHost | {
"repo_name": "fredji97/samza",
"path": "samza-core/src/test/java/org/apache/samza/clustermanager/TestHostAwareContainerAllocator.java",
"license": "apache-2.0",
"size": 18638
} | [
"java.util.HashMap",
"org.junit.Assert"
] | import java.util.HashMap; import org.junit.Assert; | import java.util.*; import org.junit.*; | [
"java.util",
"org.junit"
] | java.util; org.junit; | 983,981 |
@Test
public void testWithoutZKServer() throws Exception {
try {
new ActiveStandbyElector("127.0.0.1", 2000, ZK_PARENT_NAME,
Ids.OPEN_ACL_UNSAFE, Collections.<ZKAuthInfo> emptyList(), mockApp);
Assert.fail("Did not throw zookeeper connection loss exceptions!");
} catch (KeeperException ke) {
GenericTestUtils.assertExceptionContains( "ConnectionLoss", ke);
}
} | void function() throws Exception { try { new ActiveStandbyElector(STR, 2000, ZK_PARENT_NAME, Ids.OPEN_ACL_UNSAFE, Collections.<ZKAuthInfo> emptyList(), mockApp); Assert.fail(STR); } catch (KeeperException ke) { GenericTestUtils.assertExceptionContains( STR, ke); } } | /**
* verify the zookeeper connection establishment
*/ | verify the zookeeper connection establishment | testWithoutZKServer | {
"repo_name": "ZhangXFeng/hadoop",
"path": "src/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ha/TestActiveStandbyElector.java",
"license": "apache-2.0",
"size": 27834
} | [
"java.util.Collections",
"org.apache.hadoop.test.GenericTestUtils",
"org.apache.hadoop.util.ZKUtil",
"org.apache.zookeeper.KeeperException",
"org.apache.zookeeper.ZooDefs",
"org.junit.Assert"
] | import java.util.Collections; import org.apache.hadoop.test.GenericTestUtils; import org.apache.hadoop.util.ZKUtil; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.ZooDefs; import org.junit.Assert; | import java.util.*; import org.apache.hadoop.test.*; import org.apache.hadoop.util.*; import org.apache.zookeeper.*; import org.junit.*; | [
"java.util",
"org.apache.hadoop",
"org.apache.zookeeper",
"org.junit"
] | java.util; org.apache.hadoop; org.apache.zookeeper; org.junit; | 1,957,714 |
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<AgentPoolInner>> getWithResponseAsync(
String resourceGroupName, String resourceName, String agentPoolName) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
if (agentPoolName == null) {
return Mono.error(new IllegalArgumentException("Parameter agentPoolName is required and cannot be null."));
}
final String apiVersion = "2020-06-01";
return FluxUtil
.withContext(
context ->
service
.get(
this.client.getEndpoint(),
apiVersion,
this.client.getSubscriptionId(),
resourceGroupName,
resourceName,
agentPoolName,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<AgentPoolInner>> function( String resourceGroupName, String resourceName, String agentPoolName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (resourceName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (agentPoolName == null) { return Mono.error(new IllegalArgumentException(STR)); } final String apiVersion = STR; return FluxUtil .withContext( context -> service .get( this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, resourceName, agentPoolName, context)) .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); } | /**
* Gets the details of the agent pool by managed cluster and resource group.
*
* @param resourceGroupName The name of the resource group.
* @param resourceName The name of the managed cluster resource.
* @param agentPoolName The name of the agent pool.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the details of the agent pool by managed cluster and resource group.
*/ | Gets the details of the agent pool by managed cluster and resource group | getWithResponseAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-containerservice/src/main/java/com/azure/resourcemanager/containerservice/implementation/AgentPoolsClientImpl.java",
"license": "mit",
"size": 70622
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.FluxUtil",
"com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.containerservice.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 587,642 |
public static void rmdir( File dir ) {
if( dir != null ) {
for( File file : JAVA.iterable( dir.listFiles() ) ) {
if( file.isDirectory() ) {
rmdir( file );
}
else {
file.delete();
}
}
dir.delete();
}
} | static void function( File dir ) { if( dir != null ) { for( File file : JAVA.iterable( dir.listFiles() ) ) { if( file.isDirectory() ) { rmdir( file ); } else { file.delete(); } } dir.delete(); } } | /**
* Delete directory and all files and subdirectories
*
* @param dir Directory to delete
*
*/ | Delete directory and all files and subdirectories | rmdir | {
"repo_name": "elelpublic/tablestream",
"path": "src/main/java/com/infodesire/commons/FILE.java",
"license": "lgpl-2.1",
"size": 3208
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,254,420 |
public char getNextOpt() throws ParseException
{
if (mArgNum >= mArgs.length) return EndOfOpts;
int offset = 1;
mVal = null;
try {
String arg = mArgs[mArgNum];
// If it doesn't start with a dash, we'll assume we've reached the end of the
// arguments. We need to decrement mArgNum because the finally at the end is
// going to increment it.
if (arg.charAt(0) != '-') {
mArgNum--;
return EndOfOpts;
}
// Strip any dashes off of the beginning
for (int i = 1; i < arg.length() && arg.charAt(i) == '-'; i++) offset++;
// If they passed us a - or -- then quit
if (offset == arg.length()) return EndOfOpts;
Character cc = null;
if (arg.substring(offset).length() == 1) {
cc = new Character(arg.substring(offset).charAt(0));
} else {
cc = mLong.get(arg.substring(offset));
if (cc == null) {
Integer ii = new Integer(mArgNum + 1);
StringBuilder errMsg = new StringBuilder();
errMsg.append("Found unknown option (");
errMsg.append(arg);
errMsg.append(") at position ");
errMsg.append(ii.toString());
throw new ParseException(errMsg.toString(), mArgNum);
}
}
ValueExpected ve = mShort.get(cc);
if (ve == null) {
Integer ii = new Integer(mArgNum + 1);
StringBuilder errMsg = new StringBuilder();
errMsg.append("Found unknown option (");
errMsg.append(arg);
errMsg.append(") at position ");
errMsg.append(ii.toString());
throw new ParseException(errMsg.toString(), mArgNum);
}
switch (ve) {
case NOT_ACCEPTED:
return cc.charValue();
case REQUIRED:
// If it requires an option, make sure there is one.
if (mArgNum + 1 >= mArgs.length || mArgs[mArgNum + 1].charAt(0) == '-') {
String errMsg = "Option " + arg +
" requires a value but you did not provide one.";
throw new ParseException(errMsg, mArgNum);
}
mVal = new String(mArgs[++mArgNum]);
return cc.charValue();
case OPTIONAL:
if (mArgNum + 1 < mArgs.length && mArgs[mArgNum + 1].charAt(0) != '-') {
mVal = new String(mArgs[++mArgNum]);
}
return cc.charValue();
default:
throw new AssertionError("Unknown valueExpected state");
}
} finally {
mArgNum++;
}
} | char function() throws ParseException { if (mArgNum >= mArgs.length) return EndOfOpts; int offset = 1; mVal = null; try { String arg = mArgs[mArgNum]; if (arg.charAt(0) != '-') { mArgNum--; return EndOfOpts; } for (int i = 1; i < arg.length() && arg.charAt(i) == '-'; i++) offset++; if (offset == arg.length()) return EndOfOpts; Character cc = null; if (arg.substring(offset).length() == 1) { cc = new Character(arg.substring(offset).charAt(0)); } else { cc = mLong.get(arg.substring(offset)); if (cc == null) { Integer ii = new Integer(mArgNum + 1); StringBuilder errMsg = new StringBuilder(); errMsg.append(STR); errMsg.append(arg); errMsg.append(STR); errMsg.append(ii.toString()); throw new ParseException(errMsg.toString(), mArgNum); } } ValueExpected ve = mShort.get(cc); if (ve == null) { Integer ii = new Integer(mArgNum + 1); StringBuilder errMsg = new StringBuilder(); errMsg.append(STR); errMsg.append(arg); errMsg.append(STR); errMsg.append(ii.toString()); throw new ParseException(errMsg.toString(), mArgNum); } switch (ve) { case NOT_ACCEPTED: return cc.charValue(); case REQUIRED: if (mArgNum + 1 >= mArgs.length mArgs[mArgNum + 1].charAt(0) == '-') { String errMsg = STR + arg + STR; throw new ParseException(errMsg, mArgNum); } mVal = new String(mArgs[++mArgNum]); return cc.charValue(); case OPTIONAL: if (mArgNum + 1 < mArgs.length && mArgs[mArgNum + 1].charAt(0) != '-') { mVal = new String(mArgs[++mArgNum]); } return cc.charValue(); default: throw new AssertionError(STR); } } finally { mArgNum++; } } | /**
* Get the next option.
* @return The short designator for the next argument. If there are no more arguments
* than the special designator CmdLineParser.EndOfOpts will be returned.
* @throws ParseException if an unknown option is found or an option that
* expects a value does not have one or a value that does not expect a value does have
* one.
*/ | Get the next option | getNextOpt | {
"repo_name": "billywatson/pig",
"path": "src/org/apache/pig/tools/cmdline/CmdLineParser.java",
"license": "apache-2.0",
"size": 7155
} | [
"java.lang.AssertionError",
"java.text.ParseException"
] | import java.lang.AssertionError; import java.text.ParseException; | import java.lang.*; import java.text.*; | [
"java.lang",
"java.text"
] | java.lang; java.text; | 862,782 |
@Override
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-09-19T03:09:39-06:00", comment = "JAXB RI v2.2.6")
public String toString() {
return ToStringBuilder.reflectionToString(this, JAXBToStringStyle.MULTI_LINE_STYLE);
} | @Generated(value = STR, date = STR, comment = STR) String function() { return ToStringBuilder.reflectionToString(this, JAXBToStringStyle.MULTI_LINE_STYLE); } | /**
* Generates a String representation of the contents of this type.
* This is an extension method, produced by the 'ts' xjc plugin
*
*/ | Generates a String representation of the contents of this type. This is an extension method, produced by the 'ts' xjc plugin | toString | {
"repo_name": "angecab10/travelport-uapi-tutorial",
"path": "src/com/travelport/schema/hotel_v29_0/RatesAndDates.java",
"license": "gpl-3.0",
"size": 7004
} | [
"javax.annotation.Generated",
"org.apache.commons.lang.builder.ToStringBuilder",
"org.apache.cxf.xjc.runtime.JAXBToStringStyle"
] | import javax.annotation.Generated; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.cxf.xjc.runtime.JAXBToStringStyle; | import javax.annotation.*; import org.apache.commons.lang.builder.*; import org.apache.cxf.xjc.runtime.*; | [
"javax.annotation",
"org.apache.commons",
"org.apache.cxf"
] | javax.annotation; org.apache.commons; org.apache.cxf; | 1,880,515 |
public void setSignalNames (List<String> signalNames)
{
this.signalNames = signalNames;
} | void function (List<String> signalNames) { this.signalNames = signalNames; } | /**
* Metoda postavlja novi set imena signala
*
* @param signalNames Nove set imena signala
*/ | Metoda postavlja novi set imena signala | setSignalNames | {
"repo_name": "mbezjak/vhdllab",
"path": "vhdllab-client/src/main/java/hr/fer/zemris/vhdllab/applets/simulations/SignalNamesPanel.java",
"license": "apache-2.0",
"size": 12209
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 24,093 |
public String[] getAttributes(String name, AttributeHeader header, int rowid)
throws Exception
{
String[] result = null;
String query = String.format("SELECT %s FROM \"%s\" WHERE ROWID=?",
header.getComaNameColumns(true, false), name);
Stmt stmt = db.prepare(query);
stmt.bind(1, rowid);
if(stmt.step())
{
int count = header.getCountColumns();
result = new String[count];
for(int i=0; i < count; i++)
{
result[i] = stmt.column_string(i);
}
}
stmt.close();
return result;
} | String[] function(String name, AttributeHeader header, int rowid) throws Exception { String[] result = null; String query = String.format(STR%s\STR, header.getComaNameColumns(true, false), name); Stmt stmt = db.prepare(query); stmt.bind(1, rowid); if(stmt.step()) { int count = header.getCountColumns(); result = new String[count]; for(int i=0; i < count; i++) { result[i] = stmt.column_string(i); } } stmt.close(); return result; } | /**
* get attributes of one object
* @param name
* @param header
* @param rowid
* @return
* @throws Exception
*/ | get attributes of one object | getAttributes | {
"repo_name": "Jules-/terraingis",
"path": "src/TerrainGIS/src/cz/kalcik/vojta/terraingis/io/SpatiaLiteIO.java",
"license": "gpl-3.0",
"size": 28193
} | [
"cz.kalcik.vojta.terraingis.layer.AttributeHeader"
] | import cz.kalcik.vojta.terraingis.layer.AttributeHeader; | import cz.kalcik.vojta.terraingis.layer.*; | [
"cz.kalcik.vojta"
] | cz.kalcik.vojta; | 1,406,447 |
private void createTreeLibsControlTab() {
Composite parent;
GridData gd;
TabItem tabItem = new TabItem(tabFolder, SWT.None);
tabItem.setText("Libraries");
tabItem.setImage(imageSystemLibRoot);
Composite composite = new Composite(tabFolder, SWT.None);
parent = composite;
composite.setLayout(new GridLayout(2, false));
Label l1 = new Label(parent, SWT.None);
l1.setText("System PYTHONPATH. Reorder with Drag && Drop.");
gd = new GridData();
gd.horizontalSpan = 2;
l1.setLayoutData(gd);
//the tree
treeWithLibs = getTreeLibsControl(parent);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
gd.heightHint = 200;
treeWithLibs.setLayoutData(gd);
//buttons at the side of the tree
Composite control = getButtonBoxControlSystem(parent);
gd = new GridData();
gd.verticalAlignment = GridData.BEGINNING;
control.setLayoutData(gd);
tabItem.setControl(composite);
} | void function() { Composite parent; GridData gd; TabItem tabItem = new TabItem(tabFolder, SWT.None); tabItem.setText(STR); tabItem.setImage(imageSystemLibRoot); Composite composite = new Composite(tabFolder, SWT.None); parent = composite; composite.setLayout(new GridLayout(2, false)); Label l1 = new Label(parent, SWT.None); l1.setText(STR); gd = new GridData(); gd.horizontalSpan = 2; l1.setLayoutData(gd); treeWithLibs = getTreeLibsControl(parent); gd = new GridData(); gd.horizontalAlignment = SWT.FILL; gd.verticalAlignment = SWT.FILL; gd.grabExcessHorizontalSpace = true; gd.grabExcessVerticalSpace = true; gd.heightHint = 200; treeWithLibs.setLayoutData(gd); Composite control = getButtonBoxControlSystem(parent); gd = new GridData(); gd.verticalAlignment = GridData.BEGINNING; control.setLayoutData(gd); tabItem.setControl(composite); } | /**
* Creates tab to show the pythonpath (libraries)
*/ | Creates tab to show the pythonpath (libraries) | createTreeLibsControlTab | {
"repo_name": "RandallDW/Aruba_plugin",
"path": "plugins/org.python.pydev/src/org/python/pydev/ui/pythonpathconf/AbstractInterpreterEditor.java",
"license": "epl-1.0",
"size": 44153
} | [
"org.eclipse.swt.layout.GridData",
"org.eclipse.swt.layout.GridLayout",
"org.eclipse.swt.widgets.Composite",
"org.eclipse.swt.widgets.Label",
"org.eclipse.swt.widgets.TabItem"
] | import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.TabItem; | import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 913,752 |
private static boolean isCodecUsableDecoder(MediaCodecInfo info, String name,
boolean secureDecodersExplicit) {
if (info.isEncoder() || (!secureDecodersExplicit && name.endsWith(".secure"))) {
return false;
}
// Work around broken audio decoders.
if (Util.SDK_INT < 21
&& ("CIPAACDecoder".equals(name)
|| "CIPMP3Decoder".equals(name)
|| "CIPVorbisDecoder".equals(name)
|| "AACDecoder".equals(name)
|| "MP3Decoder".equals(name))) {
return false;
}
// Work around https://github.com/google/ExoPlayer/issues/398
if (Util.SDK_INT < 18 && "OMX.SEC.MP3.Decoder".equals(name)) {
return false;
}
// Work around https://github.com/google/ExoPlayer/issues/1528
if (Util.SDK_INT < 18 && "OMX.MTK.AUDIO.DECODER.AAC".equals(name)
&& "a70".equals(Util.DEVICE)) {
return false;
}
// Work around an issue where querying/creating a particular MP3 decoder on some devices on
// platform API version 16 fails.
if (Util.SDK_INT == 16 && Util.DEVICE != null
&& "OMX.qcom.audio.decoder.mp3".equals(name)
&& ("dlxu".equals(Util.DEVICE) // HTC Butterfly
|| "protou".equals(Util.DEVICE) // HTC Desire X
|| "ville".equals(Util.DEVICE) // HTC One S
|| "villeplus".equals(Util.DEVICE)
|| "villec2".equals(Util.DEVICE)
|| Util.DEVICE.startsWith("gee") // LGE Optimus G
|| "C6602".equals(Util.DEVICE) // Sony Xperia Z
|| "C6603".equals(Util.DEVICE)
|| "C6606".equals(Util.DEVICE)
|| "C6616".equals(Util.DEVICE)
|| "L36h".equals(Util.DEVICE)
|| "SO-02E".equals(Util.DEVICE))) {
return false;
}
// Work around an issue where large timestamps are not propagated correctly.
if (Util.SDK_INT == 16
&& "OMX.qcom.audio.decoder.aac".equals(name)
&& ("C1504".equals(Util.DEVICE) // Sony Xperia E
|| "C1505".equals(Util.DEVICE)
|| "C1604".equals(Util.DEVICE) // Sony Xperia E dual
|| "C1605".equals(Util.DEVICE))) {
return false;
}
// Work around https://github.com/google/ExoPlayer/issues/548
// VP8 decoder on Samsung Galaxy S3/S4/S4 Mini/Tab 3 does not render video.
if (Util.SDK_INT <= 19 && Util.DEVICE != null
&& (Util.DEVICE.startsWith("d2") || Util.DEVICE.startsWith("serrano")
|| Util.DEVICE.startsWith("jflte") || Util.DEVICE.startsWith("santos"))
&& "samsung".equals(Util.MANUFACTURER) && name.equals("OMX.SEC.vp8.dec")) {
return false;
}
// VP8 decoder on Samsung Galaxy S4 cannot be queried.
return !(Util.SDK_INT <= 19 && Util.DEVICE != null && Util.DEVICE.startsWith("jflte")
&& "OMX.qcom.video.decoder.vp8".equals(name));
} | static boolean function(MediaCodecInfo info, String name, boolean secureDecodersExplicit) { if (info.isEncoder() (!secureDecodersExplicit && name.endsWith(STR))) { return false; } if (Util.SDK_INT < 21 && (STR.equals(name) STR.equals(name) STR.equals(name) STR.equals(name) STR.equals(name))) { return false; } if (Util.SDK_INT < 18 && STR.equals(name)) { return false; } if (Util.SDK_INT < 18 && STR.equals(name) && "a70".equals(Util.DEVICE)) { return false; } if (Util.SDK_INT == 16 && Util.DEVICE != null && STR.equals(name) && ("dlxu".equals(Util.DEVICE) STR.equals(Util.DEVICE) "ville".equals(Util.DEVICE) STR.equals(Util.DEVICE) STR.equals(Util.DEVICE) Util.DEVICE.startsWith("gee") "C6602".equals(Util.DEVICE) "C6603".equals(Util.DEVICE) "C6606".equals(Util.DEVICE) "C6616".equals(Util.DEVICE) "L36h".equals(Util.DEVICE) STR.equals(Util.DEVICE))) { return false; } if (Util.SDK_INT == 16 && STR.equals(name) && ("C1504".equals(Util.DEVICE) "C1505".equals(Util.DEVICE) "C1604".equals(Util.DEVICE) "C1605".equals(Util.DEVICE))) { return false; } if (Util.SDK_INT <= 19 && Util.DEVICE != null && (Util.DEVICE.startsWith("d2") Util.DEVICE.startsWith(STR) Util.DEVICE.startsWith("jflte") Util.DEVICE.startsWith(STR)) && STR.equals(Util.MANUFACTURER) && name.equals(STR)) { return false; } return !(Util.SDK_INT <= 19 && Util.DEVICE != null && Util.DEVICE.startsWith("jflte") && STR.equals(name)); } | /**
* Returns whether the specified codec is usable for decoding on the current device.
*/ | Returns whether the specified codec is usable for decoding on the current device | isCodecUsableDecoder | {
"repo_name": "DigitalLabApp/Gramy",
"path": "Telegram-master/TMessagesProj/src/main/java/org/telegram/messenger/exoplayer/MediaCodecUtil.java",
"license": "gpl-2.0",
"size": 19636
} | [
"android.media.MediaCodecInfo",
"org.telegram.messenger.exoplayer.util.Util"
] | import android.media.MediaCodecInfo; import org.telegram.messenger.exoplayer.util.Util; | import android.media.*; import org.telegram.messenger.exoplayer.util.*; | [
"android.media",
"org.telegram.messenger"
] | android.media; org.telegram.messenger; | 2,109,146 |
@Test
public void updateAll() throws Exception {
if (normaltblTableName.startsWith("ob")) {
// ob不支持批量更新
return;
}
String sql = "UPDATE " + normaltblTableName
+ " SET id=?,gmt_create=?,gmt_timestamp=?,gmt_datetime=?,name=?,floatCol=?";
List<List<Object>> params = new ArrayList();
for (int i = 0; i < 50; i++) {
List<Object> param = new ArrayList<Object>();
param.add(9999);
param.add(gmtDay);
param.add(gmt);
param.add(gmt);
param.add("new_name");
param.add(0.999F);
params.add(param);
}
executeBatch(sql, params);
sql = "SELECT * FROM " + normaltblTableName;
String[] columnParam = { "ID", "GMT_CREATE", "NAME", "FLOATCOL", "GMT_TIMESTAMP", "GMT_DATETIME" };
selectOrderAssert(sql, columnParam, Collections.EMPTY_LIST);
} | void function() throws Exception { if (normaltblTableName.startsWith("ob")) { return; } String sql = STR + normaltblTableName + STR; List<List<Object>> params = new ArrayList(); for (int i = 0; i < 50; i++) { List<Object> param = new ArrayList<Object>(); param.add(9999); param.add(gmtDay); param.add(gmt); param.add(gmt); param.add(STR); param.add(0.999F); params.add(param); } executeBatch(sql, params); sql = STR + normaltblTableName; String[] columnParam = { "ID", STR, "NAME", STR, STR, STR }; selectOrderAssert(sql, columnParam, Collections.EMPTY_LIST); } | /**
* update all records
*
* @author zhuoxue
* @since 5.0.1
*/ | update all records | updateAll | {
"repo_name": "xloye/tddl5",
"path": "tddl-qatest/src/test/java/com/taobao/tddl/qatest/matrix/basecrud/BatchUpdateTest.java",
"license": "apache-2.0",
"size": 8491
} | [
"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; | 2,392,678 |
public List getSectionXmlList(Assessment assessmentXml)
{
List nodeList = assessmentXml.selectNodes("//section");
List sectionXmlList = new ArrayList();
// now convert our list of Nodes to a list of section xml
for (int i = 0; i < nodeList.size(); i++)
{
try
{
Node node = (Node) nodeList.get(i);
// create a document for a section xml object
Document sectionDoc = XmlUtil.createDocument();
// Make a copy for inserting into the new document
Node importNode = sectionDoc.importNode(node, true);
// Insert the copy into sectionDoc
sectionDoc.appendChild(importNode);
Section sectionXml = new Section(sectionDoc,
this.getQtiVersion());
// add the new section xml object to the list
sectionXmlList.add(sectionXml);
}
catch (DOMException ex)
{
log.error(ex);
ex.printStackTrace(System.out);
}
}
return sectionXmlList;
} | List function(Assessment assessmentXml) { List nodeList = assessmentXml.selectNodes(" List sectionXmlList = new ArrayList(); for (int i = 0; i < nodeList.size(); i++) { try { Node node = (Node) nodeList.get(i); Document sectionDoc = XmlUtil.createDocument(); Node importNode = sectionDoc.importNode(node, true); sectionDoc.appendChild(importNode); Section sectionXml = new Section(sectionDoc, this.getQtiVersion()); sectionXmlList.add(sectionXml); } catch (DOMException ex) { log.error(ex); ex.printStackTrace(System.out); } } return sectionXmlList; } | /**
* Look up a List of Section XML from Assessment Xml
* @return a List of Section XML objects
*/ | Look up a List of Section XML from Assessment Xml | getSectionXmlList | {
"repo_name": "ktakacs/sakai",
"path": "samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/ExtractionHelper.java",
"license": "apache-2.0",
"size": 113505
} | [
"java.util.ArrayList",
"java.util.List",
"org.sakaiproject.tool.assessment.qti.asi.Assessment",
"org.sakaiproject.tool.assessment.qti.asi.Section",
"org.sakaiproject.tool.assessment.qti.util.XmlUtil",
"org.w3c.dom.DOMException",
"org.w3c.dom.Document",
"org.w3c.dom.Node"
] | import java.util.ArrayList; import java.util.List; import org.sakaiproject.tool.assessment.qti.asi.Assessment; import org.sakaiproject.tool.assessment.qti.asi.Section; import org.sakaiproject.tool.assessment.qti.util.XmlUtil; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.Node; | import java.util.*; import org.sakaiproject.tool.assessment.qti.asi.*; import org.sakaiproject.tool.assessment.qti.util.*; import org.w3c.dom.*; | [
"java.util",
"org.sakaiproject.tool",
"org.w3c.dom"
] | java.util; org.sakaiproject.tool; org.w3c.dom; | 699,197 |
void releaseContextualSearchContentViewCore();
}
/**
* The delegate that is responsible for promoting a {@link ContentViewCore} to a {@link Tab} | void releaseContextualSearchContentViewCore(); } /** * The delegate that is responsible for promoting a {@link ContentViewCore} to a {@link Tab} | /**
* Releases the {@code ContentViewCore} associated to the Contextual Search Panel.
*/ | Releases the ContentViewCore associated to the Contextual Search Panel | releaseContextualSearchContentViewCore | {
"repo_name": "Pluto-tv/chromium-crosswalk",
"path": "chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java",
"license": "bsd-3-clause",
"size": 57913
} | [
"org.chromium.chrome.browser.tab.Tab",
"org.chromium.content.browser.ContentViewCore"
] | import org.chromium.chrome.browser.tab.Tab; import org.chromium.content.browser.ContentViewCore; | import org.chromium.chrome.browser.tab.*; import org.chromium.content.browser.*; | [
"org.chromium.chrome",
"org.chromium.content"
] | org.chromium.chrome; org.chromium.content; | 2,801,051 |
protected void assertHeavyHitterPresent(String heavyHitterOpCode) {
Set<String> heavyHitterOpCodes = Statistics.getCPHeavyHitterOpCodes();
Assert.assertTrue(heavyHitterOpCodes.contains(heavyHitterOpCode));
}
/**
* Runs a program on the CPU
*
* @param spark a valid {@link SparkSession} | void function(String heavyHitterOpCode) { Set<String> heavyHitterOpCodes = Statistics.getCPHeavyHitterOpCodes(); Assert.assertTrue(heavyHitterOpCodes.contains(heavyHitterOpCode)); } /** * Runs a program on the CPU * * @param spark a valid {@link SparkSession} | /**
* asserts that the expected op was executed
*
* @param heavyHitterOpCode opcode of the heavy hitter for the unary op
*/ | asserts that the expected op was executed | assertHeavyHitterPresent | {
"repo_name": "asurve/arvind-sysml2",
"path": "src/test/java/org/apache/sysml/test/gpu/GPUTests.java",
"license": "apache-2.0",
"size": 12954
} | [
"java.util.Set",
"org.apache.spark.sql.SparkSession",
"org.apache.sysml.utils.Statistics",
"org.junit.Assert"
] | import java.util.Set; import org.apache.spark.sql.SparkSession; import org.apache.sysml.utils.Statistics; import org.junit.Assert; | import java.util.*; import org.apache.spark.sql.*; import org.apache.sysml.utils.*; import org.junit.*; | [
"java.util",
"org.apache.spark",
"org.apache.sysml",
"org.junit"
] | java.util; org.apache.spark; org.apache.sysml; org.junit; | 419,249 |
@Test
public void testCacheTTLMatcherAttribute() throws Exception {
final IvySettings settings = new IvySettings();
settings.setBaseDir(new File("test/base/dir"));
final XmlSettingsParser parser = new XmlSettingsParser(settings);
parser.parse(XmlSettingsParserTest.class.getResource("ivysettings-cache-ttl-matcher.xml"));
// verify ttl
final DefaultRepositoryCacheManager cacheManager = (DefaultRepositoryCacheManager) settings.getRepositoryCacheManager("foo");
assertNotNull("Missing cache manager 'foo'", cacheManager);
assertEquals("Unexpected default ttl on cache manager", 30000, cacheManager.getDefaultTTL());
final ModuleRevisionId module1 = new ModuleRevisionId(new ModuleId("foo", "bar"), "*");
final long module1SpecificTTL = cacheManager.getTTL(module1);
assertEquals("Unexpected ttl for module " + module1 + " on cache manager", 60000, module1SpecificTTL);
final ModuleRevisionId module2 = new ModuleRevisionId(new ModuleId("food", "*"), "1.2.4");
final long module2SpecificTTL = cacheManager.getTTL(module2);
assertEquals("Unexpected ttl for module " + module2 + " on cache manager", 60000, module2SpecificTTL);
} | void function() throws Exception { final IvySettings settings = new IvySettings(); settings.setBaseDir(new File(STR)); final XmlSettingsParser parser = new XmlSettingsParser(settings); parser.parse(XmlSettingsParserTest.class.getResource(STR)); final DefaultRepositoryCacheManager cacheManager = (DefaultRepositoryCacheManager) settings.getRepositoryCacheManager("foo"); assertNotNull(STR, cacheManager); assertEquals(STR, 30000, cacheManager.getDefaultTTL()); final ModuleRevisionId module1 = new ModuleRevisionId(new ModuleId("foo", "bar"), "*"); final long module1SpecificTTL = cacheManager.getTTL(module1); assertEquals(STR + module1 + STR, 60000, module1SpecificTTL); final ModuleRevisionId module2 = new ModuleRevisionId(new ModuleId("food", "*"), "1.2.4"); final long module2SpecificTTL = cacheManager.getTTL(module2); assertEquals(STR + module2 + STR, 60000, module2SpecificTTL); } | /**
* Test case for IVY-1495.
* <code><ttl></code> containing the <code>matcher</code> attribute,
* in an ivy settings file, must work as expected.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-1495">IVY-1495</a>
*/ | Test case for IVY-1495. <code><ttl></code> containing the <code>matcher</code> attribute, in an ivy settings file, must work as expected | testCacheTTLMatcherAttribute | {
"repo_name": "apache/ant-ivy",
"path": "test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java",
"license": "apache-2.0",
"size": 37820
} | [
"java.io.File",
"org.apache.ivy.core.cache.DefaultRepositoryCacheManager",
"org.apache.ivy.core.module.id.ModuleId",
"org.apache.ivy.core.module.id.ModuleRevisionId",
"org.junit.Assert"
] | import java.io.File; import org.apache.ivy.core.cache.DefaultRepositoryCacheManager; import org.apache.ivy.core.module.id.ModuleId; import org.apache.ivy.core.module.id.ModuleRevisionId; import org.junit.Assert; | import java.io.*; import org.apache.ivy.core.cache.*; import org.apache.ivy.core.module.id.*; import org.junit.*; | [
"java.io",
"org.apache.ivy",
"org.junit"
] | java.io; org.apache.ivy; org.junit; | 2,868,540 |
protected Match createMatchFromPacket(IOFSwitch sw, OFPort inPort, FloodlightContext cntx) {
// The packet in match will only contain the port number.
// We need to add in specifics for the hosts we're routing between.
Ethernet eth = IFloodlightProviderService.bcStore.get(cntx, IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
VlanVid vlan = VlanVid.ofVlan(eth.getVlanID());
MacAddress srcMac = eth.getSourceMACAddress();
MacAddress dstMac = eth.getDestinationMACAddress();
Match.Builder mb = sw.getOFFactory().buildMatch();
mb.setExact(MatchField.IN_PORT, inPort);
if (FLOWMOD_DEFAULT_MATCH_MAC) {
mb.setExact(MatchField.ETH_SRC, srcMac)
.setExact(MatchField.ETH_DST, dstMac);
}
if (FLOWMOD_DEFAULT_MATCH_VLAN) {
if (!vlan.equals(VlanVid.ZERO)) {
mb.setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlanVid(vlan));
}
}
// TODO Detect switch type and match to create hardware-implemented flow
if (eth.getEtherType() == EthType.IPv4) {
IPv4 ip = (IPv4) eth.getPayload();
IPv4Address srcIp = ip.getSourceAddress();
IPv4Address dstIp = ip.getDestinationAddress();
if (FLOWMOD_DEFAULT_MATCH_IP_ADDR) {
mb.setExact(MatchField.ETH_TYPE, EthType.IPv4)
.setExact(MatchField.IPV4_SRC, srcIp)
.setExact(MatchField.IPV4_DST, dstIp);
}
if (FLOWMOD_DEFAULT_MATCH_TRANSPORT) {
if (!FLOWMOD_DEFAULT_MATCH_IP_ADDR) {
mb.setExact(MatchField.ETH_TYPE, EthType.IPv4);
}
if (ip.getProtocol().equals(IpProtocol.TCP)) {
TCP tcp = (TCP) ip.getPayload();
mb.setExact(MatchField.IP_PROTO, IpProtocol.TCP)
.setExact(MatchField.TCP_SRC, tcp.getSourcePort())
.setExact(MatchField.TCP_DST, tcp.getDestinationPort());
} else if (ip.getProtocol().equals(IpProtocol.UDP)) {
UDP udp = (UDP) ip.getPayload();
mb.setExact(MatchField.IP_PROTO, IpProtocol.UDP)
.setExact(MatchField.UDP_SRC, udp.getSourcePort())
.setExact(MatchField.UDP_DST, udp.getDestinationPort());
}
}
} else if (eth.getEtherType() == EthType.ARP) {
mb.setExact(MatchField.ETH_TYPE, EthType.ARP);
} else if (eth.getEtherType() == EthType.IPv6) {
IPv6 ip = (IPv6) eth.getPayload();
IPv6Address srcIp = ip.getSourceAddress();
IPv6Address dstIp = ip.getDestinationAddress();
if (FLOWMOD_DEFAULT_MATCH_IP_ADDR) {
mb.setExact(MatchField.ETH_TYPE, EthType.IPv6)
.setExact(MatchField.IPV6_SRC, srcIp)
.setExact(MatchField.IPV6_DST, dstIp);
}
if (FLOWMOD_DEFAULT_MATCH_TRANSPORT) {
if (!FLOWMOD_DEFAULT_MATCH_IP_ADDR) {
mb.setExact(MatchField.ETH_TYPE, EthType.IPv6);
}
if (ip.getNextHeader().equals(IpProtocol.TCP)) {
TCP tcp = (TCP) ip.getPayload();
mb.setExact(MatchField.IP_PROTO, IpProtocol.TCP)
.setExact(MatchField.TCP_SRC, tcp.getSourcePort())
.setExact(MatchField.TCP_DST, tcp.getDestinationPort());
} else if (ip.getNextHeader().equals(IpProtocol.UDP)) {
UDP udp = (UDP) ip.getPayload();
mb.setExact(MatchField.IP_PROTO, IpProtocol.UDP)
.setExact(MatchField.UDP_SRC, udp.getSourcePort())
.setExact(MatchField.UDP_DST, udp.getDestinationPort());
}
}
}
return mb.build();
} | Match function(IOFSwitch sw, OFPort inPort, FloodlightContext cntx) { Ethernet eth = IFloodlightProviderService.bcStore.get(cntx, IFloodlightProviderService.CONTEXT_PI_PAYLOAD); VlanVid vlan = VlanVid.ofVlan(eth.getVlanID()); MacAddress srcMac = eth.getSourceMACAddress(); MacAddress dstMac = eth.getDestinationMACAddress(); Match.Builder mb = sw.getOFFactory().buildMatch(); mb.setExact(MatchField.IN_PORT, inPort); if (FLOWMOD_DEFAULT_MATCH_MAC) { mb.setExact(MatchField.ETH_SRC, srcMac) .setExact(MatchField.ETH_DST, dstMac); } if (FLOWMOD_DEFAULT_MATCH_VLAN) { if (!vlan.equals(VlanVid.ZERO)) { mb.setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlanVid(vlan)); } } if (eth.getEtherType() == EthType.IPv4) { IPv4 ip = (IPv4) eth.getPayload(); IPv4Address srcIp = ip.getSourceAddress(); IPv4Address dstIp = ip.getDestinationAddress(); if (FLOWMOD_DEFAULT_MATCH_IP_ADDR) { mb.setExact(MatchField.ETH_TYPE, EthType.IPv4) .setExact(MatchField.IPV4_SRC, srcIp) .setExact(MatchField.IPV4_DST, dstIp); } if (FLOWMOD_DEFAULT_MATCH_TRANSPORT) { if (!FLOWMOD_DEFAULT_MATCH_IP_ADDR) { mb.setExact(MatchField.ETH_TYPE, EthType.IPv4); } if (ip.getProtocol().equals(IpProtocol.TCP)) { TCP tcp = (TCP) ip.getPayload(); mb.setExact(MatchField.IP_PROTO, IpProtocol.TCP) .setExact(MatchField.TCP_SRC, tcp.getSourcePort()) .setExact(MatchField.TCP_DST, tcp.getDestinationPort()); } else if (ip.getProtocol().equals(IpProtocol.UDP)) { UDP udp = (UDP) ip.getPayload(); mb.setExact(MatchField.IP_PROTO, IpProtocol.UDP) .setExact(MatchField.UDP_SRC, udp.getSourcePort()) .setExact(MatchField.UDP_DST, udp.getDestinationPort()); } } } else if (eth.getEtherType() == EthType.ARP) { mb.setExact(MatchField.ETH_TYPE, EthType.ARP); } else if (eth.getEtherType() == EthType.IPv6) { IPv6 ip = (IPv6) eth.getPayload(); IPv6Address srcIp = ip.getSourceAddress(); IPv6Address dstIp = ip.getDestinationAddress(); if (FLOWMOD_DEFAULT_MATCH_IP_ADDR) { mb.setExact(MatchField.ETH_TYPE, EthType.IPv6) .setExact(MatchField.IPV6_SRC, srcIp) .setExact(MatchField.IPV6_DST, dstIp); } if (FLOWMOD_DEFAULT_MATCH_TRANSPORT) { if (!FLOWMOD_DEFAULT_MATCH_IP_ADDR) { mb.setExact(MatchField.ETH_TYPE, EthType.IPv6); } if (ip.getNextHeader().equals(IpProtocol.TCP)) { TCP tcp = (TCP) ip.getPayload(); mb.setExact(MatchField.IP_PROTO, IpProtocol.TCP) .setExact(MatchField.TCP_SRC, tcp.getSourcePort()) .setExact(MatchField.TCP_DST, tcp.getDestinationPort()); } else if (ip.getNextHeader().equals(IpProtocol.UDP)) { UDP udp = (UDP) ip.getPayload(); mb.setExact(MatchField.IP_PROTO, IpProtocol.UDP) .setExact(MatchField.UDP_SRC, udp.getSourcePort()) .setExact(MatchField.UDP_DST, udp.getDestinationPort()); } } } return mb.build(); } | /**
* Instead of using the Firewall's routing decision Match, which might be as general
* as "in_port" and inadvertently Match packets erroneously, construct a more
* specific Match based on the deserialized OFPacketIn's payload, which has been
* placed in the FloodlightContext already by the Controller.
*
* @param sw, the switch on which the packet was received
* @param inPort, the ingress switch port on which the packet was received
* @param cntx, the current context which contains the deserialized packet
* @return a composed Match object based on the provided information
*/ | Instead of using the Firewall's routing decision Match, which might be as general as "in_port" and inadvertently Match packets erroneously, construct a more specific Match based on the deserialized OFPacketIn's payload, which has been placed in the FloodlightContext already by the Controller | createMatchFromPacket | {
"repo_name": "Pengfei-Lu/floodlight",
"path": "src/main/java/net/floodlightcontroller/forwarding/Forwarding.java",
"license": "apache-2.0",
"size": 22534
} | [
"net.floodlightcontroller.core.FloodlightContext",
"net.floodlightcontroller.core.IFloodlightProviderService",
"net.floodlightcontroller.core.IOFSwitch",
"net.floodlightcontroller.packet.Ethernet",
"net.floodlightcontroller.packet.IPv4",
"net.floodlightcontroller.packet.IPv6",
"org.projectfloodlight.openflow.protocol.match.Match",
"org.projectfloodlight.openflow.protocol.match.MatchField",
"org.projectfloodlight.openflow.types.EthType",
"org.projectfloodlight.openflow.types.IPv4Address",
"org.projectfloodlight.openflow.types.IPv6Address",
"org.projectfloodlight.openflow.types.IpProtocol",
"org.projectfloodlight.openflow.types.MacAddress",
"org.projectfloodlight.openflow.types.OFPort",
"org.projectfloodlight.openflow.types.OFVlanVidMatch",
"org.projectfloodlight.openflow.types.VlanVid"
] | import net.floodlightcontroller.core.FloodlightContext; import net.floodlightcontroller.core.IFloodlightProviderService; import net.floodlightcontroller.core.IOFSwitch; import net.floodlightcontroller.packet.Ethernet; import net.floodlightcontroller.packet.IPv4; import net.floodlightcontroller.packet.IPv6; import org.projectfloodlight.openflow.protocol.match.Match; import org.projectfloodlight.openflow.protocol.match.MatchField; import org.projectfloodlight.openflow.types.EthType; import org.projectfloodlight.openflow.types.IPv4Address; import org.projectfloodlight.openflow.types.IPv6Address; import org.projectfloodlight.openflow.types.IpProtocol; import org.projectfloodlight.openflow.types.MacAddress; import org.projectfloodlight.openflow.types.OFPort; import org.projectfloodlight.openflow.types.OFVlanVidMatch; import org.projectfloodlight.openflow.types.VlanVid; | import net.floodlightcontroller.core.*; import net.floodlightcontroller.packet.*; import org.projectfloodlight.openflow.protocol.match.*; import org.projectfloodlight.openflow.types.*; | [
"net.floodlightcontroller.core",
"net.floodlightcontroller.packet",
"org.projectfloodlight.openflow"
] | net.floodlightcontroller.core; net.floodlightcontroller.packet; org.projectfloodlight.openflow; | 1,707,678 |
protected boolean isTreeHandleEventType(MouseEvent e) {
switch (e.getID()) {
case MouseEvent.MOUSE_CLICKED:
case MouseEvent.MOUSE_PRESSED:
case MouseEvent.MOUSE_RELEASED:
return !e.isPopupTrigger();
}
return false;
} | boolean function(MouseEvent e) { switch (e.getID()) { case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: return !e.isPopupTrigger(); } return false; } | /**
* Filter to find mouse events that are candidates for node expansion/
* collapse. MOUSE_PRESSED and MOUSE_RELEASED are used by default UIs.
* MOUSE_CLICKED is included as it may be used by a custom UI.
*
* @param e the currently dispatching mouse event
* @return true if the event is a candidate for sending to the JTree
*/ | Filter to find mouse events that are candidates for node expansion collapse. MOUSE_PRESSED and MOUSE_RELEASED are used by default UIs. MOUSE_CLICKED is included as it may be used by a custom UI | isTreeHandleEventType | {
"repo_name": "syncer/swingx",
"path": "swingx-core/src/main/java/org/jdesktop/swingx/JXTreeTable.java",
"license": "lgpl-2.1",
"size": 132592
} | [
"java.awt.event.MouseEvent"
] | import java.awt.event.MouseEvent; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 2,617,207 |
protected void addStepPerformanceSnapShot() {
if ( stepPerformanceSnapShots == null ) {
return; // Race condition somewhere?
}
boolean pausedAndNotEmpty = isPaused() && !stepPerformanceSnapShots.isEmpty();
boolean stoppedAndNotEmpty = isStopped() && !stepPerformanceSnapShots.isEmpty();
if ( transMeta.isCapturingStepPerformanceSnapShots() && !pausedAndNotEmpty && !stoppedAndNotEmpty ) {
// get the statistics from the steps and keep them...
//
int seqNr = stepPerformanceSnapshotSeqNr.incrementAndGet();
for ( int i = 0; i < steps.size(); i++ ) {
StepMeta stepMeta = steps.get( i ).stepMeta;
StepInterface step = steps.get( i ).step;
StepPerformanceSnapShot snapShot =
new StepPerformanceSnapShot( seqNr, getBatchId(), new Date(), getName(), stepMeta.getName(), step.getCopy(),
step.getLinesRead(), step.getLinesWritten(), step.getLinesInput(), step.getLinesOutput(), step
.getLinesUpdated(), step.getLinesRejected(), step.getErrors() );
synchronized ( stepPerformanceSnapShots ) {
List<StepPerformanceSnapShot> snapShotList = stepPerformanceSnapShots.get( step.toString() );
StepPerformanceSnapShot previous;
if ( snapShotList == null ) {
snapShotList = new ArrayList<>();
stepPerformanceSnapShots.put( step.toString(), snapShotList );
previous = null;
} else {
previous = snapShotList.get( snapShotList.size() - 1 ); // the last one...
}
// Make the difference...
//
snapShot.diff( previous, step.rowsetInputSize(), step.rowsetOutputSize() );
snapShotList.add( snapShot );
if ( stepPerformanceSnapshotSizeLimit > 0 && snapShotList.size() > stepPerformanceSnapshotSizeLimit ) {
snapShotList.remove( 0 );
}
}
}
lastStepPerformanceSnapshotSeqNrAdded = stepPerformanceSnapshotSeqNr.get();
}
} | void function() { if ( stepPerformanceSnapShots == null ) { return; } boolean pausedAndNotEmpty = isPaused() && !stepPerformanceSnapShots.isEmpty(); boolean stoppedAndNotEmpty = isStopped() && !stepPerformanceSnapShots.isEmpty(); if ( transMeta.isCapturingStepPerformanceSnapShots() && !pausedAndNotEmpty && !stoppedAndNotEmpty ) { for ( int i = 0; i < steps.size(); i++ ) { StepMeta stepMeta = steps.get( i ).stepMeta; StepInterface step = steps.get( i ).step; StepPerformanceSnapShot snapShot = new StepPerformanceSnapShot( seqNr, getBatchId(), new Date(), getName(), stepMeta.getName(), step.getCopy(), step.getLinesRead(), step.getLinesWritten(), step.getLinesInput(), step.getLinesOutput(), step .getLinesUpdated(), step.getLinesRejected(), step.getErrors() ); synchronized ( stepPerformanceSnapShots ) { List<StepPerformanceSnapShot> snapShotList = stepPerformanceSnapShots.get( step.toString() ); StepPerformanceSnapShot previous; if ( snapShotList == null ) { snapShotList = new ArrayList<>(); stepPerformanceSnapShots.put( step.toString(), snapShotList ); previous = null; } else { previous = snapShotList.get( snapShotList.size() - 1 ); } snapShotList.add( snapShot ); if ( stepPerformanceSnapshotSizeLimit > 0 && snapShotList.size() > stepPerformanceSnapshotSizeLimit ) { snapShotList.remove( 0 ); } } } lastStepPerformanceSnapshotSeqNrAdded = stepPerformanceSnapshotSeqNr.get(); } } | /**
* Adds a step performance snapshot.
*/ | Adds a step performance snapshot | addStepPerformanceSnapShot | {
"repo_name": "tmcsantos/pentaho-kettle",
"path": "engine/src/main/java/org/pentaho/di/trans/Trans.java",
"license": "apache-2.0",
"size": 199612
} | [
"java.util.ArrayList",
"java.util.Date",
"java.util.List",
"org.pentaho.di.trans.performance.StepPerformanceSnapShot",
"org.pentaho.di.trans.step.StepInterface",
"org.pentaho.di.trans.step.StepMeta"
] | import java.util.ArrayList; import java.util.Date; import java.util.List; import org.pentaho.di.trans.performance.StepPerformanceSnapShot; import org.pentaho.di.trans.step.StepInterface; import org.pentaho.di.trans.step.StepMeta; | import java.util.*; import org.pentaho.di.trans.performance.*; import org.pentaho.di.trans.step.*; | [
"java.util",
"org.pentaho.di"
] | java.util; org.pentaho.di; | 1,157,849 |
public void _testUpdateLoadedWithImplicitDependency() throws Exception {
AuraContext context = Aura.getContextService().startContext(Mode.PROD, Format.JSON,
Authentication.AUTHENTICATED,
laxSecurityApp);
DefDescriptor<?> depDesc = addSourceAutoCleanup(ComponentDef.class, String.format(baseComponentTag, "", ""));
DefDescriptor<?> cmpDesc = addSourceAutoCleanup(ComponentDef.class,
String.format(baseComponentTag, "", String.format("<%s/>", depDesc.getDescriptorName())));
String uid = context.getDefRegistry().getUid(null, cmpDesc);
String depUid = context.getDefRegistry().getUid(null, depDesc);
Map<DefDescriptor<?>, String> loaded = context.getLoaded();
assertNull("Parent should not be loaded initially", loaded.get(cmpDesc));
assertNull("Dependency should not be loaded initially", loaded.get(depDesc));
context.addLoaded(cmpDesc, uid);
loaded = context.getLoaded();
assertEquals("Parent was not added", uid, loaded.get(cmpDesc));
assertNull("Dependency should not have been added", loaded.get(depDesc));
Aura.getDefinitionService().updateLoaded(cmpDesc);
loaded = context.getLoaded();
assertEquals("Parent was updated incorrectly", uid, loaded.get(cmpDesc));
assertEquals("Dependency should have been added in update", depUid, loaded.get(depDesc));
} | void function() throws Exception { AuraContext context = Aura.getContextService().startContext(Mode.PROD, Format.JSON, Authentication.AUTHENTICATED, laxSecurityApp); DefDescriptor<?> depDesc = addSourceAutoCleanup(ComponentDef.class, String.format(baseComponentTag, STRSTRSTR<%s/>STRParent should not be loaded initiallySTRDependency should not be loaded initiallySTRParent was not addedSTRDependency should not have been addedSTRParent was updated incorrectlySTRDependency should have been added in update", depUid, loaded.get(depDesc)); } | /**
* Dependencies should be added to loaded set during updateLoaded.
*/ | Dependencies should be added to loaded set during updateLoaded | _testUpdateLoadedWithImplicitDependency | {
"repo_name": "TribeMedia/aura",
"path": "aura-integration-test/src/test/java/org/auraframework/integration/test/service/DefinitionServiceImplTest.java",
"license": "apache-2.0",
"size": 42712
} | [
"org.auraframework.Aura",
"org.auraframework.def.ComponentDef",
"org.auraframework.def.DefDescriptor",
"org.auraframework.system.AuraContext"
] | import org.auraframework.Aura; import org.auraframework.def.ComponentDef; import org.auraframework.def.DefDescriptor; import org.auraframework.system.AuraContext; | import org.auraframework.*; import org.auraframework.def.*; import org.auraframework.system.*; | [
"org.auraframework",
"org.auraframework.def",
"org.auraframework.system"
] | org.auraframework; org.auraframework.def; org.auraframework.system; | 2,260,707 |
public static UTMCoordinate MGRSToUTM(String mgrutm) {
MGRSCoordConverter cnv = new MGRSCoordConverter();
UTMCoord utm = cnv.convertMGRSToUTM(mgrutm, defaultUTMZones);
if(utm == null) return null;
int half = (int) Math.pow(10, (5 - utm.getMGRS().precision)) / 2;
Precision prec = new Precision();
prec.setSquare(half * 2);
return new UTMCoordinate(utm.getZone(), utm.getMGRS().getLatitudeBand(), (long) utm.getEasting() + half, (long) utm.getNorthing() + half, prec);
} | static UTMCoordinate function(String mgrutm) { MGRSCoordConverter cnv = new MGRSCoordConverter(); UTMCoord utm = cnv.convertMGRSToUTM(mgrutm, defaultUTMZones); if(utm == null) return null; int half = (int) Math.pow(10, (5 - utm.getMGRS().precision)) / 2; Precision prec = new Precision(); prec.setSquare(half * 2); return new UTMCoordinate(utm.getZone(), utm.getMGRS().getLatitudeBand(), (long) utm.getEasting() + half, (long) utm.getNorthing() + half, prec); } | /**
* Converts a MGRS string to the center point UTM coordinates and respective precision.
* @param mgrutm
* @return
*/ | Converts a MGRS string to the center point UTM coordinates and respective precision | MGRSToUTM | {
"repo_name": "miguel-porto/flora-on-server",
"path": "webadmin/src/main/java/pt/floraon/geometry/CoordinateConversion.java",
"license": "gpl-2.0",
"size": 14755
} | [
"pt.floraon.geometry.mgrs.MGRSCoordConverter",
"pt.floraon.geometry.mgrs.UTMCoord"
] | import pt.floraon.geometry.mgrs.MGRSCoordConverter; import pt.floraon.geometry.mgrs.UTMCoord; | import pt.floraon.geometry.mgrs.*; | [
"pt.floraon.geometry"
] | pt.floraon.geometry; | 2,752,483 |
int eatWhitespace()
throws IOException
{
int ch;
while (!isEOS(ch = _readStream.read())) {
if (!isWhitespace(ch)) {
_readStream.unread();
break;
}
}
return ch;
} | int eatWhitespace() throws IOException { int ch; while (!isEOS(ch = _readStream.read())) { if (!isWhitespace(ch)) { _readStream.unread(); break; } } return ch; } | /**
* Eat whitespace characters out of readStream
*
* @return the first non-whitespace character (which
* is still in the _readStream), or -1 if end of stream encountered.
*/ | Eat whitespace characters out of readStream | eatWhitespace | {
"repo_name": "dlitz/resin",
"path": "resin-doc/examples/custom-protocol/src/example/Parser.java",
"license": "gpl-2.0",
"size": 3128
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,002,175 |
public static Optional<Object> getData(OfflinePlayer player, String name) {
if (save.containsKey(player.getName())) {
return Optional.ofNullable(save.get(player.getName()).getOrDefault(name, null));
}
return Optional.empty();
}
| static Optional<Object> function(OfflinePlayer player, String name) { if (save.containsKey(player.getName())) { return Optional.ofNullable(save.get(player.getName()).getOrDefault(name, null)); } return Optional.empty(); } | /**
* Returns the data with the key <code>name</code> from <code>player</code>'s HashMap.
*
* @param player the player to check.
* @param name the key to grab.
*/ | Returns the data with the key <code>name</code> from <code>player</code>'s HashMap | getData | {
"repo_name": "bog500/SecurityBOG",
"path": "mc.securitybog/src/mc/securitybog/JUtility.java",
"license": "gpl-3.0",
"size": 5157
} | [
"java.util.Optional",
"org.bukkit.OfflinePlayer"
] | import java.util.Optional; import org.bukkit.OfflinePlayer; | import java.util.*; import org.bukkit.*; | [
"java.util",
"org.bukkit"
] | java.util; org.bukkit; | 2,900,424 |
@Test
public void testConvertScopeSetToScopeList() {
ScopeListDTO scopeListDTO = RestAPIStoreUtils.convertScopeSetToScopeList(null);
Assert.assertNull("Scope list was returned for a scope set of null", scopeListDTO);
Set<Scope> scopeSet = new LinkedHashSet<>();
scopeListDTO = RestAPIStoreUtils.convertScopeSetToScopeList(scopeSet);
Assert.assertNotNull("Scope list was not returned for a scope set", scopeListDTO);
Assert.assertEquals("Scope list size is different from the scope set size", scopeSet.size(),
scopeListDTO.getList().size());
scopeSet = getScopes();
scopeListDTO = RestAPIStoreUtils.convertScopeSetToScopeList(scopeSet);
Assert.assertNotNull("Scope list was not returned for a scope set", scopeListDTO);
Assert.assertEquals("Scope list size is different from the scope set size", scopeSet.size(),
scopeListDTO.getList().size());
} | void function() { ScopeListDTO scopeListDTO = RestAPIStoreUtils.convertScopeSetToScopeList(null); Assert.assertNull(STR, scopeListDTO); Set<Scope> scopeSet = new LinkedHashSet<>(); scopeListDTO = RestAPIStoreUtils.convertScopeSetToScopeList(scopeSet); Assert.assertNotNull(STR, scopeListDTO); Assert.assertEquals(STR, scopeSet.size(), scopeListDTO.getList().size()); scopeSet = getScopes(); scopeListDTO = RestAPIStoreUtils.convertScopeSetToScopeList(scopeSet); Assert.assertNotNull(STR, scopeListDTO); Assert.assertEquals(STR, scopeSet.size(), scopeListDTO.getList().size()); } | /**
* This method tests the behaviour of convertScopeSetToScopeList, under various conditions.
*/ | This method tests the behaviour of convertScopeSetToScopeList, under various conditions | testConvertScopeSetToScopeList | {
"repo_name": "nuwand/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.store/src/test/java/org/wso2/carbon/apimgt/rest/api/store/utils/RestAPIStoreUtilsTestCase.java",
"license": "apache-2.0",
"size": 9811
} | [
"java.util.LinkedHashSet",
"java.util.Set",
"org.junit.Assert",
"org.wso2.carbon.apimgt.api.model.Scope",
"org.wso2.carbon.apimgt.rest.api.store.dto.ScopeListDTO"
] | import java.util.LinkedHashSet; import java.util.Set; import org.junit.Assert; import org.wso2.carbon.apimgt.api.model.Scope; import org.wso2.carbon.apimgt.rest.api.store.dto.ScopeListDTO; | import java.util.*; import org.junit.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.rest.api.store.dto.*; | [
"java.util",
"org.junit",
"org.wso2.carbon"
] | java.util; org.junit; org.wso2.carbon; | 77,390 |
public ContentHandler getStub4TesttoolContentHandler(ContentHandler handler, Properties properties) throws IOException, TransformerConfigurationException {
if (Boolean.parseBoolean(properties.getProperty(ConfigurationUtils.STUB4TESTTOOL_CONFIGURATION_KEY,"false"))) {
Resource xslt = Resource.getResource(ConfigurationUtils.STUB4TESTTOOL_XSLT);
TransformerPool tp = TransformerPool.getInstance(xslt);
TransformerFilter filter = tp.getTransformerFilter(null, handler);
Map<String,Object> parameters = new HashMap<String,Object>();
parameters.put(ConfigurationUtils.STUB4TESTTOOL_XSLT_VALIDATORS_PARAM, Boolean.parseBoolean(properties.getProperty(ConfigurationUtils.STUB4TESTTOOL_VALIDATORS_DISABLED_KEY,"false")));
XmlUtils.setTransformerParameters(filter.getTransformer(), parameters);
return filter;
}
return handler;
} | ContentHandler function(ContentHandler handler, Properties properties) throws IOException, TransformerConfigurationException { if (Boolean.parseBoolean(properties.getProperty(ConfigurationUtils.STUB4TESTTOOL_CONFIGURATION_KEY,"false"))) { Resource xslt = Resource.getResource(ConfigurationUtils.STUB4TESTTOOL_XSLT); TransformerPool tp = TransformerPool.getInstance(xslt); TransformerFilter filter = tp.getTransformerFilter(null, handler); Map<String,Object> parameters = new HashMap<String,Object>(); parameters.put(ConfigurationUtils.STUB4TESTTOOL_XSLT_VALIDATORS_PARAM, Boolean.parseBoolean(properties.getProperty(ConfigurationUtils.STUB4TESTTOOL_VALIDATORS_DISABLED_KEY,"false"))); XmlUtils.setTransformerParameters(filter.getTransformer(), parameters); return filter; } return handler; } | /**
* Get the contenthandler to stub configurations
* If stubbing is disabled, the input ContentHandler is returned as-is
*/ | Get the contenthandler to stub configurations If stubbing is disabled, the input ContentHandler is returned as-is | getStub4TesttoolContentHandler | {
"repo_name": "ibissource/iaf",
"path": "core/src/main/java/nl/nn/adapterframework/configuration/ConfigurationDigester.java",
"license": "apache-2.0",
"size": 12942
} | [
"java.io.IOException",
"java.util.HashMap",
"java.util.Map",
"java.util.Properties",
"javax.xml.transform.TransformerConfigurationException",
"nl.nn.adapterframework.core.Resource",
"nl.nn.adapterframework.util.TransformerPool",
"nl.nn.adapterframework.util.XmlUtils",
"nl.nn.adapterframework.xml.TransformerFilter",
"org.xml.sax.ContentHandler"
] | import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.Properties; import javax.xml.transform.TransformerConfigurationException; import nl.nn.adapterframework.core.Resource; import nl.nn.adapterframework.util.TransformerPool; import nl.nn.adapterframework.util.XmlUtils; import nl.nn.adapterframework.xml.TransformerFilter; import org.xml.sax.ContentHandler; | import java.io.*; import java.util.*; import javax.xml.transform.*; import nl.nn.adapterframework.core.*; import nl.nn.adapterframework.util.*; import nl.nn.adapterframework.xml.*; import org.xml.sax.*; | [
"java.io",
"java.util",
"javax.xml",
"nl.nn.adapterframework",
"org.xml.sax"
] | java.io; java.util; javax.xml; nl.nn.adapterframework; org.xml.sax; | 1,781,251 |
public static String getNamenodeLifelineAddr(final Configuration conf,
String nsId, String nnId) {
if (nsId == null) {
nsId = getOnlyNameServiceIdOrNull(conf);
}
String lifelineAddrKey = DFSUtilClient.concatSuffixes(
DFSConfigKeys.DFS_NAMENODE_LIFELINE_RPC_ADDRESS_KEY, nsId, nnId);
return conf.get(lifelineAddrKey);
} | static String function(final Configuration conf, String nsId, String nnId) { if (nsId == null) { nsId = getOnlyNameServiceIdOrNull(conf); } String lifelineAddrKey = DFSUtilClient.concatSuffixes( DFSConfigKeys.DFS_NAMENODE_LIFELINE_RPC_ADDRESS_KEY, nsId, nnId); return conf.get(lifelineAddrKey); } | /**
* Map a logical namenode ID to its lifeline address. Use the given
* nameservice if specified, or the configured one if none is given.
*
* @param conf Configuration
* @param nsId which nameservice nnId is a part of, optional
* @param nnId the namenode ID to get the service addr for
* @return the lifeline addr, null if it could not be determined
*/ | Map a logical namenode ID to its lifeline address. Use the given nameservice if specified, or the configured one if none is given | getNamenodeLifelineAddr | {
"repo_name": "dennishuo/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java",
"license": "apache-2.0",
"size": 63202
} | [
"org.apache.hadoop.conf.Configuration"
] | import org.apache.hadoop.conf.Configuration; | import org.apache.hadoop.conf.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,642,326 |
IAddress getAddress(); | IAddress getAddress(); | /**
* Returns the start address of the basic block.
*
* @return The start address of the basic block.
*/ | Returns the start address of the basic block | getAddress | {
"repo_name": "chubbymaggie/binnavi",
"path": "src/main/java/com/google/security/zynamics/binnavi/disassembly/INaviBasicBlock.java",
"license": "apache-2.0",
"size": 1384
} | [
"com.google.security.zynamics.zylib.disassembly.IAddress"
] | import com.google.security.zynamics.zylib.disassembly.IAddress; | import com.google.security.zynamics.zylib.disassembly.*; | [
"com.google.security"
] | com.google.security; | 2,391,573 |
InputStream getTenantTheme(int tenantId) throws APIManagementException; | InputStream getTenantTheme(int tenantId) throws APIManagementException; | /**
* Retrieves a tenant theme from the database
*
* @param tenantId tenant ID of user
* @return content of the tenant theme
* @throws APIManagementException if an error occurs when retrieving a tenant theme from the database
*/ | Retrieves a tenant theme from the database | getTenantTheme | {
"repo_name": "ruks/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/APIAdmin.java",
"license": "apache-2.0",
"size": 18053
} | [
"java.io.InputStream"
] | import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,533,045 |
private static Logger log = LoggerFactory.getLogger(MultiWindowSumKeyValTest.class);
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testNodeProcessing() throws InterruptedException
{
MultiWindowSumKeyVal<String, Integer> oper = new MultiWindowSumKeyVal<String, Integer>();
CollectorTestSink swinSink = new CollectorTestSink();
oper.sum.setSink(swinSink);
oper.beginWindow(0);
KeyValPair<String, Integer> low = new KeyValPair<String, Integer>("a", 3);
oper.data.process(low);
KeyValPair<String, Integer> high = new KeyValPair<String, Integer>("a", 11);
oper.data.process(high);
oper.endWindow();
oper.beginWindow(1);
low = new KeyValPair<String, Integer>("a", 1);
oper.data.process(low);
high = new KeyValPair<String, Integer>("a", 9);
oper.data.process(high);
oper.endWindow();
Assert.assertEquals("number emitted tuples", 1, swinSink.collectedTuples.size());
for (Object o : swinSink.collectedTuples) {
log.debug(o.toString());
}
} | static Logger log = LoggerFactory.getLogger(MultiWindowSumKeyValTest.class); @SuppressWarnings({ STR, STR }) public void function() throws InterruptedException { MultiWindowSumKeyVal<String, Integer> oper = new MultiWindowSumKeyVal<String, Integer>(); CollectorTestSink swinSink = new CollectorTestSink(); oper.sum.setSink(swinSink); oper.beginWindow(0); KeyValPair<String, Integer> low = new KeyValPair<String, Integer>("a", 3); oper.data.process(low); KeyValPair<String, Integer> high = new KeyValPair<String, Integer>("a", 11); oper.data.process(high); oper.endWindow(); oper.beginWindow(1); low = new KeyValPair<String, Integer>("a", 1); oper.data.process(low); high = new KeyValPair<String, Integer>("a", 9); oper.data.process(high); oper.endWindow(); Assert.assertEquals(STR, 1, swinSink.collectedTuples.size()); for (Object o : swinSink.collectedTuples) { log.debug(o.toString()); } } | /**
* Test functional logic
*/ | Test functional logic | testNodeProcessing | {
"repo_name": "siyuanh/apex-malhar",
"path": "library/src/test/java/com/datatorrent/lib/multiwindow/MultiWindowSumKeyValTest.java",
"license": "apache-2.0",
"size": 2280
} | [
"com.datatorrent.lib.testbench.CollectorTestSink",
"com.datatorrent.lib.util.KeyValPair",
"org.junit.Assert",
"org.slf4j.Logger",
"org.slf4j.LoggerFactory"
] | import com.datatorrent.lib.testbench.CollectorTestSink; import com.datatorrent.lib.util.KeyValPair; import org.junit.Assert; import org.slf4j.Logger; import org.slf4j.LoggerFactory; | import com.datatorrent.lib.testbench.*; import com.datatorrent.lib.util.*; import org.junit.*; import org.slf4j.*; | [
"com.datatorrent.lib",
"org.junit",
"org.slf4j"
] | com.datatorrent.lib; org.junit; org.slf4j; | 2,425,258 |
public List symmetryOperators() {
final List res = new ArrayList();
for (final Iterator iter = symmetries().iterator(); iter.hasNext();) {
res.add(((Morphism) iter.next()).getAffineOperator());
}
return res;
} | List function() { final List res = new ArrayList(); for (final Iterator iter = symmetries().iterator(); iter.hasNext();) { res.add(((Morphism) iter.next()).getAffineOperator()); } return res; } | /**
* Determines the affine operators associated to the periodic automorphisms
* of this periodic graph.
*
* @return the list of operators.
*/ | Determines the affine operators associated to the periodic automorphisms of this periodic graph | symmetryOperators | {
"repo_name": "BackupTheBerlios/gavrog",
"path": "src/org/gavrog/joss/pgraphs/basic/PeriodicGraph.java",
"license": "apache-2.0",
"size": 79927
} | [
"java.util.ArrayList",
"java.util.Iterator",
"java.util.List"
] | import java.util.ArrayList; import java.util.Iterator; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 334,614 |
public void performWeaving() throws URISyntaxException,MalformedURLException,IOException{
preProcess();
process();
} | void function() throws URISyntaxException,MalformedURLException,IOException{ preProcess(); process(); } | /**
* This method performs weaving function on the class individually from the specified source.
*/ | This method performs weaving function on the class individually from the specified source | performWeaving | {
"repo_name": "gameduell/eclipselink.runtime",
"path": "jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/tools/weaving/jpa/StaticWeaveProcessor.java",
"license": "epl-1.0",
"size": 16687
} | [
"java.io.IOException",
"java.net.MalformedURLException",
"java.net.URISyntaxException"
] | import java.io.IOException; import java.net.MalformedURLException; import java.net.URISyntaxException; | import java.io.*; import java.net.*; | [
"java.io",
"java.net"
] | java.io; java.net; | 2,373,362 |
private static String sanitizeUrl(final String url) {
final Matcher m = NON_PRINTABLE.matcher(url);
final StringBuffer sb = new StringBuffer(url.length());
boolean hasNonPrintable = false;
while (m.find()) {
m.appendReplacement(sb, " ");
hasNonPrintable = true;
}
m.appendTail(sb);
if (hasNonPrintable) {
LOGGER.warn("The following redirect URL has been sanitized and may be sign of attack:\n[{}]", url);
}
return sb.toString();
} | static String function(final String url) { final Matcher m = NON_PRINTABLE.matcher(url); final StringBuffer sb = new StringBuffer(url.length()); boolean hasNonPrintable = false; while (m.find()) { m.appendReplacement(sb, " "); hasNonPrintable = true; } m.appendTail(sb); if (hasNonPrintable) { LOGGER.warn(STR, url); } return sb.toString(); } | /**
* Sanitize a URL provided by a relying party by normalizing non-printable
* ASCII character sequences into spaces. This functionality protects
* against CRLF attacks and other similar attacks using invisible characters
* that could be abused to trick user agents.
*
* @param url URL to sanitize.
*
* @return Sanitized URL string.
*/ | Sanitize a URL provided by a relying party by normalizing non-printable ASCII character sequences into spaces. This functionality protects against CRLF attacks and other similar attacks using invisible characters that could be abused to trick user agents | sanitizeUrl | {
"repo_name": "gabedwrds/cas",
"path": "core/cas-server-core-services/src/main/java/org/apereo/cas/authentication/principal/DefaultResponse.java",
"license": "apache-2.0",
"size": 4412
} | [
"java.util.regex.Matcher"
] | import java.util.regex.Matcher; | import java.util.regex.*; | [
"java.util"
] | java.util; | 921,951 |
default Optional<O> owner() {
return this.executor().map(GoalExecutor::owner);
} | default Optional<O> owner() { return this.executor().map(GoalExecutor::owner); } | /**
* Gets the {@link Agent} that owns this goal, if any.
*
* @return The owner or {@link Optional#empty()} if not present
*/ | Gets the <code>Agent</code> that owns this goal, if any | owner | {
"repo_name": "SpongePowered/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/entity/ai/goal/Goal.java",
"license": "mit",
"size": 4002
} | [
"java.util.Optional"
] | import java.util.Optional; | import java.util.*; | [
"java.util"
] | java.util; | 2,525,113 |
@Override
public Trace currentRpcTraceObject() {
final Trace trace = threadLocalBinder.get();
if (trace == null) {
return null;
}
return trace;
} | Trace function() { final Trace trace = threadLocalBinder.get(); if (trace == null) { return null; } return trace; } | /**
* Return Trace object without validating
* @return
*/ | Return Trace object without validating | currentRpcTraceObject | {
"repo_name": "philipz/pinpoint",
"path": "profiler/src/main/java/com/navercorp/pinpoint/profiler/context/ThreadLocalTraceFactory.java",
"license": "apache-2.0",
"size": 6524
} | [
"com.navercorp.pinpoint.bootstrap.context.Trace"
] | import com.navercorp.pinpoint.bootstrap.context.Trace; | import com.navercorp.pinpoint.bootstrap.context.*; | [
"com.navercorp.pinpoint"
] | com.navercorp.pinpoint; | 2,173,993 |
public Map<String, Map<MetricType, Long>> aggregate() {
Map<String, Map<MetricType, Long>> publishedMetrics = new HashMap<>();
for (Entry<String, MutationMetric> entry : tableMutationMetric.entrySet()) {
String tableName = entry.getKey();
MutationMetric metric = entry.getValue();
Map<MetricType, Long> publishedMetricsForTable = publishedMetrics.get(tableName);
if (publishedMetricsForTable == null) {
publishedMetricsForTable = new HashMap<>();
publishedMetrics.put(tableName, publishedMetricsForTable);
}
publishedMetricsForTable.put(metric.getNumMutations().getMetricType(), metric.getNumMutations().getValue());
publishedMetricsForTable.put(metric.getMutationsSizeBytes().getMetricType(), metric.getMutationsSizeBytes().getValue());
publishedMetricsForTable.put(metric.getCommitTimeForMutations().getMetricType(), metric.getCommitTimeForMutations().getValue());
publishedMetricsForTable.put(metric.getNumFailedMutations().getMetricType(), metric.getNumFailedMutations().getValue());
}
return publishedMetrics;
} | Map<String, Map<MetricType, Long>> function() { Map<String, Map<MetricType, Long>> publishedMetrics = new HashMap<>(); for (Entry<String, MutationMetric> entry : tableMutationMetric.entrySet()) { String tableName = entry.getKey(); MutationMetric metric = entry.getValue(); Map<MetricType, Long> publishedMetricsForTable = publishedMetrics.get(tableName); if (publishedMetricsForTable == null) { publishedMetricsForTable = new HashMap<>(); publishedMetrics.put(tableName, publishedMetricsForTable); } publishedMetricsForTable.put(metric.getNumMutations().getMetricType(), metric.getNumMutations().getValue()); publishedMetricsForTable.put(metric.getMutationsSizeBytes().getMetricType(), metric.getMutationsSizeBytes().getValue()); publishedMetricsForTable.put(metric.getCommitTimeForMutations().getMetricType(), metric.getCommitTimeForMutations().getValue()); publishedMetricsForTable.put(metric.getNumFailedMutations().getMetricType(), metric.getNumFailedMutations().getValue()); } return publishedMetrics; } | /**
* Publish the metrics to wherever you want them published. The internal state is cleared out after every publish.
* @return map of table name -> list of pair of (metric name, metric value)
*/ | Publish the metrics to wherever you want them published. The internal state is cleared out after every publish | aggregate | {
"repo_name": "ohadshacham/phoenix",
"path": "phoenix-core/src/main/java/org/apache/phoenix/monitoring/MutationMetricQueue.java",
"license": "apache-2.0",
"size": 6086
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 939,426 |
@Test
public void testTrackNodeMultipleTimes() {
final NodeKeyResolver<ImmutableNode> resolver = createResolver();
model.trackNode(selector, resolver);
model.trackNode(selector, resolver);
model.untrackNode(selector);
assertNotNull("No tracked node", model.getTrackedNode(selector));
} | void function() { final NodeKeyResolver<ImmutableNode> resolver = createResolver(); model.trackNode(selector, resolver); model.trackNode(selector, resolver); model.untrackNode(selector); assertNotNull(STR, model.getTrackedNode(selector)); } | /**
* Tests whether a single node can be tracked multiple times.
*/ | Tests whether a single node can be tracked multiple times | testTrackNodeMultipleTimes | {
"repo_name": "apache/commons-configuration",
"path": "src/test/java/org/apache/commons/configuration2/tree/TestInMemoryNodeModelTrackedNodes.java",
"license": "apache-2.0",
"size": 34423
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 832,456 |
private static int getNnz(CSRPointer inPointer, int rl, int ru) {
int[] rlPtr = { -1 }; int[] ruPtr = { -1 };
cudaMemcpy(Pointer.to(rlPtr), inPointer.rowPtr.withByteOffset(rl*Sizeof.INT), Sizeof.INT, cudaMemcpyDeviceToHost);
cudaMemcpy(Pointer.to(ruPtr), inPointer.rowPtr.withByteOffset((ru+1)*Sizeof.INT), Sizeof.INT, cudaMemcpyDeviceToHost);
return ruPtr[0] - rlPtr[0];
} | static int function(CSRPointer inPointer, int rl, int ru) { int[] rlPtr = { -1 }; int[] ruPtr = { -1 }; cudaMemcpy(Pointer.to(rlPtr), inPointer.rowPtr.withByteOffset(rl*Sizeof.INT), Sizeof.INT, cudaMemcpyDeviceToHost); cudaMemcpy(Pointer.to(ruPtr), inPointer.rowPtr.withByteOffset((ru+1)*Sizeof.INT), Sizeof.INT, cudaMemcpyDeviceToHost); return ruPtr[0] - rlPtr[0]; } | /**
* Returns the number of non-zeroes in the given range of rows
*
* @param inPointer input CSR pointer
* @param rl lower row index (inclusive and zero-based)
* @param ru upper row index (inclusive and zero-based)
* @return number of non-zeroes
*/ | Returns the number of non-zeroes in the given range of rows | getNnz | {
"repo_name": "niketanpansare/systemml",
"path": "src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixCUDA.java",
"license": "apache-2.0",
"size": 119941
} | [
"org.apache.sysml.runtime.instructions.gpu.context.CSRPointer"
] | import org.apache.sysml.runtime.instructions.gpu.context.CSRPointer; | import org.apache.sysml.runtime.instructions.gpu.context.*; | [
"org.apache.sysml"
] | org.apache.sysml; | 2,599,553 |
@SuppressWarnings("UnusedParameters")
public void onAddStarting(ViewHolder item) {
} | @SuppressWarnings(STR) void function(ViewHolder item) { } | /**
* Called when an add animation is being started on the given ViewHolder.
* The default implementation does nothing. Subclasses may wish to override
* this method to handle any ViewHolder-specific operations linked to animation
* lifecycles.
*
* @param item The ViewHolder being animated.
*/ | Called when an add animation is being started on the given ViewHolder. The default implementation does nothing. Subclasses may wish to override this method to handle any ViewHolder-specific operations linked to animation lifecycles | onAddStarting | {
"repo_name": "amirlotfi/Nikagram",
"path": "app/src/main/java/ir/nikagram/messenger/support/widget/SimpleItemAnimator.java",
"license": "gpl-2.0",
"size": 19653
} | [
"ir.nikagram.messenger.support.widget.RecyclerView"
] | import ir.nikagram.messenger.support.widget.RecyclerView; | import ir.nikagram.messenger.support.widget.*; | [
"ir.nikagram.messenger"
] | ir.nikagram.messenger; | 1,467,551 |
protected void setSynonymsFrom(final UserThesaurusHolder userThesaurus) throws ThesaurusException {
for (PdcPositionValueEntity pdcPositionValue : values) {
pdcPositionValue.setSynonyms(userThesaurus.getSynonymsOf(pdcPositionValue));
}
} | void function(final UserThesaurusHolder userThesaurus) throws ThesaurusException { for (PdcPositionValueEntity pdcPositionValue : values) { pdcPositionValue.setSynonyms(userThesaurus.getSynonymsOf(pdcPositionValue)); } } | /**
* Sets the synonyms for each value of this position from the specified thesaurus.
* @param userThesaurus a user thesaurus from which synonyms can be get.
* @throws ThesaurusException if an error occurs while getting the synonyms of this position's
* values.
*/ | Sets the synonyms for each value of this position from the specified thesaurus | setSynonymsFrom | {
"repo_name": "CecileBONIN/Silverpeas-Core",
"path": "web-core/src/main/java/com/silverpeas/pdc/web/PdcPositionEntity.java",
"license": "agpl-3.0",
"size": 10246
} | [
"com.silverpeas.thesaurus.ThesaurusException"
] | import com.silverpeas.thesaurus.ThesaurusException; | import com.silverpeas.thesaurus.*; | [
"com.silverpeas.thesaurus"
] | com.silverpeas.thesaurus; | 1,533,974 |
protected void sendSubscriptionNotif(PDCSubscription subscription,
List<String> spaceAndInstanceNames, String componentId,
SilverContentInterface silverContent,
int fromUserId) throws NotificationManagerException {
final int userID = subscription.getOwnerId();
final String subscriptionName = subscription.getName();
final java.util.Date classifiedDate = new java.util.Date();
String documentName = "";
String documentUrl = "";
if (silverContent != null) {
String contentUrl = silverContent.getURL();
String contentName = silverContent.getName();
if (contentUrl != null) {
StringBuilder documentUrlBuffer = new StringBuilder().append(
"/RpdcSearch/jsp/GlobalContentForward?contentURL=");
try {
documentUrlBuffer.append(URLEncoder.encode(contentUrl, "UTF-8"));
} catch (UnsupportedEncodingException e) {
documentUrlBuffer.append(contentUrl);
}
documentUrlBuffer.append("&componentId=").append(componentId);
documentUrl = documentUrlBuffer.toString();
}
documentName = (contentName != null) ? contentName : "";
}
String spaceName = spaceAndInstanceNames.get(0);
String instanceName = spaceAndInstanceNames.get(1);
sendNotification(userID, fromUserId, subscriptionName, instanceName,
componentId, spaceName, classifiedDate, "standartMessage", documentUrl,
documentName);
} | void function(PDCSubscription subscription, List<String> spaceAndInstanceNames, String componentId, SilverContentInterface silverContent, int fromUserId) throws NotificationManagerException { final int userID = subscription.getOwnerId(); final String subscriptionName = subscription.getName(); final java.util.Date classifiedDate = new java.util.Date(); String documentName = STRSTR/RpdcSearch/jsp/GlobalContentForward?contentURL=STRUTF-8STR&componentId=STRSTRstandartMessage", documentUrl, documentName); } | /**
* Sends a notification when subscription criterias math a new content classified
*/ | Sends a notification when subscription criterias math a new content classified | sendSubscriptionNotif | {
"repo_name": "stephaneperry/Silverpeas-Core",
"path": "ejb-core/pdc/src/main/java/com/silverpeas/pdcSubscription/ejb/PdcSubscriptionBmEJB.java",
"license": "agpl-3.0",
"size": 26945
} | [
"com.silverpeas.pdcSubscription.model.PDCSubscription",
"com.stratelia.silverpeas.contentManager.SilverContentInterface",
"com.stratelia.silverpeas.notificationManager.NotificationManagerException",
"java.util.List"
] | import com.silverpeas.pdcSubscription.model.PDCSubscription; import com.stratelia.silverpeas.contentManager.SilverContentInterface; import com.stratelia.silverpeas.notificationManager.NotificationManagerException; import java.util.List; | import com.silverpeas.*; import com.stratelia.silverpeas.*; import java.util.*; | [
"com.silverpeas",
"com.stratelia.silverpeas",
"java.util"
] | com.silverpeas; com.stratelia.silverpeas; java.util; | 654,400 |
public void save(final String iClusterName) {
checkIfAttached();
graph.setCurrentGraphInThreadLocal();
if (rawElement instanceof ODocument)
if (iClusterName != null)
rawElement = ((ODocument) rawElement).save(iClusterName);
else
rawElement = ((ODocument) rawElement).save();
} | void function(final String iClusterName) { checkIfAttached(); graph.setCurrentGraphInThreadLocal(); if (rawElement instanceof ODocument) if (iClusterName != null) rawElement = ((ODocument) rawElement).save(iClusterName); else rawElement = ((ODocument) rawElement).save(); } | /**
* (Blueprints Extension) Saves current element to a particular cluster. You don't need to call save() unless you're working
* against Temporary Vertices.
*
* @param iClusterName
* Cluster name or null to use the default "E"
*/ | (Blueprints Extension) Saves current element to a particular cluster. You don't need to call save() unless you're working against Temporary Vertices | save | {
"repo_name": "DiceHoldingsInc/orientdb",
"path": "graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientElement.java",
"license": "apache-2.0",
"size": 18826
} | [
"com.orientechnologies.orient.core.record.impl.ODocument"
] | import com.orientechnologies.orient.core.record.impl.ODocument; | import com.orientechnologies.orient.core.record.impl.*; | [
"com.orientechnologies.orient"
] | com.orientechnologies.orient; | 1,288,698 |
@WebMethod(operationName = "GetRecordingJobState", action = "http://www.onvif.org/ver10/recording/wsdl/GetRecordingJobState")
@RequestWrapper(localName = "GetRecordingJobState", targetNamespace = "http://www.onvif.org/ver10/recording/wsdl", className = "org.onvif.ver10.recording.wsdl.GetRecordingJobState")
@ResponseWrapper(localName = "GetRecordingJobStateResponse", targetNamespace = "http://www.onvif.org/ver10/recording/wsdl", className = "org.onvif.ver10.recording.wsdl.GetRecordingJobStateResponse")
@WebResult(name = "State", targetNamespace = "http://www.onvif.org/ver10/recording/wsdl")
public org.onvif.ver10.schema.RecordingJobStateInformation getRecordingJobState(
@WebParam(name = "JobToken", targetNamespace = "http://www.onvif.org/ver10/recording/wsdl")
java.lang.String jobToken
); | @WebMethod(operationName = STR, action = "http: @RequestWrapper(localName = STR, targetNamespace = "http: @ResponseWrapper(localName = "GetRecordingJobStateResponseSTRhttp: @WebResult(name = "StateSTRhttp: org.onvif.ver10.schema.RecordingJobStateInformation function( @WebParam(name = "JobTokenSTRhttp: java.lang.String jobToken ); | /**
* GetRecordingJobState returns the state of a recording job. It includes an
* aggregated state,
* and state for each track of the recording job.
*
*/ | GetRecordingJobState returns the state of a recording job. It includes an aggregated state, and state for each track of the recording job | getRecordingJobState | {
"repo_name": "fpompermaier/onvif",
"path": "onvif-ws-client/src/main/java/org/onvif/ver10/recording/wsdl/RecordingPort.java",
"license": "apache-2.0",
"size": 24757
} | [
"javax.jws.WebMethod",
"javax.jws.WebParam",
"javax.jws.WebResult",
"javax.xml.ws.RequestWrapper",
"javax.xml.ws.ResponseWrapper"
] | import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.xml.ws.RequestWrapper; import javax.xml.ws.ResponseWrapper; | import javax.jws.*; import javax.xml.ws.*; | [
"javax.jws",
"javax.xml"
] | javax.jws; javax.xml; | 2,744,319 |
public String formatMessage(Locale locale, String key, Object[] arguments)
throws MissingResourceException {
if (fResourceBundle == null || locale != fLocale) {
if (locale != null) {
fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
// memorize the most-recent locale
fLocale = locale;
}
if (fResourceBundle == null)
fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
}
// format message
String msg;
try {
msg = fResourceBundle.getString(key);
if (arguments != null) {
try {
msg = java.text.MessageFormat.format(msg, arguments);
}
catch (Exception e) {
msg = fResourceBundle.getString("FormatFailed");
msg += " " + fResourceBundle.getString(key);
}
}
}
// error
catch (MissingResourceException e) {
msg = fResourceBundle.getString("BadMessageKey");
throw new MissingResourceException(key, msg, key);
}
// no message
if (msg == null) {
msg = key;
if (arguments.length > 0) {
StringBuffer str = new StringBuffer(msg);
str.append('?');
for (int i = 0; i < arguments.length; i++) {
if (i > 0) {
str.append('&');
}
str.append(String.valueOf(arguments[i]));
}
}
}
return msg;
} | String function(Locale locale, String key, Object[] arguments) throws MissingResourceException { if (fResourceBundle == null locale != fLocale) { if (locale != null) { fResourceBundle = SecuritySupport.getResourceBundle(STR, locale); fLocale = locale; } if (fResourceBundle == null) fResourceBundle = SecuritySupport.getResourceBundle(STR); } String msg; try { msg = fResourceBundle.getString(key); if (arguments != null) { try { msg = java.text.MessageFormat.format(msg, arguments); } catch (Exception e) { msg = fResourceBundle.getString(STR); msg += " " + fResourceBundle.getString(key); } } } catch (MissingResourceException e) { msg = fResourceBundle.getString(STR); throw new MissingResourceException(key, msg, key); } if (msg == null) { msg = key; if (arguments.length > 0) { StringBuffer str = new StringBuffer(msg); str.append('?'); for (int i = 0; i < arguments.length; i++) { if (i > 0) { str.append('&'); } str.append(String.valueOf(arguments[i])); } } } return msg; } | /**
* Formats a message with the specified arguments using the given
* locale information.
*
* @param locale The locale of the message.
* @param key The message key.
* @param arguments The message replacement text arguments. The order
* of the arguments must match that of the placeholders
* in the actual message.
*
* @return Returns the formatted message.
*
* @throws MissingResourceException Thrown if the message with the
* specified key cannot be found.
*/ | Formats a message with the specified arguments using the given locale information | formatMessage | {
"repo_name": "FauxFaux/jdk9-jaxp",
"path": "src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_ko.java",
"license": "gpl-2.0",
"size": 4137
} | [
"com.sun.org.apache.xerces.internal.utils.SecuritySupport",
"java.util.Locale",
"java.util.MissingResourceException"
] | import com.sun.org.apache.xerces.internal.utils.SecuritySupport; import java.util.Locale; import java.util.MissingResourceException; | import com.sun.org.apache.xerces.internal.utils.*; import java.util.*; | [
"com.sun.org",
"java.util"
] | com.sun.org; java.util; | 1,898,360 |
private void updateHeadKey(long destroyedKey) throws CacheException {
this.headKey = inc(destroyedKey);
if (logger.isTraceEnabled()) {
logger.trace("{}: Incremented HEAD_KEY for region {} to {}", this, this.region.getName(), this.headKey);
}
} | void function(long destroyedKey) throws CacheException { this.headKey = inc(destroyedKey); if (logger.isTraceEnabled()) { logger.trace(STR, this, this.region.getName(), this.headKey); } } | /**
* Increments the value of the head key by one.
*
* @throws CacheException
*/ | Increments the value of the head key by one | updateHeadKey | {
"repo_name": "kidaa/incubator-geode",
"path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderQueue.java",
"license": "apache-2.0",
"size": 45928
} | [
"com.gemstone.gemfire.cache.CacheException"
] | import com.gemstone.gemfire.cache.CacheException; | import com.gemstone.gemfire.cache.*; | [
"com.gemstone.gemfire"
] | com.gemstone.gemfire; | 2,613,898 |
public Interactive open(OnCommandResultListener onCommandResultListener) {
return new Interactive(this, onCommandResultListener);
}
}
public static class Interactive {
private final Handler handler;
private final boolean autoHandler;
private final String shell;
private final boolean wantSTDERR;
private final List<Command> commands;
private final Map<String, String> environment;
private final OnLineListener onSTDOUTLineListener;
private final OnLineListener onSTDERRLineListener;
private int watchdogTimeout;
private Process process = null;
private DataOutputStream STDIN = null;
private StreamGobbler STDOUT = null;
private StreamGobbler STDERR = null;
private ScheduledThreadPoolExecutor watchdog = null;
private volatile boolean running = false;
private volatile boolean idle = true; // read/write only synchronized
private volatile boolean closed = true;
private volatile int callbacks = 0;
private volatile int watchdogCount;
private Object idleSync = new Object();
private Object callbackSync = new Object();
private volatile int lastExitCode = 0;
private volatile String lastMarkerSTDOUT = null;
private volatile String lastMarkerSTDERR = null;
private volatile Command command = null;
private volatile List<String> buffer = null;
private Interactive(final Builder builder,
final OnCommandResultListener onCommandResultListener) {
autoHandler = builder.autoHandler;
shell = builder.shell;
wantSTDERR = builder.wantSTDERR;
commands = builder.commands;
environment = builder.environment;
onSTDOUTLineListener = builder.onSTDOUTLineListener;
onSTDERRLineListener = builder.onSTDERRLineListener;
watchdogTimeout = builder.watchdogTimeout;
// If a looper is available, we offload the callbacks from the
// gobbling threads
// to whichever thread created us. Would normally do this in open(),
// but then we could not declare handler as final
if ((Looper.myLooper() != null) && (builder.handler == null) && autoHandler) {
handler = new Handler();
} else {
handler = builder.handler;
}
boolean ret = open();
if (onCommandResultListener == null) {
return;
} else if (ret == false) {
onCommandResultListener.onCommandResult(0,
OnCommandResultListener.SHELL_EXEC_FAILED, null);
return;
} | Interactive function(OnCommandResultListener onCommandResultListener) { return new Interactive(this, onCommandResultListener); } } static class Interactive { private final Handler handler; private final boolean autoHandler; private final String shell; private final boolean wantSTDERR; private final List<Command> commands; private final Map<String, String> environment; private final OnLineListener onSTDOUTLineListener; private final OnLineListener onSTDERRLineListener; private int watchdogTimeout; private Process process = null; private DataOutputStream STDIN = null; private StreamGobbler STDOUT = null; private StreamGobbler STDERR = null; private ScheduledThreadPoolExecutor watchdog = null; private volatile boolean running = false; private volatile boolean idle = true; private volatile boolean closed = true; private volatile int callbacks = 0; private volatile int watchdogCount; private Object idleSync = new Object(); private Object callbackSync = new Object(); private volatile int lastExitCode = 0; private volatile String lastMarkerSTDOUT = null; private volatile String lastMarkerSTDERR = null; private volatile Command command = null; private volatile List<String> buffer = null; private Interactive(final Builder builder, final OnCommandResultListener onCommandResultListener) { autoHandler = builder.autoHandler; shell = builder.shell; wantSTDERR = builder.wantSTDERR; commands = builder.commands; environment = builder.environment; onSTDOUTLineListener = builder.onSTDOUTLineListener; onSTDERRLineListener = builder.onSTDERRLineListener; watchdogTimeout = builder.watchdogTimeout; if ((Looper.myLooper() != null) && (builder.handler == null) && autoHandler) { handler = new Handler(); } else { handler = builder.handler; } boolean ret = function(); if (onCommandResultListener == null) { return; } else if (ret == false) { onCommandResultListener.onCommandResult(0, OnCommandResultListener.SHELL_EXEC_FAILED, null); return; } | /**
* Construct a {@link Shell.Interactive} instance, try to start the
* shell, and call onCommandResultListener to report success or failure
*
* @param onCommandResultListener Callback to return shell open status
*/ | Construct a <code>Shell.Interactive</code> instance, try to start the shell, and call onCommandResultListener to report success or failure | open | {
"repo_name": "aravindsagar/EasyLock",
"path": "libsuperuser/src/eu/chainfire/libsuperuser/Shell.java",
"license": "apache-2.0",
"size": 66888
} | [
"android.os.Handler",
"android.os.Looper",
"eu.chainfire.libsuperuser.StreamGobbler",
"java.io.DataOutputStream",
"java.util.List",
"java.util.Map",
"java.util.concurrent.ScheduledThreadPoolExecutor"
] | import android.os.Handler; import android.os.Looper; import eu.chainfire.libsuperuser.StreamGobbler; import java.io.DataOutputStream; import java.util.List; import java.util.Map; import java.util.concurrent.ScheduledThreadPoolExecutor; | import android.os.*; import eu.chainfire.libsuperuser.*; import java.io.*; import java.util.*; import java.util.concurrent.*; | [
"android.os",
"eu.chainfire.libsuperuser",
"java.io",
"java.util"
] | android.os; eu.chainfire.libsuperuser; java.io; java.util; | 2,862,036 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.