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 testAuthenticatingState() throws IOException {
newAuthenticatingSession();
assertEquals(AuthnState.AUTHENTICATING, session.getState());
// We're allowed to access generic authentication state.
allowSamlSsoContext();
allowAuthnEntryUrl();
allowGetPromptCounter();
// We're allowed to increment the prompt counter.
allowIncrementPromptCounter();
// We're not allowed to access ULF or credentials-gatherer state.
denyUniversalLoginForm();
denyCredentialsGathererElement();
// Transition allowed: AUTHENTICATING->IDLE
allowIdleTransition();
// Transition forbidden: AUTHENTICATING->AUTHENTICATING
newAuthenticatingSession();
denyAuthenticatingTransition();
// Return forbidden: AUTHENTICATING->AUTHENTICATING
newAuthenticatingSession();
denyAuthenticatingReturnTransition();
// Transition allowed: AUTHENTICATING->IN_UL_FORM
newAuthenticatingSession();
allowInUniversalLoginFormTransition();
// Transition allowed: AUTHENTICATING->IN_CREDENTIALS_GATHERER
newAuthenticatingSession();
allowInCredentialsGathererTransition();
}
|
void function() throws IOException { newAuthenticatingSession(); assertEquals(AuthnState.AUTHENTICATING, session.getState()); allowSamlSsoContext(); allowAuthnEntryUrl(); allowGetPromptCounter(); allowIncrementPromptCounter(); denyUniversalLoginForm(); denyCredentialsGathererElement(); allowIdleTransition(); newAuthenticatingSession(); denyAuthenticatingTransition(); newAuthenticatingSession(); denyAuthenticatingReturnTransition(); newAuthenticatingSession(); allowInUniversalLoginFormTransition(); newAuthenticatingSession(); allowInCredentialsGathererTransition(); }
|
/**
* Test access and transitions from the AUTHENTICATING state.
*/
|
Test access and transitions from the AUTHENTICATING state
|
testAuthenticatingState
|
{
"repo_name": "googlegsa/secmgr",
"path": "src/test/java/com/google/enterprise/secmgr/authncontroller/AuthnSessionTest.java",
"license": "apache-2.0",
"size": 17598
}
|
[
"com.google.enterprise.secmgr.authncontroller.AuthnSession",
"java.io.IOException"
] |
import com.google.enterprise.secmgr.authncontroller.AuthnSession; import java.io.IOException;
|
import com.google.enterprise.secmgr.authncontroller.*; import java.io.*;
|
[
"com.google.enterprise",
"java.io"
] |
com.google.enterprise; java.io;
| 2,187,807
|
@Test
public void testRenameIndexOnNonExistentIndex() {
Schema testSchema = schema(appleTable);
RenameIndex renameIndex = new RenameIndex("Apple", "Apple_3", "Apple_4");
assertFalse("Should not be applied", renameIndex.isApplied(testSchema, MockConnectionResources.build()));
}
|
void function() { Schema testSchema = schema(appleTable); RenameIndex renameIndex = new RenameIndex("Apple", STR, STR); assertFalse(STR, renameIndex.isApplied(testSchema, MockConnectionResources.build())); }
|
/**
* Tests that a task to rename an index appears unapplied when the index isn't
* present.
*/
|
Tests that a task to rename an index appears unapplied when the index isn't present
|
testRenameIndexOnNonExistentIndex
|
{
"repo_name": "badgerwithagun/morf",
"path": "morf-core/src/test/java/org/alfasoftware/morf/upgrade/TestRenameIndex.java",
"license": "apache-2.0",
"size": 8285
}
|
[
"org.alfasoftware.morf.metadata.Schema",
"org.alfasoftware.morf.metadata.SchemaUtils",
"org.junit.Assert"
] |
import org.alfasoftware.morf.metadata.Schema; import org.alfasoftware.morf.metadata.SchemaUtils; import org.junit.Assert;
|
import org.alfasoftware.morf.metadata.*; import org.junit.*;
|
[
"org.alfasoftware.morf",
"org.junit"
] |
org.alfasoftware.morf; org.junit;
| 2,060,566
|
private boolean joinElectedMaster(DiscoveryNode masterNode) {
try {
// first, make sure we can connect to the master
transportService.connectToNode(masterNode);
} catch (Exception e) {
logger.warn("failed to connect to master [{}], retrying...", e, masterNode);
return false;
}
int joinAttempt = 0; // we retry on illegal state if the master is not yet ready
while (true) {
try {
logger.trace("joining master {}", masterNode);
membership.sendJoinRequestBlocking(masterNode, clusterService.localNode(), joinTimeout);
return true;
} catch (Throwable t) {
Throwable unwrap = ExceptionsHelper.unwrapCause(t);
if (unwrap instanceof NotMasterException) {
if (++joinAttempt == this.joinRetryAttempts) {
logger.info("failed to send join request to master [{}], reason [{}], tried [{}] times", masterNode, ExceptionsHelper.detailedMessage(t), joinAttempt);
return false;
} else {
logger.trace("master {} failed with [{}]. retrying... (attempts done: [{}])", masterNode, ExceptionsHelper.detailedMessage(t), joinAttempt);
}
} else {
if (logger.isTraceEnabled()) {
logger.trace("failed to send join request to master [{}]", t, masterNode);
} else {
logger.info("failed to send join request to master [{}], reason [{}]", masterNode, ExceptionsHelper.detailedMessage(t));
}
return false;
}
}
try {
Thread.sleep(this.joinRetryDelay.millis());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
}
// visible for testing
static class NodeRemovalClusterStateTaskExecutor extends ClusterStateTaskExecutor<NodeRemovalClusterStateTaskExecutor.Task> implements ClusterStateTaskListener {
private final AllocationService allocationService;
private final ElectMasterService electMasterService;
private final Rejoin rejoin;
private final ESLogger logger;
static class Task {
private final DiscoveryNode node;
private final String reason;
public Task(final DiscoveryNode node, final String reason) {
this.node = node;
this.reason = reason;
}
|
boolean function(DiscoveryNode masterNode) { try { transportService.connectToNode(masterNode); } catch (Exception e) { logger.warn(STR, e, masterNode); return false; } int joinAttempt = 0; while (true) { try { logger.trace(STR, masterNode); membership.sendJoinRequestBlocking(masterNode, clusterService.localNode(), joinTimeout); return true; } catch (Throwable t) { Throwable unwrap = ExceptionsHelper.unwrapCause(t); if (unwrap instanceof NotMasterException) { if (++joinAttempt == this.joinRetryAttempts) { logger.info(STR, masterNode, ExceptionsHelper.detailedMessage(t), joinAttempt); return false; } else { logger.trace(STR, masterNode, ExceptionsHelper.detailedMessage(t), joinAttempt); } } else { if (logger.isTraceEnabled()) { logger.trace(STR, t, masterNode); } else { logger.info(STR, masterNode, ExceptionsHelper.detailedMessage(t)); } return false; } } try { Thread.sleep(this.joinRetryDelay.millis()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } static class NodeRemovalClusterStateTaskExecutor extends ClusterStateTaskExecutor<NodeRemovalClusterStateTaskExecutor.Task> implements ClusterStateTaskListener { private final AllocationService allocationService; private final ElectMasterService electMasterService; private final Rejoin rejoin; private final ESLogger logger; static class Task { private final DiscoveryNode node; private final String reason; public Task(final DiscoveryNode node, final String reason) { this.node = node; this.reason = reason; }
|
/**
* Join a newly elected master.
*
* @return true if successful
*/
|
Join a newly elected master
|
joinElectedMaster
|
{
"repo_name": "xiaguangme/demo",
"path": "07.ElasticSearch_demo/elasticsearch-2.4.0-sources/org/elasticsearch/discovery/zen/ZenDiscovery.java",
"license": "apache-2.0",
"size": 64832
}
|
[
"org.elasticsearch.ExceptionsHelper",
"org.elasticsearch.cluster.ClusterStateTaskExecutor",
"org.elasticsearch.cluster.ClusterStateTaskListener",
"org.elasticsearch.cluster.NotMasterException",
"org.elasticsearch.cluster.node.DiscoveryNode",
"org.elasticsearch.cluster.routing.allocation.AllocationService",
"org.elasticsearch.common.logging.ESLogger",
"org.elasticsearch.discovery.zen.elect.ElectMasterService"
] |
import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.cluster.ClusterStateTaskExecutor; import org.elasticsearch.cluster.ClusterStateTaskListener; import org.elasticsearch.cluster.NotMasterException; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.allocation.AllocationService; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.discovery.zen.elect.ElectMasterService;
|
import org.elasticsearch.*; import org.elasticsearch.cluster.*; import org.elasticsearch.cluster.node.*; import org.elasticsearch.cluster.routing.allocation.*; import org.elasticsearch.common.logging.*; import org.elasticsearch.discovery.zen.elect.*;
|
[
"org.elasticsearch",
"org.elasticsearch.cluster",
"org.elasticsearch.common",
"org.elasticsearch.discovery"
] |
org.elasticsearch; org.elasticsearch.cluster; org.elasticsearch.common; org.elasticsearch.discovery;
| 49,119
|
Object evalExpr(String expr, ImmutableMap<String, Object> env)
throws SyntaxError.Exception, EvalException, InterruptedException {
// The apparent file name (for error messages) will be "<expr>".
ParserInput input = ParserInput.fromString(expr, "<expr>");
// Create the module in which the expression is evaluated.
// It may define additional predeclared environment bindings.
Module module = Module.withPredeclared(StarlarkSemantics.DEFAULT, env);
// Resolve, compile, and execute the expression.
try (Mutability mu = Mutability.create(input.getFile())) {
StarlarkThread thread = new StarlarkThread(mu, StarlarkSemantics.DEFAULT);
return Starlark.eval(input, FileOptions.DEFAULT, module, thread);
}
}
|
Object evalExpr(String expr, ImmutableMap<String, Object> env) throws SyntaxError.Exception, EvalException, InterruptedException { ParserInput input = ParserInput.fromString(expr, STR); Module module = Module.withPredeclared(StarlarkSemantics.DEFAULT, env); try (Mutability mu = Mutability.create(input.getFile())) { StarlarkThread thread = new StarlarkThread(mu, StarlarkSemantics.DEFAULT); return Starlark.eval(input, FileOptions.DEFAULT, module, thread); } }
|
/**
* This example evaluates a Starlark expression in the specified environment and returns its
* value.
*/
|
This example evaluates a Starlark expression in the specified environment and returns its value
|
evalExpr
|
{
"repo_name": "bazelbuild/bazel",
"path": "src/test/java/net/starlark/java/eval/Examples.java",
"license": "apache-2.0",
"size": 5296
}
|
[
"com.google.common.collect.ImmutableMap",
"net.starlark.java.syntax.FileOptions",
"net.starlark.java.syntax.ParserInput",
"net.starlark.java.syntax.SyntaxError"
] |
import com.google.common.collect.ImmutableMap; import net.starlark.java.syntax.FileOptions; import net.starlark.java.syntax.ParserInput; import net.starlark.java.syntax.SyntaxError;
|
import com.google.common.collect.*; import net.starlark.java.syntax.*;
|
[
"com.google.common",
"net.starlark.java"
] |
com.google.common; net.starlark.java;
| 1,909,276
|
@Test public void connectViaHttpsToUntrustedServer() throws IOException, InterruptedException {
server.useHttps(sslContext.getSocketFactory(), false);
server.enqueue(new MockResponse()); // unused
connection = client.open(server.getUrl("/foo"));
try {
connection.getInputStream();
fail();
} catch (SSLHandshakeException expected) {
assertTrue(expected.getCause() instanceof CertificateException);
}
assertEquals(0, server.getRequestCount());
}
|
@Test void function() throws IOException, InterruptedException { server.useHttps(sslContext.getSocketFactory(), false); server.enqueue(new MockResponse()); connection = client.open(server.getUrl("/foo")); try { connection.getInputStream(); fail(); } catch (SSLHandshakeException expected) { assertTrue(expected.getCause() instanceof CertificateException); } assertEquals(0, server.getRequestCount()); }
|
/**
* Verify that we don't retry connections on certificate verification errors.
*
* http://code.google.com/p/android/issues/detail?id=13178
*/
|
Verify that we don't retry connections on certificate verification errors. HREF
|
connectViaHttpsToUntrustedServer
|
{
"repo_name": "linyh1993/okhttp",
"path": "okhttp-tests/src/test/java/com/squareup/okhttp/URLConnectionTest.java",
"license": "apache-2.0",
"size": 133144
}
|
[
"com.squareup.okhttp.mockwebserver.MockResponse",
"java.io.IOException",
"java.security.cert.CertificateException",
"javax.net.ssl.SSLHandshakeException",
"org.junit.Assert",
"org.junit.Test"
] |
import com.squareup.okhttp.mockwebserver.MockResponse; import java.io.IOException; import java.security.cert.CertificateException; import javax.net.ssl.SSLHandshakeException; import org.junit.Assert; import org.junit.Test;
|
import com.squareup.okhttp.mockwebserver.*; import java.io.*; import java.security.cert.*; import javax.net.ssl.*; import org.junit.*;
|
[
"com.squareup.okhttp",
"java.io",
"java.security",
"javax.net",
"org.junit"
] |
com.squareup.okhttp; java.io; java.security; javax.net; org.junit;
| 2,011,781
|
protected int countArtefactsRecursively(PortfolioStructure structure) {
//return countArtefactsRecursively(structure, 0);
StringBuilder sb = new StringBuilder();
sb.append("select count(link) from ").append(EPStructureToArtefactLink.class.getName()).append(" link")
.append(" inner join link.structureElement structure ")
.append(" inner join structure.rootMap root")
.append(" where root=:structureEl");
DBQuery query = dbInstance.createQuery(sb.toString());
query.setEntity("structureEl", structure);
Number count = (Number)query.uniqueResult();
return count.intValue();
}
|
int function(PortfolioStructure structure) { StringBuilder sb = new StringBuilder(); sb.append(STR).append(EPStructureToArtefactLink.class.getName()).append(STR) .append(STR) .append(STR) .append(STR); DBQuery query = dbInstance.createQuery(sb.toString()); query.setEntity(STR, structure); Number count = (Number)query.uniqueResult(); return count.intValue(); }
|
/**
* Count all artefacts (links) in a map
*/
|
Count all artefacts (links) in a map
|
countArtefactsRecursively
|
{
"repo_name": "stevenhva/InfoLearn_OpenOLAT",
"path": "src/main/java/org/olat/portfolio/manager/EPStructureManager.java",
"license": "apache-2.0",
"size": 75865
}
|
[
"org.olat.core.commons.persistence.DBQuery",
"org.olat.portfolio.model.structel.EPStructureToArtefactLink",
"org.olat.portfolio.model.structel.PortfolioStructure"
] |
import org.olat.core.commons.persistence.DBQuery; import org.olat.portfolio.model.structel.EPStructureToArtefactLink; import org.olat.portfolio.model.structel.PortfolioStructure;
|
import org.olat.core.commons.persistence.*; import org.olat.portfolio.model.structel.*;
|
[
"org.olat.core",
"org.olat.portfolio"
] |
org.olat.core; org.olat.portfolio;
| 1,045,220
|
ReplicaHandler recoverRbw(ExtendedBlock b,
long newGS, long minBytesRcvd, long maxBytesRcvd) throws IOException;
|
ReplicaHandler recoverRbw(ExtendedBlock b, long newGS, long minBytesRcvd, long maxBytesRcvd) throws IOException;
|
/**
* Recovers a RBW replica and returns the meta info of the replica.
*
* @param b block
* @param newGS the new generation stamp for the replica
* @param minBytesRcvd the minimum number of bytes that the replica could have
* @param maxBytesRcvd the maximum number of bytes that the replica could have
* @return the meta info of the replica which is being written to
* @throws IOException if an error occurs
*/
|
Recovers a RBW replica and returns the meta info of the replica
|
recoverRbw
|
{
"repo_name": "WIgor/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/FsDatasetSpi.java",
"license": "apache-2.0",
"size": 21835
}
|
[
"java.io.IOException",
"org.apache.hadoop.hdfs.protocol.ExtendedBlock",
"org.apache.hadoop.hdfs.server.datanode.ReplicaHandler"
] |
import java.io.IOException; import org.apache.hadoop.hdfs.protocol.ExtendedBlock; import org.apache.hadoop.hdfs.server.datanode.ReplicaHandler;
|
import java.io.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.hdfs.server.datanode.*;
|
[
"java.io",
"org.apache.hadoop"
] |
java.io; org.apache.hadoop;
| 2,554,205
|
@Test(expected = NoSuchElementException.class)
public void testReduceWithEmptyObservable() {
Observable<Integer> observable = Observable.range(1, 0);
observable.reduce(new Func2<Integer, Integer, Integer>() {
@Override
public Integer call(Integer t1, Integer t2) {
return t1 + t2;
}
}).toBlocking().forEach(new Action1<Integer>() {
|
@Test(expected = NoSuchElementException.class) void function() { Observable<Integer> observable = Observable.range(1, 0); observable.reduce(new Func2<Integer, Integer, Integer>() { public Integer call(Integer t1, Integer t2) { return t1 + t2; } }).toBlocking().forEach(new Action1<Integer>() {
|
/**
* A reduce should fail with an NoSuchElementException if done on an empty Observable.
*/
|
A reduce should fail with an NoSuchElementException if done on an empty Observable
|
testReduceWithEmptyObservable
|
{
"repo_name": "puniverse/RxJava",
"path": "rxjava-core/src/test/java/rx/ObservableTests.java",
"license": "apache-2.0",
"size": 37184
}
|
[
"java.util.NoSuchElementException",
"org.junit.Test"
] |
import java.util.NoSuchElementException; import org.junit.Test;
|
import java.util.*; import org.junit.*;
|
[
"java.util",
"org.junit"
] |
java.util; org.junit;
| 1,043,523
|
public ObjectType getInstanceType() {
Preconditions.checkState(hasInstanceType());
return typeOfThis;
}
|
ObjectType function() { Preconditions.checkState(hasInstanceType()); return typeOfThis; }
|
/**
* Gets the type of instance of this function.
* @throws IllegalStateException if this function is not a constructor
* (see {@link #isConstructor()}).
*/
|
Gets the type of instance of this function
|
getInstanceType
|
{
"repo_name": "Dandandan/wikiprogramming",
"path": "jsrepl/tools/closure-compiler/trunk/src/com/google/javascript/rhino/jstype/FunctionType.java",
"license": "mit",
"size": 36092
}
|
[
"com.google.common.base.Preconditions"
] |
import com.google.common.base.Preconditions;
|
import com.google.common.base.*;
|
[
"com.google.common"
] |
com.google.common;
| 1,205,561
|
public MimeMessage signMail(MimeMessage message) {
final Session session = createSession(getHost(), String.valueOf(getPort()), getMailProperties());
return signMail(message, session);
}
|
MimeMessage function(MimeMessage message) { final Session session = createSession(getHost(), String.valueOf(getPort()), getMailProperties()); return signMail(message, session); }
|
/**
* signing of mail
*
* @param message - MimeMessage to be signed
* @return MimeMessage - signed MimeMessage
*/
|
signing of mail
|
signMail
|
{
"repo_name": "NCIP/cacis",
"path": "nav/src/main/java/gov/nih/nci/cacis/nav/SendSignedMail.java",
"license": "bsd-3-clause",
"size": 10520
}
|
[
"javax.mail.Session",
"javax.mail.internet.MimeMessage"
] |
import javax.mail.Session; import javax.mail.internet.MimeMessage;
|
import javax.mail.*; import javax.mail.internet.*;
|
[
"javax.mail"
] |
javax.mail;
| 1,854,236
|
public void addFeatures(Set<String> featureNameSet) {
Iterator<String> featureNameSetIterator = featureNameSet.iterator();
while (featureNameSetIterator.hasNext()) {
String featureName = featureNameSetIterator.next();
this.addFeature(featureName);
}
}
|
void function(Set<String> featureNameSet) { Iterator<String> featureNameSetIterator = featureNameSet.iterator(); while (featureNameSetIterator.hasNext()) { String featureName = featureNameSetIterator.next(); this.addFeature(featureName); } }
|
/**
* From a set of names, create features with the names and assign them the default value
* @param add
*/
|
From a set of names, create features with the names and assign them the default value
|
addFeatures
|
{
"repo_name": "nicolashernandez/dev-star",
"path": "java-ml-nlp/src/main/java/fr/univnantes/lina/mlnlp/model/ml/FeatureListInstance.java",
"license": "apache-2.0",
"size": 5364
}
|
[
"java.util.Iterator",
"java.util.Set"
] |
import java.util.Iterator; import java.util.Set;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,532,241
|
@Test public void testTableExtend() {
sql("select * from emp extend (x int, y varchar(10) not null)")
.ok("SELECT *\n"
+ "FROM `EMP` EXTEND (`X` INTEGER, `Y` VARCHAR(10))");
sql("select * from emp extend (x int, y varchar(10) not null) where true")
.ok("SELECT *\n"
+ "FROM `EMP` EXTEND (`X` INTEGER, `Y` VARCHAR(10))\n"
+ "WHERE TRUE");
// with table alias
sql("select * from emp extend (x int, y varchar(10) not null) as t")
.ok("SELECT *\n"
+ "FROM `EMP` EXTEND (`X` INTEGER, `Y` VARCHAR(10)) AS `T`");
// as previous, without AS
sql("select * from emp extend (x int, y varchar(10) not null) t")
.ok("SELECT *\n"
+ "FROM `EMP` EXTEND (`X` INTEGER, `Y` VARCHAR(10)) AS `T`");
// with table alias and column alias list
sql("select * from emp extend (x int, y varchar(10) not null) as t(a, b)")
.ok("SELECT *\n"
+ "FROM `EMP` EXTEND (`X` INTEGER, `Y` VARCHAR(10)) AS `T` (`A`, `B`)");
// as previous, without AS
sql("select * from emp extend (x int, y varchar(10) not null) t(a, b)")
.ok("SELECT *\n"
+ "FROM `EMP` EXTEND (`X` INTEGER, `Y` VARCHAR(10)) AS `T` (`A`, `B`)");
// omit EXTEND
sql("select * from emp (x int, y varchar(10) not null) t(a, b)")
.ok("SELECT *\n"
+ "FROM `EMP` EXTEND (`X` INTEGER, `Y` VARCHAR(10)) AS `T` (`A`, `B`)");
sql("select * from emp (x int, y varchar(10) not null) where x = y")
.ok("SELECT *\n"
+ "FROM `EMP` EXTEND (`X` INTEGER, `Y` VARCHAR(10))\n"
+ "WHERE (`X` = `Y`)");
}
|
@Test void function() { sql(STR) .ok(STR + STR); sql(STR) .ok(STR + STR + STR); sql(STR) .ok(STR + STR); sql(STR) .ok(STR + STR); sql(STR) .ok(STR + STR); sql(STR) .ok(STR + STR); sql(STR) .ok(STR + STR); sql(STR) .ok(STR + STR + STR); }
|
/** Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-493">[CALCITE-493]
* Add EXTEND clause, for defining columns and their types at query/DML
* time</a>. */
|
Test case for [CALCITE-493] Add EXTEND clause, for defining columns and their types at query/DML
|
testTableExtend
|
{
"repo_name": "dindin5258/calcite",
"path": "core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java",
"license": "apache-2.0",
"size": 325850
}
|
[
"org.junit.Test"
] |
import org.junit.Test;
|
import org.junit.*;
|
[
"org.junit"
] |
org.junit;
| 1,625,272
|
public NegativeSelector createNegativeSelector(SimpleSelector selector)
throws CSSException {
throw new CSSException("Not implemented in CSS2");
}
|
NegativeSelector function(SimpleSelector selector) throws CSSException { throw new CSSException(STR); }
|
/**
* <b>SAC</b>: Implements {@link
* org.w3c.css.sac.SelectorFactory#createNegativeSelector(SimpleSelector)}.
*/
|
SAC: Implements <code>org.w3c.css.sac.SelectorFactory#createNegativeSelector(SimpleSelector)</code>
|
createNegativeSelector
|
{
"repo_name": "Squeegee/batik",
"path": "sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java",
"license": "apache-2.0",
"size": 6104
}
|
[
"org.w3c.css.sac.CSSException",
"org.w3c.css.sac.NegativeSelector",
"org.w3c.css.sac.SimpleSelector"
] |
import org.w3c.css.sac.CSSException; import org.w3c.css.sac.NegativeSelector; import org.w3c.css.sac.SimpleSelector;
|
import org.w3c.css.sac.*;
|
[
"org.w3c.css"
] |
org.w3c.css;
| 1,205,982
|
public List<FieldChange> addEntriesToGroup(Collection<BibEntry> entries) {
if (getGroup() instanceof GroupEntryChanger) {
return ((GroupEntryChanger) getGroup()).add(entries);
} else {
return Collections.emptyList();
}
}
|
List<FieldChange> function(Collection<BibEntry> entries) { if (getGroup() instanceof GroupEntryChanger) { return ((GroupEntryChanger) getGroup()).add(entries); } else { return Collections.emptyList(); } }
|
/**
* Adds the specified entries to this group.
* If the group does not support explicit adding of entries (i.e., does not implement {@link GroupEntryChanger}),
* then no action is performed.
*/
|
Adds the specified entries to this group. If the group does not support explicit adding of entries (i.e., does not implement <code>GroupEntryChanger</code>), then no action is performed
|
addEntriesToGroup
|
{
"repo_name": "zellerdev/jabref",
"path": "src/main/java/org/jabref/model/groups/GroupTreeNode.java",
"license": "mit",
"size": 11493
}
|
[
"java.util.Collection",
"java.util.Collections",
"java.util.List",
"org.jabref.model.FieldChange",
"org.jabref.model.entry.BibEntry"
] |
import java.util.Collection; import java.util.Collections; import java.util.List; import org.jabref.model.FieldChange; import org.jabref.model.entry.BibEntry;
|
import java.util.*; import org.jabref.model.*; import org.jabref.model.entry.*;
|
[
"java.util",
"org.jabref.model"
] |
java.util; org.jabref.model;
| 1,891,819
|
private void
setAttr (String a, String value)
{
Attribute attr = _el.getAttribute(a);
if (attr == null)
{
_el.addAttribute (new Attribute (a, value));
}
else
{
attr.setValue (value);
}
}
|
void function (String a, String value) { Attribute attr = _el.getAttribute(a); if (attr == null) { _el.addAttribute (new Attribute (a, value)); } else { attr.setValue (value); } }
|
/**
* set element attribute for notes
* @param a
* @param value
*/
|
set element attribute for notes
|
setAttr
|
{
"repo_name": "cst316/spring16project-Team-Boston",
"path": "src/net/sf/memoranda/NoteImpl.java",
"license": "gpl-2.0",
"size": 5601
}
|
[
"nu.xom.Attribute"
] |
import nu.xom.Attribute;
|
import nu.xom.*;
|
[
"nu.xom"
] |
nu.xom;
| 852,012
|
@Override
protected void cleanup( TestParameters Param, PrintWriter log) {
log.println("disposing impress documents");
util.DesktopTools.closeDoc(xImpressDoc);
util.DesktopTools.closeDoc(xSecondDrawDoc);
}
|
void function( TestParameters Param, PrintWriter log) { log.println(STR); util.DesktopTools.closeDoc(xImpressDoc); util.DesktopTools.closeDoc(xSecondDrawDoc); }
|
/**
* Called while disposing a <code>TestEnvironment</code>.
* Disposes Impress documents.
* @param Param test parameters
* @param log writer to log information while testing
*/
|
Called while disposing a <code>TestEnvironment</code>. Disposes Impress documents
|
cleanup
|
{
"repo_name": "Limezero/libreoffice",
"path": "qadevOOo/tests/java/mod/_sd/SdUnoPresView.java",
"license": "gpl-3.0",
"size": 10808
}
|
[
"java.io.PrintWriter"
] |
import java.io.PrintWriter;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 2,654,449
|
PlateData getImportedPlate(long imageID)
throws DSOutOfServiceException, DSAccessException
{
isSessionAlive();
try {
List results = null;
Iterator i;
IQueryPrx service = getQueryService();
if (service == null) service = getQueryService();
StringBuilder sb = new StringBuilder();
ParametersI param = new ParametersI();
param.addLong("imageID", imageID);
sb.append("select well from Well as well ");
sb.append("left outer join fetch well.plate as pt ");
sb.append("left outer join fetch well.wellSamples as ws ");
sb.append("left outer join fetch ws.image as img ");
sb.append("left outer join fetch img.pixels as pix ");
sb.append("left outer join fetch pix.pixelsType as pt ");
sb.append("where img.id = :imageID");
results = service.findAllByQuery(sb.toString(), param);
if (results.size() > 0) {
Well well = (Well) results.get(0);
if (well.getPlate() != null)
return new PlateData(well.getPlate());
return null;
}
return null;
} catch (Exception e) {
handleException(e, "Cannot load plate");
}
return null;
}
|
PlateData getImportedPlate(long imageID) throws DSOutOfServiceException, DSAccessException { isSessionAlive(); try { List results = null; Iterator i; IQueryPrx service = getQueryService(); if (service == null) service = getQueryService(); StringBuilder sb = new StringBuilder(); ParametersI param = new ParametersI(); param.addLong(STR, imageID); sb.append(STR); sb.append(STR); sb.append(STR); sb.append(STR); sb.append(STR); sb.append(STR); sb.append(STR); results = service.findAllByQuery(sb.toString(), param); if (results.size() > 0) { Well well = (Well) results.get(0); if (well.getPlate() != null) return new PlateData(well.getPlate()); return null; } return null; } catch (Exception e) { handleException(e, STR); } return null; }
|
/**
* Returns the plate where the specified image has been imported.
*
* @param imageID The identifier of the image.
* @return See above.
* @throws DSOutOfServiceException If the connection is broken, or logged
* in.
* @throws DSAccessException If an error occurred while trying to
* retrieve data from OMEDS service.
*/
|
Returns the plate where the specified image has been imported
|
getImportedPlate
|
{
"repo_name": "joshmoore/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/env/data/OMEROGateway.java",
"license": "gpl-2.0",
"size": 264705
}
|
[
"java.util.Iterator",
"java.util.List"
] |
import java.util.Iterator; import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 854,296
|
private void printUsage() {
new HelpFormatter().printHelp("Client", opts);
}
|
void function() { new HelpFormatter().printHelp(STR, opts); }
|
/**
* Helper function to print out usage
*/
|
Helper function to print out usage
|
printUsage
|
{
"repo_name": "tobiajo/hops-tensorflow",
"path": "src/main/java/io/hops/tensorflow/Client.java",
"license": "apache-2.0",
"size": 31598
}
|
[
"org.apache.commons.cli.HelpFormatter"
] |
import org.apache.commons.cli.HelpFormatter;
|
import org.apache.commons.cli.*;
|
[
"org.apache.commons"
] |
org.apache.commons;
| 1,853,999
|
private void stopEmulatorWindows(CommandExecutor executor, String pid) throws ExecutionException {
String stopCommand = "TASKKILL"; // this assumes that the command is on the path
List<String> commands = new ArrayList<String>();
// separate the commands as per the command line interface
commands.add("/PID");
commands.add(pid);
getLog().info(STOP_EMULATOR_MSG + pid);
executor.executeCommand(stopCommand, commands);
}
|
void function(CommandExecutor executor, String pid) throws ExecutionException { String stopCommand = STR; List<String> commands = new ArrayList<String>(); commands.add("/PID"); commands.add(pid); getLog().info(STOP_EMULATOR_MSG + pid); executor.executeCommand(stopCommand, commands); }
|
/**
* Stop the emulator by using the taskkill command.
*
* @param executor
* @param pid
* @throws ExecutionException
*/
|
Stop the emulator by using the taskkill command
|
stopEmulatorWindows
|
{
"repo_name": "snooplsm/njtransit",
"path": "maven-android-plugin/src/main/java/com/jayway/maven/plugins/android/AbstractEmulatorMojo.java",
"license": "gpl-3.0",
"size": 15541
}
|
[
"java.util.ArrayList",
"java.util.List"
] |
import java.util.ArrayList; import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,306,317
|
private OverriddenCucumberOptionsParameters overrideParametersWithCucumberOptions() throws MojoExecutionException {
try {
final OverriddenCucumberOptionsParameters overriddenParameters =
new OverriddenCucumberOptionsParameters()
.setTags(tags)
.setGlue(glue)
.setStrict(strict)
.setPlugins(parseFormatAndPlugins(format, plugins == null ? new ArrayList<Plugin>() : plugins))
.setMonochrome(monochrome);
if (cucumberOptions != null && cucumberOptions.length() > 0) {
final RuntimeOptions options = new RuntimeOptions(cucumberOptions);
overriddenParameters
.overrideTags(options.getFilters())
.overrideGlue(options.getGlue())
.overridePlugins(parsePlugins(options.getPluginNames()))
.overrideStrict(options.isStrict())
.overrideMonochrome(options.isMonochrome());
}
return overriddenParameters;
} catch (IllegalArgumentException e) {
throw new MojoExecutionException(this, "Invalid parameter. ", e.getMessage());
}
}
|
OverriddenCucumberOptionsParameters function() throws MojoExecutionException { try { final OverriddenCucumberOptionsParameters overriddenParameters = new OverriddenCucumberOptionsParameters() .setTags(tags) .setGlue(glue) .setStrict(strict) .setPlugins(parseFormatAndPlugins(format, plugins == null ? new ArrayList<Plugin>() : plugins)) .setMonochrome(monochrome); if (cucumberOptions != null && cucumberOptions.length() > 0) { final RuntimeOptions options = new RuntimeOptions(cucumberOptions); overriddenParameters .overrideTags(options.getFilters()) .overrideGlue(options.getGlue()) .overridePlugins(parsePlugins(options.getPluginNames())) .overrideStrict(options.isStrict()) .overrideMonochrome(options.isMonochrome()); } return overriddenParameters; } catch (IllegalArgumentException e) { throw new MojoExecutionException(this, STR, e.getMessage()); } }
|
/**
* Overrides the parameters with cucumber.options if they have been specified. Plugins have
* somewhat limited support.
*/
|
Overrides the parameters with cucumber.options if they have been specified. Plugins have somewhat limited support
|
overrideParametersWithCucumberOptions
|
{
"repo_name": "temyers/cucumber-jvm-parallel-plugin",
"path": "src/main/java/com/github/timm/cucumber/generate/GenerateRunnersMojo.java",
"license": "apache-2.0",
"size": 11913
}
|
[
"com.github.timm.cucumber.options.RuntimeOptions",
"java.util.ArrayList",
"org.apache.maven.plugin.MojoExecutionException"
] |
import com.github.timm.cucumber.options.RuntimeOptions; import java.util.ArrayList; import org.apache.maven.plugin.MojoExecutionException;
|
import com.github.timm.cucumber.options.*; import java.util.*; import org.apache.maven.plugin.*;
|
[
"com.github.timm",
"java.util",
"org.apache.maven"
] |
com.github.timm; java.util; org.apache.maven;
| 2,052,852
|
private List<ParticipantSetDataObject> getContainedSets(
ParticipantSetDataObject dataObject) {
List<ParticipantSetDataObject> result =
new ArrayList<ParticipantSetDataObject>();
List<Association> associations = this.diagram.getAssociationsWithTarget(
dataObject.getId(), Association.DIRECTION_FROM,
ParticipantSetDataObject.class);
for (Iterator<Association> itAssoc = associations.iterator(); itAssoc.hasNext();) {
Association association = itAssoc.next();
result.add((ParticipantSetDataObject)association.getSource());
}
associations = this.diagram.getAssociationsWithSource(
dataObject.getId(), Association.DIRECTION_TO,
ParticipantSetDataObject.class);
for (Iterator<Association> itAssoc = associations.iterator(); itAssoc.hasNext();) {
Association association = itAssoc.next();
result.add((ParticipantSetDataObject)association.getTarget());
}
return result;
}
|
List<ParticipantSetDataObject> function( ParticipantSetDataObject dataObject) { List<ParticipantSetDataObject> result = new ArrayList<ParticipantSetDataObject>(); List<Association> associations = this.diagram.getAssociationsWithTarget( dataObject.getId(), Association.DIRECTION_FROM, ParticipantSetDataObject.class); for (Iterator<Association> itAssoc = associations.iterator(); itAssoc.hasNext();) { Association association = itAssoc.next(); result.add((ParticipantSetDataObject)association.getSource()); } associations = this.diagram.getAssociationsWithSource( dataObject.getId(), Association.DIRECTION_TO, ParticipantSetDataObject.class); for (Iterator<Association> itAssoc = associations.iterator(); itAssoc.hasNext();) { Association association = itAssoc.next(); result.add((ParticipantSetDataObject)association.getTarget()); } return result; }
|
/**
* Determines the participant sets that are contained in the given
* participant set.
*
* <p>Participant sets are contained in another set if there is an
* association from the set to the containing set.</p>
*
* @param dataObject The participant set to get the contained references for
*
* @return A list with the determined participant set data objects. The list
* is empty if no participant sets were found.
*/
|
Determines the participant sets that are contained in the given participant set. Participant sets are contained in another set if there is an association from the set to the containing set
|
getContainedSets
|
{
"repo_name": "grasscrm/gdesigner",
"path": "editor/server/src/de/hpi/bpel4chor/transformation/factories/ParticipantsFactory.java",
"license": "apache-2.0",
"size": 51114
}
|
[
"de.hpi.bpel4chor.model.artifacts.ParticipantSetDataObject",
"de.hpi.bpel4chor.model.connections.Association",
"java.util.ArrayList",
"java.util.Iterator",
"java.util.List"
] |
import de.hpi.bpel4chor.model.artifacts.ParticipantSetDataObject; import de.hpi.bpel4chor.model.connections.Association; import java.util.ArrayList; import java.util.Iterator; import java.util.List;
|
import de.hpi.bpel4chor.model.artifacts.*; import de.hpi.bpel4chor.model.connections.*; import java.util.*;
|
[
"de.hpi.bpel4chor",
"java.util"
] |
de.hpi.bpel4chor; java.util;
| 1,825,826
|
protected boolean isSuitableTarget(EntityLivingBase p_75296_1_, boolean p_75296_2_)
{
if (p_75296_1_ == null)
{
return false;
}
else if (p_75296_1_ == this.taskOwner)
{
return false;
}
else if (!p_75296_1_.isEntityAlive())
{
return false;
}
else if (!this.taskOwner.canAttackClass(p_75296_1_.getClass()))
{
return false;
}
else
{
if (this.taskOwner instanceof IEntityOwnable && StringUtils.isNotEmpty(((IEntityOwnable)this.taskOwner).func_152113_b()))
{
if (p_75296_1_ instanceof IEntityOwnable && ((IEntityOwnable)this.taskOwner).func_152113_b().equals(((IEntityOwnable)p_75296_1_).func_152113_b()))
{
return false;
}
if (p_75296_1_ == ((IEntityOwnable)this.taskOwner).getOwner())
{
return false;
}
}
else if (p_75296_1_ instanceof EntityPlayer && !p_75296_2_ && ((EntityPlayer)p_75296_1_).capabilities.disableDamage)
{
return false;
}
if (!this.taskOwner.isWithinHomeDistance(MathHelper.floor_double(p_75296_1_.posX), MathHelper.floor_double(p_75296_1_.posY), MathHelper.floor_double(p_75296_1_.posZ)))
{
return false;
}
else if (this.shouldCheckSight && !this.taskOwner.getEntitySenses().canSee(p_75296_1_))
{
return false;
}
else
{
if (this.nearbyOnly)
{
if (--this.targetSearchDelay <= 0)
{
this.targetSearchStatus = 0;
}
if (this.targetSearchStatus == 0)
{
this.targetSearchStatus = this.canEasilyReach(p_75296_1_) ? 1 : 2;
}
if (this.targetSearchStatus == 2)
{
return false;
}
}
return true;
}
}
}
|
boolean function(EntityLivingBase p_75296_1_, boolean p_75296_2_) { if (p_75296_1_ == null) { return false; } else if (p_75296_1_ == this.taskOwner) { return false; } else if (!p_75296_1_.isEntityAlive()) { return false; } else if (!this.taskOwner.canAttackClass(p_75296_1_.getClass())) { return false; } else { if (this.taskOwner instanceof IEntityOwnable && StringUtils.isNotEmpty(((IEntityOwnable)this.taskOwner).func_152113_b())) { if (p_75296_1_ instanceof IEntityOwnable && ((IEntityOwnable)this.taskOwner).func_152113_b().equals(((IEntityOwnable)p_75296_1_).func_152113_b())) { return false; } if (p_75296_1_ == ((IEntityOwnable)this.taskOwner).getOwner()) { return false; } } else if (p_75296_1_ instanceof EntityPlayer && !p_75296_2_ && ((EntityPlayer)p_75296_1_).capabilities.disableDamage) { return false; } if (!this.taskOwner.isWithinHomeDistance(MathHelper.floor_double(p_75296_1_.posX), MathHelper.floor_double(p_75296_1_.posY), MathHelper.floor_double(p_75296_1_.posZ))) { return false; } else if (this.shouldCheckSight && !this.taskOwner.getEntitySenses().canSee(p_75296_1_)) { return false; } else { if (this.nearbyOnly) { if (--this.targetSearchDelay <= 0) { this.targetSearchStatus = 0; } if (this.targetSearchStatus == 0) { this.targetSearchStatus = this.canEasilyReach(p_75296_1_) ? 1 : 2; } if (this.targetSearchStatus == 2) { return false; } } return true; } } }
|
/**
* A method used to see if an entity is a suitable target through a number of checks.
*/
|
A method used to see if an entity is a suitable target through a number of checks
|
isSuitableTarget
|
{
"repo_name": "TheHecticByte/BananaJ1.7.10Beta",
"path": "src/net/minecraft/Server1_7_10/entity/ai/EntityAITarget.java",
"license": "gpl-3.0",
"size": 6896
}
|
[
"net.minecraft.Server1_7_10",
"org.apache.commons.lang3.StringUtils"
] |
import net.minecraft.Server1_7_10; import org.apache.commons.lang3.StringUtils;
|
import net.minecraft.*; import org.apache.commons.lang3.*;
|
[
"net.minecraft",
"org.apache.commons"
] |
net.minecraft; org.apache.commons;
| 2,149,635
|
public HttpRequest receive(final File file) throws HttpRequestException {
final OutputStream output;
try {
output = new BufferedOutputStream(new FileOutputStream(file), bufferSize);
} catch (FileNotFoundException e) {
throw new HttpRequestException(e);
}
return new CloseOperation<HttpRequest>(output, ignoreCloseExceptions) {
|
HttpRequest function(final File file) throws HttpRequestException { final OutputStream output; try { output = new BufferedOutputStream(new FileOutputStream(file), bufferSize); } catch (FileNotFoundException e) { throw new HttpRequestException(e); } return new CloseOperation<HttpRequest>(output, ignoreCloseExceptions) {
|
/**
* Stream response body to file
*
* @param file
* @return this request
* @throws HttpRequestException
*/
|
Stream response body to file
|
receive
|
{
"repo_name": "jlpuma24/colector-android-telecomsoftsrs",
"path": "app/src/main/java/co/colector/http/HttpRequest.java",
"license": "mit",
"size": 88794
}
|
[
"java.io.BufferedOutputStream",
"java.io.File",
"java.io.FileNotFoundException",
"java.io.FileOutputStream",
"java.io.OutputStream"
] |
import java.io.BufferedOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.OutputStream;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 2,068,370
|
public static void handleReflectionException(Exception ex) {
if (ex instanceof NoSuchMethodException) {
throw new IllegalStateException("Method not found: " + ex.getMessage());
}
if (ex instanceof IllegalAccessException) {
throw new IllegalStateException("Could not access method: " + ex.getMessage());
}
if (ex instanceof InvocationTargetException) {
handleInvocationTargetException((InvocationTargetException) ex);
}
if (ex instanceof RuntimeException) {
throw (RuntimeException) ex;
}
handleUnexpectedException(ex);
}
|
static void function(Exception ex) { if (ex instanceof NoSuchMethodException) { throw new IllegalStateException(STR + ex.getMessage()); } if (ex instanceof IllegalAccessException) { throw new IllegalStateException(STR + ex.getMessage()); } if (ex instanceof InvocationTargetException) { handleInvocationTargetException((InvocationTargetException) ex); } if (ex instanceof RuntimeException) { throw (RuntimeException) ex; } handleUnexpectedException(ex); }
|
/**
* Handle the given reflection exception. Should only be called if no
* checked exception is expected to be thrown by the target method.
* <p>Throws the underlying RuntimeException or Error in case of an
* InvocationTargetException with such a root cause. Throws an
* IllegalStateException with an appropriate message else.
* @param ex the reflection exception to handle
*/
|
Handle the given reflection exception. Should only be called if no checked exception is expected to be thrown by the target method. Throws the underlying RuntimeException or Error in case of an InvocationTargetException with such a root cause. Throws an IllegalStateException with an appropriate message else
|
handleReflectionException
|
{
"repo_name": "xuse/ef-orm",
"path": "common-core/src/main/java/jef/tools/reflect/ReflectionUtils.java",
"license": "apache-2.0",
"size": 22293
}
|
[
"java.lang.reflect.InvocationTargetException"
] |
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.*;
|
[
"java.lang"
] |
java.lang;
| 2,739,321
|
public void testConstructor1() {
CombinedDomainXYPlot plot = new CombinedDomainXYPlot(null);
assertEquals(null, plot.getDomainAxis());
}
|
void function() { CombinedDomainXYPlot plot = new CombinedDomainXYPlot(null); assertEquals(null, plot.getDomainAxis()); }
|
/**
* Confirm that the constructor will accept a null axis.
*/
|
Confirm that the constructor will accept a null axis
|
testConstructor1
|
{
"repo_name": "apetresc/JFreeChart",
"path": "src/test/java/org/jfree/chart/plot/junit/CombinedDomainXYPlotTests.java",
"license": "lgpl-2.1",
"size": 10382
}
|
[
"org.jfree.chart.plot.CombinedDomainXYPlot"
] |
import org.jfree.chart.plot.CombinedDomainXYPlot;
|
import org.jfree.chart.plot.*;
|
[
"org.jfree.chart"
] |
org.jfree.chart;
| 2,525,526
|
public Environment getEnvironment();
|
Environment function();
|
/**
* Gets the environment in which logical forms are evaluated.
* The returned environment may be mutated by the calling code.
*
* @return
*/
|
Gets the environment in which logical forms are evaluated. The returned environment may be mutated by the calling code
|
getEnvironment
|
{
"repo_name": "jayantk/jklol",
"path": "src/com/jayantkrish/jklol/lisp/inc/IncEval.java",
"license": "bsd-2-clause",
"size": 2151
}
|
[
"com.jayantkrish.jklol.lisp.Environment"
] |
import com.jayantkrish.jklol.lisp.Environment;
|
import com.jayantkrish.jklol.lisp.*;
|
[
"com.jayantkrish.jklol"
] |
com.jayantkrish.jklol;
| 2,210,855
|
private static DDRRecord createDDRRecordOnCommunication(AdapterConfig config, String accountId,
DDRTypeCategory category, String senderName, Map<String, String> addresses, CommunicationStatus status,
int quantity, String message, Map<String, Session> sessionKeyMap) throws Exception {
DDRType communicationCostDDRType = DDRType.getDDRType(category);
if (communicationCostDDRType != null && config != null) {
log.info(String.format("Applying charges for account: %s and adapter: %s with address: %s", accountId,
config.getConfigId(), config.getMyAddress()));
if (config.getConfigId() != null && accountId != null) {
DDRRecord ddrRecord = new DDRRecord(communicationCostDDRType.getTypeId(), config, accountId, 1);
switch (status) {
case SENT:
String fromAddress = senderName != null && !senderName.isEmpty() ? senderName
: config.getFormattedMyAddress();
ddrRecord.setFromAddress(fromAddress);
ddrRecord.setToAddress(addresses);
ddrRecord.setDirection("outbound");
break;
case RECEIVED:
ddrRecord.setFromAddress(addresses.keySet().iterator().next());
Map<String, String> toAddresses = new HashMap<String, String>();
String toAddress = config.getFormattedMyAddress();
if(sessionKeyMap != null && !sessionKeyMap.values().isEmpty()) {
String localName = sessionKeyMap.values().iterator().next().getLocalName();
if(localName != null && !localName.isEmpty()) {
toAddress = localName;
}
}
toAddresses.put(toAddress, "");
ddrRecord.setToAddress(toAddresses);
ddrRecord.setDirection("inbound");
break;
default:
throw new Exception("Unknown CommunicationStatus seen: " + status.name());
}
ddrRecord.setQuantity(quantity);
//add individual statuses
for (String address : addresses.keySet()) {
if (config.isCallAdapter() || config.isSMSAdapter()) {
address = PhoneNumberUtils.formatNumber(address, null);
}
ddrRecord.addStatusForAddress(address, status);
}
ddrRecord.addAdditionalInfo(DDR_MESSAGE_KEY, message);
ddrRecord.setSessionKeysFromMap(sessionKeyMap);
ddrRecord.addAdditionalInfo(DDRType.DDR_CATEGORY_KEY, category);
//set the ddrRecord time with server current time creationTime.
ddrRecord.setStart(TimeUtils.getServerCurrentTimeInMillis());
if(config.isPrivate()) {
ddrRecord.addAdditionalInfo(Adapter.IS_PRIVATE, true);
}
ddrRecord = ddrRecord.createOrUpdateWithLog(sessionKeyMap);
return ddrRecord;
}
}
log.warning(String.format("Not charging this communication from: %s adapterid: %s anything!!",
config.getMyAddress(), config.getConfigId()));
return null;
}
|
static DDRRecord function(AdapterConfig config, String accountId, DDRTypeCategory category, String senderName, Map<String, String> addresses, CommunicationStatus status, int quantity, String message, Map<String, Session> sessionKeyMap) throws Exception { DDRType communicationCostDDRType = DDRType.getDDRType(category); if (communicationCostDDRType != null && config != null) { log.info(String.format(STR, accountId, config.getConfigId(), config.getMyAddress())); if (config.getConfigId() != null && accountId != null) { DDRRecord ddrRecord = new DDRRecord(communicationCostDDRType.getTypeId(), config, accountId, 1); switch (status) { case SENT: String fromAddress = senderName != null && !senderName.isEmpty() ? senderName : config.getFormattedMyAddress(); ddrRecord.setFromAddress(fromAddress); ddrRecord.setToAddress(addresses); ddrRecord.setDirection(STR); break; case RECEIVED: ddrRecord.setFromAddress(addresses.keySet().iterator().next()); Map<String, String> toAddresses = new HashMap<String, String>(); String toAddress = config.getFormattedMyAddress(); if(sessionKeyMap != null && !sessionKeyMap.values().isEmpty()) { String localName = sessionKeyMap.values().iterator().next().getLocalName(); if(localName != null && !localName.isEmpty()) { toAddress = localName; } } toAddresses.put(toAddress, STRinboundSTRUnknown CommunicationStatus seen: STRNot charging this communication from: %s adapterid: %s anything!!", config.getMyAddress(), config.getConfigId())); return null; }
|
/**
* creates a ddr record based on the input parameters
*
* @param config
* picks the adpaterId, owner and myAddress from this
* @param category
* @param senderName
* will be used as the DDRRecord's fromAddress (if not null and
* outbound). Use null if {@link AdapterConfig#getMyAddress()} is
* to be used.
* @param unitType
* @param addresses
* @param status
* @param quantity
* @throws Exception
*/
|
creates a ddr record based on the input parameters
|
createDDRRecordOnCommunication
|
{
"repo_name": "almende/dialog",
"path": "dialoghandler/src/main/java/com/almende/dialog/util/DDRUtils.java",
"license": "apache-2.0",
"size": 57427
}
|
[
"com.almende.dialog.accounts.AdapterConfig",
"com.almende.dialog.model.Session",
"com.almende.dialog.model.ddr.DDRRecord",
"com.almende.dialog.model.ddr.DDRType",
"com.askfast.commons.entity.DDRRecord",
"com.askfast.commons.entity.DDRType",
"java.util.HashMap",
"java.util.Map"
] |
import com.almende.dialog.accounts.AdapterConfig; import com.almende.dialog.model.Session; import com.almende.dialog.model.ddr.DDRRecord; import com.almende.dialog.model.ddr.DDRType; import com.askfast.commons.entity.DDRRecord; import com.askfast.commons.entity.DDRType; import java.util.HashMap; import java.util.Map;
|
import com.almende.dialog.accounts.*; import com.almende.dialog.model.*; import com.almende.dialog.model.ddr.*; import com.askfast.commons.entity.*; import java.util.*;
|
[
"com.almende.dialog",
"com.askfast.commons",
"java.util"
] |
com.almende.dialog; com.askfast.commons; java.util;
| 1,379,270
|
public void setInAnimation(Animation inAnimation) {
mInAnimation = inAnimation;
}
|
void function(Animation inAnimation) { mInAnimation = inAnimation; }
|
/**
* Specifies the animation used to animate a View that enters the screen.
*
* @param inAnimation The animation started when a View enters the screen.
*
* @see #getInAnimation()
* @see #setInAnimation(android.content.Context, int)
*/
|
Specifies the animation used to animate a View that enters the screen
|
setInAnimation
|
{
"repo_name": "haikuowuya/android_system_code",
"path": "src/android/widget/ViewAnimator.java",
"license": "apache-2.0",
"size": 12170
}
|
[
"android.view.animation.Animation"
] |
import android.view.animation.Animation;
|
import android.view.animation.*;
|
[
"android.view"
] |
android.view;
| 2,565,377
|
public final void appendLabel(final short key, final Appendable toAppendTo) throws IOException {
toAppendTo.append(getString(key));
if (Locale.FRENCH.getLanguage().equals(getLocale().getLanguage())) {
toAppendTo.append("\u00A0:");
} else {
toAppendTo.append(':');
}
}
|
final void function(final short key, final Appendable toAppendTo) throws IOException { toAppendTo.append(getString(key)); if (Locale.FRENCH.getLanguage().equals(getLocale().getLanguage())) { toAppendTo.append(STR); } else { toAppendTo.append(':'); } }
|
/**
* Writes the localized string identified by the given key followed by a colon.
* The way to write the colon depends on the language.
*
* @param key the key for the desired string.
* @param toAppendTo where to write the localized string followed by a colon.
* @throws IOException if an error occurred while writing to the given destination.
*
* @since 0.8
*/
|
Writes the localized string identified by the given key followed by a colon. The way to write the colon depends on the language
|
appendLabel
|
{
"repo_name": "Geomatys/sis",
"path": "core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java",
"license": "apache-2.0",
"size": 31782
}
|
[
"java.io.IOException",
"java.util.Locale"
] |
import java.io.IOException; import java.util.Locale;
|
import java.io.*; import java.util.*;
|
[
"java.io",
"java.util"
] |
java.io; java.util;
| 776,698
|
public synchronized Map<ServerLocation, ServerLoad> getLoadMap() {
Map connectionMap = (Map) connectionLoadMap.get(null);
Map queueMap = (Map) queueLoadMap.get(null);
Map result = new HashMap();
for (Iterator itr = connectionMap.entrySet().iterator(); itr.hasNext();) {
Map.Entry next = (Entry) itr.next();
ServerLocation location = (ServerLocation) next.getKey();
LoadHolder connectionLoad = (LoadHolder) next.getValue();
LoadHolder queueLoad = (LoadHolder) queueMap.get(location);
// was asynchronously removed
if (queueLoad == null) {
continue;
}
result.put(location,
new ServerLoad(connectionLoad.getLoad(), connectionLoad.getLoadPerConnection(),
queueLoad.getLoad(), queueLoad.getLoadPerConnection()));
}
return result;
}
|
synchronized Map<ServerLocation, ServerLoad> function() { Map connectionMap = (Map) connectionLoadMap.get(null); Map queueMap = (Map) queueLoadMap.get(null); Map result = new HashMap(); for (Iterator itr = connectionMap.entrySet().iterator(); itr.hasNext();) { Map.Entry next = (Entry) itr.next(); ServerLocation location = (ServerLocation) next.getKey(); LoadHolder connectionLoad = (LoadHolder) next.getValue(); LoadHolder queueLoad = (LoadHolder) queueMap.get(location); if (queueLoad == null) { continue; } result.put(location, new ServerLoad(connectionLoad.getLoad(), connectionLoad.getLoadPerConnection(), queueLoad.getLoad(), queueLoad.getLoadPerConnection())); } return result; }
|
/**
* Test hook to get the current load for all servers Returns a map of ServerLocation->Load for
* each server.
*/
|
Test hook to get the current load for all servers Returns a map of ServerLocation->Load for each server
|
getLoadMap
|
{
"repo_name": "pdxrunner/geode",
"path": "geode-core/src/main/java/org/apache/geode/distributed/internal/LocatorLoadSnapshot.java",
"license": "apache-2.0",
"size": 24315
}
|
[
"java.util.HashMap",
"java.util.Iterator",
"java.util.Map",
"org.apache.geode.cache.server.ServerLoad"
] |
import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.apache.geode.cache.server.ServerLoad;
|
import java.util.*; import org.apache.geode.cache.server.*;
|
[
"java.util",
"org.apache.geode"
] |
java.util; org.apache.geode;
| 1,014,341
|
RecordingData getRecordingData();
|
RecordingData getRecordingData();
|
/**
* Returns the {@link RecordingData} if the recording is on. Otherwise <code>null</code>.
*
* @return Returns the {@link RecordingData} if the recording is on. Otherwise <code>null</code>
* .
*/
|
Returns the <code>RecordingData</code> if the recording is on. Otherwise <code>null</code>
|
getRecordingData
|
{
"repo_name": "andy32323/inspectIT",
"path": "CMR/src/info/novatec/inspectit/cmr/service/rest/unsafe/IUnsafeStorageService.java",
"license": "agpl-3.0",
"size": 22398
}
|
[
"info.novatec.inspectit.communication.data.cmr.RecordingData"
] |
import info.novatec.inspectit.communication.data.cmr.RecordingData;
|
import info.novatec.inspectit.communication.data.cmr.*;
|
[
"info.novatec.inspectit"
] |
info.novatec.inspectit;
| 842,181
|
public void fromQuadString(String text) throws GestionExceptionCases {
assert (!this.readOnly);
text = stripComments(text);
StringTokenizer stok = new StringTokenizer(text);
int patternCount = countTextPatterns(text);
double gridsize = Math.sqrt(patternCount / 4); // $codepro.audit.disable
// integerDivisionInFloatingPointExpression
if ((gridsize != Math.round(gridsize)) || (gridsize < 2.0D)) {
throw new GestionExceptionCases("Inconsistent grid size. "
+ patternCount + " values found instead of n * n * 4");
}
int i_gridsize = (int) Math.round(gridsize);
int ix_quad = 0;
int ix_dir = 0;
boolean lock = false;
List<Cases> quadbuffer = new ArrayList<Cases>();
while ((stok.hasMoreTokens()) && (ix_quad < i_gridsize * i_gridsize)) {
String token = stok.nextToken();
if (token.contains("[")) {
lock = true;
token = token.replaceAll("\\[", "");
}
if (token.contains("]")) {
lock = false;
token = token.replaceAll("\\]", "");
}
if (token.length() > 0) {
int pattern_code;
try {
pattern_code = Integer.parseInt(token);
} catch (NumberFormatException ex) {
throw new GestionExceptionCases("Incorrect number format '"
+ token + "'");
}
Pieces pattern = Pieces.getPatternByCode(pattern_code);
if (pattern == null) {
throw new GestionExceptionCases("Unknown pattern code "
+ pattern_code);
}
while (ix_quad >= quadbuffer.size()) {
Cases quad = new Cases();
quad.setLocked(lock);
quadbuffer.add(quad);
}
if (pattern != null) {
quadbuffer.get(ix_quad).setPattern(ix_dir, pattern);
ix_dir++;
if (ix_dir == 4) {
ix_dir = 0;
ix_quad++;
}
}
}
}
setSize(i_gridsize);
for (int qi = 0; qi < quadbuffer.size(); qi++)
quadbuffer.get(qi).copyTo(this.gridQuads.get(qi));
}
|
void function(String text) throws GestionExceptionCases { assert (!this.readOnly); text = stripComments(text); StringTokenizer stok = new StringTokenizer(text); int patternCount = countTextPatterns(text); double gridsize = Math.sqrt(patternCount / 4); if ((gridsize != Math.round(gridsize)) (gridsize < 2.0D)) { throw new GestionExceptionCases(STR + patternCount + STR); } int i_gridsize = (int) Math.round(gridsize); int ix_quad = 0; int ix_dir = 0; boolean lock = false; List<Cases> quadbuffer = new ArrayList<Cases>(); while ((stok.hasMoreTokens()) && (ix_quad < i_gridsize * i_gridsize)) { String token = stok.nextToken(); if (token.contains("[")) { lock = true; token = token.replaceAll("\\[", STR]STR\\]STRSTRIncorrect number format 'STR'STRUnknown pattern code " + pattern_code); } while (ix_quad >= quadbuffer.size()) { Cases quad = new Cases(); quad.setLocked(lock); quadbuffer.add(quad); } if (pattern != null) { quadbuffer.get(ix_quad).setPattern(ix_dir, pattern); ix_dir++; if (ix_dir == 4) { ix_dir = 0; ix_quad++; } } } } setSize(i_gridsize); for (int qi = 0; qi < quadbuffer.size(); qi++) quadbuffer.get(qi).copyTo(this.gridQuads.get(qi)); }
|
/**
* Method fromQuadString.
*
* @param text
* String
*
* @throws GestionExceptionCases
*/
|
Method fromQuadString
|
fromQuadString
|
{
"repo_name": "laynos/GLPOO_ESIEA_1415_Eternity_Souhel",
"path": "eternity/src/main/java/fr/esiea/glpoo/création_pièces_terrain/Terrain.java",
"license": "apache-2.0",
"size": 18602
}
|
[
"java.util.ArrayList",
"java.util.List",
"java.util.StringTokenizer"
] |
import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,600,189
|
public AutocompleteResponse getSuggestions(AutocompleteRequest request) {
logger.info("Received request (" + request + ")");
String wordAtCursor = getWordAtCursor(request);
List<String> suggestions = data.findCompletions(wordAtCursor);
AutocompleteResponse response = new AutocompleteResponse(request, suggestions);
return processRequest(response);
}
|
AutocompleteResponse function(AutocompleteRequest request) { logger.info(STR + request + ")"); String wordAtCursor = getWordAtCursor(request); List<String> suggestions = data.findCompletions(wordAtCursor); AutocompleteResponse response = new AutocompleteResponse(request, suggestions); return processRequest(response); }
|
/**
* Find auto-complete suggestions given a search term
* @param term - search term
* @return a list of suggestions for the given term
*/
|
Find auto-complete suggestions given a search term
|
getSuggestions
|
{
"repo_name": "CS2103JAN2017-T16-B2/main",
"path": "src/main/java/seedu/address/logic/autocomplete/AutocompleteManager.java",
"license": "mit",
"size": 9313
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 835,327
|
public void runFromConfig(final Long experimenterId) throws ServerError, IOException {
Check.notNull(experimenterId, "experimenterId");
// config is expected to be valid at this point
log.debug("Config dump: {}", config.dump());
// convert cli arguments to valid enum values or fail
final String runModeArg = config.getRunModeArg();
final RunMode runMode = RunMode.valueOf(runModeArg);
log.debug("Requested run mode: {}", runMode);
switch (runMode) {
case annotate:
runAnnotateModeFromConfig(experimenterId);
break;
case export:
runExportModeFromConfig(experimenterId);
break;
case transfer:
runTransferModeFromConfig(experimenterId);
break;
case auto:
runAutoModeFromConfig(experimenterId);
break;
default:
throw new UnsupportedOperationException("Unsupported run mode parameter");
}
}
|
void function(final Long experimenterId) throws ServerError, IOException { Check.notNull(experimenterId, STR); log.debug(STR, config.dump()); final String runModeArg = config.getRunModeArg(); final RunMode runMode = RunMode.valueOf(runModeArg); log.debug(STR, runMode); switch (runMode) { case annotate: runAnnotateModeFromConfig(experimenterId); break; case export: runExportModeFromConfig(experimenterId); break; case transfer: runTransferModeFromConfig(experimenterId); break; case auto: runAutoModeFromConfig(experimenterId); break; default: throw new UnsupportedOperationException(STR); } }
|
/**
* Main entry point to the application logic.
*
* @param experimenterId the experimenter
* @throws ServerError OMERO client or server failure
* @throws IOException CSV file read failure
*/
|
Main entry point to the application logic
|
runFromConfig
|
{
"repo_name": "imagopole/omero-csv-tools",
"path": "src/main/java/org/imagopole/omero/tools/impl/CsvAnnotator.java",
"license": "gpl-2.0",
"size": 20257
}
|
[
"java.io.IOException",
"org.imagopole.omero.tools.api.cli.Args",
"org.imagopole.omero.tools.util.Check"
] |
import java.io.IOException; import org.imagopole.omero.tools.api.cli.Args; import org.imagopole.omero.tools.util.Check;
|
import java.io.*; import org.imagopole.omero.tools.api.cli.*; import org.imagopole.omero.tools.util.*;
|
[
"java.io",
"org.imagopole.omero"
] |
java.io; org.imagopole.omero;
| 1,290,282
|
protected boolean isButtonEnabledForHttpMessageContainerState(HttpMessageContainer httpMessageContainer) {
boolean enabled = isButtonEnabledForNumberOfSelectedMessages(httpMessageContainer);
if (enabled) {
enabled = isButtonEnabledForSelectedMessages(httpMessageContainer);
}
return enabled;
}
|
boolean function(HttpMessageContainer httpMessageContainer) { boolean enabled = isButtonEnabledForNumberOfSelectedMessages(httpMessageContainer); if (enabled) { enabled = isButtonEnabledForSelectedMessages(httpMessageContainer); } return enabled; }
|
/**
* Tells whether or not the button should be enabled for the state of the given message container. Called from
* {@code isEnableForMessageContainer(MessageContainer)}.
* <p>
* By default, is only enabled if both methods {@code isButtonEnabledForNumberOfSelectedMessages(HttpMessageContainer)} and
* {@code isButtonEnabledForSelectedMessages(HttpMessageContainer)} (called only if the former method returns {@code true})
* return {@code true}.<br>
* </p>
* <p>
* Not normally overridden.
* </p>
*
* @param httpMessageContainer the message container that will be evaluated
* @return {@code true} if the button should be enabled for the message container, {@code false} otherwise.
* @see #isEnableForMessageContainer(MessageContainer)
* @see #isButtonEnabledForNumberOfSelectedMessages(HttpMessageContainer)
* @see #isButtonEnabledForSelectedMessages(HttpMessageContainer)
*/
|
Tells whether or not the button should be enabled for the state of the given message container. Called from isEnableForMessageContainer(MessageContainer). By default, is only enabled if both methods isButtonEnabledForNumberOfSelectedMessages(HttpMessageContainer) and isButtonEnabledForSelectedMessages(HttpMessageContainer) (called only if the former method returns true) return true. Not normally overridden.
|
isButtonEnabledForHttpMessageContainerState
|
{
"repo_name": "JordanGS/zaproxy",
"path": "src/org/zaproxy/zap/view/popup/PopupMenuItemHttpMessageContainer.java",
"license": "apache-2.0",
"size": 24299
}
|
[
"org.zaproxy.zap.view.messagecontainer.http.HttpMessageContainer"
] |
import org.zaproxy.zap.view.messagecontainer.http.HttpMessageContainer;
|
import org.zaproxy.zap.view.messagecontainer.http.*;
|
[
"org.zaproxy.zap"
] |
org.zaproxy.zap;
| 860,792
|
public ZFolder getFolderByUuid(String uuid) throws ServiceException {
populateFolderCache();
ZItem item = mItemCache.getByUuid(uuid);
if (!(item instanceof ZFolder)) return null;
ZFolder folder = (ZFolder) item;
return folder.isHierarchyPlaceholder() ? null : folder;
}
|
ZFolder function(String uuid) throws ServiceException { populateFolderCache(); ZItem item = mItemCache.getByUuid(uuid); if (!(item instanceof ZFolder)) return null; ZFolder folder = (ZFolder) item; return folder.isHierarchyPlaceholder() ? null : folder; }
|
/**
* find the folder with the specified UUID.
* @param uuid UUID of folder
* @return ZFolder if found, null otherwise.
* @throws com.zimbra.common.service.ServiceException on error
*/
|
find the folder with the specified UUID
|
getFolderByUuid
|
{
"repo_name": "nico01f/z-pec",
"path": "ZimbraClient/src/java/com/zimbra/client/ZMailbox.java",
"license": "mit",
"size": 216305
}
|
[
"com.zimbra.common.service.ServiceException"
] |
import com.zimbra.common.service.ServiceException;
|
import com.zimbra.common.service.*;
|
[
"com.zimbra.common"
] |
com.zimbra.common;
| 1,225,236
|
private void addVersionColumn() {
AbstractCell<CmsHistoryResourceBean> cell = new CmsVersionCell();
addColumn(CmsHistoryMessages.columnVersion(), 40, new IdentityColumn<CmsHistoryResourceBean>(cell));
}
|
void function() { AbstractCell<CmsHistoryResourceBean> cell = new CmsVersionCell(); addColumn(CmsHistoryMessages.columnVersion(), 40, new IdentityColumn<CmsHistoryResourceBean>(cell)); }
|
/**
* Adds a table column.<p>
*/
|
Adds a table column
|
addVersionColumn
|
{
"repo_name": "sbonoc/opencms-core",
"path": "src-gwt/org/opencms/gwt/client/ui/history/CmsResourceHistoryTable.java",
"license": "lgpl-2.1",
"size": 9578
}
|
[
"com.google.gwt.cell.client.AbstractCell",
"com.google.gwt.user.cellview.client.IdentityColumn",
"org.opencms.gwt.shared.CmsHistoryResourceBean"
] |
import com.google.gwt.cell.client.AbstractCell; import com.google.gwt.user.cellview.client.IdentityColumn; import org.opencms.gwt.shared.CmsHistoryResourceBean;
|
import com.google.gwt.cell.client.*; import com.google.gwt.user.cellview.client.*; import org.opencms.gwt.shared.*;
|
[
"com.google.gwt",
"org.opencms.gwt"
] |
com.google.gwt; org.opencms.gwt;
| 386,431
|
void endJSON() throws ParseException, IOException;
|
void endJSON() throws ParseException, IOException;
|
/**
* Receive notification of the end of JSON processing.
*
* @throws ParseException
*/
|
Receive notification of the end of JSON processing
|
endJSON
|
{
"repo_name": "minepass/gameserver-core",
"path": "src/embed/java/net/minepass/api/gameserver/embed/solidtx/embed/json/parser/ContentHandler.java",
"license": "mit",
"size": 3141
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 2,597,814
|
public int loadTable(final Table t, final byte[] f, boolean writeToWAL) throws IOException {
return loadTable(t, new byte[][] {f}, null, writeToWAL);
}
|
int function(final Table t, final byte[] f, boolean writeToWAL) throws IOException { return loadTable(t, new byte[][] {f}, null, writeToWAL); }
|
/**
* Load table with rows from 'aaa' to 'zzz'.
* @param t Table
* @param f Family
* @return Count of rows loaded.
* @throws IOException
*/
|
Load table with rows from 'aaa' to 'zzz'
|
loadTable
|
{
"repo_name": "narendragoyal/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java",
"license": "apache-2.0",
"size": 144216
}
|
[
"java.io.IOException",
"org.apache.hadoop.hbase.client.Table"
] |
import java.io.IOException; import org.apache.hadoop.hbase.client.Table;
|
import java.io.*; import org.apache.hadoop.hbase.client.*;
|
[
"java.io",
"org.apache.hadoop"
] |
java.io; org.apache.hadoop;
| 671,054
|
private void setupActionBar() {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
// Show the Up button in the action bar.
actionBar.setDisplayHomeAsUpEnabled(true);
}
}
|
void function() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } }
|
/**
* Set up the {@link android.app.ActionBar}, if the API is available.
*/
|
Set up the <code>android.app.ActionBar</code>, if the API is available
|
setupActionBar
|
{
"repo_name": "OlgaKuklina/GitJourney",
"path": "app/src/main/java/com/oklab/gitjourney/activities/SettingsActivity.java",
"license": "apache-2.0",
"size": 9092
}
|
[
"android.support.v7.app.ActionBar"
] |
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.*;
|
[
"android.support"
] |
android.support;
| 1,496,705
|
private static Object copyArrayGrow1(final Object array, final Class<?> newArrayComponentType) {
if (array != null) {
final int arrayLength = Array.getLength(array);
final Object newArray = Array.newInstance(array.getClass().getComponentType(), arrayLength + 1);
System.arraycopy(array, 0, newArray, 0, arrayLength);
return newArray;
}
return Array.newInstance(newArrayComponentType, 1);
}
/**
* <p>Inserts the specified element at the specified position in the array.
* Shifts the element currently at that position (if any) and any subsequent
* elements to the right (adds one to their indices).
*
* <p>This method returns a new array with the same elements of the input
* array plus the given element on the specified position. The component
* type of the returned array is always the same as that of the input
* array.
*
* <p>If the input array is {@code null}, a new one element array is returned
* whose component type is the same as the element.
*
* <pre>
* ArrayUtils.add(null, 0, null) = IllegalArgumentException
* ArrayUtils.add(null, 0, "a") = ["a"]
* ArrayUtils.add(["a"], 1, null) = ["a", null]
* ArrayUtils.add(["a"], 1, "b") = ["a", "b"]
* ArrayUtils.add(["a", "b"], 3, "c") = ["a", "b", "c"]
* </pre>
*
* @param <T> the component type of the array
* @param array the array to add the element to, may be {@code null}
|
static Object function(final Object array, final Class<?> newArrayComponentType) { if (array != null) { final int arrayLength = Array.getLength(array); final Object newArray = Array.newInstance(array.getClass().getComponentType(), arrayLength + 1); System.arraycopy(array, 0, newArray, 0, arrayLength); return newArray; } return Array.newInstance(newArrayComponentType, 1); } /** * <p>Inserts the specified element at the specified position in the array. * Shifts the element currently at that position (if any) and any subsequent * elements to the right (adds one to their indices). * * <p>This method returns a new array with the same elements of the input * array plus the given element on the specified position. The component * type of the returned array is always the same as that of the input * array. * * <p>If the input array is {@code null}, a new one element array is returned * whose component type is the same as the element. * * <pre> * ArrayUtils.add(null, 0, null) = IllegalArgumentException * ArrayUtils.add(null, 0, "a") = ["a"] * ArrayUtils.add(["a"], 1, null) = ["a", null] * ArrayUtils.add(["a"], 1, "b") = ["a", "b"] * ArrayUtils.add(["a", "b"], 3, "c") = ["a", "b", "c"] * </pre> * * @param <T> the component type of the array * @param array the array to add the element to, may be {@code null}
|
/**
* Returns a copy of the given array of size 1 greater than the argument.
* The last value of the array is left to the default value.
*
* @param array The array to copy, must not be {@code null}.
* @param newArrayComponentType If {@code array} is {@code null}, create a
* size 1 array of this type.
* @return A new copy of the array of size 1 greater than the input.
*/
|
Returns a copy of the given array of size 1 greater than the argument. The last value of the array is left to the default value
|
copyArrayGrow1
|
{
"repo_name": "weston100721/commons-lang",
"path": "src/main/java/org/apache/commons/lang3/ArrayUtils.java",
"license": "apache-2.0",
"size": 337165
}
|
[
"java.lang.reflect.Array"
] |
import java.lang.reflect.Array;
|
import java.lang.reflect.*;
|
[
"java.lang"
] |
java.lang;
| 320,657
|
public List<String> getBlacklistMatches(Integer userId) {
List<String> results = new ArrayList<String>();
List<BlacklistFilter> filters = getEnabledFilters();
for (BlacklistFilter filter : filters) {
BlacklistFilter.Result result = filter.checkUser(userId);
if (result.isBlacklisted()) {
results.add(result.getMessage());
}
}
return results;
}
|
List<String> function(Integer userId) { List<String> results = new ArrayList<String>(); List<BlacklistFilter> filters = getEnabledFilters(); for (BlacklistFilter filter : filters) { BlacklistFilter.Result result = filter.checkUser(userId); if (result.isBlacklisted()) { results.add(result.getMessage()); } } return results; }
|
/**
* Calls each blacklist filter to test the user id. If any fail, the
* response message is added to the returned results vector. An empty
* returned vector means the user id didn't match any blacklist entries.
*/
|
Calls each blacklist filter to test the user id. If any fail, the response message is added to the returned results vector. An empty returned vector means the user id didn't match any blacklist entries
|
getBlacklistMatches
|
{
"repo_name": "PaloAlto/jbilling",
"path": "classes/com/sapienter/jbilling/server/payment/tasks/PaymentFilterTask.java",
"license": "agpl-3.0",
"size": 8554
}
|
[
"com.sapienter.jbilling.server.payment.blacklist.BlacklistFilter",
"java.util.ArrayList",
"java.util.List"
] |
import com.sapienter.jbilling.server.payment.blacklist.BlacklistFilter; import java.util.ArrayList; import java.util.List;
|
import com.sapienter.jbilling.server.payment.blacklist.*; import java.util.*;
|
[
"com.sapienter.jbilling",
"java.util"
] |
com.sapienter.jbilling; java.util;
| 2,780,610
|
public static Body createBoxBody(World world, float x, float y, float width, float height) {
// Define un cuerpo f�sico din�mico con posici�n en el mundo 2D
BodyDef bodyDef = new BodyDef();
bodyDef.type = BodyType.DynamicBody;
bodyDef.position.set(x, y);
Body body = world.createBody(bodyDef);
// Define una forma circular de 6 unidades de di�metro
PolygonShape box = new PolygonShape();
box.setAsBox(width, height);
// Define un elemento f�sico y sus propiedades y le asigna la forma circular
FixtureDef fixtureDef = new FixtureDef();
// Forma del elemento f�sico
fixtureDef.shape = box;
// Densidad (kg/m^2)
fixtureDef.density = 10f;
// Coeficiente de fricci�n (0 - 1)
fixtureDef.friction = 0.8f;
// Elasticidad (0 - 1)
fixtureDef.restitution = 0.2f;
// A�ade el elemento f�sico al cuerpo del mundo 2D
Fixture fixture = body.createFixture(fixtureDef);
box.dispose();
return body;
}
|
static Body function(World world, float x, float y, float width, float height) { BodyDef bodyDef = new BodyDef(); bodyDef.type = BodyType.DynamicBody; bodyDef.position.set(x, y); Body body = world.createBody(bodyDef); PolygonShape box = new PolygonShape(); box.setAsBox(width, height); FixtureDef fixtureDef = new FixtureDef(); fixtureDef.shape = box; fixtureDef.density = 10f; fixtureDef.friction = 0.8f; fixtureDef.restitution = 0.2f; Fixture fixture = body.createFixture(fixtureDef); box.dispose(); return body; }
|
/**
* Genera un cuerpo con forma de caja
* @param world El mundo
* @param x Posici�n x
* @param y Posici�n y
* @return El cuerpo creado
*/
|
Genera un cuerpo con forma de caja
|
createBoxBody
|
{
"repo_name": "sfaci/libgdx",
"path": "box2d/box2d_textures/core/src/org/sfaci/box2d_textures/WorldGenerator.java",
"license": "gpl-2.0",
"size": 4348
}
|
[
"com.badlogic.gdx.physics.box2d.Body",
"com.badlogic.gdx.physics.box2d.BodyDef",
"com.badlogic.gdx.physics.box2d.Fixture",
"com.badlogic.gdx.physics.box2d.FixtureDef",
"com.badlogic.gdx.physics.box2d.PolygonShape",
"com.badlogic.gdx.physics.box2d.World"
] |
import com.badlogic.gdx.physics.box2d.Body; import com.badlogic.gdx.physics.box2d.BodyDef; import com.badlogic.gdx.physics.box2d.Fixture; import com.badlogic.gdx.physics.box2d.FixtureDef; import com.badlogic.gdx.physics.box2d.PolygonShape; import com.badlogic.gdx.physics.box2d.World;
|
import com.badlogic.gdx.physics.box2d.*;
|
[
"com.badlogic.gdx"
] |
com.badlogic.gdx;
| 1,540,307
|
protected int getIndexOfPath(Path path) throws IOException {
final String pathAsString = path.getPath();
final GitChangeSet changeSet = path.getChangeSet();
int i = 0;
for (String affected : changeSet.getAffectedPaths())
{
if (affected.compareTo(pathAsString) < 0)
i++;
}
return i;
}
|
int function(Path path) throws IOException { final String pathAsString = path.getPath(); final GitChangeSet changeSet = path.getChangeSet(); int i = 0; for (String affected : changeSet.getAffectedPaths()) { if (affected.compareTo(pathAsString) < 0) i++; } return i; }
|
/**
* Calculate the index of the given path in a
* sorted list of affected files
*
* @param path affected file path
* @return The index in the lexicographical sorted filelist
* @throws IOException on input or output error
*/
|
Calculate the index of the given path in a sorted list of affected files
|
getIndexOfPath
|
{
"repo_name": "v1v/git-plugin",
"path": "src/main/java/hudson/plugins/git/browser/GitRepositoryBrowser.java",
"license": "mit",
"size": 3696
}
|
[
"hudson.plugins.git.GitChangeSet",
"java.io.IOException"
] |
import hudson.plugins.git.GitChangeSet; import java.io.IOException;
|
import hudson.plugins.git.*; import java.io.*;
|
[
"hudson.plugins.git",
"java.io"
] |
hudson.plugins.git; java.io;
| 2,707,570
|
public static void awaitQuiet(CyclicBarrier barrier) {
boolean interrupted = false;
while (true) {
try {
barrier.await();
break;
}
catch (InterruptedException ignored) {
interrupted = true;
}
catch (BrokenBarrierException ignored) {
break;
}
}
if (interrupted)
Thread.currentThread().interrupt();
}
|
static void function(CyclicBarrier barrier) { boolean interrupted = false; while (true) { try { barrier.await(); break; } catch (InterruptedException ignored) { interrupted = true; } catch (BrokenBarrierException ignored) { break; } } if (interrupted) Thread.currentThread().interrupt(); }
|
/**
* Awaits for the barrier ignoring interruptions.
* <p>
* If calling thread was interrupted, interrupted status will be recovered prior to return. If the barrier is
* already broken, return immediately without throwing any exceptions.
*
* @param barrier Barrier to wait for.
*/
|
Awaits for the barrier ignoring interruptions. If calling thread was interrupted, interrupted status will be recovered prior to return. If the barrier is already broken, return immediately without throwing any exceptions
|
awaitQuiet
|
{
"repo_name": "pperalta/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java",
"license": "apache-2.0",
"size": 314980
}
|
[
"java.util.concurrent.BrokenBarrierException",
"java.util.concurrent.CyclicBarrier"
] |
import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.CyclicBarrier;
|
import java.util.concurrent.*;
|
[
"java.util"
] |
java.util;
| 1,151,868
|
@SimpleFunction(description = "Rotate the motors in a period of time.")
public void RotateInDuration(int power, int milliseconds, boolean useBrake) {
String functionName = "RotateInDuration";
try {
if (regulationEnabled)
outputTimeSpeed(functionName, 0, motorPortBitField, power, 0, milliseconds, 0, useBrake);
else
outputTimePower(functionName, 0, motorPortBitField, power, 0, milliseconds, 0, useBrake);
} catch (IllegalArgumentException e) {
form.dispatchErrorOccurredEvent(this, functionName, ErrorMessages.ERROR_EV3_ILLEGAL_ARGUMENT, functionName);
}
}
|
@SimpleFunction(description = STR) void function(int power, int milliseconds, boolean useBrake) { String functionName = STR; try { if (regulationEnabled) outputTimeSpeed(functionName, 0, motorPortBitField, power, 0, milliseconds, 0, useBrake); else outputTimePower(functionName, 0, motorPortBitField, power, 0, milliseconds, 0, useBrake); } catch (IllegalArgumentException e) { form.dispatchErrorOccurredEvent(this, functionName, ErrorMessages.ERROR_EV3_ILLEGAL_ARGUMENT, functionName); } }
|
/**
* Rotate the motors in a period of time.
*/
|
Rotate the motors in a period of time
|
RotateInDuration
|
{
"repo_name": "ewpatton/appinventor-sources",
"path": "appinventor/components/src/com/google/appinventor/components/runtime/Ev3Motors.java",
"license": "apache-2.0",
"size": 31217
}
|
[
"com.google.appinventor.components.annotations.SimpleFunction",
"com.google.appinventor.components.runtime.util.ErrorMessages"
] |
import com.google.appinventor.components.annotations.SimpleFunction; import com.google.appinventor.components.runtime.util.ErrorMessages;
|
import com.google.appinventor.components.annotations.*; import com.google.appinventor.components.runtime.util.*;
|
[
"com.google.appinventor"
] |
com.google.appinventor;
| 1,227,585
|
void stopContinuousSequenceAcquisition(int accessID) throws MicroscopeException, MicroscopeLockedException, InterruptedException, SettingException, DeviceException;
|
void stopContinuousSequenceAcquisition(int accessID) throws MicroscopeException, MicroscopeLockedException, InterruptedException, SettingException, DeviceException;
|
/**
* Stops the previously started continuous acquisition.
*
* @param accessID The access ID of the current microscope object. If the microscope is locked with a different accessID, a MicroscopeLockedException is thrown.
* @throws MicroscopeException
* @throws MicroscopeLockedException
* @throws InterruptedException
* @throws SettingException
* @throws DeviceException
*/
|
Stops the previously started continuous acquisition
|
stopContinuousSequenceAcquisition
|
{
"repo_name": "langmo/youscope",
"path": "core/api/src/main/java/org/youscope/addon/microscopeaccess/CameraDeviceInternal.java",
"license": "gpl-2.0",
"size": 7015
}
|
[
"org.youscope.common.microscope.DeviceException",
"org.youscope.common.microscope.MicroscopeException",
"org.youscope.common.microscope.MicroscopeLockedException",
"org.youscope.common.microscope.SettingException"
] |
import org.youscope.common.microscope.DeviceException; import org.youscope.common.microscope.MicroscopeException; import org.youscope.common.microscope.MicroscopeLockedException; import org.youscope.common.microscope.SettingException;
|
import org.youscope.common.microscope.*;
|
[
"org.youscope.common"
] |
org.youscope.common;
| 1,356,043
|
@Test(expectedExceptions = IllegalArgumentException.class)
public void testNullOvernightIndices() {
new DirectForwardMethodPreConstructedCurveTypeSetUp(SETUP).forIndex((OvernightIndex[]) null);
}
|
@Test(expectedExceptions = IllegalArgumentException.class) void function() { new DirectForwardMethodPreConstructedCurveTypeSetUp(SETUP).forIndex((OvernightIndex[]) null); }
|
/**
* Tests that the overnight indices cannot be null.
*/
|
Tests that the overnight indices cannot be null
|
testNullOvernightIndices
|
{
"repo_name": "McLeodMoores/starling",
"path": "projects/analytics/src/test/java/com/mcleodmoores/analytics/financial/curve/interestrate/curvebuilder/DirectForwardMethodPreConstructedCurveTypeSetUpTest.java",
"license": "apache-2.0",
"size": 2722
}
|
[
"com.mcleodmoores.analytics.financial.index.OvernightIndex",
"org.testng.annotations.Test"
] |
import com.mcleodmoores.analytics.financial.index.OvernightIndex; import org.testng.annotations.Test;
|
import com.mcleodmoores.analytics.financial.index.*; import org.testng.annotations.*;
|
[
"com.mcleodmoores.analytics",
"org.testng.annotations"
] |
com.mcleodmoores.analytics; org.testng.annotations;
| 2,715,590
|
public ServiceFuture<Void> putResourceCollectionAsync(final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(putResourceCollectionWithServiceResponseAsync(), serviceCallback);
}
|
ServiceFuture<Void> function(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(putResourceCollectionWithServiceResponseAsync(), serviceCallback); }
|
/**
* Put External Resource as a ResourceCollection.
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
|
Put External Resource as a ResourceCollection
|
putResourceCollectionAsync
|
{
"repo_name": "lmazuel/autorest",
"path": "src/generator/AutoRest.Java.Azure.Fluent.Tests/src/main/java/fixtures/azureresource/implementation/AutoRestResourceFlatteningTestServiceImpl.java",
"license": "mit",
"size": 36347
}
|
[
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] |
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
|
import com.microsoft.rest.*;
|
[
"com.microsoft.rest"
] |
com.microsoft.rest;
| 240,525
|
private JTextField getOperationCountBox() {
if (operationCountBox == null) {
operationCountBox = new JTextField();
operationCountBox.setBounds(new java.awt.Rectangle(374,334,65,32));
operationCountBox.setEditable(false);
}
return operationCountBox;
}
|
JTextField function() { if (operationCountBox == null) { operationCountBox = new JTextField(); operationCountBox.setBounds(new java.awt.Rectangle(374,334,65,32)); operationCountBox.setEditable(false); } return operationCountBox; }
|
/**
* This method initializes jTextField
*
* @return javax.swing.JTextField
*/
|
This method initializes jTextField
|
getOperationCountBox
|
{
"repo_name": "mu29/UNIST",
"path": "OOP/assign8/SortDemo.java",
"license": "mit",
"size": 7150
}
|
[
"javax.swing.JTextField"
] |
import javax.swing.JTextField;
|
import javax.swing.*;
|
[
"javax.swing"
] |
javax.swing;
| 478,022
|
@Test
public void testAddTypeToRegistryLTTypeNameEmptyStr() {
String folderConstant = "populateRegistryWithTypeLibraries/1";
//Set the environment.
setEnvironment(folderConstant);
try {
m_soaTypeRegistry.addTypeLibraryToRegistry(CATEGORY_TYPE_LIBRARY);
LibraryType type = new LibraryType();
type.setName("");
type.setLibraryInfo((TypeLibraryType) updateGlobalTableWithNewLibrary(TYPE_LIBRARY_TYPE, CATEGORY_TYPE_LIBRARY));
type.setNamespace(NAMESPACE);
type.setVersion("1.2.3");
m_soaTypeRegistry.addTypeToRegistry(type);
assertTrue("Invalid working of addTypeToRegistry(LibraryType libraryType)", false);
} catch (Exception ex) {
String exceptionMessage = "Input params \"libraryType\" cannot have a null value for name.";
String exceptionClassName = "org.ebayopensource.turmeric.tools.codegen.exception.BadInputValueException";
assertTrue("Exception class is invalid. \n Actual:" + ex.getClass().getName()
+ " \n Expected:"
+ exceptionClassName, ex.getClass().getName().equals(exceptionClassName));
assertTrue("Exception message is Invalid. \n Actual:" + ex.getMessage() + "\n Expected:" + exceptionMessage,
ex.getMessage().equals(exceptionMessage));
}
}
|
void function() { String folderConstant = STR; setEnvironment(folderConstant); try { m_soaTypeRegistry.addTypeLibraryToRegistry(CATEGORY_TYPE_LIBRARY); LibraryType type = new LibraryType(); type.setName(STR1.2.3STRInvalid working of addTypeToRegistry(LibraryType libraryType)STRInput params \STR cannot have a null value for name.STRorg.ebayopensource.turmeric.tools.codegen.exception.BadInputValueExceptionSTRException class is invalid. \n Actual:STR \n Expected:STRException message is Invalid. \n Actual:STR\n Expected:" + exceptionMessage, ex.getMessage().equals(exceptionMessage)); } }
|
/**
* Validate the working of addTypeToRegistry(LibraryType libraryType) for
* type name as empty string.
*/
|
Validate the working of addTypeToRegistry(LibraryType libraryType) for type name as empty string
|
testAddTypeToRegistryLTTypeNameEmptyStr
|
{
"repo_name": "ebayopensource/turmeric-runtime",
"path": "codegen/codegen-tools/src/test/java/org/ebayopensource/turmeric/tools/library/SOAGlobalRegistryQETest.java",
"license": "apache-2.0",
"size": 82980
}
|
[
"org.ebayopensource.turmeric.common.config.LibraryType"
] |
import org.ebayopensource.turmeric.common.config.LibraryType;
|
import org.ebayopensource.turmeric.common.config.*;
|
[
"org.ebayopensource.turmeric"
] |
org.ebayopensource.turmeric;
| 2,386,706
|
private void insertGeneratedCombAppearance(PDPageContentStream contents, PDAppearanceStream appearanceStream,
PDFont font, float fontSize) throws IOException
{
// TODO: Currently the quadding is not taken into account
// so the comb is always filled from left to right.
int maxLen = ((PDTextField) field).getMaxLen();
int numChars = Math.min(value.length(), maxLen);
PDRectangle paddingEdge = applyPadding(appearanceStream.getBBox(), 1);
float combWidth = appearanceStream.getBBox().getWidth() / maxLen;
float ascentAtFontSize = font.getFontDescriptor().getAscent() / FONTSCALE * fontSize;
float baselineOffset = paddingEdge.getLowerLeftY() +
(appearanceStream.getBBox().getHeight() - ascentAtFontSize)/2;
float prevCharWidth = 0f;
float xOffset = combWidth / 2;
for (int i = 0; i < numChars; i++)
{
String combString = value.substring(i, i+1);
float currCharWidth = font.getStringWidth(combString) / FONTSCALE * fontSize/2;
xOffset = xOffset + prevCharWidth/2 - currCharWidth/2;
contents.newLineAtOffset(xOffset, baselineOffset);
contents.showText(combString);
baselineOffset = 0;
prevCharWidth = currCharWidth;
xOffset = combWidth;
}
}
|
void function(PDPageContentStream contents, PDAppearanceStream appearanceStream, PDFont font, float fontSize) throws IOException { int maxLen = ((PDTextField) field).getMaxLen(); int numChars = Math.min(value.length(), maxLen); PDRectangle paddingEdge = applyPadding(appearanceStream.getBBox(), 1); float combWidth = appearanceStream.getBBox().getWidth() / maxLen; float ascentAtFontSize = font.getFontDescriptor().getAscent() / FONTSCALE * fontSize; float baselineOffset = paddingEdge.getLowerLeftY() + (appearanceStream.getBBox().getHeight() - ascentAtFontSize)/2; float prevCharWidth = 0f; float xOffset = combWidth / 2; for (int i = 0; i < numChars; i++) { String combString = value.substring(i, i+1); float currCharWidth = font.getStringWidth(combString) / FONTSCALE * fontSize/2; xOffset = xOffset + prevCharWidth/2 - currCharWidth/2; contents.newLineAtOffset(xOffset, baselineOffset); contents.showText(combString); baselineOffset = 0; prevCharWidth = currCharWidth; xOffset = combWidth; } }
|
/**
* Generate the appearance for comb fields.
*
* @param contents the content stream to write to
* @param appearanceStream the appearance stream used
* @param font the font to be used
* @param fontSize the font size to be used
* @throws IOException
*/
|
Generate the appearance for comb fields
|
insertGeneratedCombAppearance
|
{
"repo_name": "TomRoush/PdfBox-Android",
"path": "library/src/main/java/com/tom_roush/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java",
"license": "apache-2.0",
"size": 32273
}
|
[
"com.tom_roush.pdfbox.pdmodel.PDPageContentStream",
"com.tom_roush.pdfbox.pdmodel.common.PDRectangle",
"com.tom_roush.pdfbox.pdmodel.font.PDFont",
"com.tom_roush.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream",
"java.io.IOException"
] |
import com.tom_roush.pdfbox.pdmodel.PDPageContentStream; import com.tom_roush.pdfbox.pdmodel.common.PDRectangle; import com.tom_roush.pdfbox.pdmodel.font.PDFont; import com.tom_roush.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream; import java.io.IOException;
|
import com.tom_roush.pdfbox.pdmodel.*; import com.tom_roush.pdfbox.pdmodel.common.*; import com.tom_roush.pdfbox.pdmodel.font.*; import com.tom_roush.pdfbox.pdmodel.interactive.annotation.*; import java.io.*;
|
[
"com.tom_roush.pdfbox",
"java.io"
] |
com.tom_roush.pdfbox; java.io;
| 2,226,345
|
private static void setRMSchedulerAddress(Configuration conf, String schedulerAddress) {
if (schedulerAddress == null) {
return;
}
// If the RM scheduler address is not in the config or it's from yarn-default.xml,
// replace it with the one from the env, which is the same as the one client connected to.
String[] sources = conf.getPropertySources(YarnConfiguration.RM_SCHEDULER_ADDRESS);
if (sources == null || sources.length == 0 || "yarn-default.xml".equals(sources[sources.length - 1])) {
conf.set(YarnConfiguration.RM_SCHEDULER_ADDRESS, schedulerAddress);
}
}
|
static void function(Configuration conf, String schedulerAddress) { if (schedulerAddress == null) { return; } String[] sources = conf.getPropertySources(YarnConfiguration.RM_SCHEDULER_ADDRESS); if (sources == null sources.length == 0 STR.equals(sources[sources.length - 1])) { conf.set(YarnConfiguration.RM_SCHEDULER_ADDRESS, schedulerAddress); } }
|
/**
* Optionally sets the RM scheduler address based on the environment variable if it is not set in the cluster config.
*/
|
Optionally sets the RM scheduler address based on the environment variable if it is not set in the cluster config
|
setRMSchedulerAddress
|
{
"repo_name": "serranom/twill",
"path": "twill-yarn/src/main/java/org/apache/twill/internal/appmaster/ApplicationMasterMain.java",
"license": "apache-2.0",
"size": 14120
}
|
[
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.yarn.conf.YarnConfiguration"
] |
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.conf.*; import org.apache.hadoop.yarn.conf.*;
|
[
"org.apache.hadoop"
] |
org.apache.hadoop;
| 915,323
|
InputStream getProcessModel(String processDefinitionId);
|
InputStream getProcessModel(String processDefinitionId);
|
/**
* Gives access to a deployed process model, e.g., a BPMN 2.0 XML file,
* through a stream of bytes.
*
* @param processDefinitionId
* id of a {@link ProcessDefinition}, cannot be null.
*
* @throws ProcessEngineException
* when the process model doesn't exist.
* @throws AuthorizationException
* If the user has no {@link Permissions#READ} permission on {@link Resources#PROCESS_DEFINITION}.
*/
|
Gives access to a deployed process model, e.g., a BPMN 2.0 XML file, through a stream of bytes
|
getProcessModel
|
{
"repo_name": "xasx/camunda-bpm-platform",
"path": "engine/src/main/java/org/camunda/bpm/engine/RepositoryService.java",
"license": "apache-2.0",
"size": 37134
}
|
[
"java.io.InputStream"
] |
import java.io.InputStream;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 1,072,802
|
@JsonSerialize(include = NON_NULL)
public String getFirstname() {
return getStringProperty(PROPERTY_FIRSTNAME);
}
|
@JsonSerialize(include = NON_NULL) String function() { return getStringProperty(PROPERTY_FIRSTNAME); }
|
/**
* Returns the value of the 'firstname' property in the User object.
*
* @return the user's first name
*/
|
Returns the value of the 'firstname' property in the User object
|
getFirstname
|
{
"repo_name": "ablozhou/usergrid_android_sdk",
"path": "src/org/apache/usergrid/android/sdk/entities/User.java",
"license": "apache-2.0",
"size": 8875
}
|
[
"com.fasterxml.jackson.databind.annotation.JsonSerialize"
] |
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.*;
|
[
"com.fasterxml.jackson"
] |
com.fasterxml.jackson;
| 2,165,787
|
String getEntityHelperName(ModelEntity entity);
|
String getEntityHelperName(ModelEntity entity);
|
/**
* Gets the helper name that corresponds to this delegator and the specified
* entity
*
* @param entity
* The entity to get the helper for
* @return String with the helper name that corresponds to this delegator
* and the specified entity
*/
|
Gets the helper name that corresponds to this delegator and the specified entity
|
getEntityHelperName
|
{
"repo_name": "ilscipio/scipio-erp",
"path": "framework/entity/src/org/ofbiz/entity/Delegator.java",
"license": "apache-2.0",
"size": 49437
}
|
[
"org.ofbiz.entity.model.ModelEntity"
] |
import org.ofbiz.entity.model.ModelEntity;
|
import org.ofbiz.entity.model.*;
|
[
"org.ofbiz.entity"
] |
org.ofbiz.entity;
| 1,750,802
|
private Class<?> findClassOnClassPathOrNull(String cn) {
String path = cn.replace('.', '/').concat(".class");
if (System.getSecurityManager() == null) {
Resource res = ucp.getResource(path, false);
if (res != null) {
try {
return defineClass(cn, res);
} catch (IOException ioe) {
// TBD on how I/O errors should be propagated
}
}
|
Class<?> function(String cn) { String path = cn.replace('.', '/').concat(STR); if (System.getSecurityManager() == null) { Resource res = ucp.getResource(path, false); if (res != null) { try { return defineClass(cn, res); } catch (IOException ioe) { } }
|
/**
* Finds the class with the specified binary name on the class path.
*
* @return the resulting Class or {@code null} if not found
*/
|
Finds the class with the specified binary name on the class path
|
findClassOnClassPathOrNull
|
{
"repo_name": "dmlloyd/openjdk-modules",
"path": "jdk/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java",
"license": "gpl-2.0",
"size": 35311
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 1,859,774
|
public void testReverse() {
// rational numbers
BigRational cf = new BigRational(99);
// System.out.println("cf = " + cf);
// polynomials over rational numbers
GenPolynomialRing<BigRational> pf = new GenPolynomialRing<BigRational>(cf, rl);
//System.out.println("pf = " + pf);
GenPolynomial<BigRational> a = pf.random(kl, ll, el, q);
//System.out.println("a = " + a);
GenPolynomialRing<BigRational> pfr = pf.reverse();
GenPolynomialRing<BigRational> pfrr = pfr.reverse();
assertEquals("pf == pfrr", pf, pfrr);
//System.out.println("pfr = " + pfr);
GenPolynomial<BigRational> ar = a.reverse(pfr);
GenPolynomial<BigRational> arr = ar.reverse(pfrr);
assertEquals("a == arr", a, arr);
//System.out.println("ar = " + ar);
//System.out.println("arr = " + arr);
}
|
void function() { BigRational cf = new BigRational(99); GenPolynomialRing<BigRational> pf = new GenPolynomialRing<BigRational>(cf, rl); GenPolynomial<BigRational> a = pf.random(kl, ll, el, q); GenPolynomialRing<BigRational> pfr = pf.reverse(); GenPolynomialRing<BigRational> pfrr = pfr.reverse(); assertEquals(STR, pf, pfrr); GenPolynomial<BigRational> ar = a.reverse(pfr); GenPolynomial<BigRational> arr = ar.reverse(pfrr); assertEquals(STR, a, arr); }
|
/**
* Test reversion.
*/
|
Test reversion
|
testReverse
|
{
"repo_name": "breandan/java-algebra-system",
"path": "trc/edu/jas/poly/GenPolynomialTest.java",
"license": "gpl-2.0",
"size": 15138
}
|
[
"edu.jas.arith.BigRational"
] |
import edu.jas.arith.BigRational;
|
import edu.jas.arith.*;
|
[
"edu.jas.arith"
] |
edu.jas.arith;
| 2,452,863
|
private void createItemsTable(SQLiteDatabase db) {
String TABLE_CREATE = "CREATE TABLE " + ITEMS_TABLE + " (" + ID_COLUMN + " INTEGER PRIMARY KEY AUTOINCREMENT, " + ROW_ID_COLUMN + " INTEGER, "
+ POSITION_COLUMN + " INTEGER, " + TITLE_COLUMN + " STRING, " + INTENT_COLUMN + " STRING, " + ITEM_TYPE_COLUMN + " INTEGER, " + ICON_COLUMN
+ " STRING " + ");";
db.execSQL(TABLE_CREATE);
Log.i(LOG_TAG, ITEMS_TABLE + " table was created successfully");
}
|
void function(SQLiteDatabase db) { String TABLE_CREATE = STR + ITEMS_TABLE + STR + ID_COLUMN + STR + ROW_ID_COLUMN + STR + POSITION_COLUMN + STR + TITLE_COLUMN + STR + INTENT_COLUMN + STR + ITEM_TYPE_COLUMN + STR + ICON_COLUMN + STR + ");"; db.execSQL(TABLE_CREATE); Log.i(LOG_TAG, ITEMS_TABLE + STR); }
|
/**
* Create items table
*
* @param db
*/
|
Create items table
|
createItemsTable
|
{
"repo_name": "entertailion/Open-Launcher-for-GTV",
"path": "src/com/entertailion/android/launcher/database/DatabaseHelper.java",
"license": "apache-2.0",
"size": 13611
}
|
[
"android.database.sqlite.SQLiteDatabase",
"android.util.Log"
] |
import android.database.sqlite.SQLiteDatabase; import android.util.Log;
|
import android.database.sqlite.*; import android.util.*;
|
[
"android.database",
"android.util"
] |
android.database; android.util;
| 313,535
|
public boolean print(JspWriter out,
ELContext env,
boolean escapeXml)
throws IOException, ELException
{
//try {
Object obj = getValue(env);
if (obj == null)
return true;
else if (escapeXml) {
toStreamEscaped(out, obj);
return false;
}
else {
toStream(out, obj);
return false;
}
}
|
boolean function(JspWriter out, ELContext env, boolean escapeXml) throws IOException, ELException { Object obj = getValue(env); if (obj == null) return true; else if (escapeXml) { toStreamEscaped(out, obj); return false; } else { toStream(out, obj); return false; } }
|
/**
* Evaluates directly to the output. The method returns true
* if the default value should be printed instead.
*
* @param out the output writer
* @param env the variable environment
* @param escapeXml if true, escape reserved XML
*
* @return true if the object is null, otherwise false
*/
|
Evaluates directly to the output. The method returns true if the default value should be printed instead
|
print
|
{
"repo_name": "CleverCloud/Quercus",
"path": "resin/src/main/java/com/caucho/el/Expr.java",
"license": "gpl-2.0",
"size": 34046
}
|
[
"java.io.IOException",
"javax.el.ELContext",
"javax.el.ELException",
"javax.servlet.jsp.JspWriter"
] |
import java.io.IOException; import javax.el.ELContext; import javax.el.ELException; import javax.servlet.jsp.JspWriter;
|
import java.io.*; import javax.el.*; import javax.servlet.jsp.*;
|
[
"java.io",
"javax.el",
"javax.servlet"
] |
java.io; javax.el; javax.servlet;
| 1,958,191
|
private List<MembershipState> getActiveNamenodeRegistrations()
throws IOException {
List<MembershipState> resultList = new ArrayList<>();
if (membershipStore == null) {
return resultList;
}
GetNamespaceInfoRequest request = GetNamespaceInfoRequest.newInstance();
GetNamespaceInfoResponse response =
membershipStore.getNamespaceInfo(request);
for (FederationNamespaceInfo nsInfo : response.getNamespaceInfo()) {
// Fetch the most recent namenode registration
String nsId = nsInfo.getNameserviceId();
List<? extends FederationNamenodeContext> nns =
namenodeResolver.getNamenodesForNameserviceId(nsId);
if (nns != null) {
FederationNamenodeContext nn = nns.get(0);
if (nn instanceof MembershipState) {
resultList.add((MembershipState) nn);
}
}
}
return resultList;
}
|
List<MembershipState> function() throws IOException { List<MembershipState> resultList = new ArrayList<>(); if (membershipStore == null) { return resultList; } GetNamespaceInfoRequest request = GetNamespaceInfoRequest.newInstance(); GetNamespaceInfoResponse response = membershipStore.getNamespaceInfo(request); for (FederationNamespaceInfo nsInfo : response.getNamespaceInfo()) { String nsId = nsInfo.getNameserviceId(); List<? extends FederationNamenodeContext> nns = namenodeResolver.getNamenodesForNameserviceId(nsId); if (nns != null) { FederationNamenodeContext nn = nns.get(0); if (nn instanceof MembershipState) { resultList.add((MembershipState) nn); } } } return resultList; }
|
/**
* Fetches the most active namenode memberships for all known nameservices.
* The fetched membership may not or may not be active. Excludes expired
* memberships.
* @throws IOException if the query could not be performed.
* @return List of the most active NNs from each known nameservice.
*/
|
Fetches the most active namenode memberships for all known nameservices. The fetched membership may not or may not be active. Excludes expired memberships
|
getActiveNamenodeRegistrations
|
{
"repo_name": "JingchengDu/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/metrics/RBFMetrics.java",
"license": "apache-2.0",
"size": 34251
}
|
[
"java.io.IOException",
"java.util.ArrayList",
"java.util.List",
"org.apache.hadoop.hdfs.server.federation.resolver.FederationNamenodeContext",
"org.apache.hadoop.hdfs.server.federation.resolver.FederationNamespaceInfo",
"org.apache.hadoop.hdfs.server.federation.store.protocol.GetNamespaceInfoRequest",
"org.apache.hadoop.hdfs.server.federation.store.protocol.GetNamespaceInfoResponse",
"org.apache.hadoop.hdfs.server.federation.store.records.MembershipState"
] |
import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.hdfs.server.federation.resolver.FederationNamenodeContext; import org.apache.hadoop.hdfs.server.federation.resolver.FederationNamespaceInfo; import org.apache.hadoop.hdfs.server.federation.store.protocol.GetNamespaceInfoRequest; import org.apache.hadoop.hdfs.server.federation.store.protocol.GetNamespaceInfoResponse; import org.apache.hadoop.hdfs.server.federation.store.records.MembershipState;
|
import java.io.*; import java.util.*; import org.apache.hadoop.hdfs.server.federation.resolver.*; import org.apache.hadoop.hdfs.server.federation.store.protocol.*; import org.apache.hadoop.hdfs.server.federation.store.records.*;
|
[
"java.io",
"java.util",
"org.apache.hadoop"
] |
java.io; java.util; org.apache.hadoop;
| 2,140,021
|
public void setInsecureSSLContext(SSLContext insecureSSLContext) {
this.insecureSSLContext = insecureSSLContext;
}
|
void function(SSLContext insecureSSLContext) { this.insecureSSLContext = insecureSSLContext; }
|
/**
* Set the insecure SSLContext
* @param insecureSSLContext
*/
|
Set the insecure SSLContext
|
setInsecureSSLContext
|
{
"repo_name": "RestIt/RestIt",
"path": "src/org/restit/network/RestItClient.java",
"license": "apache-2.0",
"size": 5391
}
|
[
"javax.net.ssl.SSLContext"
] |
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.*;
|
[
"javax.net"
] |
javax.net;
| 2,052,929
|
public static OFGroup createL2DCOFloodOverMulticastTunnels(U16 index, U16 tunnelId) { //8
return OFGroup.of(0 | (index.getRaw() & 0x03ff)
| (tunnelId.getRaw() << 12)
| (L2OverlaySubType.L2_OVERLAY_FLOOD_OVER_MULTICAST_TUNNELS << 10)
| (OFDPAGroupType.L2_DATA_CENTER_OVERLAY << 28));
}
|
static OFGroup function(U16 index, U16 tunnelId) { return OFGroup.of(0 (index.getRaw() & 0x03ff) (tunnelId.getRaw() << 12) (L2OverlaySubType.L2_OVERLAY_FLOOD_OVER_MULTICAST_TUNNELS << 10) (OFDPAGroupType.L2_DATA_CENTER_OVERLAY << 28)); }
|
/**
* Only bits 0-9 of index are used. Bits 10-15 are ignored.
* @param index
* @param tunnelId
* @return
*/
|
Only bits 0-9 of index are used. Bits 10-15 are ignored
|
createL2DCOFloodOverMulticastTunnels
|
{
"repo_name": "chinhnc/floodlight",
"path": "src/main/java/net/floodlightcontroller/util/OFDPAUtils.java",
"license": "apache-2.0",
"size": 32338
}
|
[
"org.projectfloodlight.openflow.types.OFGroup"
] |
import org.projectfloodlight.openflow.types.OFGroup;
|
import org.projectfloodlight.openflow.types.*;
|
[
"org.projectfloodlight.openflow"
] |
org.projectfloodlight.openflow;
| 2,003,108
|
@SuppressWarnings("unchecked")
public default THIS withColumnOrder(Column<ITEM, ?>... columns) {
((Grid<ITEM>) this).setColumnOrder(columns);
return (THIS) this;
}
|
@SuppressWarnings(STR) default THIS function(Column<ITEM, ?>... columns) { ((Grid<ITEM>) this).setColumnOrder(columns); return (THIS) this; }
|
/**
* Sets a new column order for the grid. All columns which are not ordered
* here will remain in the order they were before as the last columns of
* grid.
*
* @param columns
* the columns in the order they should be
* @return this for method chaining
* @see Grid#setColumnOrder(Column...)
*/
|
Sets a new column order for the grid. All columns which are not ordered here will remain in the order they were before as the last columns of grid
|
withColumnOrder
|
{
"repo_name": "viydaag/vaadin-fluent-api",
"path": "src/main/java/com/vaadin/fluent/api/FluentGrid.java",
"license": "apache-2.0",
"size": 18344
}
|
[
"com.vaadin.ui.Grid"
] |
import com.vaadin.ui.Grid;
|
import com.vaadin.ui.*;
|
[
"com.vaadin.ui"
] |
com.vaadin.ui;
| 1,447,916
|
@Override
public StellarResult execute(String input, StellarShellExecutor executor) {
assert StellarAssignment.isAssignment(input);
// extract the variable and assignment expression
StellarAssignment assignment = StellarAssignment.from(input);
String varName = assignment.getVariable();
String varExpr = assignment.getStatement();
// execute the stellar expression
StellarResult result = executor.execute(varExpr);
if(result.isSuccess()) {
Object value = null;
if(result.getValue().isPresent()) {
value = result.getValue().get();
} else if(result.isValueNull()) {
value = null;
}
// variable assignment
executor.assign(varName, value, Optional.of(varExpr));
return result;
} else {
return error("Assignment expression failed");
}
}
|
StellarResult function(String input, StellarShellExecutor executor) { assert StellarAssignment.isAssignment(input); StellarAssignment assignment = StellarAssignment.from(input); String varName = assignment.getVariable(); String varExpr = assignment.getStatement(); StellarResult result = executor.execute(varExpr); if(result.isSuccess()) { Object value = null; if(result.getValue().isPresent()) { value = result.getValue().get(); } else if(result.isValueNull()) { value = null; } executor.assign(varName, value, Optional.of(varExpr)); return result; } else { return error(STR); } }
|
/**
* Handles variable assignment.
* @param input The assignment expression to execute.
* @param executor A stellar execution environment.
* @return
*/
|
Handles variable assignment
|
execute
|
{
"repo_name": "mattf-horton/incubator-metron",
"path": "metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/shell/specials/AssignmentCommand.java",
"license": "apache-2.0",
"size": 2695
}
|
[
"java.util.Optional",
"org.apache.metron.stellar.common.StellarAssignment",
"org.apache.metron.stellar.common.shell.StellarResult",
"org.apache.metron.stellar.common.shell.StellarShellExecutor"
] |
import java.util.Optional; import org.apache.metron.stellar.common.StellarAssignment; import org.apache.metron.stellar.common.shell.StellarResult; import org.apache.metron.stellar.common.shell.StellarShellExecutor;
|
import java.util.*; import org.apache.metron.stellar.common.*; import org.apache.metron.stellar.common.shell.*;
|
[
"java.util",
"org.apache.metron"
] |
java.util; org.apache.metron;
| 1,772,817
|
if (o instanceof SurfaceTypeBinding) {
return 1;
} else {
return 0;
}
}
|
if (o instanceof SurfaceTypeBinding) { return 1; } else { return 0; } }
|
/**
* Implement comparable because MultiPolygonBinding, MultiSurfaceBinding and Surface are bound
* to the same class, MultiPolygon. Since MultiPolygon is deprecated by gml3 and MultiSurface
* only has children that are also mapped to MultiPolygons, Surface always wins.
*/
|
Implement comparable because MultiPolygonBinding, MultiSurfaceBinding and Surface are bound to the same class, MultiPolygon. Since MultiPolygon is deprecated by gml3 and MultiSurface only has children that are also mapped to MultiPolygons, Surface always wins
|
compareTo
|
{
"repo_name": "geotools/geotools",
"path": "modules/extension/xsd/xsd-gml3/src/main/java/org/geotools/gml3/bindings/ext/MultiPolygonTypeBinding.java",
"license": "lgpl-2.1",
"size": 1462
}
|
[
"org.geotools.gml3.bindings.SurfaceTypeBinding"
] |
import org.geotools.gml3.bindings.SurfaceTypeBinding;
|
import org.geotools.gml3.bindings.*;
|
[
"org.geotools.gml3"
] |
org.geotools.gml3;
| 2,249,767
|
@Test
public void testParse() {
final DateField field = new DateField();
final ByteBuffer buffer = ByteBuffer.wrap(new byte[]{(byte) 0x00, (byte) 0x00, (byte) 0x8D, (byte) 0x40});
final Date value = field.parse(null, buffer, null);
Assert.assertEquals("Invalid date value.", "0100-01-01", value.toString());
}
|
void function() { final DateField field = new DateField(); final ByteBuffer buffer = ByteBuffer.wrap(new byte[]{(byte) 0x00, (byte) 0x00, (byte) 0x8D, (byte) 0x40}); final Date value = field.parse(null, buffer, null); Assert.assertEquals(STR, STR, value.toString()); }
|
/**
* Test for parse method.
*/
|
Test for parse method
|
testParse
|
{
"repo_name": "leonhad/paradoxdriver",
"path": "src/test/java/com/googlecode/paradox/data/field/DateFieldTest.java",
"license": "lgpl-3.0",
"size": 2252
}
|
[
"java.nio.ByteBuffer",
"java.sql.Date",
"org.junit.Assert"
] |
import java.nio.ByteBuffer; import java.sql.Date; import org.junit.Assert;
|
import java.nio.*; import java.sql.*; import org.junit.*;
|
[
"java.nio",
"java.sql",
"org.junit"
] |
java.nio; java.sql; org.junit;
| 494,075
|
public void displayResults(List<AcronymExpansion> results,
String errorMessage) {
Log.d(TAG, "results = " + results);
if (results == null || results.size() == 0)
Utils.showToast(this,
errorMessage);
else {
Log.d(TAG,
"displayResults() with number of acronyms = "
+ results.size());
// Add the results to the Adapter and notify changes.
mAdapter.clear();
mAdapter.addAll(results);
mAdapter.notifyDataSetChanged();
}
}
|
void function(List<AcronymExpansion> results, String errorMessage) { Log.d(TAG, STR + results); if (results == null results.size() == 0) Utils.showToast(this, errorMessage); else { Log.d(TAG, STR + results.size()); mAdapter.clear(); mAdapter.addAll(results); mAdapter.notifyDataSetChanged(); } }
|
/**
* Display the acronym expansions to the user.
*
* @param results
* List of acronym expansions to display.
*/
|
Display the acronym expansions to the user
|
displayResults
|
{
"repo_name": "geniusgeek/mobilecloud-15",
"path": "assignments/assignment1sol/app/src/main/java/vandy/mooc/activities/AcronymActivity.java",
"license": "apache-2.0",
"size": 4058
}
|
[
"android.util.Log",
"java.util.List"
] |
import android.util.Log; import java.util.List;
|
import android.util.*; import java.util.*;
|
[
"android.util",
"java.util"
] |
android.util; java.util;
| 1,219,360
|
public static void storeItems(List<Item> items) {
List<Entity> entities = new ArrayList<Entity>();
for (Item i : items)
entities.add(i.toEntity());
datastore.put(entities);
}
|
static void function(List<Item> items) { List<Entity> entities = new ArrayList<Entity>(); for (Item i : items) entities.add(i.toEntity()); datastore.put(entities); }
|
/**
* Stores multiple items in the DB at once.
*/
|
Stores multiple items in the DB at once
|
storeItems
|
{
"repo_name": "koffeinsource/kaffeefy",
"path": "src/de/kaffeeshare/server/datastore/Datastore.java",
"license": "gpl-3.0",
"size": 2379
}
|
[
"com.google.appengine.api.datastore.Entity",
"java.util.ArrayList",
"java.util.List"
] |
import com.google.appengine.api.datastore.Entity; import java.util.ArrayList; import java.util.List;
|
import com.google.appengine.api.datastore.*; import java.util.*;
|
[
"com.google.appengine",
"java.util"
] |
com.google.appengine; java.util;
| 2,196,094
|
@Test
public void test_setErrorProcessing() {
Boolean value = true;
instance.setErrorProcessing(value);
assertEquals("'setErrorProcessing' should be correct.",
value, TestsHelper.getField(instance, "errorProcessing"));
}
|
void function() { Boolean value = true; instance.setErrorProcessing(value); assertEquals(STR, value, TestsHelper.getField(instance, STR)); }
|
/**
* <p>
* Accuracy test for the method <code>setErrorProcessing(Boolean errorProcessing)</code>.<br>
* The value should be properly set.
* </p>
*/
|
Accuracy test for the method <code>setErrorProcessing(Boolean errorProcessing)</code>. The value should be properly set.
|
test_setErrorProcessing
|
{
"repo_name": "NASA-Tournament-Lab/CoECI-OPM-Service-Credit-Redeposit-Deposit-Application",
"path": "Code/SCRD_BRE/src/java/tests/gov/opm/scrd/entities/application/AuditBatchUnitTests.java",
"license": "apache-2.0",
"size": 26926
}
|
[
"gov.opm.scrd.TestsHelper",
"org.junit.Assert"
] |
import gov.opm.scrd.TestsHelper; import org.junit.Assert;
|
import gov.opm.scrd.*; import org.junit.*;
|
[
"gov.opm.scrd",
"org.junit"
] |
gov.opm.scrd; org.junit;
| 1,550,682
|
public void setProtocol(String protocol) {
Assert.hasLength(protocol, "Protocol must not be empty");
this.protocol = protocol;
}
|
void function(String protocol) { Assert.hasLength(protocol, STR); this.protocol = protocol; }
|
/**
* The Tomcat protocol to use when create the {@link Connector}.
* @param protocol the protocol
* @see Connector#Connector(String)
*/
|
The Tomcat protocol to use when create the <code>Connector</code>
|
setProtocol
|
{
"repo_name": "NetoDevel/spring-boot",
"path": "spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java",
"license": "apache-2.0",
"size": 16275
}
|
[
"org.springframework.util.Assert"
] |
import org.springframework.util.Assert;
|
import org.springframework.util.*;
|
[
"org.springframework.util"
] |
org.springframework.util;
| 2,340,525
|
public RSAPublicKey getRSAPublicKey() {
if (key != null) {
return key;
}
try {
KeyFactory kf = KeyFactory.getInstance("RSA");
key = (RSAPublicKey) kf.generatePublic(new RSAPublicKeySpec(par1,
par2));
} catch (Exception e) {
return null;
}
return key;
}
|
RSAPublicKey function() { if (key != null) { return key; } try { KeyFactory kf = KeyFactory.getInstance("RSA"); key = (RSAPublicKey) kf.generatePublic(new RSAPublicKeySpec(par1, par2)); } catch (Exception e) { return null; } return key; }
|
/**
* Returns RSAPublicKey generated using ServerRSAParams
* (rsa_modulus and rsa_exponent).
*
* @return
*/
|
Returns RSAPublicKey generated using ServerRSAParams (rsa_modulus and rsa_exponent)
|
getRSAPublicKey
|
{
"repo_name": "indashnet/InDashNet.Open.UN2000",
"path": "android/libcore/crypto/src/main/java/org/conscrypt/ServerKeyExchange.java",
"license": "apache-2.0",
"size": 5677
}
|
[
"java.security.KeyFactory",
"java.security.interfaces.RSAPublicKey",
"java.security.spec.RSAPublicKeySpec"
] |
import java.security.KeyFactory; import java.security.interfaces.RSAPublicKey; import java.security.spec.RSAPublicKeySpec;
|
import java.security.*; import java.security.interfaces.*; import java.security.spec.*;
|
[
"java.security"
] |
java.security;
| 398,785
|
@Override
public void fatal(final Marker marker, final Message msg, final Throwable t) {
if (isEnabled(Level.FATAL, marker, msg, t)) {
log(marker, FQCN, Level.FATAL, msg, t);
}
}
|
void function(final Marker marker, final Message msg, final Throwable t) { if (isEnabled(Level.FATAL, marker, msg, t)) { log(marker, FQCN, Level.FATAL, msg, t); } }
|
/**
* Logs a message with the specific Marker at the FATAL level.
*
* @param marker the marker data specific to this log statement
* @param msg the message string to be logged
* @param t A Throwable or null.
*/
|
Logs a message with the specific Marker at the FATAL level
|
fatal
|
{
"repo_name": "OuZhencong/log4j2",
"path": "log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java",
"license": "apache-2.0",
"size": 66623
}
|
[
"org.apache.logging.log4j.Level",
"org.apache.logging.log4j.Marker",
"org.apache.logging.log4j.message.Message"
] |
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.message.Message;
|
import org.apache.logging.log4j.*; import org.apache.logging.log4j.message.*;
|
[
"org.apache.logging"
] |
org.apache.logging;
| 2,038,976
|
Set<Settings> getSettings();
|
Set<Settings> getSettings();
|
/**
* get a list of different settings
*
* @return enum set of settings
*/
|
get a list of different settings
|
getSettings
|
{
"repo_name": "rolandoislas/PeripheralsPlusPlus",
"path": "src/api/java/appeng/api/util/IConfigManager.java",
"license": "gpl-2.0",
"size": 2465
}
|
[
"java.util.Set"
] |
import java.util.Set;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 238,774
|
public OperationsClient getOperations() {
return this.operations;
}
LogicManagementClientImpl(
HttpPipeline httpPipeline,
SerializerAdapter serializerAdapter,
Duration defaultPollInterval,
AzureEnvironment environment,
String subscriptionId,
String endpoint) {
this.httpPipeline = httpPipeline;
this.serializerAdapter = serializerAdapter;
this.defaultPollInterval = defaultPollInterval;
this.subscriptionId = subscriptionId;
this.endpoint = endpoint;
this.apiVersion = "2019-05-01";
this.workflows = new WorkflowsClientImpl(this);
this.workflowVersions = new WorkflowVersionsClientImpl(this);
this.workflowTriggers = new WorkflowTriggersClientImpl(this);
this.workflowVersionTriggers = new WorkflowVersionTriggersClientImpl(this);
this.workflowTriggerHistories = new WorkflowTriggerHistoriesClientImpl(this);
this.workflowRuns = new WorkflowRunsClientImpl(this);
this.workflowRunActions = new WorkflowRunActionsClientImpl(this);
this.workflowRunActionRepetitions = new WorkflowRunActionRepetitionsClientImpl(this);
this.workflowRunActionRepetitionsRequestHistories =
new WorkflowRunActionRepetitionsRequestHistoriesClientImpl(this);
this.workflowRunActionRequestHistories = new WorkflowRunActionRequestHistoriesClientImpl(this);
this.workflowRunActionScopeRepetitions = new WorkflowRunActionScopeRepetitionsClientImpl(this);
this.workflowRunOperations = new WorkflowRunOperationsClientImpl(this);
this.integrationAccounts = new IntegrationAccountsClientImpl(this);
this.integrationAccountAssemblies = new IntegrationAccountAssembliesClientImpl(this);
this.integrationAccountBatchConfigurations = new IntegrationAccountBatchConfigurationsClientImpl(this);
this.integrationAccountSchemas = new IntegrationAccountSchemasClientImpl(this);
this.integrationAccountMaps = new IntegrationAccountMapsClientImpl(this);
this.integrationAccountPartners = new IntegrationAccountPartnersClientImpl(this);
this.integrationAccountAgreements = new IntegrationAccountAgreementsClientImpl(this);
this.integrationAccountCertificates = new IntegrationAccountCertificatesClientImpl(this);
this.integrationAccountSessions = new IntegrationAccountSessionsClientImpl(this);
this.integrationServiceEnvironments = new IntegrationServiceEnvironmentsClientImpl(this);
this.integrationServiceEnvironmentSkus = new IntegrationServiceEnvironmentSkusClientImpl(this);
this.integrationServiceEnvironmentNetworkHealths =
new IntegrationServiceEnvironmentNetworkHealthsClientImpl(this);
this.integrationServiceEnvironmentManagedApis = new IntegrationServiceEnvironmentManagedApisClientImpl(this);
this.integrationServiceEnvironmentManagedApiOperations =
new IntegrationServiceEnvironmentManagedApiOperationsClientImpl(this);
this.operations = new OperationsClientImpl(this);
}
|
OperationsClient function() { return this.operations; } LogicManagementClientImpl( HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, AzureEnvironment environment, String subscriptionId, String endpoint) { this.httpPipeline = httpPipeline; this.serializerAdapter = serializerAdapter; this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; this.apiVersion = STR; this.workflows = new WorkflowsClientImpl(this); this.workflowVersions = new WorkflowVersionsClientImpl(this); this.workflowTriggers = new WorkflowTriggersClientImpl(this); this.workflowVersionTriggers = new WorkflowVersionTriggersClientImpl(this); this.workflowTriggerHistories = new WorkflowTriggerHistoriesClientImpl(this); this.workflowRuns = new WorkflowRunsClientImpl(this); this.workflowRunActions = new WorkflowRunActionsClientImpl(this); this.workflowRunActionRepetitions = new WorkflowRunActionRepetitionsClientImpl(this); this.workflowRunActionRepetitionsRequestHistories = new WorkflowRunActionRepetitionsRequestHistoriesClientImpl(this); this.workflowRunActionRequestHistories = new WorkflowRunActionRequestHistoriesClientImpl(this); this.workflowRunActionScopeRepetitions = new WorkflowRunActionScopeRepetitionsClientImpl(this); this.workflowRunOperations = new WorkflowRunOperationsClientImpl(this); this.integrationAccounts = new IntegrationAccountsClientImpl(this); this.integrationAccountAssemblies = new IntegrationAccountAssembliesClientImpl(this); this.integrationAccountBatchConfigurations = new IntegrationAccountBatchConfigurationsClientImpl(this); this.integrationAccountSchemas = new IntegrationAccountSchemasClientImpl(this); this.integrationAccountMaps = new IntegrationAccountMapsClientImpl(this); this.integrationAccountPartners = new IntegrationAccountPartnersClientImpl(this); this.integrationAccountAgreements = new IntegrationAccountAgreementsClientImpl(this); this.integrationAccountCertificates = new IntegrationAccountCertificatesClientImpl(this); this.integrationAccountSessions = new IntegrationAccountSessionsClientImpl(this); this.integrationServiceEnvironments = new IntegrationServiceEnvironmentsClientImpl(this); this.integrationServiceEnvironmentSkus = new IntegrationServiceEnvironmentSkusClientImpl(this); this.integrationServiceEnvironmentNetworkHealths = new IntegrationServiceEnvironmentNetworkHealthsClientImpl(this); this.integrationServiceEnvironmentManagedApis = new IntegrationServiceEnvironmentManagedApisClientImpl(this); this.integrationServiceEnvironmentManagedApiOperations = new IntegrationServiceEnvironmentManagedApiOperationsClientImpl(this); this.operations = new OperationsClientImpl(this); }
|
/**
* Gets the OperationsClient object to access its operations.
*
* @return the OperationsClient object.
*/
|
Gets the OperationsClient object to access its operations
|
getOperations
|
{
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/logic/azure-resourcemanager-logic/src/main/java/com/azure/resourcemanager/logic/implementation/LogicManagementClientImpl.java",
"license": "mit",
"size": 26950
}
|
[
"com.azure.core.http.HttpPipeline",
"com.azure.core.management.AzureEnvironment",
"com.azure.core.util.serializer.SerializerAdapter",
"com.azure.resourcemanager.logic.fluent.OperationsClient",
"java.time.Duration"
] |
import com.azure.core.http.HttpPipeline; import com.azure.core.management.AzureEnvironment; import com.azure.core.util.serializer.SerializerAdapter; import com.azure.resourcemanager.logic.fluent.OperationsClient; import java.time.Duration;
|
import com.azure.core.http.*; import com.azure.core.management.*; import com.azure.core.util.serializer.*; import com.azure.resourcemanager.logic.fluent.*; import java.time.*;
|
[
"com.azure.core",
"com.azure.resourcemanager",
"java.time"
] |
com.azure.core; com.azure.resourcemanager; java.time;
| 2,441,137
|
void run(Context context, String flowName) throws ActionFailedException;
|
void run(Context context, String flowName) throws ActionFailedException;
|
/**
* Run Flow.json
*
* @param context the context
* @param flowName the flow name
* @throws ActionFailedException the action failed exception
*/
|
Run Flow.json
|
run
|
{
"repo_name": "rohitghatol/cucumber-sikuli-selenium-framework",
"path": "src/main/java/com/synerzip/testframework/flow/FlowRunner.java",
"license": "apache-2.0",
"size": 824
}
|
[
"com.synerzip.testframework.context.Context",
"com.synerzip.testframework.exceptions.ActionFailedException"
] |
import com.synerzip.testframework.context.Context; import com.synerzip.testframework.exceptions.ActionFailedException;
|
import com.synerzip.testframework.context.*; import com.synerzip.testframework.exceptions.*;
|
[
"com.synerzip.testframework"
] |
com.synerzip.testframework;
| 146,664
|
public CalendarIntent location(@StringRes int resId) {
return location(obtainText(resId));
}
|
CalendarIntent function(@StringRes int resId) { return location(obtainText(resId)); }
|
/**
* Same as {@link #location(CharSequence)} for resource id.
*
* @param resId Resource id of the desired location text.
*/
|
Same as <code>#location(CharSequence)</code> for resource id
|
location
|
{
"repo_name": "android-libraries/android_intents",
"path": "library/src/calendar/java/com/albedinsky/android/intent/CalendarIntent.java",
"license": "apache-2.0",
"size": 19141
}
|
[
"android.support.annotation.StringRes"
] |
import android.support.annotation.StringRes;
|
import android.support.annotation.*;
|
[
"android.support"
] |
android.support;
| 2,791,293
|
public void setSocket(Socket socket) {
this.socket = socket;
}
|
void function(Socket socket) { this.socket = socket; }
|
/**
* Set socket
* @param socket
*/
|
Set socket
|
setSocket
|
{
"repo_name": "EliHar/mr_robot",
"path": "tools/socket/src/main/java/tcp/TCPPing.java",
"license": "mit",
"size": 1465
}
|
[
"java.net.Socket"
] |
import java.net.Socket;
|
import java.net.*;
|
[
"java.net"
] |
java.net;
| 1,822,080
|
public FormulaFactory factory() {
return this.f;
}
|
FormulaFactory function() { return this.f; }
|
/**
* Returns the factory of this parser.
* @return the factory of this parser
*/
|
Returns the factory of this parser
|
factory
|
{
"repo_name": "logic-ng/LogicNG",
"path": "src/main/java/org/logicng/io/parsers/FormulaParser.java",
"license": "apache-2.0",
"size": 5727
}
|
[
"org.logicng.formulas.FormulaFactory"
] |
import org.logicng.formulas.FormulaFactory;
|
import org.logicng.formulas.*;
|
[
"org.logicng.formulas"
] |
org.logicng.formulas;
| 2,859,242
|
public Builder deleteProjectWatch(ProjectWatchKey projectWatch) {
return deleteProjectWatches(ImmutableSet.of(projectWatch));
}
|
Builder function(ProjectWatchKey projectWatch) { return deleteProjectWatches(ImmutableSet.of(projectWatch)); }
|
/**
* Deletes a project watch for the account.
*
* <p>If no project watch with the ID exists this is a no-op.
*
* @param projectWatch project watch that should be deleted
* @return the builder
*/
|
Deletes a project watch for the account. If no project watch with the ID exists this is a no-op
|
deleteProjectWatch
|
{
"repo_name": "GerritCodeReview/gerrit",
"path": "java/com/google/gerrit/server/account/AccountDelta.java",
"license": "apache-2.0",
"size": 21143
}
|
[
"com.google.common.collect.ImmutableSet",
"com.google.gerrit.server.account.ProjectWatches"
] |
import com.google.common.collect.ImmutableSet; import com.google.gerrit.server.account.ProjectWatches;
|
import com.google.common.collect.*; import com.google.gerrit.server.account.*;
|
[
"com.google.common",
"com.google.gerrit"
] |
com.google.common; com.google.gerrit;
| 1,812,834
|
public SimpleDescription setParameters(List<Parameter> parameters) {
this.parameters = Collections.unmodifiableList(parameters);
return this;
}
|
SimpleDescription function(List<Parameter> parameters) { this.parameters = Collections.unmodifiableList(parameters); return this; }
|
/**
* Set the list of parameters.
*
* @param parameters the list of parameters
* @see #getParameters()
*/
|
Set the list of parameters
|
setParameters
|
{
"repo_name": "mickare/WorldEdit",
"path": "worldedit-core/src/main/java/com/sk89q/worldedit/util/command/SimpleDescription.java",
"license": "gpl-3.0",
"size": 3573
}
|
[
"java.util.Collections",
"java.util.List"
] |
import java.util.Collections; import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,857,655
|
public void addSingleMessage(final Message message) {
try {
final Document doc = paneMessages.getDocument();
final StyleContext sc = StyleContext.getDefaultStyleContext();
AttributeSet aset;
if (message.getOwner().equals(this.user.getName())) {
aset = sc.addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.Foreground, new Color(255,0,0));
} else {
aset = sc.addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.Foreground, new Color(0,0,0));
}
doc.insertString(doc.getLength(), message.toString() + "\n", aset);
paneMessages.setCaretPosition(paneMessages.getDocument().getLength());
} catch (BadLocationException exc) {
exc.printStackTrace();
}
}
|
void function(final Message message) { try { final Document doc = paneMessages.getDocument(); final StyleContext sc = StyleContext.getDefaultStyleContext(); AttributeSet aset; if (message.getOwner().equals(this.user.getName())) { aset = sc.addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.Foreground, new Color(255,0,0)); } else { aset = sc.addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.Foreground, new Color(0,0,0)); } doc.insertString(doc.getLength(), message.toString() + "\n", aset); paneMessages.setCaretPosition(paneMessages.getDocument().getLength()); } catch (BadLocationException exc) { exc.printStackTrace(); } }
|
/**
* Add a single message to the main pane.
*
* @param message the message to add
*/
|
Add a single message to the main pane
|
addSingleMessage
|
{
"repo_name": "llgb/chatVS",
"path": "src/verteilteSysteme/ChatWindow.java",
"license": "gpl-2.0",
"size": 8111
}
|
[
"java.awt.Color",
"javax.swing.text.AttributeSet",
"javax.swing.text.BadLocationException",
"javax.swing.text.Document",
"javax.swing.text.SimpleAttributeSet",
"javax.swing.text.StyleConstants",
"javax.swing.text.StyleContext"
] |
import java.awt.Color; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext;
|
import java.awt.*; import javax.swing.text.*;
|
[
"java.awt",
"javax.swing"
] |
java.awt; javax.swing;
| 2,233,286
|
public static void configurePeriodicSync(Context context, int syncInterval, int flexTime) {
Account account = getSyncAccount(context);
String authority = context.getString(R.string.content_authority);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// we can enable inexact timers in our periodic sync
SyncRequest request = new SyncRequest.Builder().
syncPeriodic(syncInterval, flexTime).
setSyncAdapter(account, authority).
setExtras(new Bundle()).build();
ContentResolver.requestSync(request);
} else {
ContentResolver.addPeriodicSync(account,
authority, new Bundle(), syncInterval);
}
}
|
static void function(Context context, int syncInterval, int flexTime) { Account account = getSyncAccount(context); String authority = context.getString(R.string.content_authority); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { SyncRequest request = new SyncRequest.Builder(). syncPeriodic(syncInterval, flexTime). setSyncAdapter(account, authority). setExtras(new Bundle()).build(); ContentResolver.requestSync(request); } else { ContentResolver.addPeriodicSync(account, authority, new Bundle(), syncInterval); } }
|
/**
* Helper method to schedule the sync adapter periodic execution
*/
|
Helper method to schedule the sync adapter periodic execution
|
configurePeriodicSync
|
{
"repo_name": "josemontiel/SunshineWatchFace",
"path": "app/src/main/java/com/example/android/sunshine/app/sync/SunshineSyncAdapter.java",
"license": "apache-2.0",
"size": 29520
}
|
[
"android.accounts.Account",
"android.content.ContentResolver",
"android.content.Context",
"android.content.SyncRequest",
"android.os.Build",
"android.os.Bundle"
] |
import android.accounts.Account; import android.content.ContentResolver; import android.content.Context; import android.content.SyncRequest; import android.os.Build; import android.os.Bundle;
|
import android.accounts.*; import android.content.*; import android.os.*;
|
[
"android.accounts",
"android.content",
"android.os"
] |
android.accounts; android.content; android.os;
| 998,322
|
public static Resource getResource(byte[] content) {
ResourceSet resourceSet = new ResourceSetImpl();
return getResource(content, resourceSet);
}
|
static Resource function(byte[] content) { ResourceSet resourceSet = new ResourceSetImpl(); return getResource(content, resourceSet); }
|
/**
* Returns the resource after parsing the given bytes.
*/
|
Returns the resource after parsing the given bytes
|
getResource
|
{
"repo_name": "dresden-ocl/dresdenocl",
"path": "plugins/org.dresdenocl.language.ocl.resource.ocl/src-gen/org/dresdenocl/language/ocl/resource/ocl/util/OclResourceUtil.java",
"license": "lgpl-3.0",
"size": 9728
}
|
[
"org.eclipse.emf.ecore.resource.Resource",
"org.eclipse.emf.ecore.resource.ResourceSet",
"org.eclipse.emf.ecore.resource.impl.ResourceSetImpl"
] |
import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
import org.eclipse.emf.ecore.resource.*; import org.eclipse.emf.ecore.resource.impl.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 1,194,401
|
private static long writeSharedGroupCacheSizes(PageMemory pageMem, int grpId,
long cntrsPageId, int partId, Map<Integer, Long> sizes) throws IgniteCheckedException {
byte[] data = PagePartitionCountersIO.VERSIONS.latest().serializeCacheSizes(sizes);
int items = data.length / PagePartitionCountersIO.ITEM_SIZE;
boolean init = cntrsPageId == 0;
if (init && !sizes.isEmpty())
cntrsPageId = pageMem.allocatePage(grpId, partId, PageIdAllocator.FLAG_DATA);
long nextId = cntrsPageId;
int written = 0;
while (written != items) {
final long curId = nextId;
final long curPage = pageMem.acquirePage(grpId, curId);
try {
final long curAddr = pageMem.writeLock(grpId, curId, curPage);
assert curAddr != 0;
try {
PagePartitionCountersIO partCntrIo;
if (init) {
partCntrIo = PagePartitionCountersIO.VERSIONS.latest();
partCntrIo.initNewPage(curAddr, curId, pageMem.realPageSize(grpId));
}
else
partCntrIo = PageIO.getPageIO(curAddr);
written += partCntrIo.writeCacheSizes(pageMem.realPageSize(grpId), curAddr, data, written);
nextId = partCntrIo.getNextCountersPageId(curAddr);
if (written != items && (init = nextId == 0)) {
//allocate new counters page
nextId = pageMem.allocatePage(grpId, partId, PageIdAllocator.FLAG_DATA);
partCntrIo.setNextCountersPageId(curAddr, nextId);
}
}
finally {
// Write full page
pageMem.writeUnlock(grpId, curId, curPage, Boolean.TRUE, true);
}
}
finally {
pageMem.releasePage(grpId, curId, curPage);
}
}
return cntrsPageId;
}
|
static long function(PageMemory pageMem, int grpId, long cntrsPageId, int partId, Map<Integer, Long> sizes) throws IgniteCheckedException { byte[] data = PagePartitionCountersIO.VERSIONS.latest().serializeCacheSizes(sizes); int items = data.length / PagePartitionCountersIO.ITEM_SIZE; boolean init = cntrsPageId == 0; if (init && !sizes.isEmpty()) cntrsPageId = pageMem.allocatePage(grpId, partId, PageIdAllocator.FLAG_DATA); long nextId = cntrsPageId; int written = 0; while (written != items) { final long curId = nextId; final long curPage = pageMem.acquirePage(grpId, curId); try { final long curAddr = pageMem.writeLock(grpId, curId, curPage); assert curAddr != 0; try { PagePartitionCountersIO partCntrIo; if (init) { partCntrIo = PagePartitionCountersIO.VERSIONS.latest(); partCntrIo.initNewPage(curAddr, curId, pageMem.realPageSize(grpId)); } else partCntrIo = PageIO.getPageIO(curAddr); written += partCntrIo.writeCacheSizes(pageMem.realPageSize(grpId), curAddr, data, written); nextId = partCntrIo.getNextCountersPageId(curAddr); if (written != items && (init = nextId == 0)) { nextId = pageMem.allocatePage(grpId, partId, PageIdAllocator.FLAG_DATA); partCntrIo.setNextCountersPageId(curAddr, nextId); } } finally { pageMem.writeUnlock(grpId, curId, curPage, Boolean.TRUE, true); } } finally { pageMem.releasePage(grpId, curId, curPage); } } return cntrsPageId; }
|
/**
* Saves cache sizes for all caches in shared group. Unconditionally marks pages as dirty.
*
* @param pageMem page memory to perform operations on pages.
* @param grpId Cache group ID.
* @param cntrsPageId Counters page ID, if zero is provided that means no counters page exist.
* @param partId Partition ID.
* @param sizes Cache sizes of all caches in group. Not null.
* @return new counter page Id. Same as {@code cntrsPageId} or new value if cache size pages were initialized.
* @throws IgniteCheckedException if page memory operation failed.
*/
|
Saves cache sizes for all caches in shared group. Unconditionally marks pages as dirty
|
writeSharedGroupCacheSizes
|
{
"repo_name": "ilantukh/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java",
"license": "apache-2.0",
"size": 102981
}
|
[
"java.util.Map",
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.internal.pagemem.PageIdAllocator",
"org.apache.ignite.internal.pagemem.PageMemory",
"org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO",
"org.apache.ignite.internal.processors.cache.persistence.tree.io.PagePartitionCountersIO"
] |
import java.util.Map; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.pagemem.PageIdAllocator; import org.apache.ignite.internal.pagemem.PageMemory; import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO; import org.apache.ignite.internal.processors.cache.persistence.tree.io.PagePartitionCountersIO;
|
import java.util.*; import org.apache.ignite.*; import org.apache.ignite.internal.pagemem.*; import org.apache.ignite.internal.processors.cache.persistence.tree.io.*;
|
[
"java.util",
"org.apache.ignite"
] |
java.util; org.apache.ignite;
| 630,036
|
public void putServiceInstance(Service service, InstancePublishInfo instance) {
if (null == publishers.put(service, parseToHealthCheckInstance(instance))) {
MetricsMonitor.incrementInstanceCount();
}
}
|
void function(Service service, InstancePublishInfo instance) { if (null == publishers.put(service, parseToHealthCheckInstance(instance))) { MetricsMonitor.incrementInstanceCount(); } }
|
/**
* Purely put instance into service without publish events.
*/
|
Purely put instance into service without publish events
|
putServiceInstance
|
{
"repo_name": "alibaba/nacos",
"path": "naming/src/main/java/com/alibaba/nacos/naming/core/v2/client/impl/IpPortBasedClient.java",
"license": "apache-2.0",
"size": 4937
}
|
[
"com.alibaba.nacos.naming.core.v2.pojo.InstancePublishInfo",
"com.alibaba.nacos.naming.core.v2.pojo.Service",
"com.alibaba.nacos.naming.monitor.MetricsMonitor"
] |
import com.alibaba.nacos.naming.core.v2.pojo.InstancePublishInfo; import com.alibaba.nacos.naming.core.v2.pojo.Service; import com.alibaba.nacos.naming.monitor.MetricsMonitor;
|
import com.alibaba.nacos.naming.core.v2.pojo.*; import com.alibaba.nacos.naming.monitor.*;
|
[
"com.alibaba.nacos"
] |
com.alibaba.nacos;
| 2,239,114
|
@Override
public ILoggerFactory getLoggerFactory() {
return loggerFactory;
}
|
ILoggerFactory function() { return loggerFactory; }
|
/**
* Returns the logger factory.
*
* @return the logger factory
*/
|
Returns the logger factory
|
getLoggerFactory
|
{
"repo_name": "recena/DependencyCheck",
"path": "dependency-check-maven/src/main/java/org/slf4j/impl/StaticLoggerBinder.java",
"license": "apache-2.0",
"size": 3069
}
|
[
"org.slf4j.ILoggerFactory"
] |
import org.slf4j.ILoggerFactory;
|
import org.slf4j.*;
|
[
"org.slf4j"
] |
org.slf4j;
| 1,943,928
|
@Test(expectedExceptions = { LDAPException.class })
public void testConstructor3NullValue()
throws Exception
{
new ServerSideSortResponseControl("1.2.840.113556.1.4.474", false, null);
}
|
@Test(expectedExceptions = { LDAPException.class }) void function() throws Exception { new ServerSideSortResponseControl(STR, false, null); }
|
/**
* Tests the third constructor with a {@code null} value.
*
* @throws Exception If an unexpected problem occurs.
*/
|
Tests the third constructor with a null value
|
testConstructor3NullValue
|
{
"repo_name": "UnboundID/ldapsdk",
"path": "tests/unit/src/com/unboundid/ldap/sdk/controls/ServerSideSortResponseControlTestCase.java",
"license": "gpl-2.0",
"size": 9234
}
|
[
"com.unboundid.ldap.sdk.LDAPException",
"org.testng.annotations.Test"
] |
import com.unboundid.ldap.sdk.LDAPException; import org.testng.annotations.Test;
|
import com.unboundid.ldap.sdk.*; import org.testng.annotations.*;
|
[
"com.unboundid.ldap",
"org.testng.annotations"
] |
com.unboundid.ldap; org.testng.annotations;
| 1,174,149
|
public BigDecimal getProcessedOn();
public static final String COLUMNNAME_Processing = "Processing";
|
BigDecimal function(); public static final String COLUMNNAME_Processing = STR;
|
/** Get Processed On.
* The date+time (expressed in decimal format) when the document has been processed
*/
|
Get Processed On. The date+time (expressed in decimal format) when the document has been processed
|
getProcessedOn
|
{
"repo_name": "armenrz/adempiere",
"path": "base/src/org/compiere/model/I_GL_Journal.java",
"license": "gpl-2.0",
"size": 12888
}
|
[
"java.math.BigDecimal"
] |
import java.math.BigDecimal;
|
import java.math.*;
|
[
"java.math"
] |
java.math;
| 2,204,815
|
public String quickStream( boolean priority, String filename,
boolean toLoop, SimpleVector jPCTposition,
int attmodel, float distOrRoll )
{
//generate a random name for this source:
String sourcename = "Source_"
+ randomNumberGenerator.nextInt()
+ "_" + randomNumberGenerator.nextInt();
SimpleVector position = convertCoordinates( jPCTposition );
// Queue a command to quick stream this new source:
CommandQueue( new CommandObject( CommandObject.QUICK_PLAY, priority,
true, toLoop, sourcename,
new FilenameURL( filename ), position.x,
position.y, position.z, attmodel, distOrRoll,
true ) );
CommandQueue( new CommandObject( CommandObject.PLAY, sourcename) );
// Wake the command thread to process commands:
commandThread.interrupt();
// return the new source name.
return sourcename;
}
|
String function( boolean priority, String filename, boolean toLoop, SimpleVector jPCTposition, int attmodel, float distOrRoll ) { String sourcename = STR + randomNumberGenerator.nextInt() + "_" + randomNumberGenerator.nextInt(); SimpleVector position = convertCoordinates( jPCTposition ); CommandQueue( new CommandObject( CommandObject.QUICK_PLAY, priority, true, toLoop, sourcename, new FilenameURL( filename ), position.x, position.y, position.z, attmodel, distOrRoll, true ) ); CommandQueue( new CommandObject( CommandObject.PLAY, sourcename) ); commandThread.interrupt(); return sourcename; }
|
/**
* Creates a temporary source and streams it. After the source finishes
* playing, it is removed. Returns a randomly generated name for the new
* source. NOTE: to make a source created by this method permanant, call the
* setActive() method using the return value for sourcename.
* @param priority Setting this to true will prevent other sounds from overriding this one.
* @param filename The name of the sound file to play at this source.
* @param toLoop Should this source loop, or play only once.
* @param jPCTposition SimpleVector containing jPCT coordinates.
* @param attmodel Attenuation model to use.
* @param distOrRoll Either the fading distance or rolloff factor, depending on the value of "attmodel".
* @return The new sorce's name.
*/
|
Creates a temporary source and streams it. After the source finishes playing, it is removed. Returns a randomly generated name for the new setActive() method using the return value for sourcename
|
quickStream
|
{
"repo_name": "rekh127/Catacomb-Snatch-Reloaded",
"path": "paulscodesrc/paulscode/sound/SoundSystemJPCT.java",
"license": "mit",
"size": 154879
}
|
[
"com.threed.jpct.SimpleVector"
] |
import com.threed.jpct.SimpleVector;
|
import com.threed.jpct.*;
|
[
"com.threed.jpct"
] |
com.threed.jpct;
| 2,032,527
|
public static <T> String concat(int startIndex, T[] strArray, @Nullable String separator) {
//noinspection ConstantConditions
return concat(startIndex, strArray.length, strArray, separator, "");
}
|
static <T> String function(int startIndex, T[] strArray, @Nullable String separator) { return concat(startIndex, strArray.length, strArray, separator, ""); }
|
/**
* Concatenates an array into a single string using the specified separator string.
*
* @param startIndex The index to start concatenating at.
* @param strArray The array to concatenate.
* @param separator The separator to insert between elements.
*/
|
Concatenates an array into a single string using the specified separator string
|
concat
|
{
"repo_name": "JCThePants/NucleusFramework",
"path": "src/com/jcwhatever/nucleus/utils/text/TextUtils.java",
"license": "mit",
"size": 44562
}
|
[
"javax.annotation.Nullable"
] |
import javax.annotation.Nullable;
|
import javax.annotation.*;
|
[
"javax.annotation"
] |
javax.annotation;
| 553,538
|
@Deployment
public void testStartTimerEventSubProcessInParallelMultiInstanceSubProcessWithInterruptingBoundaryTimerEvent() {
// start process instance
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
// execute multiInstance loop number 1
// check if execution exists
ExecutionQuery executionQuery = runtimeService.createExecutionQuery().processInstanceId(processInstance.getId());
assertEquals(6, executionQuery.count());
// check if user task exists
TaskQuery taskQuery = taskService.createTaskQuery();
assertEquals(2, taskQuery.count());
JobQuery jobQuery = managementService.createJobQuery();
assertEquals(3, jobQuery.count());
// execute interrupting timer job
managementService.executeJob(jobQuery.orderByJobDuedate().asc().list().get(1).getId());
// after interrupting timer job execution
assertEquals(2, jobQuery.count());
assertEquals(1, taskQuery.count());
assertEquals(5, executionQuery.count());
// execute interrupting boundary timer job
managementService.executeJob(jobQuery.orderByJobDuedate().asc().list().get(0).getId());
// after interrupting boundary timer job execution
assertEquals(0, jobQuery.count());
assertEquals(0, taskQuery.count());
assertEquals(0, executionQuery.count());
assertProcessEnded(processInstance.getId());
}
|
void function() { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(STR); ExecutionQuery executionQuery = runtimeService.createExecutionQuery().processInstanceId(processInstance.getId()); assertEquals(6, executionQuery.count()); TaskQuery taskQuery = taskService.createTaskQuery(); assertEquals(2, taskQuery.count()); JobQuery jobQuery = managementService.createJobQuery(); assertEquals(3, jobQuery.count()); managementService.executeJob(jobQuery.orderByJobDuedate().asc().list().get(1).getId()); assertEquals(2, jobQuery.count()); assertEquals(1, taskQuery.count()); assertEquals(5, executionQuery.count()); managementService.executeJob(jobQuery.orderByJobDuedate().asc().list().get(0).getId()); assertEquals(0, jobQuery.count()); assertEquals(0, taskQuery.count()); assertEquals(0, executionQuery.count()); assertProcessEnded(processInstance.getId()); }
|
/**
* test scenario: - start process instance with multiInstance parallel -
* execute interrupting timer job of event subprocess - execute interrupting
* timer boundary event of subprocess
*/
|
test scenario: - start process instance with multiInstance parallel - execute interrupting timer job of event subprocess - execute interrupting timer boundary event of subprocess
|
testStartTimerEventSubProcessInParallelMultiInstanceSubProcessWithInterruptingBoundaryTimerEvent
|
{
"repo_name": "falko/camunda-bpm-platform",
"path": "engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/timer/StartTimerEventTest.java",
"license": "apache-2.0",
"size": 59250
}
|
[
"org.camunda.bpm.engine.runtime.ExecutionQuery",
"org.camunda.bpm.engine.runtime.JobQuery",
"org.camunda.bpm.engine.runtime.ProcessInstance",
"org.camunda.bpm.engine.task.TaskQuery"
] |
import org.camunda.bpm.engine.runtime.ExecutionQuery; import org.camunda.bpm.engine.runtime.JobQuery; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.camunda.bpm.engine.task.TaskQuery;
|
import org.camunda.bpm.engine.runtime.*; import org.camunda.bpm.engine.task.*;
|
[
"org.camunda.bpm"
] |
org.camunda.bpm;
| 2,771,902
|
public int addUtf8( final String n ) {
int ret;
if ((ret = lookupUtf8(n)) != -1) {
return ret; // Already in CP
}
adjustSize();
ret = index;
constants[index++] = new ConstantUtf8(n);
if (!utf8Table.containsKey(n)) {
utf8Table.put(n, new Index(ret));
}
return ret;
}
|
int function( final String n ) { int ret; if ((ret = lookupUtf8(n)) != -1) { return ret; } adjustSize(); ret = index; constants[index++] = new ConstantUtf8(n); if (!utf8Table.containsKey(n)) { utf8Table.put(n, new Index(ret)); } return ret; }
|
/**
* Add a new Utf8 constant to the ConstantPool, if it is not already in there.
*
* @param n Utf8 string to add
* @return index of entry
*/
|
Add a new Utf8 constant to the ConstantPool, if it is not already in there
|
addUtf8
|
{
"repo_name": "apache/commons-bcel",
"path": "src/main/java/org/apache/bcel/generic/ConstantPoolGen.java",
"license": "apache-2.0",
"size": 28295
}
|
[
"org.apache.bcel.classfile.ConstantUtf8"
] |
import org.apache.bcel.classfile.ConstantUtf8;
|
import org.apache.bcel.classfile.*;
|
[
"org.apache.bcel"
] |
org.apache.bcel;
| 1,972,017
|
@Override
public Map<String, FieldSchema> getKeys() {
return this.strategy.getKeys();
}
|
Map<String, FieldSchema> function() { return this.strategy.getKeys(); }
|
/**
* Get all keys schema information
*
* @return
*/
|
Get all keys schema information
|
getKeys
|
{
"repo_name": "silentbalanceyh/lyra",
"path": "lyra-bus/meta-orb/src/main/java/com/lyra/meta/impl/GenericContext.java",
"license": "gpl-3.0",
"size": 5250
}
|
[
"com.lyra.mod.def.FieldSchema",
"java.util.Map"
] |
import com.lyra.mod.def.FieldSchema; import java.util.Map;
|
import com.lyra.mod.def.*; import java.util.*;
|
[
"com.lyra.mod",
"java.util"
] |
com.lyra.mod; java.util;
| 434,810
|
public CassandraLinkedService withHost(Object host) {
if (this.innerTypeProperties() == null) {
this.innerTypeProperties = new CassandraLinkedServiceTypeProperties();
}
this.innerTypeProperties().withHost(host);
return this;
}
|
CassandraLinkedService function(Object host) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new CassandraLinkedServiceTypeProperties(); } this.innerTypeProperties().withHost(host); return this; }
|
/**
* Set the host property: Host name for connection. Type: string (or Expression with resultType string).
*
* @param host the host value to set.
* @return the CassandraLinkedService object itself.
*/
|
Set the host property: Host name for connection. Type: string (or Expression with resultType string)
|
withHost
|
{
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CassandraLinkedService.java",
"license": "mit",
"size": 8252
}
|
[
"com.azure.resourcemanager.datafactory.fluent.models.CassandraLinkedServiceTypeProperties"
] |
import com.azure.resourcemanager.datafactory.fluent.models.CassandraLinkedServiceTypeProperties;
|
import com.azure.resourcemanager.datafactory.fluent.models.*;
|
[
"com.azure.resourcemanager"
] |
com.azure.resourcemanager;
| 71,397
|
public Timestamp getCreated();
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
|
Timestamp function(); public static final String COLUMNNAME_CreatedBy = STR;
|
/** Get Created.
* Date this record was created
*/
|
Get Created. Date this record was created
|
getCreated
|
{
"repo_name": "geneos/adempiere",
"path": "base/src/org/compiere/model/I_AD_PrintFormatItem.java",
"license": "gpl-2.0",
"size": 22385
}
|
[
"java.sql.Timestamp"
] |
import java.sql.Timestamp;
|
import java.sql.*;
|
[
"java.sql"
] |
java.sql;
| 2,601,692
|
@Path("/required-actions/{alias}/lower-priority")
@POST
@NoCache
public void lowerRequiredActionPriority(@PathParam("alias") String alias) {
auth.realm().requireManageRealm();
RequiredActionProviderModel model = realm.getRequiredActionProviderByAlias(alias);
if (model == null) {
throw new NotFoundException("Failed to find required action.");
}
List<RequiredActionProviderModel> actions = realm.getRequiredActionProviders();
int i = 0;
for (i = 0; i < actions.size(); i++) {
if (actions.get(i).getId().equals(model.getId())) {
break;
}
}
if (i + 1 >= actions.size()) return;
RequiredActionProviderModel next = actions.get(i + 1);
int tmp = model.getPriority();
model.setPriority(next.getPriority());
realm.updateRequiredActionProvider(model);
next.setPriority(tmp);
realm.updateRequiredActionProvider(next);
adminEvent.operation(OperationType.UPDATE).resource(ResourceType.REQUIRED_ACTION).resourcePath(session.getContext().getUri()).success();
}
|
@Path(STR) void function(@PathParam("alias") String alias) { auth.realm().requireManageRealm(); RequiredActionProviderModel model = realm.getRequiredActionProviderByAlias(alias); if (model == null) { throw new NotFoundException(STR); } List<RequiredActionProviderModel> actions = realm.getRequiredActionProviders(); int i = 0; for (i = 0; i < actions.size(); i++) { if (actions.get(i).getId().equals(model.getId())) { break; } } if (i + 1 >= actions.size()) return; RequiredActionProviderModel next = actions.get(i + 1); int tmp = model.getPriority(); model.setPriority(next.getPriority()); realm.updateRequiredActionProvider(model); next.setPriority(tmp); realm.updateRequiredActionProvider(next); adminEvent.operation(OperationType.UPDATE).resource(ResourceType.REQUIRED_ACTION).resourcePath(session.getContext().getUri()).success(); }
|
/**
* Lower required action's priority
*
* @param alias Alias of required action
*/
|
Lower required action's priority
|
lowerRequiredActionPriority
|
{
"repo_name": "mhajas/keycloak",
"path": "services/src/main/java/org/keycloak/services/resources/admin/AuthenticationManagementResource.java",
"license": "apache-2.0",
"size": 53043
}
|
[
"java.util.List",
"javax.ws.rs.NotFoundException",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"org.keycloak.events.admin.OperationType",
"org.keycloak.events.admin.ResourceType",
"org.keycloak.models.RequiredActionProviderModel"
] |
import java.util.List; import javax.ws.rs.NotFoundException; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import org.keycloak.events.admin.OperationType; import org.keycloak.events.admin.ResourceType; import org.keycloak.models.RequiredActionProviderModel;
|
import java.util.*; import javax.ws.rs.*; import org.keycloak.events.admin.*; import org.keycloak.models.*;
|
[
"java.util",
"javax.ws",
"org.keycloak.events",
"org.keycloak.models"
] |
java.util; javax.ws; org.keycloak.events; org.keycloak.models;
| 44,903
|
public void stopRecording(int callId) throws SameThreadException {
if (!created) {
return;
}
List<IRecorderHandler> recoders = callRecorders.get(callId, null);
if (recoders != null) {
for (IRecorderHandler recoder : recoders) {
recoder.stopRecording();
// Broadcast to other apps the a new sip record has been done
SipCallSession callInfo = getPublicCallInfo(callId);
Intent it = new Intent(SipManager.ACTION_SIP_CALL_RECORDED);
it.putExtra(SipManager.EXTRA_CALL_INFO, callInfo);
recoder.fillBroadcastWithInfo(it);
service.sendBroadcast(it, SipManager.PERMISSION_USE_SIP);
}
// In first case we drop everything
callRecorders.delete(callId);
userAgentReceiver.updateRecordingStatus(callId, true, false);
}
}
|
void function(int callId) throws SameThreadException { if (!created) { return; } List<IRecorderHandler> recoders = callRecorders.get(callId, null); if (recoders != null) { for (IRecorderHandler recoder : recoders) { recoder.stopRecording(); SipCallSession callInfo = getPublicCallInfo(callId); Intent it = new Intent(SipManager.ACTION_SIP_CALL_RECORDED); it.putExtra(SipManager.EXTRA_CALL_INFO, callInfo); recoder.fillBroadcastWithInfo(it); service.sendBroadcast(it, SipManager.PERMISSION_USE_SIP); } callRecorders.delete(callId); userAgentReceiver.updateRecordingStatus(callId, true, false); } }
|
/**
* Stop recording of a call.
*
* @param callId the call to stop record for.
* @throws SameThreadException virtual exception to be sure we are calling
* this from correct thread
*/
|
Stop recording of a call
|
stopRecording
|
{
"repo_name": "ccalleu/halo-halo",
"path": "CSipSimple/src/com/csipsimple/pjsip/PjSipService.java",
"license": "gpl-3.0",
"size": 94513
}
|
[
"android.content.Intent",
"com.csipsimple.api.SipCallSession",
"com.csipsimple.api.SipManager",
"com.csipsimple.pjsip.recorder.IRecorderHandler",
"com.csipsimple.service.SipService",
"java.util.List"
] |
import android.content.Intent; import com.csipsimple.api.SipCallSession; import com.csipsimple.api.SipManager; import com.csipsimple.pjsip.recorder.IRecorderHandler; import com.csipsimple.service.SipService; import java.util.List;
|
import android.content.*; import com.csipsimple.api.*; import com.csipsimple.pjsip.recorder.*; import com.csipsimple.service.*; import java.util.*;
|
[
"android.content",
"com.csipsimple.api",
"com.csipsimple.pjsip",
"com.csipsimple.service",
"java.util"
] |
android.content; com.csipsimple.api; com.csipsimple.pjsip; com.csipsimple.service; java.util;
| 1,255,971
|
public Object validateIssuedIdentityToken(IssuedIdentityToken token, UserTokenPolicy tokenPolicy,
SecureChannel channel, Session session) throws UaException {
throw new UaException(StatusCodes.Bad_IdentityTokenInvalid);
}
|
Object function(IssuedIdentityToken token, UserTokenPolicy tokenPolicy, SecureChannel channel, Session session) throws UaException { throw new UaException(StatusCodes.Bad_IdentityTokenInvalid); }
|
/**
* Validate an {@link IssuedIdentityToken} and return an identity Object that represents the user.
* <p>
* This Object should implement equality in such a way that a subsequent identity validation for the same user
* yields a comparable Object.
*
* @param token the {@link IssuedIdentityToken}.
* @param tokenPolicy the {@link UserTokenPolicy} specified by the policyId in {@code token}.
* @param channel the {@link SecureChannel} the request is arriving on.
* @param session the {@link Session} the request is arriving on.
* @return an identity Object that represents the user.
* @throws UaException if the token is invalid, rejected, or user access is denied.
*/
|
Validate an <code>IssuedIdentityToken</code> and return an identity Object that represents the user. This Object should implement equality in such a way that a subsequent identity validation for the same user yields a comparable Object
|
validateIssuedIdentityToken
|
{
"repo_name": "bencaldwell/ua-server-sdk",
"path": "ua-server/src/main/java/com/digitalpetri/opcua/sdk/server/identity/IdentityValidator.java",
"license": "agpl-3.0",
"size": 7793
}
|
[
"com.digitalpetri.opcua.sdk.server.Session",
"com.digitalpetri.opcua.stack.core.StatusCodes",
"com.digitalpetri.opcua.stack.core.UaException",
"com.digitalpetri.opcua.stack.core.channel.SecureChannel",
"com.digitalpetri.opcua.stack.core.types.structured.IssuedIdentityToken",
"com.digitalpetri.opcua.stack.core.types.structured.UserTokenPolicy"
] |
import com.digitalpetri.opcua.sdk.server.Session; import com.digitalpetri.opcua.stack.core.StatusCodes; import com.digitalpetri.opcua.stack.core.UaException; import com.digitalpetri.opcua.stack.core.channel.SecureChannel; import com.digitalpetri.opcua.stack.core.types.structured.IssuedIdentityToken; import com.digitalpetri.opcua.stack.core.types.structured.UserTokenPolicy;
|
import com.digitalpetri.opcua.sdk.server.*; import com.digitalpetri.opcua.stack.core.*; import com.digitalpetri.opcua.stack.core.channel.*; import com.digitalpetri.opcua.stack.core.types.structured.*;
|
[
"com.digitalpetri.opcua"
] |
com.digitalpetri.opcua;
| 1,457,511
|
@Test
public void testGrowCases2() {
JoddArrayList<String> jal0 = new JoddArrayList<String>();
addFirst(jal0, 0, 3);
assertEquals(3, jal0.size());
assertEquals(16, jal0.buffer.length);
assertEquals(4, jal0.pivotIndex);
assertEquals(2, jal0.start);
assertEquals(5, jal0.end);
JoddArrayList<String> jal = (JoddArrayList<String>) jal0.clone();
jal.add("1");
assertEquals(4, jal.size());
assertEquals(16, jal.buffer.length);
assertEquals(4, jal.pivotIndex);
assertEquals(2, jal.start);
assertEquals(6, jal.end);
jal = (JoddArrayList<String>) jal0.clone();
jal.addFirst("1");
assertEquals(4, jal.size());
assertEquals(16, jal.buffer.length);
assertEquals(4, jal.pivotIndex);
assertEquals(1, jal.start);
assertEquals(5, jal.end);
jal = (JoddArrayList<String>) jal0.clone();
jal.removeFirst();
assertEquals(2, jal.size());
assertEquals(16, jal.buffer.length);
assertEquals(4, jal.pivotIndex);
assertEquals(3, jal.start);
assertEquals(5, jal.end);
jal = (JoddArrayList<String>) jal0.clone();
jal.removeLast();
assertEquals(2, jal.size());
assertEquals(16, jal.buffer.length);
assertEquals(3, jal.pivotIndex);
assertEquals(2, jal.start);
assertEquals(4, jal.end);
checkNulls(jal);
}
|
void function() { JoddArrayList<String> jal0 = new JoddArrayList<String>(); addFirst(jal0, 0, 3); assertEquals(3, jal0.size()); assertEquals(16, jal0.buffer.length); assertEquals(4, jal0.pivotIndex); assertEquals(2, jal0.start); assertEquals(5, jal0.end); JoddArrayList<String> jal = (JoddArrayList<String>) jal0.clone(); jal.add("1"); assertEquals(4, jal.size()); assertEquals(16, jal.buffer.length); assertEquals(4, jal.pivotIndex); assertEquals(2, jal.start); assertEquals(6, jal.end); jal = (JoddArrayList<String>) jal0.clone(); jal.addFirst("1"); assertEquals(4, jal.size()); assertEquals(16, jal.buffer.length); assertEquals(4, jal.pivotIndex); assertEquals(1, jal.start); assertEquals(5, jal.end); jal = (JoddArrayList<String>) jal0.clone(); jal.removeFirst(); assertEquals(2, jal.size()); assertEquals(16, jal.buffer.length); assertEquals(4, jal.pivotIndex); assertEquals(3, jal.start); assertEquals(5, jal.end); jal = (JoddArrayList<String>) jal0.clone(); jal.removeLast(); assertEquals(2, jal.size()); assertEquals(16, jal.buffer.length); assertEquals(3, jal.pivotIndex); assertEquals(2, jal.start); assertEquals(4, jal.end); checkNulls(jal); }
|
/**
* List: S = X, E = P + 1
* add: ->
* addFirst: <-
* removeFirst: ->
* removeLast: <-
*/
|
List: S = X, E = P + 1 add: -> addFirst: removeLast: <-
|
testGrowCases2
|
{
"repo_name": "wsldl123292/jodd",
"path": "jodd-core/src/test/java/jodd/util/collection/JoddArrayListTest.java",
"license": "bsd-3-clause",
"size": 28107
}
|
[
"org.junit.Assert"
] |
import org.junit.Assert;
|
import org.junit.*;
|
[
"org.junit"
] |
org.junit;
| 2,278,945
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.