method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public void testJobFailedOver() throws Exception {
failed.set(false);
routed.set(false);
try {
Ignite ignite1 = startGrid(NODE1);
Ignite ignite2 = startGrid(NODE2);
Ignite ignite3 = startGrid(NODE3);
assert ignite1 != null;
assert ignite2 != null;
assert ignite3 != null;
Integer res = (Integer)compute(ignite1.cluster().forPredicate(p)).withTimeout(10000).
execute(JobFailTask.class.getName(), "1");
assert res == 1;
}
catch (ClusterTopologyException ignored) {
failed.set(true);
}
finally {
assertFalse(failed.get());
assertTrue(routed.get());
stopGrid(NODE1);
stopGrid(NODE2);
stopGrid(NODE3);
}
} | void function() throws Exception { failed.set(false); routed.set(false); try { Ignite ignite1 = startGrid(NODE1); Ignite ignite2 = startGrid(NODE2); Ignite ignite3 = startGrid(NODE3); assert ignite1 != null; assert ignite2 != null; assert ignite3 != null; Integer res = (Integer)compute(ignite1.cluster().forPredicate(p)).withTimeout(10000). execute(JobFailTask.class.getName(), "1"); assert res == 1; } catch (ClusterTopologyException ignored) { failed.set(true); } finally { assertFalse(failed.get()); assertTrue(routed.get()); stopGrid(NODE1); stopGrid(NODE2); stopGrid(NODE3); } } | /**
* Tests that failover happens on three-node grid when the Task is applicable for the first node
* and fails on it, but is also applicable on another node.
*
* @throws Exception If failed.
*/ | Tests that failover happens on three-node grid when the Task is applicable for the first node and fails on it, but is also applicable on another node | testJobFailedOver | {
"repo_name": "irudyak/ignite",
"path": "modules/core/src/test/java/org/apache/ignite/internal/GridFailoverTaskWithPredicateSelfTest.java",
"license": "apache-2.0",
"size": 9048
} | [
"org.apache.ignite.Ignite",
"org.apache.ignite.cluster.ClusterTopologyException"
] | import org.apache.ignite.Ignite; import org.apache.ignite.cluster.ClusterTopologyException; | import org.apache.ignite.*; import org.apache.ignite.cluster.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,985,088 |
public Object addToListOption(String key, Object value) {
if (key != null && !key.equals("")) {
if (this.containsKey(key) && this.get(key) != null) {
if (!(this.get(key) instanceof List)) { //If was not a list, getAsList returns an Unmodifiable List.
// Create new modifiable List with the content, and replace.
this.put(key, new ArrayList<>(this.getAsList(key)));
}
try {
this.getList(key).add(value);
} catch (UnsupportedOperationException e) {
List<Object> list = new ArrayList<>(this.getList(key));
list.add(value);
this.put(key, list);
}
} else {
//New List instead of "Arrays.asList" or "Collections.singletonList" to avoid unmodifiable list.
List<Object> list = new ArrayList<>();
list.add(value);
this.put(key, list);
}
return this.getList(key);
}
return null;
} | Object function(String key, Object value) { if (key != null && !key.equals("")) { if (this.containsKey(key) && this.get(key) != null) { if (!(this.get(key) instanceof List)) { this.put(key, new ArrayList<>(this.getAsList(key))); } try { this.getList(key).add(value); } catch (UnsupportedOperationException e) { List<Object> list = new ArrayList<>(this.getList(key)); list.add(value); this.put(key, list); } } else { List<Object> list = new ArrayList<>(); list.add(value); this.put(key, list); } return this.getList(key); } return null; } | /**
* This method safely add a new Object to an exiting option which type is List.
*
* @param key The new option name
* @param value The new value
* @return the list with the new Object inserted.
*/ | This method safely add a new Object to an exiting option which type is List | addToListOption | {
"repo_name": "j-coll/java-common-libs",
"path": "commons-datastore/commons-datastore-core/src/main/java/org/opencb/commons/datastore/core/QueryOptions.java",
"license": "apache-2.0",
"size": 4223
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,139,193 |
@ApiModelProperty(example = "APPROVED", required = true, value = "This attribute declares whether this workflow task is approved or rejected. ")
public WorkflowStatusEnum getWorkflowStatus() {
return workflowStatus;
} | @ApiModelProperty(example = STR, required = true, value = STR) WorkflowStatusEnum function() { return workflowStatus; } | /**
* This attribute declares whether this workflow task is approved or rejected.
* @return workflowStatus
**/ | This attribute declares whether this workflow task is approved or rejected | getWorkflowStatus | {
"repo_name": "sambaheerathan/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/dto/WorkflowResponseDTO.java",
"license": "apache-2.0",
"size": 3499
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 1,637,696 |
static List<String> getNamesOfAllInterfaceClasses(final ScanSpec scanSpec, final Set<ClassInfo> allClassInfo) {
return getClassNames(filterClassInfo(allClassInfo, true,
scanSpec, ClassType.IMPLEMENTED_INTERFACE));
} | static List<String> getNamesOfAllInterfaceClasses(final ScanSpec scanSpec, final Set<ClassInfo> allClassInfo) { return getClassNames(filterClassInfo(allClassInfo, true, scanSpec, ClassType.IMPLEMENTED_INTERFACE)); } | /**
* Get the names of interface classes found during the scan.
*
* @return the sorted list of names of interface classes found during the scan, or the empty list if none.
*/ | Get the names of interface classes found during the scan | getNamesOfAllInterfaceClasses | {
"repo_name": "CiNC0/Cartier",
"path": "cartier-classpath-scanner/src/main/java/xyz/vopen/cartier/classpathscanner/scanner/ClassInfo.java",
"license": "apache-2.0",
"size": 88074
} | [
"java.util.List",
"java.util.Set"
] | import java.util.List; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,250,000 |
public void trainSentence(final List<VocabWord> sentence, double alpha) {
if (sentence != null && !sentence.isEmpty()) {
for (int i = 0; i < sentence.size(); i++) {
if (!sentence.get(i).getWord().endsWith("STOP")) {
nextRandom.set(nextRandom.get() * 25214903917L + 11);
skipGram(i, sentence, (int) nextRandom.get() % window, alpha);
}
}
}
} | void function(final List<VocabWord> sentence, double alpha) { if (sentence != null && !sentence.isEmpty()) { for (int i = 0; i < sentence.size(); i++) { if (!sentence.get(i).getWord().endsWith("STOP")) { nextRandom.set(nextRandom.get() * 25214903917L + 11); skipGram(i, sentence, (int) nextRandom.get() % window, alpha); } } } } | /**
* Train on a list of vocab words
* @param sentence the list of vocab words to train on
*/ | Train on a list of vocab words | trainSentence | {
"repo_name": "shuodata/deeplearning4j",
"path": "deeplearning4j-scaleout/spark/dl4j-spark-nlp/src/main/java/org/deeplearning4j/spark/models/embeddings/word2vec/Word2VecPerformer.java",
"license": "apache-2.0",
"size": 9462
} | [
"java.util.List",
"org.deeplearning4j.models.word2vec.VocabWord"
] | import java.util.List; import org.deeplearning4j.models.word2vec.VocabWord; | import java.util.*; import org.deeplearning4j.models.word2vec.*; | [
"java.util",
"org.deeplearning4j.models"
] | java.util; org.deeplearning4j.models; | 1,461,863 |
private static Collection<ServiceReference> asCollection(ServiceReference[] references) {
return references == null ? new ArrayList<>(0) : Arrays.asList(references);
} | static Collection<ServiceReference> function(ServiceReference[] references) { return references == null ? new ArrayList<>(0) : Arrays.asList(references); } | /**
* Provides an iterable collection of references, even if the original array is <code>null</code>.
*/ | Provides an iterable collection of references, even if the original array is <code>null</code> | asCollection | {
"repo_name": "punkhorn/camel-upstream",
"path": "components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java",
"license": "apache-2.0",
"size": 27686
} | [
"java.util.ArrayList",
"java.util.Arrays",
"java.util.Collection",
"org.osgi.framework.ServiceReference"
] | import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import org.osgi.framework.ServiceReference; | import java.util.*; import org.osgi.framework.*; | [
"java.util",
"org.osgi.framework"
] | java.util; org.osgi.framework; | 1,311,595 |
public static String mergeTemplateIntoString(
VelocityEngine velocityEngine, String templateLocation, Map model)
throws VelocityException {
StringWriter result = new StringWriter();
mergeTemplate(velocityEngine, templateLocation, model, result);
return result.toString();
} | static String function( VelocityEngine velocityEngine, String templateLocation, Map model) throws VelocityException { StringWriter result = new StringWriter(); mergeTemplate(velocityEngine, templateLocation, model, result); return result.toString(); } | /**
* Merge the specified Velocity template with the given model into a String.
* <p>When using this method to prepare a text for a mail to be sent with Spring's
* mail support, consider wrapping VelocityException in MailPreparationException.
* @param velocityEngine VelocityEngine to work with
* @param templateLocation the location of template, relative to Velocity's
* resource loader path
* @param model the Map that contains model names as keys and model objects
* as values
* @return the result as String
* @throws VelocityException if the template wasn't found or rendering failed
* @see org.springframework.mail.MailPreparationException
*/ | Merge the specified Velocity template with the given model into a String. When using this method to prepare a text for a mail to be sent with Spring's mail support, consider wrapping VelocityException in MailPreparationException | mergeTemplateIntoString | {
"repo_name": "dachengxi/spring1.1.1_source",
"path": "src/org/springframework/ui/velocity/VelocityEngineUtils.java",
"license": "mit",
"size": 5540
} | [
"java.io.StringWriter",
"java.util.Map",
"org.apache.velocity.app.VelocityEngine",
"org.apache.velocity.exception.VelocityException"
] | import java.io.StringWriter; import java.util.Map; import org.apache.velocity.app.VelocityEngine; import org.apache.velocity.exception.VelocityException; | import java.io.*; import java.util.*; import org.apache.velocity.app.*; import org.apache.velocity.exception.*; | [
"java.io",
"java.util",
"org.apache.velocity"
] | java.io; java.util; org.apache.velocity; | 27,827 |
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
super.render(entity, f, f1, f2, f3, f4, f5);
this.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
this.sinkHolder.render(f5);
this.sinkBase.render(f5);
this.sinkBack.render(f5);
this.sinkSideRight.render(f5);
this.sinkSideLeft.render(f5);
this.sinkSideFront.render(f5);
this.tapBase1.render(f5);
this.tapEnd1.render(f5);
this.tapBase2.render(f5);
this.tapEnd2.render(f5);
this.water0.render(f5);
this.water1.render(f5);
} | void function(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); this.sinkHolder.render(f5); this.sinkBase.render(f5); this.sinkBack.render(f5); this.sinkSideRight.render(f5); this.sinkSideLeft.render(f5); this.sinkSideFront.render(f5); this.tapBase1.render(f5); this.tapEnd1.render(f5); this.tapBase2.render(f5); this.tapEnd2.render(f5); this.water0.render(f5); this.water1.render(f5); } | /**
* Sets the models various rotation angles then renders the model.
*/ | Sets the models various rotation angles then renders the model | render | {
"repo_name": "GollumTeam/AtlanteanMillenaire",
"path": "src/main/java/com/gollum/atlanteanmillenaire/client/model/ceramic/ModelBathroomSink.java",
"license": "gpl-2.0",
"size": 5892
} | [
"net.minecraft.entity.Entity"
] | import net.minecraft.entity.Entity; | import net.minecraft.entity.*; | [
"net.minecraft.entity"
] | net.minecraft.entity; | 1,245,039 |
protected static BridgeUpdateHandler getBridgeUpdateHandler(Node node) {
SVGContext ctx = getSVGContext(node);
return (ctx == null) ? null : (BridgeUpdateHandler)ctx;
}
protected class DOMAttrModifiedEventListener implements EventListener {
public DOMAttrModifiedEventListener() {
} | static BridgeUpdateHandler function(Node node) { SVGContext ctx = getSVGContext(node); return (ctx == null) ? null : (BridgeUpdateHandler)ctx; } protected class DOMAttrModifiedEventListener implements EventListener { public DOMAttrModifiedEventListener() { } | /**
* Returns the BridgeUpdateHandler associated to the specified Node
* or null if there is none.
*/ | Returns the BridgeUpdateHandler associated to the specified Node or null if there is none | getBridgeUpdateHandler | {
"repo_name": "srnsw/xena",
"path": "plugins/image/ext/src/batik-1.7/sources/org/apache/batik/bridge/BridgeContext.java",
"license": "gpl-3.0",
"size": 69039
} | [
"org.apache.batik.dom.svg.SVGContext",
"org.w3c.dom.Node",
"org.w3c.dom.events.EventListener"
] | import org.apache.batik.dom.svg.SVGContext; import org.w3c.dom.Node; import org.w3c.dom.events.EventListener; | import org.apache.batik.dom.svg.*; import org.w3c.dom.*; import org.w3c.dom.events.*; | [
"org.apache.batik",
"org.w3c.dom"
] | org.apache.batik; org.w3c.dom; | 1,659,066 |
protected InformationLoss<?> getLowerBound(long identifier) {
return lowerBound.getOrDefault(identifier, null);
} | InformationLoss<?> function(long identifier) { return lowerBound.getOrDefault(identifier, null); } | /**
* Returns the lower bound
* @param identifier
* @return
*/ | Returns the lower bound | getLowerBound | {
"repo_name": "fstahnke/arx",
"path": "src/main/org/deidentifier/arx/framework/lattice/SolutionSpace.java",
"license": "apache-2.0",
"size": 16595
} | [
"org.deidentifier.arx.metric.InformationLoss"
] | import org.deidentifier.arx.metric.InformationLoss; | import org.deidentifier.arx.metric.*; | [
"org.deidentifier.arx"
] | org.deidentifier.arx; | 2,879,362 |
void verifyRevision(Revision revision, NiFiUser user) throws InvalidRevisionException; | void verifyRevision(Revision revision, NiFiUser user) throws InvalidRevisionException; | /**
* Claims the specified revision for the specified user.
*
* @param revision revision
* @param user user
* @throws InvalidRevisionException invalid revision
*/ | Claims the specified revision for the specified user | verifyRevision | {
"repo_name": "mcgilman/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java",
"license": "apache-2.0",
"size": 85713
} | [
"org.apache.nifi.authorization.user.NiFiUser"
] | import org.apache.nifi.authorization.user.NiFiUser; | import org.apache.nifi.authorization.user.*; | [
"org.apache.nifi"
] | org.apache.nifi; | 2,542,364 |
private boolean isPacketLayer(Device.Type type) {
return type == Device.Type.SWITCH || type == Device.Type.ROUTER || type == Device.Type.VIRTUAL;
} | boolean function(Device.Type type) { return type == Device.Type.SWITCH type == Device.Type.ROUTER type == Device.Type.VIRTUAL; } | /**
* Verifies if given device type is in packet layer, i.e., ROADM, OTN or ROADM_OTN device.
*
* @param type device type
* @return true if in packet layer, false otherwise
*/ | Verifies if given device type is in packet layer, i.e., ROADM, OTN or ROADM_OTN device | isPacketLayer | {
"repo_name": "donNewtonAlpha/onos",
"path": "apps/optical/src/main/java/org/onosproject/optical/OpticalPathProvisioner.java",
"license": "apache-2.0",
"size": 15071
} | [
"org.onosproject.net.Device"
] | import org.onosproject.net.Device; | import org.onosproject.net.*; | [
"org.onosproject.net"
] | org.onosproject.net; | 1,348,284 |
Iterator<URI> getSpecURIs() throws IOException; | Iterator<URI> getSpecURIs() throws IOException; | /**
* Return an iterator of Spec URIs(Spec identifiers)
*/ | Return an iterator of Spec URIs(Spec identifiers) | getSpecURIs | {
"repo_name": "jack-moseley/gobblin",
"path": "gobblin-runtime/src/main/java/org/apache/gobblin/runtime/api/SpecStore.java",
"license": "apache-2.0",
"size": 5750
} | [
"java.io.IOException",
"java.util.Iterator"
] | import java.io.IOException; import java.util.Iterator; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 40,738 |
private boolean announceHistoricalSegment(final Handle handle, final DataSegment segment) throws IOException
{
try {
if (segmentExists(handle, segment)) {
log.info("Found [%s] in DB, not updating DB", segment.getIdentifier());
return false;
}
// Try/catch to work around races due to SELECT -> INSERT. Avoid ON DUPLICATE KEY since it's not portable.
try {
handle.createStatement(
String.format(
"INSERT INTO %s (id, dataSource, created_date, start, \"end\", partitioned, version, used, payload) "
+ "VALUES (:id, :dataSource, :created_date, :start, :end, :partitioned, :version, :used, :payload)",
dbTables.getSegmentsTable()
)
)
.bind("id", segment.getIdentifier())
.bind("dataSource", segment.getDataSource())
.bind("created_date", new DateTime().toString())
.bind("start", segment.getInterval().getStart().toString())
.bind("end", segment.getInterval().getEnd().toString())
.bind("partitioned", (segment.getShardSpec() instanceof NoneShardSpec) ? false : true)
.bind("version", segment.getVersion())
.bind("used", true)
.bind("payload", jsonMapper.writeValueAsBytes(segment))
.execute();
log.info("Published segment [%s] to DB", segment.getIdentifier());
}
catch (Exception e) {
if (e.getCause() instanceof SQLException && segmentExists(handle, segment)) {
log.info("Found [%s] in DB, not updating DB", segment.getIdentifier());
} else {
throw e;
}
}
}
catch (IOException e) {
log.error(e, "Exception inserting into DB");
throw e;
}
return true;
} | boolean function(final Handle handle, final DataSegment segment) throws IOException { try { if (segmentExists(handle, segment)) { log.info(STR, segment.getIdentifier()); return false; } try { handle.createStatement( String.format( STRend\STR + STR, dbTables.getSegmentsTable() ) ) .bind("id", segment.getIdentifier()) .bind(STR, segment.getDataSource()) .bind(STR, new DateTime().toString()) .bind("start", segment.getInterval().getStart().toString()) .bind("end", segment.getInterval().getEnd().toString()) .bind(STR, (segment.getShardSpec() instanceof NoneShardSpec) ? false : true) .bind(STR, segment.getVersion()) .bind("used", true) .bind(STR, jsonMapper.writeValueAsBytes(segment)) .execute(); log.info(STR, segment.getIdentifier()); } catch (Exception e) { if (e.getCause() instanceof SQLException && segmentExists(handle, segment)) { log.info(STR, segment.getIdentifier()); } else { throw e; } } } catch (IOException e) { log.error(e, STR); throw e; } return true; } | /**
* Attempts to insert a single segment to the database. If the segment already exists, will do nothing. Meant
* to be called from within a transaction.
*
* @return true if the segment was added, false otherwise
*/ | Attempts to insert a single segment to the database. If the segment already exists, will do nothing. Meant to be called from within a transaction | announceHistoricalSegment | {
"repo_name": "friedhardware/druid",
"path": "server/src/main/java/io/druid/metadata/IndexerSQLMetadataStorageCoordinator.java",
"license": "apache-2.0",
"size": 24103
} | [
"io.druid.timeline.DataSegment",
"io.druid.timeline.partition.NoneShardSpec",
"java.io.IOException",
"java.sql.SQLException",
"org.joda.time.DateTime",
"org.skife.jdbi.v2.Handle"
] | import io.druid.timeline.DataSegment; import io.druid.timeline.partition.NoneShardSpec; import java.io.IOException; import java.sql.SQLException; import org.joda.time.DateTime; import org.skife.jdbi.v2.Handle; | import io.druid.timeline.*; import io.druid.timeline.partition.*; import java.io.*; import java.sql.*; import org.joda.time.*; import org.skife.jdbi.v2.*; | [
"io.druid.timeline",
"java.io",
"java.sql",
"org.joda.time",
"org.skife.jdbi"
] | io.druid.timeline; java.io; java.sql; org.joda.time; org.skife.jdbi; | 2,091,082 |
public void setParameters(Map<String, Object> parameters) {
this.parameters = parameters;
} | void function(Map<String, Object> parameters) { this.parameters = parameters; } | /**
* Additional parameters to configure the consumer of the REST transport for this REST service
*/ | Additional parameters to configure the consumer of the REST transport for this REST service | setParameters | {
"repo_name": "jlpedrosa/camel",
"path": "camel-core/src/main/java/org/apache/camel/component/rest/RestEndpoint.java",
"license": "apache-2.0",
"size": 11227
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 205,885 |
private boolean findFate(final String tableName) {
Instance instance = connector.getInstance();
AdminUtil<String> admin = new AdminUtil<>(false);
try {
String tableId = Tables.getTableId(instance, tableName);
log.trace("tid: {}", tableId);
String secret = cluster.getSiteConfiguration().get(Property.INSTANCE_SECRET);
IZooReaderWriter zk = new ZooReaderWriterFactory().getZooReaderWriter(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut(), secret);
ZooStore<String> zs = new ZooStore<>(ZooUtil.getRoot(instance) + Constants.ZFATE, zk);
AdminUtil.FateStatus fateStatus = admin.getStatus(zs, zk, ZooUtil.getRoot(instance) + Constants.ZTABLE_LOCKS + "/" + tableId, null, null);
for (AdminUtil.TransactionStatus tx : fateStatus.getTransactions()) {
if (tx.getTop().contains("CompactionDriver") && tx.getDebug().contains("CompactRange")) {
return true;
}
}
} catch (KeeperException | TableNotFoundException | InterruptedException ex) {
throw new IllegalStateException(ex);
}
// did not find appropriate fate transaction for compaction.
return Boolean.FALSE;
} | boolean function(final String tableName) { Instance instance = connector.getInstance(); AdminUtil<String> admin = new AdminUtil<>(false); try { String tableId = Tables.getTableId(instance, tableName); log.trace(STR, tableId); String secret = cluster.getSiteConfiguration().get(Property.INSTANCE_SECRET); IZooReaderWriter zk = new ZooReaderWriterFactory().getZooReaderWriter(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut(), secret); ZooStore<String> zs = new ZooStore<>(ZooUtil.getRoot(instance) + Constants.ZFATE, zk); AdminUtil.FateStatus fateStatus = admin.getStatus(zs, zk, ZooUtil.getRoot(instance) + Constants.ZTABLE_LOCKS + "/" + tableId, null, null); for (AdminUtil.TransactionStatus tx : fateStatus.getTransactions()) { if (tx.getTop().contains(STR) && tx.getDebug().contains(STR)) { return true; } } } catch (KeeperException TableNotFoundException InterruptedException ex) { throw new IllegalStateException(ex); } return Boolean.FALSE; } | /**
* Checks fates in zookeeper looking for transaction associated with a compaction as a double check that the test will be valid because the running compaction
* does have a fate transaction lock.
*
* @return true if corresponding fate transaction found, false otherwise
*/ | Checks fates in zookeeper looking for transaction associated with a compaction as a double check that the test will be valid because the running compaction does have a fate transaction lock | findFate | {
"repo_name": "adamjshook/accumulo",
"path": "test/src/test/java/org/apache/accumulo/test/functional/TableChangeStateIT.java",
"license": "apache-2.0",
"size": 15812
} | [
"org.apache.accumulo.core.Constants",
"org.apache.accumulo.core.client.Instance",
"org.apache.accumulo.core.client.TableNotFoundException",
"org.apache.accumulo.core.client.impl.Tables",
"org.apache.accumulo.core.conf.Property",
"org.apache.accumulo.core.zookeeper.ZooUtil",
"org.apache.accumulo.fate.Adm... | import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.zookeeper.ZooUtil; import org.apache.accumulo.fate.AdminUtil; import org.apache.accumulo.fate.ZooStore; import org.apache.accumulo.fate.zookeeper.IZooReaderWriter; import org.apache.accumulo.server.zookeeper.ZooReaderWriterFactory; import org.apache.zookeeper.KeeperException; | import org.apache.accumulo.core.*; import org.apache.accumulo.core.client.*; import org.apache.accumulo.core.client.impl.*; import org.apache.accumulo.core.conf.*; import org.apache.accumulo.core.zookeeper.*; import org.apache.accumulo.fate.*; import org.apache.accumulo.fate.zookeeper.*; import org.apache.accumulo.server.zookeeper.*; import org.apache.zookeeper.*; | [
"org.apache.accumulo",
"org.apache.zookeeper"
] | org.apache.accumulo; org.apache.zookeeper; | 1,481,905 |
return new GZIPInputStream(inputStream);
} | return new GZIPInputStream(inputStream); } | /**
* Creates a new {@link GZIPInputStream}.
* @param inputStream the {@link InputStream} from which the new instance will be created
* @return the new instance
* @throws IOException if an I/O error has occurred
*/ | Creates a new <code>GZIPInputStream</code> | createInputStream | {
"repo_name": "nagyistoce/Wilma",
"path": "wilma-application/modules/wilma-compression/src/main/java/com/epam/wilma/compression/gzip/helper/GzipInputStreamFactory.java",
"license": "gpl-3.0",
"size": 1552
} | [
"java.util.zip.GZIPInputStream"
] | import java.util.zip.GZIPInputStream; | import java.util.zip.*; | [
"java.util"
] | java.util; | 14,043 |
public static String runJavaScriptInFrameOrFail(
String js, int timeout, final WebContents webContents) {
return runJavaScriptInFrameInternal(js, timeout, webContents, true );
} | static String function( String js, int timeout, final WebContents webContents) { return runJavaScriptInFrameInternal(js, timeout, webContents, true ); } | /**
* Runs the given JavaScript in the focused frame, failing if a timeout/interrupt occurs.
*
* @param js The JavaScript to run.
* @param timeout The timeout in milliseconds before failure.
* @param webContents The WebContents object to get the focused frame from.
* @return The return value of the JavaScript.
*/ | Runs the given JavaScript in the focused frame, failing if a timeout/interrupt occurs | runJavaScriptInFrameOrFail | {
"repo_name": "ric2b/Vivaldi-browser",
"path": "chromium/chrome/android/javatests/src/org/chromium/chrome/browser/vr/XrTestFramework.java",
"license": "bsd-3-clause",
"size": 27148
} | [
"org.chromium.content_public.browser.WebContents"
] | import org.chromium.content_public.browser.WebContents; | import org.chromium.content_public.browser.*; | [
"org.chromium.content_public"
] | org.chromium.content_public; | 2,809,181 |
private static void initializeLogging() {
try {
String mdwLogLevel = LoggerUtil.initializeLogging();
if (mdwLogLevel != null) {
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
loggerContext.getLogger("com.centurylink.mdw").setLevel(Level.toLevel(mdwLogLevel.toLowerCase()));
}
}
catch (IOException ex) {
ex.printStackTrace();
}
} | static void function() { try { String mdwLogLevel = LoggerUtil.initializeLogging(); if (mdwLogLevel != null) { LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); loggerContext.getLogger(STR).setLevel(Level.toLevel(mdwLogLevel.toLowerCase())); } } catch (IOException ex) { ex.printStackTrace(); } } | /**
* Make zero-config logback logging honor mdw.logging.level in mdw.yaml.
*/ | Make zero-config logback logging honor mdw.logging.level in mdw.yaml | initializeLogging | {
"repo_name": "CenturyLinkCloud/mdw",
"path": "mdw-spring-boot/src/com/centurylink/mdw/boot/AutoConfig.java",
"license": "apache-2.0",
"size": 5220
} | [
"ch.qos.logback.classic.Level",
"ch.qos.logback.classic.LoggerContext",
"com.centurylink.mdw.util.log.LoggerUtil",
"java.io.IOException",
"org.slf4j.LoggerFactory"
] | import ch.qos.logback.classic.Level; import ch.qos.logback.classic.LoggerContext; import com.centurylink.mdw.util.log.LoggerUtil; import java.io.IOException; import org.slf4j.LoggerFactory; | import ch.qos.logback.classic.*; import com.centurylink.mdw.util.log.*; import java.io.*; import org.slf4j.*; | [
"ch.qos.logback",
"com.centurylink.mdw",
"java.io",
"org.slf4j"
] | ch.qos.logback; com.centurylink.mdw; java.io; org.slf4j; | 2,024,644 |
public void setLocker(User lockerIn) {
this.locker = lockerIn;
} | void function(User lockerIn) { this.locker = lockerIn; } | /**
* Setter for locker
* @param lockerIn to set
*/ | Setter for locker | setLocker | {
"repo_name": "aronparsons/spacewalk",
"path": "java/code/src/com/redhat/rhn/domain/server/ServerLock.java",
"license": "gpl-2.0",
"size": 2704
} | [
"com.redhat.rhn.domain.user.User"
] | import com.redhat.rhn.domain.user.User; | import com.redhat.rhn.domain.user.*; | [
"com.redhat.rhn"
] | com.redhat.rhn; | 1,279,690 |
Mat temp = new Mat();
Core.compare(img1, img2, temp, 1);
return Core.countNonZero(temp) == 0;
}
| Mat temp = new Mat(); Core.compare(img1, img2, temp, 1); return Core.countNonZero(temp) == 0; } | /**
* Checks if two mats are identical
*
* @param img1: Image in RGB format (Mat).
* @param img2: Image in RGB format (Mat).
* @return - Boolean value (true, false)
*/ | Checks if two mats are identical | compareMat | {
"repo_name": "SethStalley/IC6831-Project1",
"path": "Implementation/Source Code/backend/complete/src/main/java/tests/UnitTests.java",
"license": "mit",
"size": 2400
} | [
"org.opencv.core.Core",
"org.opencv.core.Mat"
] | import org.opencv.core.Core; import org.opencv.core.Mat; | import org.opencv.core.*; | [
"org.opencv.core"
] | org.opencv.core; | 1,158,550 |
public static boolean existsAutoLoginCookie(HttpServletRequest request) {
try {
Cookie cookie = getCookie(request);
if (cookie != null) {
return true;
} else {
//log.debug("No auto login cookie exists yet.");
return false;
}
} catch (Exception e) {
log.error("Can not find out whether to perform auto login or not! Exception message : " + e.getMessage(), e);
return false;
}
} | static boolean function(HttpServletRequest request) { try { Cookie cookie = getCookie(request); if (cookie != null) { return true; } else { return false; } } catch (Exception e) { log.error(STR + e.getMessage(), e); return false; } } | /**
* This method checks whether the current user should get logged in automatically based on an existing auto login cookie
* @param request HTTP request
* @return true means that this user can be logged in automatically.
*/ | This method checks whether the current user should get logged in automatically based on an existing auto login cookie | existsAutoLoginCookie | {
"repo_name": "baszero/yanel",
"path": "src/webapp/src/java/org/wyona/yanel/servlet/security/impl/AutoLogin.java",
"license": "apache-2.0",
"size": 12913
} | [
"javax.servlet.http.Cookie",
"javax.servlet.http.HttpServletRequest"
] | import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.*; | [
"javax.servlet"
] | javax.servlet; | 1,459,302 |
protected void addRolePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_DirectedNodePropertyType_role_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_DirectedNodePropertyType_role_feature", "_UI_DirectedNodePropertyType_type"),
GmlPackage.eINSTANCE.getDirectedNodePropertyType_Role(),
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
} | void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), GmlPackage.eINSTANCE.getDirectedNodePropertyType_Role(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } | /**
* This adds a property descriptor for the Role feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds a property descriptor for the Role feature. | addRolePropertyDescriptor | {
"repo_name": "markus1978/citygml4emf",
"path": "de.hub.citygml.emf.ecore.edit/src/net/opengis/gml/provider/DirectedNodePropertyTypeItemProvider.java",
"license": "apache-2.0",
"size": 13136
} | [
"net.opengis.gml.GmlPackage",
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor"
] | import net.opengis.gml.GmlPackage; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; | import net.opengis.gml.*; import org.eclipse.emf.edit.provider.*; | [
"net.opengis.gml",
"org.eclipse.emf"
] | net.opengis.gml; org.eclipse.emf; | 348,795 |
public boolean hasMatch(final Classifier pElem) {
return rawHasMatch(new Object[]{pElem});
}
| boolean function(final Classifier pElem) { return rawHasMatch(new Object[]{pElem}); } | /**
* Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
* under any possible substitution of the unspecified parameters (if any).
* @param pElem the fixed value of pattern parameter elem, or null if not bound.
* @return true if the input is a valid (partial) match of the pattern.
*
*/ | Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, under any possible substitution of the unspecified parameters (if any) | hasMatch | {
"repo_name": "ELTE-Soft/xUML-RT-Executor",
"path": "plugins/hu.eltesoft.modelexecution.validation/src-gen/hu/eltesoft/modelexecution/validation/PowertypeExtentMatcher.java",
"license": "epl-1.0",
"size": 10218
} | [
"org.eclipse.uml2.uml.Classifier"
] | import org.eclipse.uml2.uml.Classifier; | import org.eclipse.uml2.uml.*; | [
"org.eclipse.uml2"
] | org.eclipse.uml2; | 910,110 |
public static RemoveFileDialogFragment newInstance(OCFile file) {
RemoveFileDialogFragment frag = new RemoveFileDialogFragment();
Bundle args = new Bundle();
int messageStringId = R.string.confirmation_remove_alert;
int negBtn = -1;
if (file.isFolder()) {
messageStringId = R.string.confirmation_remove_folder_alert;
negBtn = R.string.confirmation_remove_local;
} else if (file.isDown()) {
negBtn = R.string.confirmation_remove_local;
}
args.putInt(ARG_MESSAGE_RESOURCE_ID, messageStringId);
args.putStringArray(ARG_MESSAGE_ARGUMENTS, new String[]{file.getFileName()});
args.putInt(ARG_POSITIVE_BTN_RES, R.string.common_yes);
args.putInt(ARG_NEUTRAL_BTN_RES, R.string.common_no);
args.putInt(ARG_NEGATIVE_BTN_RES, negBtn);
args.putParcelable(ARG_TARGET_FILE, file);
frag.setArguments(args);
return frag;
} | static RemoveFileDialogFragment function(OCFile file) { RemoveFileDialogFragment frag = new RemoveFileDialogFragment(); Bundle args = new Bundle(); int messageStringId = R.string.confirmation_remove_alert; int negBtn = -1; if (file.isFolder()) { messageStringId = R.string.confirmation_remove_folder_alert; negBtn = R.string.confirmation_remove_local; } else if (file.isDown()) { negBtn = R.string.confirmation_remove_local; } args.putInt(ARG_MESSAGE_RESOURCE_ID, messageStringId); args.putStringArray(ARG_MESSAGE_ARGUMENTS, new String[]{file.getFileName()}); args.putInt(ARG_POSITIVE_BTN_RES, R.string.common_yes); args.putInt(ARG_NEUTRAL_BTN_RES, R.string.common_no); args.putInt(ARG_NEGATIVE_BTN_RES, negBtn); args.putParcelable(ARG_TARGET_FILE, file); frag.setArguments(args); return frag; } | /**
* Public factory method to create new RemoveFileDialogFragment instances.
*
* @param file File to remove.
* @return Dialog ready to show.
*/ | Public factory method to create new RemoveFileDialogFragment instances | newInstance | {
"repo_name": "gdieleman/android",
"path": "src/com/owncloud/android/ui/dialog/RemoveFileDialogFragment.java",
"license": "gpl-2.0",
"size": 3837
} | [
"android.os.Bundle",
"com.owncloud.android.datamodel.OCFile"
] | import android.os.Bundle; import com.owncloud.android.datamodel.OCFile; | import android.os.*; import com.owncloud.android.datamodel.*; | [
"android.os",
"com.owncloud.android"
] | android.os; com.owncloud.android; | 1,666,995 |
private Sequence<Map<String, Object>> cursorToSequence(final Cursor cursor, final Set<String> columnsToRead)
{
return Sequences.simple(
() -> new IntermediateRowFromCursorIterator(cursor, columnsToRead)
);
}
/**
* @param sequence A sequence of intermediate rows generated from a sequence of
* cursors in {@link #intermediateRowIterator()} | Sequence<Map<String, Object>> function(final Cursor cursor, final Set<String> columnsToRead) { return Sequences.simple( () -> new IntermediateRowFromCursorIterator(cursor, columnsToRead) ); } /** * @param sequence A sequence of intermediate rows generated from a sequence of * cursors in {@link #intermediateRowIterator()} | /**
* Given a {@link Cursor} create a {@link Sequence} that returns the rows of the cursor as
* Map<String, Object> intermediate rows, selecting the dimensions and metrics of this segment reader.
*
* @param cursor A cursor
*
* @return A sequence of intermediate rows
*/ | Given a <code>Cursor</code> create a <code>Sequence</code> that returns the rows of the cursor as Map intermediate rows, selecting the dimensions and metrics of this segment reader | cursorToSequence | {
"repo_name": "nishantmonu51/druid",
"path": "indexing-service/src/main/java/org/apache/druid/indexing/input/DruidSegmentReader.java",
"license": "apache-2.0",
"size": 10919
} | [
"java.util.Map",
"java.util.Set",
"org.apache.druid.java.util.common.guava.Sequence",
"org.apache.druid.java.util.common.guava.Sequences",
"org.apache.druid.segment.Cursor"
] | import java.util.Map; import java.util.Set; import org.apache.druid.java.util.common.guava.Sequence; import org.apache.druid.java.util.common.guava.Sequences; import org.apache.druid.segment.Cursor; | import java.util.*; import org.apache.druid.java.util.common.guava.*; import org.apache.druid.segment.*; | [
"java.util",
"org.apache.druid"
] | java.util; org.apache.druid; | 312,143 |
void wrongNotePlayed(IHandPositioning playedFingering); | void wrongNotePlayed(IHandPositioning playedFingering); | /**
* Notify the user that the user played the wrong stuff.
*/ | Notify the user that the user played the wrong stuff | wrongNotePlayed | {
"repo_name": "netanelkl/guitar_guy",
"path": "Development/GuitarTeacher/src/com/mad/guitarteacher/activities/IPlayingDisplayer.java",
"license": "gpl-2.0",
"size": 3559
} | [
"com.mad.lib.musicalBase.IHandPositioning"
] | import com.mad.lib.musicalBase.IHandPositioning; | import com.mad.lib.*; | [
"com.mad.lib"
] | com.mad.lib; | 932,207 |
String getMessage(String code, Locale locale, String defaultMessage); | String getMessage(String code, Locale locale, String defaultMessage); | /**
* Gets message by code and locale, if not exists return defaultMessage.
*
* @param code the code of message
* @param locale the locale
* @param defaultMessage the default message
* @return the message
*/ | Gets message by code and locale, if not exists return defaultMessage | getMessage | {
"repo_name": "l10nws/l10n-java",
"path": "l10n-core/src/main/java/ws/l10n/core/MessageBundleContext.java",
"license": "gpl-2.0",
"size": 806
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 470,960 |
public void setOrbit(final Orbit orbit) {
acceleration = Vector3D.ZERO;
this.orbit = orbit;
} | void function(final Orbit orbit) { acceleration = Vector3D.ZERO; this.orbit = orbit; } | /** Set the current orbit.
* @param orbit current orbit
*/ | Set the current orbit | setOrbit | {
"repo_name": "attatrol/Orekit",
"path": "src/main/java/org/orekit/propagation/numerical/Jacobianizer.java",
"license": "apache-2.0",
"size": 16770
} | [
"org.apache.commons.math3.geometry.euclidean.threed.Vector3D",
"org.orekit.orbits.Orbit"
] | import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; import org.orekit.orbits.Orbit; | import org.apache.commons.math3.geometry.euclidean.threed.*; import org.orekit.orbits.*; | [
"org.apache.commons",
"org.orekit.orbits"
] | org.apache.commons; org.orekit.orbits; | 2,861,186 |
public static Thing createThing(ThingType thingType, ThingUID thingUID, Configuration configuration,
ThingUID bridgeUID, ConfigDescriptionRegistry configDescriptionRegistry) {
if (thingType == null) {
throw new IllegalArgumentException("The thingType should not be null.");
}
if (thingUID == null) {
throw new IllegalArgumentException("The thingUID should not be null.");
}
ThingFactoryHelper.applyDefaultConfiguration(configuration, thingType, configDescriptionRegistry);
List<Channel> channels = ThingFactoryHelper.createChannels(thingType, thingUID, configDescriptionRegistry);
return createThingBuilder(thingType, thingUID).withConfiguration(configuration).withChannels(channels)
.withProperties(thingType.getProperties()).withBridge(bridgeUID).build();
} | static Thing function(ThingType thingType, ThingUID thingUID, Configuration configuration, ThingUID bridgeUID, ConfigDescriptionRegistry configDescriptionRegistry) { if (thingType == null) { throw new IllegalArgumentException(STR); } if (thingUID == null) { throw new IllegalArgumentException(STR); } ThingFactoryHelper.applyDefaultConfiguration(configuration, thingType, configDescriptionRegistry); List<Channel> channels = ThingFactoryHelper.createChannels(thingType, thingUID, configDescriptionRegistry); return createThingBuilder(thingType, thingUID).withConfiguration(configuration).withChannels(channels) .withProperties(thingType.getProperties()).withBridge(bridgeUID).build(); } | /**
* Creates a thing based on a given thing type. It also creates the
* default-configuration given in the configDescriptions if the
* configDescriptionRegistry is not null
*
* @param thingType
* (should not be null)
* @param thingUID
* (should not be null)
* @param configuration
* (should not be null)
* @param bridgeUID
* (can be null)
* @param configDescriptionRegistry
* (can be null)
* @return thing
*/ | Creates a thing based on a given thing type. It also creates the default-configuration given in the configDescriptions if the configDescriptionRegistry is not null | createThing | {
"repo_name": "vilchev/eclipse-smarthome",
"path": "bundles/core/org.eclipse.smarthome.core.thing/src/main/java/org/eclipse/smarthome/core/thing/binding/ThingFactory.java",
"license": "epl-1.0",
"size": 6177
} | [
"java.util.List",
"org.eclipse.smarthome.config.core.ConfigDescriptionRegistry",
"org.eclipse.smarthome.config.core.Configuration",
"org.eclipse.smarthome.core.thing.Channel",
"org.eclipse.smarthome.core.thing.Thing",
"org.eclipse.smarthome.core.thing.ThingUID",
"org.eclipse.smarthome.core.thing.interna... | import java.util.List; import org.eclipse.smarthome.config.core.ConfigDescriptionRegistry; import org.eclipse.smarthome.config.core.Configuration; import org.eclipse.smarthome.core.thing.Channel; import org.eclipse.smarthome.core.thing.Thing; import org.eclipse.smarthome.core.thing.ThingUID; import org.eclipse.smarthome.core.thing.internal.ThingFactoryHelper; import org.eclipse.smarthome.core.thing.type.ThingType; | import java.util.*; import org.eclipse.smarthome.config.core.*; import org.eclipse.smarthome.core.thing.*; import org.eclipse.smarthome.core.thing.internal.*; import org.eclipse.smarthome.core.thing.type.*; | [
"java.util",
"org.eclipse.smarthome"
] | java.util; org.eclipse.smarthome; | 220,256 |
public Heaper receiveHeaperFrom(Category cat, SpecialistRcvr rcvr) {
return rcvr.basicReceive((getRecipe(cat)));
} | Heaper function(Category cat, SpecialistRcvr rcvr) { return rcvr.basicReceive((getRecipe(cat))); } | /**
* No special cases. Punt to the rcvr.
*/ | No special cases. Punt to the rcvr | receiveHeaperFrom | {
"repo_name": "jonesd/udanax-gold2java",
"path": "abora-gold/src/generated-sources/translator/info/dgjones/abora/gold/xcvr/TransferGeneralist.java",
"license": "mit",
"size": 2999
} | [
"info.dgjones.abora.gold.xcvr.SpecialistRcvr",
"info.dgjones.abora.gold.xpp.basic.Category",
"info.dgjones.abora.gold.xpp.basic.Heaper"
] | import info.dgjones.abora.gold.xcvr.SpecialistRcvr; import info.dgjones.abora.gold.xpp.basic.Category; import info.dgjones.abora.gold.xpp.basic.Heaper; | import info.dgjones.abora.gold.xcvr.*; import info.dgjones.abora.gold.xpp.basic.*; | [
"info.dgjones.abora"
] | info.dgjones.abora; | 2,318,027 |
public Date getMarketTime(){
return marketTime;
} | Date function(){ return marketTime; } | /**
* REQUIRED
* The market start time
*/ | REQUIRED The market start time | getMarketTime | {
"repo_name": "paulo-santos/Betfair-APING-DTO-codeGen",
"path": "src/main/java/com/betfair/aping/betting/entities/MarketDescription.java",
"license": "mit",
"size": 6767
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 1,891,799 |
public void stopProcessing() {
if (!this.isAlive()) {
return;
}
resumeDispatching();
if (logger.isDebugEnabled()) {
logger.debug("{}: Notifying the dispatcher to terminate", this);
}
// If this is the primary, stay alive for a predefined time
// OR until the queue becomes empty
if (this.sender.isPrimary()) {
if (AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME == -1) {
try {
while (!(this.queue.size() == 0)) {
Thread.sleep(5000);
if (logger.isDebugEnabled()) {
logger.debug("{}: Waiting for the queue to get empty.", this);
}
}
} catch (InterruptedException e) {
// interrupted
} catch (CancelException e) {
// cancelled
}
} else {
try {
Thread.sleep(AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME * 1000);
} catch (InterruptedException e) {
// interrupted
}
}
} else {
this.sender.getSenderAdvisor().notifyPrimaryLock();
}
setIsStopped(true);
dispatcher.stop();
if (this.isAlive()) {
if (logger.isDebugEnabled()) {
logger.debug("{}: Joining with the dispatcher thread upto limit of 5 seconds", this);
}
try {
this.join(5000); // wait for our thread to stop
if (this.isAlive()) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.GatewayImpl_0_DISPATCHER_STILL_ALIVE_EVEN_AFTER_JOIN_OF_5_SECONDS,
this));
// if the server machine crashed or there was a nic failure, we need
// to terminate the socket connection now to avoid a hang when closing
// the connections later
// try to stop it again
dispatcher.stop();
this.batchIdToEventsMap.clear();
}
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
logger.warn(LocalizedMessage.create(
LocalizedStrings.GatewayImpl_0_INTERRUPTEDEXCEPTION_IN_JOINING_WITH_DISPATCHER_THREAD,
this));
}
}
closeProcessor();
if (logger.isDebugEnabled()) {
logger.debug("Stopped dispatching: {}", this);
}
} | void function() { if (!this.isAlive()) { return; } resumeDispatching(); if (logger.isDebugEnabled()) { logger.debug(STR, this); } if (this.sender.isPrimary()) { if (AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME == -1) { try { while (!(this.queue.size() == 0)) { Thread.sleep(5000); if (logger.isDebugEnabled()) { logger.debug(STR, this); } } } catch (InterruptedException e) { } catch (CancelException e) { } } else { try { Thread.sleep(AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME * 1000); } catch (InterruptedException e) { } } } else { this.sender.getSenderAdvisor().notifyPrimaryLock(); } setIsStopped(true); dispatcher.stop(); if (this.isAlive()) { if (logger.isDebugEnabled()) { logger.debug(STR, this); } try { this.join(5000); if (this.isAlive()) { logger.warn(LocalizedMessage.create( LocalizedStrings.GatewayImpl_0_DISPATCHER_STILL_ALIVE_EVEN_AFTER_JOIN_OF_5_SECONDS, this)); dispatcher.stop(); this.batchIdToEventsMap.clear(); } } catch (InterruptedException ex) { Thread.currentThread().interrupt(); logger.warn(LocalizedMessage.create( LocalizedStrings.GatewayImpl_0_INTERRUPTEDEXCEPTION_IN_JOINING_WITH_DISPATCHER_THREAD, this)); } } closeProcessor(); if (logger.isDebugEnabled()) { logger.debug(STR, this); } } | /**
* Stops the dispatcher from dispatching events . The dispatcher will stay alive for a predefined
* time OR until its queue is empty.
*
* @see AbstractGatewaySender#MAXIMUM_SHUTDOWN_WAIT_TIME
*/ | Stops the dispatcher from dispatching events . The dispatcher will stay alive for a predefined time OR until its queue is empty | stopProcessing | {
"repo_name": "shankarh/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/wan/AbstractGatewaySenderEventProcessor.java",
"license": "apache-2.0",
"size": 50696
} | [
"org.apache.geode.CancelException",
"org.apache.geode.internal.i18n.LocalizedStrings",
"org.apache.geode.internal.logging.log4j.LocalizedMessage"
] | import org.apache.geode.CancelException; import org.apache.geode.internal.i18n.LocalizedStrings; import org.apache.geode.internal.logging.log4j.LocalizedMessage; | import org.apache.geode.*; import org.apache.geode.internal.i18n.*; import org.apache.geode.internal.logging.log4j.*; | [
"org.apache.geode"
] | org.apache.geode; | 745,108 |
protected void dfsSee(V source, Set<V> set, boolean forward) {
Deque<V> current = new LinkedList<V>();
current.add(source);
while (!current.isEmpty()) {
V v = current.removeLast();
set.add(v);
for (E e : getDirectedEdges(v, forward)) {
V w = getNodeOfDirectedEdge(e, forward);
if (set.contains(w)) {
continue;
}
current.add(w);
}
}
set.remove(source);
} | void function(V source, Set<V> set, boolean forward) { Deque<V> current = new LinkedList<V>(); current.add(source); while (!current.isEmpty()) { V v = current.removeLast(); set.add(v); for (E e : getDirectedEdges(v, forward)) { V w = getNodeOfDirectedEdge(e, forward); if (set.contains(w)) { continue; } current.add(w); } } set.remove(source); } | /**
* A dfs algorithm to traverse the graph from the given node, and collect
* the reachable nodes in the set.
*
* @param source
* The source node
* @param set
* The reachable nodes will be collected in this set
*/ | A dfs algorithm to traverse the graph from the given node, and collect the reachable nodes in the set | dfsSee | {
"repo_name": "alovassy/titan.EclipsePlug-ins",
"path": "org.eclipse.titanium/src/org/eclipse/titanium/graph/gui/layouts/algorithms/DAGLayoutAlgorithm.java",
"license": "epl-1.0",
"size": 11548
} | [
"java.util.Deque",
"java.util.LinkedList",
"java.util.Set"
] | import java.util.Deque; import java.util.LinkedList; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,756,798 |
EReference getViewpoint_InteractionFlowModelElements(); | EReference getViewpoint_InteractionFlowModelElements(); | /**
* Returns the meta object for the reference list '{@link IFML.Core.Viewpoint#getInteractionFlowModelElements <em>Interaction Flow Model Elements</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference list '<em>Interaction Flow Model Elements</em>'.
* @see IFML.Core.Viewpoint#getInteractionFlowModelElements()
* @see #getViewpoint()
* @generated
*/ | Returns the meta object for the reference list '<code>IFML.Core.Viewpoint#getInteractionFlowModelElements Interaction Flow Model Elements</code>'. | getViewpoint_InteractionFlowModelElements | {
"repo_name": "ifml/ifml-editor",
"path": "plugins/IFMLEditor/src/IFML/Core/CorePackage.java",
"license": "mit",
"size": 245317
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,546,699 |
public void mousePressed(java.awt.event.MouseEvent e)
{
if (e.isPopupTrigger())
{
showPopupMenu(e.getX(), e.getY());
}
}
public void mouseClicked(MouseEvent e) {} | void function(java.awt.event.MouseEvent e) { if (e.isPopupTrigger()) { showPopupMenu(e.getX(), e.getY()); } } public void mouseClicked(MouseEvent e) {} | /**
* Pop-up menu dispatch.
*/ | Pop-up menu dispatch | mousePressed | {
"repo_name": "jonabbey/Ganymede",
"path": "src/ganymede/arlut/csd/ganymede/client/vectorPanel.java",
"license": "gpl-2.0",
"size": 41517
} | [
"java.awt.event.MouseEvent"
] | import java.awt.event.MouseEvent; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 2,650,325 |
void loadPublicKey(String pathToDERFile) throws IOException;
| void loadPublicKey(String pathToDERFile) throws IOException; | /**
* Loads your public Key
* @param pathToDERFile
* @throws IOException
*/ | Loads your public Key | loadPublicKey | {
"repo_name": "iiPing/java-utils",
"path": "component/crypto/AssymX509Test/src/ph/gabijan/iiping/java/utils/crypto/ICryptoUtilAssymRSA.java",
"license": "bsd-2-clause",
"size": 4986
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,028,274 |
@Test
public void testCheckXPathExpression01() throws XPathExpressionException {
assertEquals(xpath.compile(EXPRESSION_NAME_A).
evaluate(document, STRING), "6");
} | void function() throws XPathExpressionException { assertEquals(xpath.compile(EXPRESSION_NAME_A). evaluate(document, STRING), "6"); } | /**
* Test for evaluate(java.lang.Object item,QName returnType)throws
* XPathExpressionException.
*
* @throws XPathExpressionException If the expression cannot be evaluated.
*/ | Test for evaluate(java.lang.Object item,QName returnType)throws XPathExpressionException | testCheckXPathExpression01 | {
"repo_name": "lostdj/Jaklin-OpenJDK-JAXP",
"path": "test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java",
"license": "gpl-2.0",
"size": 17755
} | [
"javax.xml.xpath.XPathExpressionException",
"org.testng.Assert"
] | import javax.xml.xpath.XPathExpressionException; import org.testng.Assert; | import javax.xml.xpath.*; import org.testng.*; | [
"javax.xml",
"org.testng"
] | javax.xml; org.testng; | 1,272,812 |
public final void dispatchAddStarting(ViewHolder item) {
onAddStarting(item);
} | final void function(ViewHolder item) { onAddStarting(item); } | /**
* Method to be called by subclasses when an add animation is being started.
*
* @param item The item being added
*/ | Method to be called by subclasses when an add animation is being started | dispatchAddStarting | {
"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,547 |
ImmutableList<SchemaOrgType> getParticipantList(); | ImmutableList<SchemaOrgType> getParticipantList(); | /**
* Returns the value list of property participant. Empty list is returned if the property not set
* in current object.
*/ | Returns the value list of property participant. Empty list is returned if the property not set in current object | getParticipantList | {
"repo_name": "google/schemaorg-java",
"path": "src/main/java/com/google/schemaorg/core/Action.java",
"license": "apache-2.0",
"size": 10417
} | [
"com.google.common.collect.ImmutableList",
"com.google.schemaorg.SchemaOrgType"
] | import com.google.common.collect.ImmutableList; import com.google.schemaorg.SchemaOrgType; | import com.google.common.collect.*; import com.google.schemaorg.*; | [
"com.google.common",
"com.google.schemaorg"
] | com.google.common; com.google.schemaorg; | 843,917 |
public static IPv6Address fromBigInteger(final BigInteger bigInteger)
{
if (bigInteger == null)
throw new IllegalArgumentException("can not construct from [null]");
if (bigInteger.compareTo(BigInteger.ZERO) < 0)
throw new IllegalArgumentException("can not construct from negative value");
if (bigInteger.compareTo(MAX.toBigInteger()) > 0)
throw new IllegalArgumentException("bigInteger represents a value bigger than 2^128 - 1");
byte[] bytes = bigInteger.toByteArray();
if (bytes[0] == 0)
{
// a zero byte was added to represent the (always positive, hence zero) sign bit
return fromByteArray(prefixWithZeroBytes(Arrays.copyOfRange(bytes, 1, bytes.length), N_BYTES));
}
else
{
return fromByteArray(prefixWithZeroBytes(bytes, N_BYTES));
}
} | static IPv6Address function(final BigInteger bigInteger) { if (bigInteger == null) throw new IllegalArgumentException(STR); if (bigInteger.compareTo(BigInteger.ZERO) < 0) throw new IllegalArgumentException(STR); if (bigInteger.compareTo(MAX.toBigInteger()) > 0) throw new IllegalArgumentException(STR); byte[] bytes = bigInteger.toByteArray(); if (bytes[0] == 0) { return fromByteArray(prefixWithZeroBytes(Arrays.copyOfRange(bytes, 1, bytes.length), N_BYTES)); } else { return fromByteArray(prefixWithZeroBytes(bytes, N_BYTES)); } } | /**
* Create an IPv6 address from a (positive) {@link java.math.BigInteger}. The magnitude of the {@link java.math.BigInteger} represents
* the IPv6 address value. Or in other words, the {@link java.math.BigInteger} with value N defines the Nth possible IPv6 address.
*
* @param bigInteger {@link java.math.BigInteger} value
* @return IPv6 address
*/ | Create an IPv6 address from a (positive) <code>java.math.BigInteger</code>. The magnitude of the <code>java.math.BigInteger</code> represents the IPv6 address value. Or in other words, the <code>java.math.BigInteger</code> with value N defines the Nth possible IPv6 address | fromBigInteger | {
"repo_name": "mapiman/java-ipv6",
"path": "src/main/java/com/googlecode/ipv6/IPv6Address.java",
"license": "apache-2.0",
"size": 20080
} | [
"java.math.BigInteger",
"java.util.Arrays"
] | import java.math.BigInteger; import java.util.Arrays; | import java.math.*; import java.util.*; | [
"java.math",
"java.util"
] | java.math; java.util; | 1,543,130 |
public void clearSnapshot(String tag, String... keyspaces) throws IOException
{
ssProxy.clearSnapshot(tag, keyspaces);
} | void function(String tag, String... keyspaces) throws IOException { ssProxy.clearSnapshot(tag, keyspaces); } | /**
* Remove all the existing snapshots.
*/ | Remove all the existing snapshots | clearSnapshot | {
"repo_name": "blerer/cassandra",
"path": "src/java/org/apache/cassandra/tools/NodeProbe.java",
"license": "apache-2.0",
"size": 66036
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,845,698 |
protected Long getClusterId(String clusterName) throws AmbariException {
Cluster cluster = (clusterName == null) ? null : managementController.getClusters().getCluster(clusterName);
return (cluster == null) ? null : cluster.getClusterId();
} | Long function(String clusterName) throws AmbariException { Cluster cluster = (clusterName == null) ? null : managementController.getClusters().getCluster(clusterName); return (cluster == null) ? null : cluster.getClusterId(); } | /**
* Gets the resource id for the named cluster
*
* @param clusterName the name of the relevant cluster
* @return the resource id or null if not found
* @throws AmbariException if the named cluster does not exist
*/ | Gets the resource id for the named cluster | getClusterId | {
"repo_name": "sekikn/ambari",
"path": "ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java",
"license": "apache-2.0",
"size": 11548
} | [
"org.apache.ambari.server.AmbariException",
"org.apache.ambari.server.state.Cluster"
] | import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.state.Cluster; | import org.apache.ambari.server.*; import org.apache.ambari.server.state.*; | [
"org.apache.ambari"
] | org.apache.ambari; | 1,028,677 |
@NonNull
public GitURIRequirementsBuilder withHostname(@CheckForNull String hostname) {
return withHostnamePort(hostname, -1);
} | GitURIRequirementsBuilder function(@CheckForNull String hostname) { return withHostnamePort(hostname, -1); } | /**
* Replace any hostname requirements with the supplied hostname.
*
* @param hostname the hostname to use as a requirement
* @return {@code this}.
*/ | Replace any hostname requirements with the supplied hostname | withHostname | {
"repo_name": "MarkEWaite/git-client-plugin",
"path": "src/main/java/org/jenkinsci/plugins/gitclient/GitURIRequirementsBuilder.java",
"license": "mit",
"size": 11823
} | [
"edu.umd.cs.findbugs.annotations.CheckForNull"
] | import edu.umd.cs.findbugs.annotations.CheckForNull; | import edu.umd.cs.findbugs.annotations.*; | [
"edu.umd.cs"
] | edu.umd.cs; | 1,259,289 |
public List<CmsCategory> localizeCategories(CmsObject cms, List<CmsCategory> categories, Locale locale) {
List<CmsCategory> result = Lists.newArrayList();
for (CmsCategory category : categories) {
result.add(localizeCategory(cms, category, locale));
}
return result;
} | List<CmsCategory> function(CmsObject cms, List<CmsCategory> categories, Locale locale) { List<CmsCategory> result = Lists.newArrayList(); for (CmsCategory category : categories) { result.add(localizeCategory(cms, category, locale)); } return result; } | /**
* Localizes a list of categories by reading locale-specific properties for their title and description, if possible.<p>
*
* This method does not modify its input list of categories, or the categories in it.
*
* @param cms the CMS context to use for reading resources
* @param categories the list of categories
* @param locale the locale to use
*
* @return the list of localized categories
*/ | Localizes a list of categories by reading locale-specific properties for their title and description, if possible. This method does not modify its input list of categories, or the categories in it | localizeCategories | {
"repo_name": "alkacon/opencms-core",
"path": "src/org/opencms/relations/CmsCategoryService.java",
"license": "lgpl-2.1",
"size": 36300
} | [
"com.google.common.collect.Lists",
"java.util.List",
"java.util.Locale",
"org.opencms.file.CmsObject"
] | import com.google.common.collect.Lists; import java.util.List; import java.util.Locale; import org.opencms.file.CmsObject; | import com.google.common.collect.*; import java.util.*; import org.opencms.file.*; | [
"com.google.common",
"java.util",
"org.opencms.file"
] | com.google.common; java.util; org.opencms.file; | 379,770 |
public void editUserStore(UserStoreDTO userStoreDTO) throws IdentityUserStoreMgtException {
String domainName = userStoreDTO.getDomainId();
boolean isValidDomain = false;
try {
isValidDomain = xmlProcessorUtils.isValidDomain(domainName, false);
} catch (UserStoreException e) {
String errorMessage = e.getMessage();
log.error(errorMessage, e);
throw new IdentityUserStoreMgtException(errorMessage);
}
if (isValidDomain) {
File userStoreConfigFile = createConfigurationFile(domainName);
if (!userStoreConfigFile.exists()) {
String msg = "Cannot edit user store " + domainName + ". User store cannot be edited.";
log.error(msg);
throw new IdentityUserStoreMgtException(msg);
}
try {
writeUserMgtXMLFile(userStoreConfigFile, userStoreDTO, true);
if (log.isDebugEnabled()) {
log.debug("Edited user store successfully written to the file" + userStoreConfigFile.getAbsolutePath());
}
} catch (IdentityUserStoreMgtException e) {
String errorMessage = e.getMessage();
log.error(errorMessage, e);
throw new IdentityUserStoreMgtException(errorMessage);
}
} else {
String errorMessage = "Trying to edit an invalid domain : " + domainName;
throw new IdentityUserStoreMgtException(errorMessage);
}
} | void function(UserStoreDTO userStoreDTO) throws IdentityUserStoreMgtException { String domainName = userStoreDTO.getDomainId(); boolean isValidDomain = false; try { isValidDomain = xmlProcessorUtils.isValidDomain(domainName, false); } catch (UserStoreException e) { String errorMessage = e.getMessage(); log.error(errorMessage, e); throw new IdentityUserStoreMgtException(errorMessage); } if (isValidDomain) { File userStoreConfigFile = createConfigurationFile(domainName); if (!userStoreConfigFile.exists()) { String msg = STR + domainName + STR; log.error(msg); throw new IdentityUserStoreMgtException(msg); } try { writeUserMgtXMLFile(userStoreConfigFile, userStoreDTO, true); if (log.isDebugEnabled()) { log.debug(STR + userStoreConfigFile.getAbsolutePath()); } } catch (IdentityUserStoreMgtException e) { String errorMessage = e.getMessage(); log.error(errorMessage, e); throw new IdentityUserStoreMgtException(errorMessage); } } else { String errorMessage = STR + domainName; throw new IdentityUserStoreMgtException(errorMessage); } } | /**
* Edit currently existing user store
*
* @param userStoreDTO: Represent the configuration of user store
* @throws DataSourceException
* @throws TransformerException
* @throws ParserConfigurationException
*/ | Edit currently existing user store | editUserStore | {
"repo_name": "liurl3/carbon-identity",
"path": "components/user-store/org.wso2.carbon.identity.user.store.configuration/src/main/java/org/wso2/carbon/identity/user/store/configuration/UserStoreConfigAdminService.java",
"license": "apache-2.0",
"size": 43200
} | [
"java.io.File",
"org.wso2.carbon.identity.user.store.configuration.dto.UserStoreDTO",
"org.wso2.carbon.identity.user.store.configuration.utils.IdentityUserStoreMgtException",
"org.wso2.carbon.user.api.UserStoreException"
] | import java.io.File; import org.wso2.carbon.identity.user.store.configuration.dto.UserStoreDTO; import org.wso2.carbon.identity.user.store.configuration.utils.IdentityUserStoreMgtException; import org.wso2.carbon.user.api.UserStoreException; | import java.io.*; import org.wso2.carbon.identity.user.store.configuration.dto.*; import org.wso2.carbon.identity.user.store.configuration.utils.*; import org.wso2.carbon.user.api.*; | [
"java.io",
"org.wso2.carbon"
] | java.io; org.wso2.carbon; | 1,761,515 |
private void checkMemory() throws IOException {
while (memoryFull()) {
flushOnePartition();
}
} | void function() throws IOException { while (memoryFull()) { flushOnePartition(); } } | /**
* Checks the memory status, flushes if necessary
*
* @throws IOException
*/ | Checks the memory status, flushes if necessary | checkMemory | {
"repo_name": "zfighter/giraph-research",
"path": "giraph-core/target/munged/munged/main/org/apache/giraph/comm/messages/DiskBackedMessageStoreByPartition.java",
"license": "apache-2.0",
"size": 13030
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 468,327 |
public void setSecondaryMenu(View v) {
mViewBehind.setSecondaryContent(v);
// mViewBehind.invalidate();
} | void function(View v) { mViewBehind.setSecondaryContent(v); } | /**
* Set the secondary behind view (right menu) content to the given View.
*
* @param view The desired content to display.
*/ | Set the secondary behind view (right menu) content to the given View | setSecondaryMenu | {
"repo_name": "Douvi/FragmentTransactionManager",
"path": "SlidingMenu/src/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu.java",
"license": "apache-2.0",
"size": 28865
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 2,478,440 |
public final int runAndMaybeStats(boolean reportStats) throws Exception {
if (!reportStats || shouldNotRecordStats()) {
setup();
int count = doLogic();
count = disableCounting ? 0 : count;
tearDown();
return count;
}
if (reportStats && depth <= maxDepthLogStart && !shouldNeverLogAtStart()) {
System.out.println("------------> starting task: " + getName());
}
setup();
Points pnts = runData.getPoints();
TaskStats ts = pnts.markTaskStart(this, runData.getConfig().getRoundNumber());
int count = doLogic();
count = disableCounting ? 0 : count;
pnts.markTaskEnd(ts, count);
tearDown();
return count;
} | final int function(boolean reportStats) throws Exception { if (!reportStats shouldNotRecordStats()) { setup(); int count = doLogic(); count = disableCounting ? 0 : count; tearDown(); return count; } if (reportStats && depth <= maxDepthLogStart && !shouldNeverLogAtStart()) { System.out.println(STR + getName()); } setup(); Points pnts = runData.getPoints(); TaskStats ts = pnts.markTaskStart(this, runData.getConfig().getRoundNumber()); int count = doLogic(); count = disableCounting ? 0 : count; pnts.markTaskEnd(ts, count); tearDown(); return count; } | /**
* Run the task, record statistics.
* @return number of work items done by this task.
*/ | Run the task, record statistics | runAndMaybeStats | {
"repo_name": "tokee/lucene",
"path": "contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/PerfTask.java",
"license": "apache-2.0",
"size": 10063
} | [
"org.apache.lucene.benchmark.byTask.stats.Points",
"org.apache.lucene.benchmark.byTask.stats.TaskStats"
] | import org.apache.lucene.benchmark.byTask.stats.Points; import org.apache.lucene.benchmark.byTask.stats.TaskStats; | import org.apache.lucene.benchmark.*; | [
"org.apache.lucene"
] | org.apache.lucene; | 947,119 |
public void testChromosome() throws Exception {
BufferedReader srcReader = new BufferedReader(new
InputStreamReader(getClass().getClassLoader().getResourceAsStream("test_worm_chr.gff")));
converter.parse(srcReader);
converter.storeAll();
// uncomment to write out a new target items file
// writeItemsFile(writer.getItems(), "gff_worm_chromosome_item_test.xml");
assertEquals(readItemSet("GFF3ConverterTestChromosome.xml"), writer.getItems());
} | void function() throws Exception { BufferedReader srcReader = new BufferedReader(new InputStreamReader(getClass().getClassLoader().getResourceAsStream(STR))); converter.parse(srcReader); converter.storeAll(); assertEquals(readItemSet(STR), writer.getItems()); } | /**
* Test chromosome is not created twice.
*/ | Test chromosome is not created twice | testChromosome | {
"repo_name": "tomck/intermine",
"path": "bio/core/test/src/org/intermine/bio/dataconversion/GFF3ConverterTest.java",
"license": "lgpl-2.1",
"size": 6874
} | [
"java.io.BufferedReader",
"java.io.InputStreamReader"
] | import java.io.BufferedReader; import java.io.InputStreamReader; | import java.io.*; | [
"java.io"
] | java.io; | 1,171,485 |
default CompletableFuture<Optional<R>> matchAsync(Executor executor, T value){
return CompletableFuture.supplyAsync(()->match(value),executor);
} | default CompletableFuture<Optional<R>> matchAsync(Executor executor, T value){ return CompletableFuture.supplyAsync(()->match(value),executor); } | /**
* Similar to Match, but executed asynchonously on supplied Executor.
*
* @see #match
*
* Match against the supplied value.
* Value will be passed into the current predicate
* If it passes / holds, value will be passed to the current function.
* The result of function application will be returned wrapped in an Optional.
* If the predicate does not hold, Optional.empty() is returned.
*
* @param executor Executor to execute matching on
* @param value Value to match against
* @return A CompletableFuture that will eventual contain an Optional.empty if doesn't match, result of the application of current function if it does
*/ | Similar to Match, but executed asynchonously on supplied Executor | matchAsync | {
"repo_name": "sjfloat/cyclops",
"path": "cyclops-pattern-matching/src/main/java/com/aol/cyclops/matcher/Case.java",
"license": "mit",
"size": 17901
} | [
"java.util.Optional",
"java.util.concurrent.CompletableFuture",
"java.util.concurrent.Executor"
] | import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; | import java.util.*; import java.util.concurrent.*; | [
"java.util"
] | java.util; | 1,367,333 |
@Nonnull
public java.util.concurrent.CompletableFuture<UserConsentRequest> putAsync(@Nonnull final UserConsentRequest newUserConsentRequest) {
return sendAsync(HttpMethod.PUT, newUserConsentRequest);
} | java.util.concurrent.CompletableFuture<UserConsentRequest> function(@Nonnull final UserConsentRequest newUserConsentRequest) { return sendAsync(HttpMethod.PUT, newUserConsentRequest); } | /**
* Creates a UserConsentRequest with a new object
*
* @param newUserConsentRequest the object to create/update
* @return a future with the result
*/ | Creates a UserConsentRequest with a new object | putAsync | {
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/UserConsentRequestRequest.java",
"license": "mit",
"size": 6239
} | [
"com.microsoft.graph.http.HttpMethod",
"com.microsoft.graph.models.UserConsentRequest",
"javax.annotation.Nonnull"
] | import com.microsoft.graph.http.HttpMethod; import com.microsoft.graph.models.UserConsentRequest; import javax.annotation.Nonnull; | import com.microsoft.graph.http.*; import com.microsoft.graph.models.*; import javax.annotation.*; | [
"com.microsoft.graph",
"javax.annotation"
] | com.microsoft.graph; javax.annotation; | 89,325 |
public SAXParser newSAXParser()
{
return new LooseXmlSAXParser();
} | SAXParser function() { return new LooseXmlSAXParser(); } | /**
* Creates a new SAX Parser
*/ | Creates a new SAX Parser | newSAXParser | {
"repo_name": "WelcomeHUME/svn-caucho-com-resin",
"path": "modules/resin/src/com/caucho/xml2/parsers/LooseXmlSAXParserFactory.java",
"license": "gpl-2.0",
"size": 2339
} | [
"javax.xml.parsers.SAXParser"
] | import javax.xml.parsers.SAXParser; | import javax.xml.parsers.*; | [
"javax.xml"
] | javax.xml; | 106,566 |
public static int searchClosestKeyRangeWithUpperHigherThanPtr(List<KeyRange> slots, ImmutableBytesWritable ptr, int lower) {
int upper = slots.size() - 1;
int mid;
while (lower <= upper) {
mid = (lower + upper) / 2;
int cmp = slots.get(mid).compareUpperToLowerBound(ptr, true);
if (cmp < 0) {
lower = mid + 1;
} else if (cmp > 0) {
upper = mid - 1;
} else {
return mid;
}
}
mid = (lower + upper) / 2;
if (mid == 0 && slots.get(mid).compareUpperToLowerBound(ptr, true) > 0) {
return mid;
} else {
return ++mid;
}
} | static int function(List<KeyRange> slots, ImmutableBytesWritable ptr, int lower) { int upper = slots.size() - 1; int mid; while (lower <= upper) { mid = (lower + upper) / 2; int cmp = slots.get(mid).compareUpperToLowerBound(ptr, true); if (cmp < 0) { lower = mid + 1; } else if (cmp > 0) { upper = mid - 1; } else { return mid; } } mid = (lower + upper) / 2; if (mid == 0 && slots.get(mid).compareUpperToLowerBound(ptr, true) > 0) { return mid; } else { return ++mid; } } | /**
* Perform a binary lookup on the list of KeyRange for the tightest slot such that the slotBound
* of the current slot is higher or equal than the slotBound of our range.
* @return the index of the slot whose slot bound equals or are the tightest one that is
* smaller than rangeBound of range, or slots.length if no bound can be found.
*/ | Perform a binary lookup on the list of KeyRange for the tightest slot such that the slotBound of the current slot is higher or equal than the slotBound of our range | searchClosestKeyRangeWithUpperHigherThanPtr | {
"repo_name": "forcedotcom/phoenix",
"path": "phoenix-core/src/main/java/com/salesforce/phoenix/util/ScanUtil.java",
"license": "bsd-3-clause",
"size": 21013
} | [
"com.salesforce.phoenix.query.KeyRange",
"java.util.List",
"org.apache.hadoop.hbase.io.ImmutableBytesWritable"
] | import com.salesforce.phoenix.query.KeyRange; import java.util.List; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; | import com.salesforce.phoenix.query.*; import java.util.*; import org.apache.hadoop.hbase.io.*; | [
"com.salesforce.phoenix",
"java.util",
"org.apache.hadoop"
] | com.salesforce.phoenix; java.util; org.apache.hadoop; | 2,152,610 |
public void save() {
try {
FileOutputStream out = new FileOutputStream(getFile());
props.store(out, "--- Application configuration ---");
out.close();
} catch (IOException e) {
throw new ApplicationException("Problema ao guardar configurações", e);
}
} | void function() { try { FileOutputStream out = new FileOutputStream(getFile()); props.store(out, STR); out.close(); } catch (IOException e) { throw new ApplicationException(STR, e); } } | /**
* Save modifications to file.
*
* @throws ApplicationException if unable to save to file.
*/ | Save modifications to file | save | {
"repo_name": "helderco/univ-cafeteria",
"path": "src/pt/uac/cafeteria/model/persistence/abstracts/AbstractProperties.java",
"license": "gpl-3.0",
"size": 8238
} | [
"java.io.FileOutputStream",
"java.io.IOException",
"pt.uac.cafeteria.model.ApplicationException"
] | import java.io.FileOutputStream; import java.io.IOException; import pt.uac.cafeteria.model.ApplicationException; | import java.io.*; import pt.uac.cafeteria.model.*; | [
"java.io",
"pt.uac.cafeteria"
] | java.io; pt.uac.cafeteria; | 248,926 |
public List<BluetoothDevice> getAvailableDevices(){
return availableDevices;
} | List<BluetoothDevice> function(){ return availableDevices; } | /**
* This method returns a list of bluetooth devices found so far in the current/last scan.
* Note that this list is set to 0 whenever the scan is restarted and not when the current scan is complete
*
* @return The list of discoverable bluetooth devices found in the current/last scan
*/ | This method returns a list of bluetooth devices found so far in the current/last scan. Note that this list is set to 0 whenever the scan is restarted and not when the current scan is complete | getAvailableDevices | {
"repo_name": "ilri/azizi-odk-sensors",
"path": "app/src/main/java/org/cgiar/ilri/odk/sensors/handlers/BluetoothHandler.java",
"license": "gpl-3.0",
"size": 21493
} | [
"android.bluetooth.BluetoothDevice",
"java.util.List"
] | import android.bluetooth.BluetoothDevice; import java.util.List; | import android.bluetooth.*; import java.util.*; | [
"android.bluetooth",
"java.util"
] | android.bluetooth; java.util; | 1,931,180 |
@ApiModelProperty(example = "123123123", value = "The tax file number e.g 123123123.")
public String getTaxFileNumber() {
return taxFileNumber;
} | @ApiModelProperty(example = STR, value = STR) String function() { return taxFileNumber; } | /**
* The tax file number e.g 123123123.
*
* @return taxFileNumber
*/ | The tax file number e.g 123123123 | getTaxFileNumber | {
"repo_name": "SidneyAllen/Xero-Java",
"path": "src/main/java/com/xero/models/payrollau/TaxDeclaration.java",
"license": "mit",
"size": 16351
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 1,378,816 |
public static Context fromUserPass(Subject s,
final String user, final char[] pass,
boolean storeKey) throws Exception {
Context out = new Context();
out.name = user;
out.s = s == null ? new Subject() : s;
Krb5LoginModule krb5 = new Krb5LoginModule();
Map<String, String> map = new HashMap<>();
Map<String, Object> shared = new HashMap<>();
if (storeKey) {
map.put("storeKey", "true");
} | static Context function(Subject s, final String user, final char[] pass, boolean storeKey) throws Exception { Context out = new Context(); out.name = user; out.s = s == null ? new Subject() : s; Krb5LoginModule krb5 = new Krb5LoginModule(); Map<String, String> map = new HashMap<>(); Map<String, Object> shared = new HashMap<>(); if (storeKey) { map.put(STR, "true"); } | /**
* Logins with a username and a password, using Krb5LoginModule directly
* @param s existing subject, test multiple princ & creds for single subj
* @param storeKey true if key should be saved, used on acceptor side
*/ | Logins with a username and a password, using Krb5LoginModule directly | fromUserPass | {
"repo_name": "openjdk/jdk7u",
"path": "jdk/test/sun/security/krb5/auto/Context.java",
"license": "gpl-2.0",
"size": 23244
} | [
"com.sun.security.auth.module.Krb5LoginModule",
"java.util.HashMap",
"java.util.Map",
"javax.security.auth.Subject"
] | import com.sun.security.auth.module.Krb5LoginModule; import java.util.HashMap; import java.util.Map; import javax.security.auth.Subject; | import com.sun.security.auth.module.*; import java.util.*; import javax.security.auth.*; | [
"com.sun.security",
"java.util",
"javax.security"
] | com.sun.security; java.util; javax.security; | 317,139 |
protected void switchToIframe(WebElement elem) {
webDriver.switchTo().frame(elem);
} | void function(WebElement elem) { webDriver.switchTo().frame(elem); } | /**
* switch the WebDriver to the given iFrame.
*
* @param elem
* WebElement (iFrame).
*/ | switch the WebDriver to the given iFrame | switchToIframe | {
"repo_name": "franzbecker/test-editor",
"path": "uiscanner/org.testeditor.ui.uiscanner/src/org/testeditor/ui/uiscanner/webscanner/Scanner.java",
"license": "epl-1.0",
"size": 13204
} | [
"org.openqa.selenium.WebElement"
] | import org.openqa.selenium.WebElement; | import org.openqa.selenium.*; | [
"org.openqa.selenium"
] | org.openqa.selenium; | 2,793,906 |
public void put(final Object key, final Object value) throws CacheException {
delegate.put((Serializable) key, (Serializable) value);
} | void function(final Object key, final Object value) throws CacheException { delegate.put((Serializable) key, (Serializable) value); } | /**
* Add an item to the cache, in a non-transactional fashion, with fail-fast semantics
*
* @param key key to put.
* @param value key value to put.
* @throws CacheException
*/ | Add an item to the cache, in a non-transactional fashion, with fail-fast semantics | put | {
"repo_name": "cacheonix/cacheonix-core",
"path": "src/org/cacheonix/plugin/hibernate/v32/HibernateCacheonixCache.java",
"license": "lgpl-2.1",
"size": 5903
} | [
"java.io.Serializable",
"org.hibernate.cache.CacheException"
] | import java.io.Serializable; import org.hibernate.cache.CacheException; | import java.io.*; import org.hibernate.cache.*; | [
"java.io",
"org.hibernate.cache"
] | java.io; org.hibernate.cache; | 1,767,294 |
@Test
public void testConstraintSet() throws IOException {
assertEqual(createFile("constraintSet"), null, null);
} | void function() throws IOException { assertEqual(createFile(STR), null, null); } | /**
* Constraint set test case. Simplified version contributed by QualiMaster.
*
* @throws IOException should not occur
*/ | Constraint set test case. Simplified version contributed by QualiMaster | testConstraintSet | {
"repo_name": "SSEHUB/EASyProducer",
"path": "Plugins/IVML/de.uni_hildesheim.sse.ivml.tests/src/test/de/uni_hildesheim/sse/ExternalTests.java",
"license": "apache-2.0",
"size": 8657
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,458,608 |
Element getControlObject() {
Element elt = new Element();
elt.key = 0;
TreeMap<Integer, String> tMap = new TreeMap<Integer, String>();
tMap.put(101, "KTM");
tMap.put(69, "CBR");
elt.value = tMap;
return elt;
} | Element getControlObject() { Element elt = new Element(); elt.key = 0; TreeMap<Integer, String> tMap = new TreeMap<Integer, String>(); tMap.put(101, "KTM"); tMap.put(69, "CBR"); elt.value = tMap; return elt; } | /**
* Used for unmarshal test verification
*/ | Used for unmarshal test verification | getControlObject | {
"repo_name": "gameduell/eclipselink.runtime",
"path": "moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/binder/adapter/BinderWithAdapterTestCases.java",
"license": "epl-1.0",
"size": 5207
} | [
"java.util.TreeMap"
] | import java.util.TreeMap; | import java.util.*; | [
"java.util"
] | java.util; | 345,133 |
protected DynamoDBMapper getMapper() {
return new DynamoDBMapper(ddbClient);
} | DynamoDBMapper function() { return new DynamoDBMapper(ddbClient); } | /**
* Returns a DynamoDBMapper object initialized with the default DynamoDB client
*
* @return An initialized DynamoDBMapper
*/ | Returns a DynamoDBMapper object initialized with the default DynamoDB client | getMapper | {
"repo_name": "awslabs/api-gateway-secure-pet-store",
"path": "src/main/java/com/amazonaws/apigatewaydemo/model/user/DDBUserDAO.java",
"license": "apache-2.0",
"size": 3362
} | [
"com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper"
] | import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper; | import com.amazonaws.services.dynamodbv2.datamodeling.*; | [
"com.amazonaws.services"
] | com.amazonaws.services; | 882,333 |
Pair<Integer, Integer> getAlterStatus(final TableName tableName) throws IOException;
/**
* Get the status of alter command - indicates how many regions have received the updated schema
* Asynchronous operation.
*
* @param tableName name of the table to get the status of
* @return Pair indicating the number of regions updated Pair.getFirst() is the regions that are
* yet to be updated Pair.getSecond() is the total number of regions of the table
* @throws IOException if a remote or network exception occurs
* @deprecated Since 2.0.0. Will be removed in 3.0.0. Use {@link #getAlterStatus(TableName)} | Pair<Integer, Integer> getAlterStatus(final TableName tableName) throws IOException; /** * Get the status of alter command - indicates how many regions have received the updated schema * Asynchronous operation. * * @param tableName name of the table to get the status of * @return Pair indicating the number of regions updated Pair.getFirst() is the regions that are * yet to be updated Pair.getSecond() is the total number of regions of the table * @throws IOException if a remote or network exception occurs * @deprecated Since 2.0.0. Will be removed in 3.0.0. Use {@link #getAlterStatus(TableName)} | /**
* Get the status of alter command - indicates how many regions have received the updated schema
* Asynchronous operation.
*
* @param tableName TableName instance
* @return Pair indicating the number of regions updated Pair.getFirst() is the regions that are
* yet to be updated Pair.getSecond() is the total number of regions of the table
* @throws IOException if a remote or network exception occurs
*/ | Get the status of alter command - indicates how many regions have received the updated schema Asynchronous operation | getAlterStatus | {
"repo_name": "gustavoanatoly/hbase",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java",
"license": "apache-2.0",
"size": 97415
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.TableName",
"org.apache.hadoop.hbase.util.Pair"
] | import java.io.IOException; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.util.Pair; | import java.io.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.util.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 90,687 |
@Override
public Object visit(PropertyIsEqualTo filter, Object extraData) {
visitBinaryComparisonOperator(filter, "=");
return extraData;
} | Object function(PropertyIsEqualTo filter, Object extraData) { visitBinaryComparisonOperator(filter, "="); return extraData; } | /**
* Write the SQL for this kind of filter
*
* @param filter the filter to visit
* @param extraData extra data (unused by this method)
*/ | Write the SQL for this kind of filter | visit | {
"repo_name": "geotools/geotools",
"path": "modules/library/jdbc/src/main/java/org/geotools/data/jdbc/FilterToSQL.java",
"license": "lgpl-2.1",
"size": 81277
} | [
"org.opengis.filter.PropertyIsEqualTo"
] | import org.opengis.filter.PropertyIsEqualTo; | import org.opengis.filter.*; | [
"org.opengis.filter"
] | org.opengis.filter; | 1,328,093 |
@DoesServiceRequest
public QueuePermissions downloadPermissions() throws StorageException {
return this.downloadPermissions(null , null );
} | QueuePermissions function() throws StorageException { return this.downloadPermissions(null , null ); } | /**
* Downloads the permission settings for the queue.
*
* @return A {@link QueuePermissions} object that represents the queue's permissions.
*
* @throws StorageException
* If a storage service error occurred.
*/ | Downloads the permission settings for the queue | downloadPermissions | {
"repo_name": "horizon-institute/runspotrun-android-client",
"path": "src/com/microsoft/azure/storage/queue/CloudQueue.java",
"license": "agpl-3.0",
"size": 84049
} | [
"com.microsoft.azure.storage.StorageException"
] | import com.microsoft.azure.storage.StorageException; | import com.microsoft.azure.storage.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 2,772,406 |
public Map getConstrainedProperties();
public Validator getValidator();
public void setValidator(Validator validator);
| Map getConstrainedProperties(); public Validator getValidator(); public void function(Validator validator); | /**
* Sets the validator for this domain class
*
* @param validator The domain class validator to set
*/ | Sets the validator for this domain class | setValidator | {
"repo_name": "lpicanco/grails",
"path": "src/commons/org/codehaus/groovy/grails/commons/GrailsDomainClass.java",
"license": "apache-2.0",
"size": 5676
} | [
"java.util.Map",
"org.springframework.validation.Validator"
] | import java.util.Map; import org.springframework.validation.Validator; | import java.util.*; import org.springframework.validation.*; | [
"java.util",
"org.springframework.validation"
] | java.util; org.springframework.validation; | 1,477,821 |
public String[] getHardLinkedFiles(String src) throws IOException {
return dir.getHardLinkedFiles(src);
} | String[] function(String src) throws IOException { return dir.getHardLinkedFiles(src); } | /**
* See {@link ClientProtocol#getHardLinkedFiles(String)}.
*/ | See <code>ClientProtocol#getHardLinkedFiles(String)</code> | getHardLinkedFiles | {
"repo_name": "nvoron23/hadoop-20",
"path": "src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java",
"license": "apache-2.0",
"size": 358914
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,537,966 |
public boolean areSubscriptionsSupported() {
int responseCode = mBillingClient.isFeatureSupported(FeatureType.SUBSCRIPTIONS);
if (responseCode != BillingResponse.OK) {
Log.w(TAG, "areSubscriptionsSupported() got an error response: " + responseCode);
}
return responseCode == BillingResponse.OK;
} | boolean function() { int responseCode = mBillingClient.isFeatureSupported(FeatureType.SUBSCRIPTIONS); if (responseCode != BillingResponse.OK) { Log.w(TAG, STR + responseCode); } return responseCode == BillingResponse.OK; } | /**
* Checks if subscriptions are supported for current client
* <p>Note: This method does not automatically retry for RESULT_SERVICE_DISCONNECTED.
* It is only used in unit tests and after queryPurchases execution, which already has
* a retry-mechanism implemented.
* </p>
*/ | Checks if subscriptions are supported for current client Note: This method does not automatically retry for RESULT_SERVICE_DISCONNECTED. It is only used in unit tests and after queryPurchases execution, which already has a retry-mechanism implemented. | areSubscriptionsSupported | {
"repo_name": "openfl/extension-iap",
"path": "dependencies/android/src/org/haxe/extension/iap/util/BillingManager.java",
"license": "mit",
"size": 17401
} | [
"android.util.Log",
"com.android.billingclient.api.BillingClient"
] | import android.util.Log; import com.android.billingclient.api.BillingClient; | import android.util.*; import com.android.billingclient.api.*; | [
"android.util",
"com.android.billingclient"
] | android.util; com.android.billingclient; | 80,867 |
public void testPostAuthProxy() throws Exception {
UsernamePasswordCredentials creds =
new UsernamePasswordCredentials("testuser", "testpass");
this.client.getState().setProxyCredentials(AuthScope.ANY, creds);
this.server.setHttpService(new FeedbackService());
this.proxy.requireAuthentication(creds, "test", true);
PostMethod post = new PostMethod("/");
post.setRequestEntity(new StringRequestEntity("Like tons of stuff", null, null));
try {
this.client.executeMethod(post);
assertEquals(HttpStatus.SC_OK, post.getStatusCode());
assertNotNull(post.getResponseBodyAsString());
} finally {
post.releaseConnection();
}
} | void function() throws Exception { UsernamePasswordCredentials creds = new UsernamePasswordCredentials(STR, STR); this.client.getState().setProxyCredentials(AuthScope.ANY, creds); this.server.setHttpService(new FeedbackService()); this.proxy.requireAuthentication(creds, "test", true); PostMethod post = new PostMethod("/"); post.setRequestEntity(new StringRequestEntity(STR, null, null)); try { this.client.executeMethod(post); assertEquals(HttpStatus.SC_OK, post.getStatusCode()); assertNotNull(post.getResponseBodyAsString()); } finally { post.releaseConnection(); } } | /**
* Tests POST via authenticating proxy
*/ | Tests POST via authenticating proxy | testPostAuthProxy | {
"repo_name": "fmassart/commons-httpclient",
"path": "src/test/org/apache/commons/httpclient/TestProxy.java",
"license": "apache-2.0",
"size": 31221
} | [
"org.apache.commons.httpclient.auth.AuthScope",
"org.apache.commons.httpclient.methods.PostMethod",
"org.apache.commons.httpclient.methods.StringRequestEntity"
] | import org.apache.commons.httpclient.auth.AuthScope; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.StringRequestEntity; | import org.apache.commons.httpclient.auth.*; import org.apache.commons.httpclient.methods.*; | [
"org.apache.commons"
] | org.apache.commons; | 217,110 |
public static void setupPrefLevelsSoftOnly(HttpServletRequest request) throws Exception {
request.setAttribute(PreferenceLevel.PREF_LEVEL_ATTR_NAME, PreferenceLevel.getPreferenceLevelListSoftOnly());
}
| static void function(HttpServletRequest request) throws Exception { request.setAttribute(PreferenceLevel.PREF_LEVEL_ATTR_NAME, PreferenceLevel.getPreferenceLevelListSoftOnly()); } | /**
* Get Preference Levels and store it in request object (soft preferences only)
* @param request
* @throws Exception
*/ | Get Preference Levels and store it in request object (soft preferences only) | setupPrefLevelsSoftOnly | {
"repo_name": "maciej-zygmunt/unitime",
"path": "JavaSource/org/unitime/timetable/util/LookupTables.java",
"license": "apache-2.0",
"size": 17845
} | [
"javax.servlet.http.HttpServletRequest",
"org.unitime.timetable.model.PreferenceLevel"
] | import javax.servlet.http.HttpServletRequest; import org.unitime.timetable.model.PreferenceLevel; | import javax.servlet.http.*; import org.unitime.timetable.model.*; | [
"javax.servlet",
"org.unitime.timetable"
] | javax.servlet; org.unitime.timetable; | 1,772,128 |
public void testCreateParentMissing() throws Exception {
Map<String, String> propsDir = properties("ownerDir", "groupDir", "0555");
Map<String, String> propsSubDir = properties("ownerSubDir", "groupSubDir", "0666");
create(igfsSecondary, paths(DIR, SUBDIR), null);
create(igfs, null, null);
igfsSecondaryFileSystem.update(DIR, propsDir);
igfsSecondaryFileSystem.update(SUBDIR, propsSubDir);
createFile(igfs.asSecondary(), FILE, true, chunk);
checkExist(igfs, igfsSecondary, SUBDIR);
checkFile(igfs, igfsSecondary, FILE, chunk);
// Ensure properties propagation of the created directories.
assertEquals(propsDir, igfs.info(DIR).properties());
assertEquals(propsSubDir, igfs.info(SUBDIR).properties());
} | void function() throws Exception { Map<String, String> propsDir = properties(STR, STR, "0555"); Map<String, String> propsSubDir = properties(STR, STR, "0666"); create(igfsSecondary, paths(DIR, SUBDIR), null); create(igfs, null, null); igfsSecondaryFileSystem.update(DIR, propsDir); igfsSecondaryFileSystem.update(SUBDIR, propsSubDir); createFile(igfs.asSecondary(), FILE, true, chunk); checkExist(igfs, igfsSecondary, SUBDIR); checkFile(igfs, igfsSecondary, FILE, chunk); assertEquals(propsDir, igfs.info(DIR).properties()); assertEquals(propsSubDir, igfs.info(SUBDIR).properties()); } | /**
* Test create when parent directory is missing locally.
*
* @throws Exception If failed.
*/ | Test create when parent directory is missing locally | testCreateParentMissing | {
"repo_name": "dlnufox/ignite",
"path": "modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java",
"license": "apache-2.0",
"size": 55550
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,408,552 |
public WebFacesConfigDescriptor removeAllComponent()
{
model.removeChildren("component");
return this;
}
// --------------------------------------------------------------------------------------------------------||
// ClassName: WebFacesConfigDescriptor ElementName: javaee:faces-config-converterType ElementType : converter
// MaxOccurs: -unbounded isGeneric: false isAttribute: false isEnum: false isDataType: false
// --------------------------------------------------------------------------------------------------------|| | WebFacesConfigDescriptor function() { model.removeChildren(STR); return this; } | /**
* Removes all <code>component</code> elements
* @return the current instance of <code>FacesConfigComponentType<WebFacesConfigDescriptor></code>
*/ | Removes all <code>component</code> elements | removeAllComponent | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/facesconfig21/WebFacesConfigDescriptorImpl.java",
"license": "epl-1.0",
"size": 44350
} | [
"org.jboss.shrinkwrap.descriptor.api.facesconfig21.WebFacesConfigDescriptor"
] | import org.jboss.shrinkwrap.descriptor.api.facesconfig21.WebFacesConfigDescriptor; | import org.jboss.shrinkwrap.descriptor.api.facesconfig21.*; | [
"org.jboss.shrinkwrap"
] | org.jboss.shrinkwrap; | 1,308,423 |
public static void prettyPrint( Connection conn, ResultSet rs )
throws SQLException
{
org.apache.derby.tools.JDBCDisplayUtil.DisplayResults
( System.out, rs, conn );
}
//////////////////
//
// OPTIMIZER STATS
//
////////////////// | static void function( Connection conn, ResultSet rs ) throws SQLException { org.apache.derby.tools.JDBCDisplayUtil.DisplayResults ( System.out, rs, conn ); } | /**
* <p>
* Print a ResultSet, using Derby's pretty-printing tool.
* </p>
*/ | Print a ResultSet, using Derby's pretty-printing tool. | prettyPrint | {
"repo_name": "trejkaz/derby",
"path": "java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java",
"license": "apache-2.0",
"size": 105501
} | [
"java.sql.Connection",
"java.sql.ResultSet",
"java.sql.SQLException"
] | import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 891,542 |
Set<PropertyMetadata> getPropertiesMetadata(); | Set<PropertyMetadata> getPropertiesMetadata(); | /**
* Returns the set of relevant properties, that is, those properties annotated with a relevant annotation.
*/ | Returns the set of relevant properties, that is, those properties annotated with a relevant annotation | getPropertiesMetadata | {
"repo_name": "gradle/gradle",
"path": "subprojects/core/src/main/java/org/gradle/api/internal/tasks/properties/TypeMetadata.java",
"license": "apache-2.0",
"size": 1389
} | [
"java.util.Set",
"org.gradle.internal.reflect.PropertyMetadata"
] | import java.util.Set; import org.gradle.internal.reflect.PropertyMetadata; | import java.util.*; import org.gradle.internal.reflect.*; | [
"java.util",
"org.gradle.internal"
] | java.util; org.gradle.internal; | 368,853 |
public void setStatistics(ProcessingUnitStatisticsId statisticsId) {
statisticsId.validate();
properties.putMap(STATISTICS_KEY_PREFIX, statisticsId.getProperties());
} | void function(ProcessingUnitStatisticsId statisticsId) { statisticsId.validate(); properties.putMap(STATISTICS_KEY_PREFIX, statisticsId.getProperties()); } | /**
* Defines the statistics that is compared against the high and low thresholds
*/ | Defines the statistics that is compared against the high and low thresholds | setStatistics | {
"repo_name": "Gigaspaces/xap-openspaces",
"path": "src/main/java/org/openspaces/admin/pu/elastic/config/AutomaticCapacityScaleRuleConfig.java",
"license": "apache-2.0",
"size": 7017
} | [
"org.openspaces.admin.pu.statistics.ProcessingUnitStatisticsId"
] | import org.openspaces.admin.pu.statistics.ProcessingUnitStatisticsId; | import org.openspaces.admin.pu.statistics.*; | [
"org.openspaces.admin"
] | org.openspaces.admin; | 1,828,016 |
public BoltDeclarer setBolt(String id, SerializableBiConsumer<Tuple, BasicOutputCollector> biConsumer, Number parallelismHint,
String... fields) throws IllegalArgumentException {
return setBolt(id, new LambdaBiConsumerBolt(biConsumer, fields), parallelismHint);
} | BoltDeclarer function(String id, SerializableBiConsumer<Tuple, BasicOutputCollector> biConsumer, Number parallelismHint, String... fields) throws IllegalArgumentException { return setBolt(id, new LambdaBiConsumerBolt(biConsumer, fields), parallelismHint); } | /**
* Define a new bolt in this topology. This defines a lambda basic bolt, which is a simpler to use but more restricted kind of bolt.
* Basic bolts are intended for non-aggregation processing and automate the anchoring/acking process to achieve proper reliability in
* the topology.
*
* @param id the id of this component. This id is referenced by other components that want to consume this bolt's
* outputs.
* @param biConsumer lambda expression that implements tuple processing for this bolt
* @param fields fields for tuple that should be emitted to downstream bolts
* @param parallelismHint the number of tasks that should be assigned to execute this bolt. Each task will run on a thread in a process
* somewhere around the cluster.
* @return use the returned object to declare the inputs to this component
*
* @throws IllegalArgumentException if {@code parallelism_hint} is not positive
*/ | Define a new bolt in this topology. This defines a lambda basic bolt, which is a simpler to use but more restricted kind of bolt. Basic bolts are intended for non-aggregation processing and automate the anchoring/acking process to achieve proper reliability in the topology | setBolt | {
"repo_name": "kishorvpatil/incubator-storm",
"path": "storm-client/src/jvm/org/apache/storm/topology/TopologyBuilder.java",
"license": "apache-2.0",
"size": 37704
} | [
"org.apache.storm.lambda.LambdaBiConsumerBolt",
"org.apache.storm.lambda.SerializableBiConsumer",
"org.apache.storm.tuple.Tuple"
] | import org.apache.storm.lambda.LambdaBiConsumerBolt; import org.apache.storm.lambda.SerializableBiConsumer; import org.apache.storm.tuple.Tuple; | import org.apache.storm.lambda.*; import org.apache.storm.tuple.*; | [
"org.apache.storm"
] | org.apache.storm; | 2,269,720 |
@Override
public void setProperty(Object bean, String propertyName, Object propertyValue) throws BeansException {
BeanWrapper wrapper = getWrapper(bean);
PropertyDescriptor[] propertyDescriptors = wrapper.getPropertyDescriptors();
// Find a bean property by its name ignoring case.
// this way, we can accept any type of case in the spreadsheet file
//
for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
if (propertyDescriptor.getName().equalsIgnoreCase(propertyName)) {
wrapper.setPropertyValue(propertyDescriptor.getName(), propertyValue.toString());
break;
}
}
} | void function(Object bean, String propertyName, Object propertyValue) throws BeansException { BeanWrapper wrapper = getWrapper(bean); PropertyDescriptor[] propertyDescriptors = wrapper.getPropertyDescriptors(); if (propertyDescriptor.getName().equalsIgnoreCase(propertyName)) { wrapper.setPropertyValue(propertyDescriptor.getName(), propertyValue.toString()); break; } } } | /**
* Set the value of a property on the current bean.
*
* @param bean bean instance to populate
* @param propertyName the name of the property (case insensitive)
* @param propertyValue the value of the property
*/ | Set the value of a property on the current bean | setProperty | {
"repo_name": "dgageot/ExcelTemplate",
"path": "src/main/java/org/gageot/excel/beans/BeanSetterImpl.java",
"license": "apache-2.0",
"size": 2673
} | [
"java.beans.PropertyDescriptor",
"org.springframework.beans.BeanWrapper",
"org.springframework.beans.BeansException"
] | import java.beans.PropertyDescriptor; import org.springframework.beans.BeanWrapper; import org.springframework.beans.BeansException; | import java.beans.*; import org.springframework.beans.*; | [
"java.beans",
"org.springframework.beans"
] | java.beans; org.springframework.beans; | 1,438,881 |
public StyledText background(final CharSequence text, final int color) {
return append(text, new BackgroundColorSpan(color));
} | StyledText function(final CharSequence text, final int color) { return append(text, new BackgroundColorSpan(color)); } | /**
* Append text in bold
*
* @param text
* @param color
* @return this text
*/ | Append text in bold | background | {
"repo_name": "DeLaSalleUniversity-Manila/forkhub-JeraldLimqueco",
"path": "app/src/main/java/com/github/mobile/ui/StyledText.java",
"license": "apache-2.0",
"size": 5047
} | [
"android.text.style.BackgroundColorSpan"
] | import android.text.style.BackgroundColorSpan; | import android.text.style.*; | [
"android.text"
] | android.text; | 468,421 |
Optional<Key> unwrapSetKey(Key key, Class<?> wrappingClass) {
if (SetType.isSet(key)) {
SetType setType = SetType.from(key);
if (!setType.isRawType() && setType.elementsAreTypeOf(wrappingClass)) {
return Optional.of(
key.toBuilder()
.type(fromJava(setOf(setType.unwrappedElementType(wrappingClass))))
.build());
}
}
return Optional.empty();
}
/**
* If {@code key}'s type is {@code Optional<T>} for some {@code T}, returns a key with the same
* qualifier whose type is {@linkplain RequestKinds#extractKeyType(RequestKind, TypeMirror)} | Optional<Key> unwrapSetKey(Key key, Class<?> wrappingClass) { if (SetType.isSet(key)) { SetType setType = SetType.from(key); if (!setType.isRawType() && setType.elementsAreTypeOf(wrappingClass)) { return Optional.of( key.toBuilder() .type(fromJava(setOf(setType.unwrappedElementType(wrappingClass)))) .build()); } } return Optional.empty(); } /** * If {@code key}'s type is {@code Optional<T>} for some {@code T}, returns a key with the same * qualifier whose type is {@linkplain RequestKinds#extractKeyType(RequestKind, TypeMirror)} | /**
* If {@code key}'s type is {@code Set<WrappingClass<Bar>>}, returns a key with type {@code Set
* <Bar>} with the same qualifier. Otherwise returns {@link Optional#empty()}.
*/ | If key's type is Set>, returns a key with type Set with the same qualifier. Otherwise returns <code>Optional#empty()</code> | unwrapSetKey | {
"repo_name": "dushmis/dagger",
"path": "java/dagger/internal/codegen/binding/KeyFactory.java",
"license": "apache-2.0",
"size": 18630
} | [
"java.util.Optional",
"javax.lang.model.type.TypeMirror"
] | import java.util.Optional; import javax.lang.model.type.TypeMirror; | import java.util.*; import javax.lang.model.type.*; | [
"java.util",
"javax.lang"
] | java.util; javax.lang; | 2,059,719 |
public EntityBIO extractEntity(int[] sequence, int position, String tag) {
EntityBIO entity = new EntityBIO();
entity.type = tagIndex.indexOf(tag);
entity.startPosition = position;
entity.words = new ArrayList<>();
entity.words.add(wordDoc.get(position));
int pos = position + 1;
for ( ; pos < sequence.length; pos++) {
String rawTag = classIndex.get(sequence[pos]);
String[] parts = rawTag.split("-");
if (parts[0].equals("I") && parts[1].equals(tag)) {
String word = wordDoc.get(pos);
entity.words.add(word);
} else {
break;
}
}
entity.otherOccurrences = otherOccurrences(entity);
return entity;
} | EntityBIO function(int[] sequence, int position, String tag) { EntityBIO entity = new EntityBIO(); entity.type = tagIndex.indexOf(tag); entity.startPosition = position; entity.words = new ArrayList<>(); entity.words.add(wordDoc.get(position)); int pos = position + 1; for ( ; pos < sequence.length; pos++) { String rawTag = classIndex.get(sequence[pos]); String[] parts = rawTag.split("-"); if (parts[0].equals("I") && parts[1].equals(tag)) { String word = wordDoc.get(pos); entity.words.add(word); } else { break; } } entity.otherOccurrences = otherOccurrences(entity); return entity; } | /**
* extracts the entity starting at the given position
* and adds it to the entity list. returns the index
* of the last element in the entity (<b>not</b> index+1)
**/ | extracts the entity starting at the given position and adds it to the entity list. returns the index of the last element in the entity (not index+1) | extractEntity | {
"repo_name": "rupenp/CoreNLP",
"path": "src/edu/stanford/nlp/ie/EntityCachingAbstractSequencePriorBIO.java",
"license": "gpl-2.0",
"size": 14734
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 1,464,218 |
LogicalGraph getLogicalGraph() throws IOException; | LogicalGraph getLogicalGraph() throws IOException; | /**
* Reads the input as logical graph.
*
* @return logial graph
*/ | Reads the input as logical graph | getLogicalGraph | {
"repo_name": "niklasteichmann/gradoop",
"path": "gradoop-flink/src/main/java/org/gradoop/flink/io/api/DataSource.java",
"license": "apache-2.0",
"size": 1180
} | [
"java.io.IOException",
"org.gradoop.flink.model.impl.epgm.LogicalGraph"
] | import java.io.IOException; import org.gradoop.flink.model.impl.epgm.LogicalGraph; | import java.io.*; import org.gradoop.flink.model.impl.epgm.*; | [
"java.io",
"org.gradoop.flink"
] | java.io; org.gradoop.flink; | 1,974,115 |
public static boolean pingForServerUp(
NetworkServerControl networkServerController, Process serverProcess,
boolean expectServerUp)
throws InterruptedException
{
// If we expect the server to be or come up, then
// it makes sense to sleep (if ping unsuccessful), then ping
// and repeat this for the duration of wait-time, but stop
// when the ping is successful.
// But if we are pinging to see if the server is - or
// has come - down, we should do the opposite, stop if ping
// is unsuccessful, and repeat until wait-time if it is
final long startTime = System.currentTimeMillis();
while (true) {
try {
networkServerController.ping();
if (expectServerUp)
return true;
else
{
if (System.currentTimeMillis() - startTime > waitTime) {
return true;
}
}
} catch (Throwable e) {
if ( !vetPing( e ) )
{
e.printStackTrace( System.out );
// at this point, we don't have the usual "server not up
// yet" error. get out. at this point, you may have to
// manually kill the server.
return false;
}
if (expectServerUp){
if (System.currentTimeMillis() - startTime > waitTime)
return false;
}
// else, we got what we expected, done.
else
return false;
}
if (serverProcess != null) {
// if the server runs in a separate process, check whether the
// process is still alive
try {
int exitVal = serverProcess.exitValue();
// When exitValue() returns successfully, the server
// process must have terminated. No point in pinging the
// server anymore.
return false;
} catch (IllegalThreadStateException e) {
// This exception is thrown by Process.exitValue() if the
// process has not terminated. Keep on pinging the server.
} catch (Throwable t) {
// something unfortunate happened
t.printStackTrace( System.out );
return false;
}
}
Thread.sleep(SLEEP_TIME);
}
} | static boolean function( NetworkServerControl networkServerController, Process serverProcess, boolean expectServerUp) throws InterruptedException { final long startTime = System.currentTimeMillis(); while (true) { try { networkServerController.ping(); if (expectServerUp) return true; else { if (System.currentTimeMillis() - startTime > waitTime) { return true; } } } catch (Throwable e) { if ( !vetPing( e ) ) { e.printStackTrace( System.out ); return false; } if (expectServerUp){ if (System.currentTimeMillis() - startTime > waitTime) return false; } else return false; } if (serverProcess != null) { try { int exitVal = serverProcess.exitValue(); return false; } catch (IllegalThreadStateException e) { } catch (Throwable t) { t.printStackTrace( System.out ); return false; } } Thread.sleep(SLEEP_TIME); } } | /**
* Ping server for upto sixty seconds. If the server responds
* in that time then return true, otherwise return false.
*
* @param networkServerController controller object for network server
* @param serverProcess the external process in which the server runs
* (could be <code>null</code>)
* @return true if server responds in time, false otherwise
*/ | Ping server for upto sixty seconds. If the server responds in that time then return true, otherwise return false | pingForServerUp | {
"repo_name": "SnappyDataInc/snappy-store",
"path": "gemfirexd/tools/src/test/java/org/apache/derbyTesting/junit/NetworkServerTestSetup.java",
"license": "apache-2.0",
"size": 22433
} | [
"com.pivotal.gemfirexd.internal.drda.NetworkServerControl"
] | import com.pivotal.gemfirexd.internal.drda.NetworkServerControl; | import com.pivotal.gemfirexd.internal.drda.*; | [
"com.pivotal.gemfirexd"
] | com.pivotal.gemfirexd; | 736,199 |
static SQLException create( String messageCode, Object param0 ) {
String message = translateMsg(messageCode, new Object[] { param0 });
String sqlState = language.getSqlState(messageCode);
return new SmallSQLException(message, sqlState);
} | static SQLException create( String messageCode, Object param0 ) { String message = translateMsg(messageCode, new Object[] { param0 }); String sqlState = language.getSqlState(messageCode); return new SmallSQLException(message, sqlState); } | /**
* Convenience method for passing only one parameter.<br>
* To create a custom message, pass Language.CUSTOM_MESSAGE as messageCode
* and the message as param0.
*
* @param messageCode
* localized message key. pass Language.CUSTOM_MESSAGE and the
* plain message inside the parameters array to create an
* unlocalized message.
* @param param0
* message parameter.
*/ | Convenience method for passing only one parameter. To create a custom message, pass Language.CUSTOM_MESSAGE as messageCode and the message as param0 | create | {
"repo_name": "mihai303/SE",
"path": "PracticalLabSeries1/smallsql0.21_src/src/smallsql/database/SmallSQLException.java",
"license": "mit",
"size": 7423
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,861,891 |
public static final void center(Component component, Component relativeTo) {
Dimension windowSize = component.getSize();
Dimension relativeSize;
int x0;
int y0;
if (null == relativeTo) {
x0 = 0;
y0 = 0;
relativeSize = Toolkit.getDefaultToolkit().getScreenSize();
} else {
Point pos = relativeTo.getLocationOnScreen();
x0 = pos.x;
y0 = pos.y;
relativeSize = relativeTo.getSize();
}
int x = (int) (relativeSize.getWidth() - windowSize.getWidth()) / 2;
int y = (int) (relativeSize.getHeight() - windowSize.getHeight()) / 2;
component.setLocation(x0 + x, y0 + y);
} | static final void function(Component component, Component relativeTo) { Dimension windowSize = component.getSize(); Dimension relativeSize; int x0; int y0; if (null == relativeTo) { x0 = 0; y0 = 0; relativeSize = Toolkit.getDefaultToolkit().getScreenSize(); } else { Point pos = relativeTo.getLocationOnScreen(); x0 = pos.x; y0 = pos.y; relativeSize = relativeTo.getSize(); } int x = (int) (relativeSize.getWidth() - windowSize.getWidth()) / 2; int y = (int) (relativeSize.getHeight() - windowSize.getHeight()) / 2; component.setLocation(x0 + x, y0 + y); } | /**
* Centers a given component relative to a given component.
*
* @param component the component to be centered
* @param relativeTo an optional component to center with
* respect to (<b>null</b> if the entire screen should
* be considered)
*
* @since 1.50
*/ | Centers a given component relative to a given component | center | {
"repo_name": "SSEHUB/EASyProducer",
"path": "Plugins/EASy-Producer/ScenariosTest/testdata/real/svncontrol/tools/Tools.java",
"license": "apache-2.0",
"size": 2042
} | [
"java.awt.Component",
"java.awt.Dimension",
"java.awt.Point",
"java.awt.Toolkit"
] | import java.awt.Component; import java.awt.Dimension; import java.awt.Point; import java.awt.Toolkit; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,111,313 |
public static int writeToStream(final OutputStream out, final double n)
throws IOException
{
final int l = LittleEndian.DOUBLE_SIZE;
final byte[] buffer = new byte[l];
LittleEndian.putDouble(buffer, 0, n);
out.write(buffer, 0, l);
return l;
} | static int function(final OutputStream out, final double n) throws IOException { final int l = LittleEndian.DOUBLE_SIZE; final byte[] buffer = new byte[l]; LittleEndian.putDouble(buffer, 0, n); out.write(buffer, 0, l); return l; } | /**
* <p>Writes a double value value to an output stream.</p>
*
* @param out The stream to write to.
* @param n The value to write.
* @exception IOException if an I/O error occurs
* @return The number of bytes written to the output stream.
*/ | Writes a double value value to an output stream | writeToStream | {
"repo_name": "benjaminy/STuneLite",
"path": "OldJavaImplementation/poi-3.2-FINAL/src/java/org/apache/poi/hpsf/TypeWriter.java",
"license": "gpl-2.0",
"size": 7019
} | [
"java.io.IOException",
"java.io.OutputStream",
"org.apache.poi.util.LittleEndian"
] | import java.io.IOException; import java.io.OutputStream; import org.apache.poi.util.LittleEndian; | import java.io.*; import org.apache.poi.util.*; | [
"java.io",
"org.apache.poi"
] | java.io; org.apache.poi; | 322,125 |
protected String resultSetRowAsString(ResultSet rs)
throws SQLException {
int numColumns = rs.getMetaData().getColumnCount();
List<String> columnValuesStringy = new ArrayList<String>(numColumns);
for(int currentColIndex=0; currentColIndex<numColumns; currentColIndex++) {
Object value = rs.getObject(currentColIndex+1);
String label = rs.getMetaData().getColumnName(currentColIndex+1);
String convertedValue = label + "=";
if (value==null) {
convertedValue += "<null>";
} else {
convertedValue += value.toString();
}
columnValuesStringy.add(currentColIndex, convertedValue);
}
return asCommaSeparatedString(columnValuesStringy);
}
| String function(ResultSet rs) throws SQLException { int numColumns = rs.getMetaData().getColumnCount(); List<String> columnValuesStringy = new ArrayList<String>(numColumns); for(int currentColIndex=0; currentColIndex<numColumns; currentColIndex++) { Object value = rs.getObject(currentColIndex+1); String label = rs.getMetaData().getColumnName(currentColIndex+1); String convertedValue = label + "="; if (value==null) { convertedValue += STR; } else { convertedValue += value.toString(); } columnValuesStringy.add(currentColIndex, convertedValue); } return asCommaSeparatedString(columnValuesStringy); } | /**
*
* For the given ResultSet object this will return a stringified version
* of the current row. Useful to print in error or debug messages.
*
* @param rs
* @return
* @throws SQLException
*/ | For the given ResultSet object this will return a stringified version of the current row. Useful to print in error or debug messages | resultSetRowAsString | {
"repo_name": "dbolser-ebi/ensj-healthcheck",
"path": "src/org/ensembl/healthcheck/testcase/eg_compara/AbstractControlledRows.java",
"license": "apache-2.0",
"size": 15006
} | [
"java.sql.ResultSet",
"java.sql.SQLException",
"java.util.ArrayList",
"java.util.List"
] | import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; | import java.sql.*; import java.util.*; | [
"java.sql",
"java.util"
] | java.sql; java.util; | 14,362 |
protected void setContext(Context context) {
log = Log.instance(context);
options = Options.instance(context);
classLoaderClass = options.get("procloader");
}
public Log log;
protected Charset charset;
protected Options options;
protected String classLoaderClass; | void function(Context context) { log = Log.instance(context); options = Options.instance(context); classLoaderClass = options.get(STR); } public Log log; protected Charset charset; protected Options options; protected String classLoaderClass; | /**
* Set the context for JavacPathFileManager.
*/ | Set the context for JavacPathFileManager | setContext | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk/langtools/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java",
"license": "mit",
"size": 13005
} | [
"java.nio.charset.Charset"
] | import java.nio.charset.Charset; | import java.nio.charset.*; | [
"java.nio"
] | java.nio; | 2,696,391 |
interface WithZones {
WithCreate withZones(List<String> zones);
}
interface WithCreate extends Creatable<PublicIPPrefix>, Resource.DefinitionWithTags<WithCreate>, DefinitionStages.WithIpTags, DefinitionStages.WithPrefixLength, DefinitionStages.WithPublicIPAddressVersion, DefinitionStages.WithSku, DefinitionStages.WithZones {
}
}
interface Update extends Appliable<PublicIPPrefix>, Resource.UpdateWithTags<Update>, UpdateStages.WithIpTags, UpdateStages.WithPrefixLength, UpdateStages.WithPublicIPAddressVersion, UpdateStages.WithSku, UpdateStages.WithZones {
} | interface WithZones { WithCreate withZones(List<String> zones); } interface WithCreate extends Creatable<PublicIPPrefix>, Resource.DefinitionWithTags<WithCreate>, DefinitionStages.WithIpTags, DefinitionStages.WithPrefixLength, DefinitionStages.WithPublicIPAddressVersion, DefinitionStages.WithSku, DefinitionStages.WithZones { } } interface Update extends Appliable<PublicIPPrefix>, Resource.UpdateWithTags<Update>, UpdateStages.WithIpTags, UpdateStages.WithPrefixLength, UpdateStages.WithPublicIPAddressVersion, UpdateStages.WithSku, UpdateStages.WithZones { } | /**
* Specifies zones.
* @param zones A list of availability zones denoting the IP allocated for the resource needs to come from
* @return the next definition stage
*/ | Specifies zones | withZones | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/network/v2020_05_01/PublicIPPrefix.java",
"license": "mit",
"size": 8219
} | [
"com.microsoft.azure.arm.model.Appliable",
"com.microsoft.azure.arm.model.Creatable",
"com.microsoft.azure.arm.resources.models.Resource",
"java.util.List"
] | import com.microsoft.azure.arm.model.Appliable; import com.microsoft.azure.arm.model.Creatable; import com.microsoft.azure.arm.resources.models.Resource; import java.util.List; | import com.microsoft.azure.arm.model.*; import com.microsoft.azure.arm.resources.models.*; import java.util.*; | [
"com.microsoft.azure",
"java.util"
] | com.microsoft.azure; java.util; | 1,585,128 |
protected void createInjectHeadersActionState(final Flow flow) {
val headerState = createActionState(flow, CasWebflowConstants.STATE_ID_HEADER_VIEW, "injectResponseHeadersAction");
createTransitionForState(headerState, CasWebflowConstants.TRANSITION_ID_SUCCESS, CasWebflowConstants.STATE_ID_END_WEBFLOW);
createTransitionForState(headerState, CasWebflowConstants.TRANSITION_ID_REDIRECT, CasWebflowConstants.STATE_ID_REDIRECT_VIEW);
} | void function(final Flow flow) { val headerState = createActionState(flow, CasWebflowConstants.STATE_ID_HEADER_VIEW, STR); createTransitionForState(headerState, CasWebflowConstants.TRANSITION_ID_SUCCESS, CasWebflowConstants.STATE_ID_END_WEBFLOW); createTransitionForState(headerState, CasWebflowConstants.TRANSITION_ID_REDIRECT, CasWebflowConstants.STATE_ID_REDIRECT_VIEW); } | /**
* Create header end state.
*
* @param flow the flow
*/ | Create header end state | createInjectHeadersActionState | {
"repo_name": "GIP-RECIA/cas",
"path": "core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/DefaultLoginWebflowConfigurer.java",
"license": "apache-2.0",
"size": 25431
} | [
"org.apereo.cas.web.flow.CasWebflowConstants",
"org.springframework.webflow.engine.Flow"
] | import org.apereo.cas.web.flow.CasWebflowConstants; import org.springframework.webflow.engine.Flow; | import org.apereo.cas.web.flow.*; import org.springframework.webflow.engine.*; | [
"org.apereo.cas",
"org.springframework.webflow"
] | org.apereo.cas; org.springframework.webflow; | 1,616,529 |
public final boolean anyMessage(int level)
{
List<FeedbackMessage> msgs = getCurrentMessages();
for (FeedbackMessage msg : msgs)
{
if (msg.isLevel(level))
{
return true;
}
}
return false;
} | final boolean function(int level) { List<FeedbackMessage> msgs = getCurrentMessages(); for (FeedbackMessage msg : msgs) { if (msg.isLevel(level)) { return true; } } return false; } | /**
* Search messages that this panel will render, and see if there is any message of the given
* level.
*
* @param level
* the level, see FeedbackMessage
* @return whether there is any message for this panel of the given level
*/ | Search messages that this panel will render, and see if there is any message of the given level | anyMessage | {
"repo_name": "martin-g/wicket-osgi",
"path": "wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java",
"license": "apache-2.0",
"size": 9410
} | [
"java.util.List",
"org.apache.wicket.feedback.FeedbackMessage"
] | import java.util.List; import org.apache.wicket.feedback.FeedbackMessage; | import java.util.*; import org.apache.wicket.feedback.*; | [
"java.util",
"org.apache.wicket"
] | java.util; org.apache.wicket; | 2,022,270 |
void sendCTCPMessage(@Nonnull String target, @Nonnull String message); | void sendCTCPMessage(@Nonnull String target, @Nonnull String message); | /**
* Sends a CTCP message to a target user or channel. Automagically adds
* the CTCP delimiter around the message and escapes the characters that
* need escaping when sending a CTCP message.
* <p>
* <i>Note: CTCP replies should not be sent this way. Catch the message
* with the {@link PrivateCTCPQueryEvent}</i>
*
* @param target the destination of the message
* @param message the message to send
* @throws IllegalArgumentException for null parameters
*/ | Sends a CTCP message to a target user or channel. Automagically adds the CTCP delimiter around the message and escapes the characters that need escaping when sending a CTCP message. Note: CTCP replies should not be sent this way. Catch the message with the <code>PrivateCTCPQueryEvent</code> | sendCTCPMessage | {
"repo_name": "ammaraskar/KittehIRCClientLib",
"path": "src/main/java/org/kitteh/irc/client/library/Client.java",
"license": "mit",
"size": 10050
} | [
"javax.annotation.Nonnull"
] | import javax.annotation.Nonnull; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 2,037,061 |
public GlobalConfig globalConfiguration();
| GlobalConfig function(); | /**
* Get Global Configuration settings
*/ | Get Global Configuration settings | globalConfiguration | {
"repo_name": "protonsint/geosdiera",
"path": "web/src/main/java/it/geosdi/era/client/service/ConfigurationRemote.java",
"license": "gpl-3.0",
"size": 2364
} | [
"it.geosdi.era.client.config.GlobalConfig"
] | import it.geosdi.era.client.config.GlobalConfig; | import it.geosdi.era.client.config.*; | [
"it.geosdi.era"
] | it.geosdi.era; | 338,451 |
private PerformanceMeter internalCreatePerformanceMeter(String scenarioId) {
PerformanceMeter performanceMeter= Performance.getDefault().createPerformanceMeter(scenarioId);
addPerformanceMeter(performanceMeter);
return performanceMeter;
} | PerformanceMeter function(String scenarioId) { PerformanceMeter performanceMeter= Performance.getDefault().createPerformanceMeter(scenarioId); addPerformanceMeter(performanceMeter); return performanceMeter; } | /**
* Create a performance meter with the given scenario id. The
* performance meter will be disposed on {@link #tearDown()}.
*
* @param scenarioId the scenario id
* @return the created performance meter
*/ | Create a performance meter with the given scenario id. The performance meter will be disposed on <code>#tearDown()</code> | internalCreatePerformanceMeter | {
"repo_name": "maxeler/eclipse",
"path": "eclipse.jdt.ui/org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/performance/PerformanceTestCase2.java",
"license": "epl-1.0",
"size": 6085
} | [
"org.eclipse.test.performance.Performance",
"org.eclipse.test.performance.PerformanceMeter"
] | import org.eclipse.test.performance.Performance; import org.eclipse.test.performance.PerformanceMeter; | import org.eclipse.test.performance.*; | [
"org.eclipse.test"
] | org.eclipse.test; | 1,724,038 |
@Override
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof AppConfig))
return false;
AppConfig ps = (AppConfig) o;
return new EqualsBuilder()
.append(packageName, ps.packageName)
.isEquals();
}
/**
* {@inheritDoc} | boolean function(Object o) { if (o == this) return true; if (!(o instanceof AppConfig)) return false; AppConfig ps = (AppConfig) o; return new EqualsBuilder() .append(packageName, ps.packageName) .isEquals(); } /** * {@inheritDoc} | /**
* Compares given {@link com.achep.acdisplay.blacklist.AppConfig} with
* this one. <b>Warning: </b> the only criterion of equality is the package name!
*/ | Compares given <code>com.achep.acdisplay.blacklist.AppConfig</code> with this one. Warning: the only criterion of equality is the package name | equals | {
"repo_name": "hgl888/AcDisplay",
"path": "project/app/src/main/java/com/achep/acdisplay/blacklist/AppConfig.java",
"license": "gpl-2.0",
"size": 8060
} | [
"org.apache.commons.lang.builder.EqualsBuilder"
] | import org.apache.commons.lang.builder.EqualsBuilder; | import org.apache.commons.lang.builder.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,930,385 |
public static int getInt(ByteBuffer bb, boolean encoded) {
return encoded ? decodeInt(bb) : bb.getInt();
} | static int function(ByteBuffer bb, boolean encoded) { return encoded ? decodeInt(bb) : bb.getInt(); } | /**
* Reads an int from a ByteBuffer and in the process change the buffer position
* @param bb bytebuffer to read from
* @param encoded true if the int was variable encoded
* @return the int value
*/ | Reads an int from a ByteBuffer and in the process change the buffer position | getInt | {
"repo_name": "msvens/mellowtech-core",
"path": "src/main/java/org/mellowtech/core/codec/CodecUtil.java",
"license": "apache-2.0",
"size": 13155
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 1,922,285 |
protected void addFieldI18nMessage(String fieldName, String bundleName, FacesMessage.Severity severity, String summaryKey, String detailKey) {
addI18nMessage(fieldName, bundleName, severity, summaryKey, null, detailKey, null);
} | void function(String fieldName, String bundleName, FacesMessage.Severity severity, String summaryKey, String detailKey) { addI18nMessage(fieldName, bundleName, severity, summaryKey, null, detailKey, null); } | /**
* Shortcut to addI18nMessage(): field message with specified severity and simple summary and detail messages.
*
* @param fieldName
* The name of the field to which the message will be attached. If null, the message is global.
* @param bundleName
* The name of the bundle where to look for the message.
* @param severity
* The severity of the message (one of the severity levels defined by JSF).
* @param summaryKey
* The key that identifies the message that will serve as summary in the resource bundle.
* @param detailKey
* The key that identifies the message that will serve as detail in the resource bundle.
*
* @see br.ufes.inf.nemo.jbutler.ejb.controller.JSFController#addI18nMessage(java.lang.String, java.lang.String,
* javax.faces.application.FacesMessage.Severity, java.lang.String, java.lang.Object[], java.lang.String,
* java.lang.Object[])
*/ | Shortcut to addI18nMessage(): field message with specified severity and simple summary and detail messages | addFieldI18nMessage | {
"repo_name": "manzoli2122/Vip",
"path": "src/br/ufes/inf/nemo/jbutler/ejb/controller/JSFController.java",
"license": "apache-2.0",
"size": 27672
} | [
"javax.faces.application.FacesMessage"
] | import javax.faces.application.FacesMessage; | import javax.faces.application.*; | [
"javax.faces"
] | javax.faces; | 2,678,044 |
void setupTable(TableName tablename) throws Exception {
setupTableWithRegionReplica(tablename, 1);
} | void setupTable(TableName tablename) throws Exception { setupTableWithRegionReplica(tablename, 1); } | /**
* Setup a clean table before we start mucking with it.
*
* It will set tbl which needs to be closed after test
*
* @throws IOException
* @throws InterruptedException
* @throws KeeperException
*/ | Setup a clean table before we start mucking with it. It will set tbl which needs to be closed after test | setupTable | {
"repo_name": "ultratendency/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/util/BaseTestHBaseFsck.java",
"license": "apache-2.0",
"size": 22285
} | [
"org.apache.hadoop.hbase.TableName"
] | import org.apache.hadoop.hbase.TableName; | import org.apache.hadoop.hbase.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,822,995 |
private float getNbBaguettesReserveesDernierService(){
float nbBaguettesReserveesDernierService = 0;
Date dateDernierService = getDateDernierService();
if(!dateDernierService.equals(new Date(0))){
Service dernierService = LecteurBase.lireService(dateDernierService);
nbBaguettesReserveesDernierService = dernierService.getNbBaguettesReservees();
}
return(nbBaguettesReserveesDernierService);
} | float function(){ float nbBaguettesReserveesDernierService = 0; Date dateDernierService = getDateDernierService(); if(!dateDernierService.equals(new Date(0))){ Service dernierService = LecteurBase.lireService(dateDernierService); nbBaguettesReserveesDernierService = dernierService.getNbBaguettesReservees(); } return(nbBaguettesReserveesDernierService); } | /**
* Renvoie le {@code nbBaguettesReservees} du dernier service.
*
* @return le nombre de baguettes reservées pour le dernier service en date.
*/ | Renvoie le nbBaguettesReservees du dernier service | getNbBaguettesReserveesDernierService | {
"repo_name": "Rbird0/kfetinfo",
"path": "src/main/java/kfetinfo/core/Service.java",
"license": "gpl-3.0",
"size": 31154
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 1,440,569 |
@Deprecated
public synchronized boolean saveToRepository(CCNTime version, E data) throws ContentEncodingException, IOException {
setData(data);
return saveToRepository(version);
} | synchronized boolean function(CCNTime version, E data) throws ContentEncodingException, IOException { setData(data); return saveToRepository(version); } | /**
* Deprecated; use either object defaults or setRepositorySave() to indicate writes
* should go to a repository, then call save() to write.
* @throws ContentEncodingException if there is an error encoding the content
* @throws IOException if there is an error reading the content from the network
*/ | Deprecated; use either object defaults or setRepositorySave() to indicate writes should go to a repository, then call save() to write | saveToRepository | {
"repo_name": "StefanoSalsano/alien-ofelia-conet-ccnx",
"path": "javasrc/src/org/ccnx/ccn/io/content/CCNNetworkObject.java",
"license": "lgpl-2.1",
"size": 68811
} | [
"java.io.IOException",
"org.ccnx.ccn.protocol.CCNTime"
] | import java.io.IOException; import org.ccnx.ccn.protocol.CCNTime; | import java.io.*; import org.ccnx.ccn.protocol.*; | [
"java.io",
"org.ccnx.ccn"
] | java.io; org.ccnx.ccn; | 180,312 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.