method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public static void e(String tag, String s, Throwable e) {
if (LOG.ERROR >= LOGLEVEL) Log.e(tag, s, e);
} | static void function(String tag, String s, Throwable e) { if (LOG.ERROR >= LOGLEVEL) Log.e(tag, s, e); } | /**
* Error log message.
*
* @param tag
* @param s
* @param e
*/ | Error log message | e | {
"repo_name": "wufan123/cordova-plugin-push",
"path": "src/android/LOG.java",
"license": "apache-2.0",
"size": 5891
} | [
"android.util.Log"
] | import android.util.Log; | import android.util.*; | [
"android.util"
] | android.util; | 181,899 |
public WallGetByIdQueryWithExtended getByIdExtended(UserActor actor, List<String> posts) {
return new WallGetByIdQueryWithExtended(getClient(), actor, posts);
} | WallGetByIdQueryWithExtended function(UserActor actor, List<String> posts) { return new WallGetByIdQueryWithExtended(getClient(), actor, posts); } | /**
* Returns a list of posts from user or community walls by their IDs.
*
* @param actor vk actor
* @param posts User or community IDs and post IDs, separated by underscores. Use a negative value to designate a community ID. Example: "93388_21539,93388_20904,2943_4276,-1_1"
* @return query
*/ | Returns a list of posts from user or community walls by their IDs | getByIdExtended | {
"repo_name": "VKCOM/vk-java-sdk",
"path": "sdk/src/main/java/com/vk/api/sdk/actions/Wall.java",
"license": "mit",
"size": 17618
} | [
"com.vk.api.sdk.client.actors.UserActor",
"com.vk.api.sdk.queries.wall.WallGetByIdQueryWithExtended",
"java.util.List"
] | import com.vk.api.sdk.client.actors.UserActor; import com.vk.api.sdk.queries.wall.WallGetByIdQueryWithExtended; import java.util.List; | import com.vk.api.sdk.client.actors.*; import com.vk.api.sdk.queries.wall.*; import java.util.*; | [
"com.vk.api",
"java.util"
] | com.vk.api; java.util; | 1,433,513 |
private Long canPeerSyncStop(Jedis peerJedis, long startTime) throws RedisSyncException {
if (System.currentTimeMillis() - startTime > config.getMaxTimeToBootstrap()) {
logger.warn("Warm up takes more than " + config.getMaxTimeToBootstrap() / 60000 + " minutes --> moving on");
return (long) -3;
}
logger.info("Checking for peer syncing");
String peerRedisInfo = peerJedis.info();
Long masterOffset = -1L;
Long slaveOffset = -1L;
// get peer's repl offset
Iterable<String> result = Splitter.on('\n').split(peerRedisInfo);
for (String line : result) {
if (line.startsWith("master_repl_offset")) {
String[] items = line.split(":");
logger.info(items[0] + ": " + items[1]);
masterOffset = Long.parseLong(items[1].trim());
}
// slave0:ip=10.99.160.121,port=22122,state=online,offset=17279,lag=0
if (line.startsWith("slave0")) {
String[] items = line.split(",");
for (String item : items) {
if (item.startsWith("offset")) {
String[] offset = item.split("=");
logger.info(offset[0] + ": " + offset[1]);
slaveOffset = Long.parseLong(offset[1].trim());
}
}
}
}
if (slaveOffset == -1) {
logger.error("Slave offset could not be parsed --> check memory overcommit configuration");
return (long) -1;
} else if (slaveOffset == 0) {
logger.info("Slave offset is zero ---> Redis master node still dumps data to the disk");
return (long) -2;
}
Long diff = Math.abs(masterOffset - slaveOffset);
logger.info("masterOffset: " + masterOffset + " slaveOffset: " + slaveOffset + " current Diff: " + diff
+ " allowable diff: " + config.getAllowableBytesSyncDiff());
// Allowable bytes sync diff can be configured by a Fast Property.
// If the difference is very small, then we return zero.
if (diff < config.getAllowableBytesSyncDiff()) {
logger.info("master and slave are in sync!");
return (long) 0;
} else if (slaveOffset == 0) {
logger.info("slave has not started syncing");
}
return diff;
}
private class RedisSyncException extends Exception {
private static final long serialVersionUID = -7736577871204223637L;
} | Long function(Jedis peerJedis, long startTime) throws RedisSyncException { if (System.currentTimeMillis() - startTime > config.getMaxTimeToBootstrap()) { logger.warn(STR + config.getMaxTimeToBootstrap() / 60000 + STR); return (long) -3; } logger.info(STR); String peerRedisInfo = peerJedis.info(); Long masterOffset = -1L; Long slaveOffset = -1L; Iterable<String> result = Splitter.on('\n').split(peerRedisInfo); for (String line : result) { if (line.startsWith(STR)) { String[] items = line.split(":"); logger.info(items[0] + STR + items[1]); masterOffset = Long.parseLong(items[1].trim()); } if (line.startsWith(STR)) { String[] items = line.split(","); for (String item : items) { if (item.startsWith(STR)) { String[] offset = item.split("="); logger.info(offset[0] + STR + offset[1]); slaveOffset = Long.parseLong(offset[1].trim()); } } } } if (slaveOffset == -1) { logger.error(STR); return (long) -1; } else if (slaveOffset == 0) { logger.info(STR); return (long) -2; } Long diff = Math.abs(masterOffset - slaveOffset); logger.info(STR + masterOffset + STR + slaveOffset + STR + diff + STR + config.getAllowableBytesSyncDiff()); if (diff < config.getAllowableBytesSyncDiff()) { logger.info(STR); return (long) 0; } else if (slaveOffset == 0) { logger.info(STR); } return diff; } private class RedisSyncException extends Exception { private static final long serialVersionUID = -7736577871204223637L; } | /**
* Determining if the warm up process can stop
*
* @param peerJedis
* Jedis connection with the peer node
* @param startTime
* @return Long status code
* @throws RedisSyncException
*/ | Determining if the warm up process can stop | canPeerSyncStop | {
"repo_name": "diegopacheco/dynomite-manager-1",
"path": "dynomitemanager-core/src/main/java/com/netflix/dynomitemanager/storage/RedisStorageProxy.java",
"license": "apache-2.0",
"size": 33857
} | [
"com.google.common.base.Splitter",
"redis.clients.jedis.Jedis"
] | import com.google.common.base.Splitter; import redis.clients.jedis.Jedis; | import com.google.common.base.*; import redis.clients.jedis.*; | [
"com.google.common",
"redis.clients.jedis"
] | com.google.common; redis.clients.jedis; | 1,918,076 |
public ServiceFuture<Void> putIntegerValidAsync(Map<String, Integer> arrayBody, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(putIntegerValidWithServiceResponseAsync(arrayBody), serviceCallback);
} | ServiceFuture<Void> function(Map<String, Integer> arrayBody, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(putIntegerValidWithServiceResponseAsync(arrayBody), serviceCallback); } | /**
* Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}.
*
* @param arrayBody the Map<String, Integer> value
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300} | putIntegerValidAsync | {
"repo_name": "balajikris/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodydictionary/implementation/DictionarysImpl.java",
"license": "mit",
"size": 243390
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture",
"java.util.Map"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import java.util.Map; | import com.microsoft.rest.*; import java.util.*; | [
"com.microsoft.rest",
"java.util"
] | com.microsoft.rest; java.util; | 1,317,378 |
public static Set asDataObjects(List objects)
{
if (objects == null) return new HashSet<DataObject>();
Set<DataObject> set = new HashSet<DataObject>(objects.size());
Iterator i = objects.iterator();
DataObject data;
while (i.hasNext()) {
data = asDataObject((IObject) i.next());
if (data != null) set.add(data);
}
return set;
} | static Set function(List objects) { if (objects == null) return new HashSet<DataObject>(); Set<DataObject> set = new HashSet<DataObject>(objects.size()); Iterator i = objects.iterator(); DataObject data; while (i.hasNext()) { data = asDataObject((IObject) i.next()); if (data != null) set.add(data); } return set; } | /**
* Converts each {@link IObject element} of the collection into its
* corresponding {@link DataObject}.
*
* @param objects The set of objects to convert.
* @return A set of {@link DataObject}s.
* @throws IllegalArgumentException If the set is <code>null</code>, doesn't
* contain {@link IObject} or if the type {@link IObject} is unknown.
*/ | Converts each <code>IObject element</code> of the collection into its corresponding <code>DataObject</code> | asDataObjects | {
"repo_name": "joansmith/openmicroscopy",
"path": "components/blitz/src/omero/gateway/util/PojoMapper.java",
"license": "gpl-2.0",
"size": 26985
} | [
"java.util.HashSet",
"java.util.Iterator",
"java.util.List",
"java.util.Set"
] | import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,879,955 |
public final WorkflowSession getWorkflowSession(final Session session) {
return new SyntheticWorkflowSession(this, session);
} | final WorkflowSession function(final Session session) { return new SyntheticWorkflowSession(this, session); } | /**
* Creates a Synthetic Workflow Session from a JCR Session.
*
* @param session the JCR Session to create the Synthetic Workflow Session from
* @return the Synthetic Workflow Session
*/ | Creates a Synthetic Workflow Session from a JCR Session | getWorkflowSession | {
"repo_name": "dlh3/acs-aem-commons",
"path": "bundle/src/main/java/com/adobe/acs/commons/workflow/synthetic/impl/SyntheticWorkflowRunnerImpl.java",
"license": "apache-2.0",
"size": 10714
} | [
"com.day.cq.workflow.WorkflowSession",
"javax.jcr.Session"
] | import com.day.cq.workflow.WorkflowSession; import javax.jcr.Session; | import com.day.cq.workflow.*; import javax.jcr.*; | [
"com.day.cq",
"javax.jcr"
] | com.day.cq; javax.jcr; | 1,349,605 |
private static boolean validateAttributes(RuleContext ruleContext) {
AttributeMap attributes = ruleContext.attributes();
// Report an error if "restricted to" is explicitly set to nothing. Even if this made
// conceptual sense, we don't know which groups we should apply that to.
String restrictionAttr = RuleClass.RESTRICTED_ENVIRONMENT_ATTR;
List<? extends TransitiveInfoCollection> restrictionEnvironments = ruleContext
.getPrerequisites(restrictionAttr, RuleConfiguredTarget.Mode.DONT_CHECK);
if (restrictionEnvironments.isEmpty()
&& attributes.isAttributeValueExplicitlySpecified(restrictionAttr)) {
ruleContext.attributeError(restrictionAttr, "attribute cannot be empty");
return false;
}
return true;
}
private static class DepsToCheck {
private final Set<TransitiveInfoCollection> allDeps;
private final Set<TransitiveInfoCollection> selectOnlyDeps;
DepsToCheck(Set<TransitiveInfoCollection> depsToCheck,
Set<TransitiveInfoCollection> selectOnlyDeps) {
this.allDeps = depsToCheck;
this.selectOnlyDeps = selectOnlyDeps;
} | static boolean function(RuleContext ruleContext) { AttributeMap attributes = ruleContext.attributes(); String restrictionAttr = RuleClass.RESTRICTED_ENVIRONMENT_ATTR; List<? extends TransitiveInfoCollection> restrictionEnvironments = ruleContext .getPrerequisites(restrictionAttr, RuleConfiguredTarget.Mode.DONT_CHECK); if (restrictionEnvironments.isEmpty() && attributes.isAttributeValueExplicitlySpecified(restrictionAttr)) { ruleContext.attributeError(restrictionAttr, STR); return false; } return true; } private static class DepsToCheck { private final Set<TransitiveInfoCollection> allDeps; private final Set<TransitiveInfoCollection> selectOnlyDeps; DepsToCheck(Set<TransitiveInfoCollection> depsToCheck, Set<TransitiveInfoCollection> selectOnlyDeps) { this.allDeps = depsToCheck; this.selectOnlyDeps = selectOnlyDeps; } | /**
* Validity-checks this rule's constraint-related attributes. Returns true if all is good,
* returns false and reports appropriate errors if there are any problems.
*/ | Validity-checks this rule's constraint-related attributes. Returns true if all is good, returns false and reports appropriate errors if there are any problems | validateAttributes | {
"repo_name": "variac/bazel",
"path": "src/main/java/com/google/devtools/build/lib/analysis/constraints/ConstraintSemantics.java",
"license": "apache-2.0",
"size": 42194
} | [
"com.google.devtools.build.lib.analysis.RuleConfiguredTarget",
"com.google.devtools.build.lib.analysis.RuleContext",
"com.google.devtools.build.lib.analysis.TransitiveInfoCollection",
"com.google.devtools.build.lib.packages.AttributeMap",
"com.google.devtools.build.lib.packages.RuleClass",
"java.util.List",
"java.util.Set"
] | import com.google.devtools.build.lib.analysis.RuleConfiguredTarget; import com.google.devtools.build.lib.analysis.RuleContext; import com.google.devtools.build.lib.analysis.TransitiveInfoCollection; import com.google.devtools.build.lib.packages.AttributeMap; import com.google.devtools.build.lib.packages.RuleClass; import java.util.List; import java.util.Set; | import com.google.devtools.build.lib.analysis.*; import com.google.devtools.build.lib.packages.*; import java.util.*; | [
"com.google.devtools",
"java.util"
] | com.google.devtools; java.util; | 1,179,522 |
@Schema(required = true, description = "Customer type")
public CustomerContractTypeEnum getCustomerContractType() {
return customerContractType;
} | @Schema(required = true, description = STR) CustomerContractTypeEnum function() { return customerContractType; } | /**
* Customer type
* @return customerContractType
**/ | Customer type | getCustomerContractType | {
"repo_name": "iterate-ch/cyberduck",
"path": "dracoon/src/main/java/ch/cyberduck/core/sds/io/swagger/client/model/UpdateCustomerRequest.java",
"license": "gpl-3.0",
"size": 8970
} | [
"io.swagger.v3.oas.annotations.media.Schema"
] | import io.swagger.v3.oas.annotations.media.Schema; | import io.swagger.v3.oas.annotations.media.*; | [
"io.swagger.v3"
] | io.swagger.v3; | 1,769,453 |
private void checkPackToPost(PolyTupleLattice lattice,
EclipseTAC tac, final ASTNode error_node) {
Set<String> rcvr_post = getRcvrPostState();
AnnotationDatabase annoDB = analysisInput.getAnnoDB();
ThisVariable this_var = tac.thisVariable();
| void function(PolyTupleLattice lattice, EclipseTAC tac, final ASTNode error_node) { Set<String> rcvr_post = getRcvrPostState(); AnnotationDatabase annoDB = analysisInput.getAnnoDB(); ThisVariable this_var = tac.thisVariable(); | /** Make sure the receiver is in the proper post-condition
* state, which may include packing it to the post-condition
* state. If that cannot be done, errors would be issued. */ | Make sure the receiver is in the proper post-condition state, which may include packing it to the post-condition | checkPackToPost | {
"repo_name": "plaidgroup/plural",
"path": "Plural/src/edu/cmu/cs/plural/polymorphic/internal/PolyInternalChecker.java",
"license": "gpl-2.0",
"size": 30954
} | [
"edu.cmu.cs.crystal.annotations.AnnotationDatabase",
"edu.cmu.cs.crystal.tac.eclipse.EclipseTAC",
"edu.cmu.cs.crystal.tac.model.ThisVariable",
"java.util.Set",
"org.eclipse.jdt.core.dom.ASTNode"
] | import edu.cmu.cs.crystal.annotations.AnnotationDatabase; import edu.cmu.cs.crystal.tac.eclipse.EclipseTAC; import edu.cmu.cs.crystal.tac.model.ThisVariable; import java.util.Set; import org.eclipse.jdt.core.dom.ASTNode; | import edu.cmu.cs.crystal.annotations.*; import edu.cmu.cs.crystal.tac.eclipse.*; import edu.cmu.cs.crystal.tac.model.*; import java.util.*; import org.eclipse.jdt.core.dom.*; | [
"edu.cmu.cs",
"java.util",
"org.eclipse.jdt"
] | edu.cmu.cs; java.util; org.eclipse.jdt; | 272,831 |
public int getMasterInfoPort() throws IOException; | int function() throws IOException; | /**
* Get the info port of the current master if one is available.
* @return master info port
* @throws IOException
*/ | Get the info port of the current master if one is available | getMasterInfoPort | {
"repo_name": "SeekerResource/hbase",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java",
"license": "apache-2.0",
"size": 60792
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,881,065 |
public static void main (String[] args) throws IOException, MessageException, ServiceException {
String version = "MRBenchmark.0.0.2";
System.out.println(version);
String usage =
"Usage: mrbench " +
"[-baseDir <base DFS path for output/input, default is /benchmarks/MRBench>] " +
"[-jar <local path to job jar file containing Mapper and Reducer implementations, default is current jar file>] " +
"[-numRuns <number of times to run the job, default is 1>] " +
"[-maps <number of maps for each run, default is 2>] " +
"[-reduces <number of reduces for each run, default is 1>] " +
"[-inputLines <number of input lines to generate, default is 1>] " +
"[-inputType <type of input to generate, one of ascending (default), descending, random>] " +
"[-verbose]";
String jarFile = null;
int inputLines = 1;
int numRuns = 1;
int numMaps = 2;
int numReduces = 1;
boolean verbose = false;
Order inputSortOrder = Order.ASCENDING;
for (int i = 0; i < args.length; i++) { // parse command line
if (args[i].equals("-jar")) {
jarFile = args[++i];
} else if (args[i].equals("-numRuns")) {
numRuns = Integer.parseInt(args[++i]);
} else if (args[i].equals("-baseDir")) {
BASE_DIR = new Path(args[++i]);
} else if (args[i].equals("-maps")) {
numMaps = Integer.parseInt(args[++i]);
} else if (args[i].equals("-reduces")) {
numReduces = Integer.parseInt(args[++i]);
} else if (args[i].equals("-inputLines")) {
inputLines = Integer.parseInt(args[++i]);
} else if (args[i].equals("-inputType")) {
String s = args[++i];
if (s.equalsIgnoreCase("ascending")) {
inputSortOrder = Order.ASCENDING;
} else if (s.equalsIgnoreCase("descending")) {
inputSortOrder = Order.DESCENDING;
} else if (s.equalsIgnoreCase("random")) {
inputSortOrder = Order.RANDOM;
} else {
inputSortOrder = null;
}
} else if (args[i].equals("-verbose")) {
verbose = true;
} else {
System.err.println(usage);
System.exit(-1);
}
}
if (numRuns < 1 || // verify args
numMaps < 1 ||
numReduces < 1 ||
inputLines < 0 ||
inputSortOrder == null)
{
System.err.println(usage);
System.exit(-1);
}
JobConf jobConf = setupJob(numMaps, numReduces, jarFile);
FileSystem fs = FileSystem.get(jobConf);
Path inputFile = new Path(INPUT_DIR, "input_" + (new Random()).nextInt() + ".txt");
generateTextFile(fs, inputFile, inputLines, inputSortOrder);
// setup test output directory
fs.mkdirs(BASE_DIR);
ArrayList<Long> execTimes = new ArrayList<Long>();
try {
execTimes = runJobInSequence(jobConf, numRuns);
} finally {
// delete output -- should we really do this?
fs.delete(BASE_DIR, true);
}
if (verbose) {
// Print out a report
System.out.println("Total MapReduce jobs executed: " + numRuns);
System.out.println("Total lines of data per job: " + inputLines);
System.out.println("Maps per job: " + numMaps);
System.out.println("Reduces per job: " + numReduces);
}
int i = 0;
long totalTime = 0;
for (Long time : execTimes) {
totalTime += time.longValue();
if (verbose) {
System.out.println("Total milliseconds for task: " + (++i) +
" = " + time);
}
}
long avgTime = totalTime / numRuns;
System.out.println("DataLines\tMaps\tReduces\tAvgTime (milliseconds)");
System.out.println(inputLines + "\t\t" + numMaps + "\t" +
numReduces + "\t" + avgTime);
} | static void function (String[] args) throws IOException, MessageException, ServiceException { String version = STR; System.out.println(version); String usage = STR + STR + STR + STR + STR + STR + STR + STR + STR; String jarFile = null; int inputLines = 1; int numRuns = 1; int numMaps = 2; int numReduces = 1; boolean verbose = false; Order inputSortOrder = Order.ASCENDING; for (int i = 0; i < args.length; i++) { if (args[i].equals("-jar")) { jarFile = args[++i]; } else if (args[i].equals(STR)) { numRuns = Integer.parseInt(args[++i]); } else if (args[i].equals(STR)) { BASE_DIR = new Path(args[++i]); } else if (args[i].equals("-maps")) { numMaps = Integer.parseInt(args[++i]); } else if (args[i].equals(STR)) { numReduces = Integer.parseInt(args[++i]); } else if (args[i].equals(STR)) { inputLines = Integer.parseInt(args[++i]); } else if (args[i].equals(STR)) { String s = args[++i]; if (s.equalsIgnoreCase(STR)) { inputSortOrder = Order.ASCENDING; } else if (s.equalsIgnoreCase(STR)) { inputSortOrder = Order.DESCENDING; } else if (s.equalsIgnoreCase(STR)) { inputSortOrder = Order.RANDOM; } else { inputSortOrder = null; } } else if (args[i].equals(STR)) { verbose = true; } else { System.err.println(usage); System.exit(-1); } } if (numRuns < 1 numMaps < 1 numReduces < 1 inputLines < 0 inputSortOrder == null) { System.err.println(usage); System.exit(-1); } JobConf jobConf = setupJob(numMaps, numReduces, jarFile); FileSystem fs = FileSystem.get(jobConf); Path inputFile = new Path(INPUT_DIR, STR + (new Random()).nextInt() + ".txt"); generateTextFile(fs, inputFile, inputLines, inputSortOrder); fs.mkdirs(BASE_DIR); ArrayList<Long> execTimes = new ArrayList<Long>(); try { execTimes = runJobInSequence(jobConf, numRuns); } finally { fs.delete(BASE_DIR, true); } if (verbose) { System.out.println(STR + numRuns); System.out.println(STR + inputLines); System.out.println(STR + numMaps); System.out.println(STR + numReduces); } int i = 0; long totalTime = 0; for (Long time : execTimes) { totalTime += time.longValue(); if (verbose) { System.out.println(STR + (++i) + STR + time); } } long avgTime = totalTime / numRuns; System.out.println(STR); System.out.println(inputLines + "\t\t" + numMaps + "\t" + numReduces + "\t" + avgTime); } | /**
* <pre>
* Usage: mrbench
* [-baseDir <base DFS path for output/input, default is /benchmarks/MRBench>]
* [-jar <local path to job jar file containing Mapper and Reducer implementations, default is current jar file>]
* [-numRuns <number of times to run the job, default is 1>]
* [-maps <number of maps for each run, default is 2>]
* [-reduces <number of reduces for each run, default is 1>]
* [-inputLines <number of input lines to generate, default is 1>]
* [-inputType <type of input to generate, one of ascending (default), descending, random>]
* [-verbose]
* </pre>
* @throws MessageException
* @throws ServiceException
*/ | <code> Usage: mrbench [-baseDir ] [-jar ] [-numRuns ] [-maps ] [-reduces ] [-inputLines ] [-inputType ] [-verbose] </code> | main | {
"repo_name": "hanhlh/hadoop-0.20.2_FatBTree",
"path": "src/test/org/apache/hadoop/mapred/MRBench.java",
"license": "apache-2.0",
"size": 11479
} | [
"java.io.IOException",
"java.util.ArrayList",
"java.util.Random",
"org.apache.hadoop.fs.FileSystem",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hdfs.server.namenodeFBT.msg.MessageException",
"org.apache.hadoop.hdfs.server.namenodeFBT.service.ServiceException"
] | import java.io.IOException; import java.util.ArrayList; import java.util.Random; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.server.namenodeFBT.msg.MessageException; import org.apache.hadoop.hdfs.server.namenodeFBT.service.ServiceException; | import java.io.*; import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.server.*; | [
"java.io",
"java.util",
"org.apache.hadoop"
] | java.io; java.util; org.apache.hadoop; | 1,538,839 |
private void findMatchingExactSelectorSubs(String topic,
Set consumerSet)
{
if (tc.isEntryEnabled())
SibTr.entry(
tc,
"findMatchingExactSelectorSubs",
new Object[] { topic});
if(_areExactSelectorSubs)
{
// Iterate through the map
Iterator i = _exactSelectorSubs.keySet().iterator();
while (i.hasNext())
{
String consumerTopic = (String)i.next();
if (tc.isDebugEnabled())
SibTr.debug(tc, "Found consumer topic: " + consumerTopic);
// Add the list of consumers to the matching Set if it matches
if(topic.equals(consumerTopic))
{
ArrayList consumerList = (ArrayList)_exactSelectorSubs.get(topic);
if (tc.isDebugEnabled())
SibTr.debug(tc, "Add members of list to set");
consumerSet.addAll(consumerList);
}
}
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "findMatchingExactSelectorSubs");
}
| void function(String topic, Set consumerSet) { if (tc.isEntryEnabled()) SibTr.entry( tc, STR, new Object[] { topic}); if(_areExactSelectorSubs) { Iterator i = _exactSelectorSubs.keySet().iterator(); while (i.hasNext()) { String consumerTopic = (String)i.next(); if (tc.isDebugEnabled()) SibTr.debug(tc, STR + consumerTopic); if(topic.equals(consumerTopic)) { ArrayList consumerList = (ArrayList)_exactSelectorSubs.get(topic); if (tc.isDebugEnabled()) SibTr.debug(tc, STR); consumerSet.addAll(consumerList); } } } if (tc.isEntryEnabled()) SibTr.exit(tc, STR); } | /**
* Method findMatchingExactSelectorSubs
*
* Used to determine whether there are any subscriptions on fully qualified topic
* expressions and with selectors that might match the specified topic expression.
*
* For this category of subscriptions we can use string matching.
*
* @param topic
* @param consumerSet
*/ | Method findMatchingExactSelectorSubs Used to determine whether there are any subscriptions on fully qualified topic expressions and with selectors that might match the specified topic expression. For this category of subscriptions we can use string matching | findMatchingExactSelectorSubs | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/matching/SubscriptionRegistrar.java",
"license": "epl-1.0",
"size": 26698
} | [
"com.ibm.ws.sib.utils.ras.SibTr",
"java.util.ArrayList",
"java.util.Iterator",
"java.util.Set"
] | import com.ibm.ws.sib.utils.ras.SibTr; import java.util.ArrayList; import java.util.Iterator; import java.util.Set; | import com.ibm.ws.sib.utils.ras.*; import java.util.*; | [
"com.ibm.ws",
"java.util"
] | com.ibm.ws; java.util; | 593,155 |
public NamedNodeMap getAttributes() {
return null;
} | NamedNodeMap function() { return null; } | /**
* <b>DOM</b>: Implements {@link org.w3c.dom.Node#getAttributes()}.
* @return null.
*/ | DOM: Implements <code>org.w3c.dom.Node#getAttributes()</code> | getAttributes | {
"repo_name": "Groostav/CMPT880-term-project",
"path": "intruder/benchs/batik/batik-1.7/sources/org/apache/batik/dom/AbstractNode.java",
"license": "apache-2.0",
"size": 44954
} | [
"org.w3c.dom.NamedNodeMap"
] | import org.w3c.dom.NamedNodeMap; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 343,500 |
public Map<PathFragment, Artifact> getRunfilesInputs(EventHandler eventHandler,
Location location) throws IOException {
Map<PathFragment, Artifact> manifest = getSymlinksAsMap();
// Add unconditional artifacts (committed to inclusion on construction of runfiles).
for (Artifact artifact : getUnconditionalArtifactsWithoutMiddlemen()) {
manifest.put(artifact.getRootRelativePath(), artifact);
}
// Add conditional artifacts (only included if they appear in a pruning manifest).
for (Runfiles.PruningManifest pruningManifest : getPruningManifests()) {
// This map helps us convert from source tree root-relative paths back to artifacts.
Map<String, Artifact> allowedRunfiles = new HashMap<>();
for (Artifact artifact : pruningManifest.getCandidateRunfiles()) {
allowedRunfiles.put(artifact.getRootRelativePath().getPathString(), artifact);
}
BufferedReader reader = new BufferedReader(
new InputStreamReader(pruningManifest.getManifestFile().getPath().getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
Artifact artifact = allowedRunfiles.get(line);
if (artifact != null) {
manifest.put(artifact.getRootRelativePath(), artifact);
}
}
}
manifest = filterListForObscuringSymlinks(eventHandler, location, manifest);
// TODO(bazel-team): Create /dev/null-like Artifact to avoid nulls?
for (PathFragment extraPath : emptyFilesSupplier.getExtraPaths(manifest.keySet())) {
manifest.put(extraPath, null);
}
PathFragment path = new PathFragment(suffix);
Map<PathFragment, Artifact> result = new HashMap<>();
for (Map.Entry<PathFragment, Artifact> entry : manifest.entrySet()) {
result.put(path.getRelative(entry.getKey()), entry.getValue());
}
// Finally add symlinks outside the source tree on top of everything else.
for (Map.Entry<PathFragment, Artifact> entry : getRootSymlinksAsMap().entrySet()) {
PathFragment mappedPath = entry.getKey();
Artifact mappedArtifact = entry.getValue();
if (result.put(mappedPath, mappedArtifact) != null) {
// Emit warning if we overwrote something and we're capable of emitting warnings.
if (eventHandler != null) {
eventHandler.handle(Event.warn(location, "overwrote " + mappedPath + " symlink mapping "
+ "with root symlink to " + mappedArtifact));
}
}
}
return result;
} | Map<PathFragment, Artifact> function(EventHandler eventHandler, Location location) throws IOException { Map<PathFragment, Artifact> manifest = getSymlinksAsMap(); for (Artifact artifact : getUnconditionalArtifactsWithoutMiddlemen()) { manifest.put(artifact.getRootRelativePath(), artifact); } for (Runfiles.PruningManifest pruningManifest : getPruningManifests()) { Map<String, Artifact> allowedRunfiles = new HashMap<>(); for (Artifact artifact : pruningManifest.getCandidateRunfiles()) { allowedRunfiles.put(artifact.getRootRelativePath().getPathString(), artifact); } BufferedReader reader = new BufferedReader( new InputStreamReader(pruningManifest.getManifestFile().getPath().getInputStream())); String line; while ((line = reader.readLine()) != null) { Artifact artifact = allowedRunfiles.get(line); if (artifact != null) { manifest.put(artifact.getRootRelativePath(), artifact); } } } manifest = filterListForObscuringSymlinks(eventHandler, location, manifest); for (PathFragment extraPath : emptyFilesSupplier.getExtraPaths(manifest.keySet())) { manifest.put(extraPath, null); } PathFragment path = new PathFragment(suffix); Map<PathFragment, Artifact> result = new HashMap<>(); for (Map.Entry<PathFragment, Artifact> entry : manifest.entrySet()) { result.put(path.getRelative(entry.getKey()), entry.getValue()); } for (Map.Entry<PathFragment, Artifact> entry : getRootSymlinksAsMap().entrySet()) { PathFragment mappedPath = entry.getKey(); Artifact mappedArtifact = entry.getValue(); if (result.put(mappedPath, mappedArtifact) != null) { if (eventHandler != null) { eventHandler.handle(Event.warn(location, STR + mappedPath + STR + STR + mappedArtifact)); } } } return result; } | /**
* Returns the symlinks as a map from PathFragment to Artifact.
*
* @param eventHandler Used for throwing an error if we have an obscuring runlink within the
* normal source tree entries. May be null, in which case obscuring symlinks are silently
* discarded.
* @param location Location for eventHandler warnings. Ignored if eventHandler is null.
* @return Map<PathFragment, Artifact> path fragment to artifact, of normal source tree entries
* and elements that live outside the source tree. Null values represent empty input files.
*/ | Returns the symlinks as a map from PathFragment to Artifact | getRunfilesInputs | {
"repo_name": "kidaa/bazel",
"path": "src/main/java/com/google/devtools/build/lib/analysis/Runfiles.java",
"license": "apache-2.0",
"size": 31330
} | [
"com.google.devtools.build.lib.actions.Artifact",
"com.google.devtools.build.lib.events.Event",
"com.google.devtools.build.lib.events.EventHandler",
"com.google.devtools.build.lib.events.Location",
"com.google.devtools.build.lib.vfs.PathFragment",
"java.io.BufferedReader",
"java.io.IOException",
"java.io.InputStreamReader",
"java.util.HashMap",
"java.util.Map"
] | import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.events.EventHandler; import com.google.devtools.build.lib.events.Location; import com.google.devtools.build.lib.vfs.PathFragment; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; | import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.events.*; import com.google.devtools.build.lib.vfs.*; import java.io.*; import java.util.*; | [
"com.google.devtools",
"java.io",
"java.util"
] | com.google.devtools; java.io; java.util; | 1,824,147 |
public static void checkFileSystemXAttrSupport(FileSystem fs)
throws XAttrsNotSupportedException {
try {
fs.getXAttrs(new Path(Path.SEPARATOR));
} catch (Exception e) {
throw new XAttrsNotSupportedException("XAttrs not supported for file system: "
+ fs.getUri());
}
} | static void function(FileSystem fs) throws XAttrsNotSupportedException { try { fs.getXAttrs(new Path(Path.SEPARATOR)); } catch (Exception e) { throw new XAttrsNotSupportedException(STR + fs.getUri()); } } | /**
* Determines if a file system supports XAttrs by running a getXAttrs request
* on the file system root. This method is used before distcp job submission
* to fail fast if the user requested preserving XAttrs, but the file system
* cannot support XAttrs.
*
* @param fs FileSystem to check
* @throws XAttrsNotSupportedException if fs does not support XAttrs
*/ | Determines if a file system supports XAttrs by running a getXAttrs request on the file system root. This method is used before distcp job submission to fail fast if the user requested preserving XAttrs, but the file system cannot support XAttrs | checkFileSystemXAttrSupport | {
"repo_name": "apurtell/hadoop",
"path": "hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/util/DistCpUtils.java",
"license": "apache-2.0",
"size": 26119
} | [
"org.apache.hadoop.fs.FileSystem",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.tools.CopyListing"
] | import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.tools.CopyListing; | import org.apache.hadoop.fs.*; import org.apache.hadoop.tools.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 765,586 |
@Test
public void debugExceptionAndFormattedStringWithTwoIntsAndOneObject() {
RuntimeException exception = new RuntimeException();
logger.debugf(exception, "%d + %d = %s", 1, 2, "three");
if (debugEnabled) {
verify(provider).log(eq(2), isNull(), eq(Level.DEBUG), same(exception), any(PrintfStyleFormatter.class), eq("%d + %d = %s"),
eq(1), eq(2), eq("three"));
} else {
verify(provider, never()).log(anyInt(), anyString(), any(), any(), any(), any(), any());
}
} | void function() { RuntimeException exception = new RuntimeException(); logger.debugf(exception, STR, 1, 2, "three"); if (debugEnabled) { verify(provider).log(eq(2), isNull(), eq(Level.DEBUG), same(exception), any(PrintfStyleFormatter.class), eq(STR), eq(1), eq(2), eq("three")); } else { verify(provider, never()).log(anyInt(), anyString(), any(), any(), any(), any(), any()); } } | /**
* Verifies that an exception and a formatted string with two integer and one object arguments will be logged
* correctly at {@link Level#DEBUG DEBUG} level.
*/ | Verifies that an exception and a formatted string with two integer and one object arguments will be logged correctly at <code>Level#DEBUG DEBUG</code> level | debugExceptionAndFormattedStringWithTwoIntsAndOneObject | {
"repo_name": "pmwmedia/tinylog",
"path": "jboss-tinylog/src/test/java/org/tinylog/jboss/TinylogLoggerTest.java",
"license": "apache-2.0",
"size": 189291
} | [
"org.mockito.ArgumentMatchers",
"org.mockito.Mockito",
"org.tinylog.Level",
"org.tinylog.format.PrintfStyleFormatter"
] | import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.tinylog.Level; import org.tinylog.format.PrintfStyleFormatter; | import org.mockito.*; import org.tinylog.*; import org.tinylog.format.*; | [
"org.mockito",
"org.tinylog",
"org.tinylog.format"
] | org.mockito; org.tinylog; org.tinylog.format; | 1,061,135 |
private CompletableFuture<SlotAndLocality> requestAllocatedSlot(
SlotRequestId slotRequestId,
SlotProfile slotProfile,
boolean allowQueuedScheduling,
Time allocationTimeout) {
final CompletableFuture<SlotAndLocality> allocatedSlotLocalityFuture;
// (1) do we have a slot available already?
SlotAndLocality slotFromPool = pollAndAllocateSlot(slotRequestId, slotProfile);
if (slotFromPool != null) {
allocatedSlotLocalityFuture = CompletableFuture.completedFuture(slotFromPool);
} else if (allowQueuedScheduling) {
// we have to request a new allocated slot
CompletableFuture<AllocatedSlot> allocatedSlotFuture = requestNewAllocatedSlot(
slotRequestId,
slotProfile.getResourceProfile(),
allocationTimeout);
allocatedSlotLocalityFuture = allocatedSlotFuture.thenApply((AllocatedSlot allocatedSlot) -> new SlotAndLocality(allocatedSlot, Locality.UNKNOWN));
} else {
allocatedSlotLocalityFuture = FutureUtils.completedExceptionally(new NoResourceAvailableException("Could not allocate a simple slot for " +
slotRequestId + '.'));
}
return allocatedSlotLocalityFuture;
}
/**
* Requests a new slot with the given {@link ResourceProfile} from the ResourceManager. If there is
* currently not ResourceManager connected, then the request is stashed and send once a new
* ResourceManager is connected.
*
* @param slotRequestId identifying the requested slot
* @param resourceProfile which the requested slot should fulfill
* @param allocationTimeout timeout before the slot allocation times out
* @return An {@link AllocatedSlot} future which is completed once the slot is offered to the {@link SlotPool} | CompletableFuture<SlotAndLocality> function( SlotRequestId slotRequestId, SlotProfile slotProfile, boolean allowQueuedScheduling, Time allocationTimeout) { final CompletableFuture<SlotAndLocality> allocatedSlotLocalityFuture; SlotAndLocality slotFromPool = pollAndAllocateSlot(slotRequestId, slotProfile); if (slotFromPool != null) { allocatedSlotLocalityFuture = CompletableFuture.completedFuture(slotFromPool); } else if (allowQueuedScheduling) { CompletableFuture<AllocatedSlot> allocatedSlotFuture = requestNewAllocatedSlot( slotRequestId, slotProfile.getResourceProfile(), allocationTimeout); allocatedSlotLocalityFuture = allocatedSlotFuture.thenApply((AllocatedSlot allocatedSlot) -> new SlotAndLocality(allocatedSlot, Locality.UNKNOWN)); } else { allocatedSlotLocalityFuture = FutureUtils.completedExceptionally(new NoResourceAvailableException(STR + slotRequestId + '.')); } return allocatedSlotLocalityFuture; } /** * Requests a new slot with the given {@link ResourceProfile} from the ResourceManager. If there is * currently not ResourceManager connected, then the request is stashed and send once a new * ResourceManager is connected. * * @param slotRequestId identifying the requested slot * @param resourceProfile which the requested slot should fulfill * @param allocationTimeout timeout before the slot allocation times out * @return An {@link AllocatedSlot} future which is completed once the slot is offered to the {@link SlotPool} | /**
* Allocates an allocated slot first by polling from the available slots and then requesting a new
* slot from the ResourceManager if no fitting slot could be found.
*
* @param slotProfile slot profile that specifies the requirements for the slot
* @param allowQueuedScheduling true if the slot allocation can be completed in the future
* @param allocationTimeout timeout before the slot allocation times out
* @return Future containing the allocated simple slot
*/ | Allocates an allocated slot first by polling from the available slots and then requesting a new slot from the ResourceManager if no fitting slot could be found | requestAllocatedSlot | {
"repo_name": "mylog00/flink",
"path": "flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPool.java",
"license": "apache-2.0",
"size": 62423
} | [
"java.util.concurrent.CompletableFuture",
"org.apache.flink.api.common.time.Time",
"org.apache.flink.runtime.clusterframework.types.ResourceProfile",
"org.apache.flink.runtime.clusterframework.types.SlotProfile",
"org.apache.flink.runtime.concurrent.FutureUtils",
"org.apache.flink.runtime.jobmanager.scheduler.Locality",
"org.apache.flink.runtime.jobmanager.scheduler.NoResourceAvailableException",
"org.apache.flink.runtime.jobmaster.SlotRequestId"
] | import java.util.concurrent.CompletableFuture; import org.apache.flink.api.common.time.Time; import org.apache.flink.runtime.clusterframework.types.ResourceProfile; import org.apache.flink.runtime.clusterframework.types.SlotProfile; import org.apache.flink.runtime.concurrent.FutureUtils; import org.apache.flink.runtime.jobmanager.scheduler.Locality; import org.apache.flink.runtime.jobmanager.scheduler.NoResourceAvailableException; import org.apache.flink.runtime.jobmaster.SlotRequestId; | import java.util.concurrent.*; import org.apache.flink.api.common.time.*; import org.apache.flink.runtime.clusterframework.types.*; import org.apache.flink.runtime.concurrent.*; import org.apache.flink.runtime.jobmanager.scheduler.*; import org.apache.flink.runtime.jobmaster.*; | [
"java.util",
"org.apache.flink"
] | java.util; org.apache.flink; | 2,154,682 |
protected static String convertPathsToIds(CmsObject cms, String value) {
if (value == null) {
return null;
}
// represent vfslists as lists of path in JSON
List<String> paths = CmsStringUtil.splitAsList(value, CmsXmlContentProperty.PROP_SEPARATOR);
List<String> ids = new ArrayList<String>();
for (String path : paths) {
try {
CmsUUID id = getIdForUri(cms, path);
ids.add(id.toString());
} catch (CmsException e) {
// should never happen
LOG.error(e.getLocalizedMessage(), e);
continue;
}
}
return CmsStringUtil.listAsString(ids, CmsXmlContentProperty.PROP_SEPARATOR);
} | static String function(CmsObject cms, String value) { if (value == null) { return null; } List<String> paths = CmsStringUtil.splitAsList(value, CmsXmlContentProperty.PROP_SEPARATOR); List<String> ids = new ArrayList<String>(); for (String path : paths) { try { CmsUUID id = getIdForUri(cms, path); ids.add(id.toString()); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); continue; } } return CmsStringUtil.listAsString(ids, CmsXmlContentProperty.PROP_SEPARATOR); } | /**
* Converts a string containing zero or more VFS paths into a string containing the corresponding structure ids.<p>
*
* @param cms the CmsObject to use for the VFS operations
* @param value a string representation of a list of paths
*
* @return a string representation of a list of ids
*/ | Converts a string containing zero or more VFS paths into a string containing the corresponding structure ids | convertPathsToIds | {
"repo_name": "ggiudetti/opencms-core",
"path": "src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java",
"license": "lgpl-2.1",
"size": 37502
} | [
"java.util.ArrayList",
"java.util.List",
"org.opencms.file.CmsObject",
"org.opencms.main.CmsException",
"org.opencms.util.CmsStringUtil",
"org.opencms.util.CmsUUID"
] | import java.util.ArrayList; import java.util.List; import org.opencms.file.CmsObject; import org.opencms.main.CmsException; import org.opencms.util.CmsStringUtil; import org.opencms.util.CmsUUID; | import java.util.*; import org.opencms.file.*; import org.opencms.main.*; import org.opencms.util.*; | [
"java.util",
"org.opencms.file",
"org.opencms.main",
"org.opencms.util"
] | java.util; org.opencms.file; org.opencms.main; org.opencms.util; | 1,158,644 |
public com.mozu.api.contracts.customer.CustomerContact updateAccountContact(com.mozu.api.contracts.customer.CustomerContact contact, Integer accountId, Integer contactId, String responseFields) throws Exception
{
MozuClient<com.mozu.api.contracts.customer.CustomerContact> client = com.mozu.api.clients.commerce.customer.accounts.CustomerContactClient.updateAccountContactClient( contact, accountId, contactId, responseFields);
client.setContext(_apiContext);
client.executeRequest();
return client.getResult();
} | com.mozu.api.contracts.customer.CustomerContact function(com.mozu.api.contracts.customer.CustomerContact contact, Integer accountId, Integer contactId, String responseFields) throws Exception { MozuClient<com.mozu.api.contracts.customer.CustomerContact> client = com.mozu.api.clients.commerce.customer.accounts.CustomerContactClient.updateAccountContactClient( contact, accountId, contactId, responseFields); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } | /**
* Updates a contact for a specified customer account such as to update addresses or change which contact is the primary contact for billing.
* <p><pre><code>
* CustomerContact customercontact = new CustomerContact();
* CustomerContact customerContact = customercontact.updateAccountContact( contact, accountId, contactId, responseFields);
* </code></pre></p>
* @param accountId Unique identifier of the customer account.
* @param contactId Unique identifer of the customer account contact being updated.
* @param responseFields Use this field to include those fields which are not included by default.
* @param contact Contact information, including the contact's name, address, phone numbers, email addresses, and company (if supplied). Also indicates whether this is a billing, shipping, or billing and shipping contact.
* @return com.mozu.api.contracts.customer.CustomerContact
* @see com.mozu.api.contracts.customer.CustomerContact
* @see com.mozu.api.contracts.customer.CustomerContact
*/ | Updates a contact for a specified customer account such as to update addresses or change which contact is the primary contact for billing. <code><code> CustomerContact customercontact = new CustomerContact(); CustomerContact customerContact = customercontact.updateAccountContact( contact, accountId, contactId, responseFields); </code></code> | updateAccountContact | {
"repo_name": "sanjaymandadi/mozu-java",
"path": "mozu-javaasync-core/src/main/java/com/mozu/api/resources/commerce/customer/accounts/CustomerContactResource.java",
"license": "mit",
"size": 21834
} | [
"com.mozu.api.MozuClient"
] | import com.mozu.api.MozuClient; | import com.mozu.api.*; | [
"com.mozu.api"
] | com.mozu.api; | 73,864 |
public int executeUpdate()
{
try {
return _userQuery.executeUpdate();
} catch (Exception e) {
throw EJBExceptionWrapper.createRuntime(e);
}
} | int function() { try { return _userQuery.executeUpdate(); } catch (Exception e) { throw EJBExceptionWrapper.createRuntime(e); } } | /**
* Execute an update or delete.
*/ | Execute an update or delete | executeUpdate | {
"repo_name": "mdaniel/svn-caucho-com-resin",
"path": "modules/resin/src/com/caucho/amber/ejb3/QueryImpl.java",
"license": "gpl-2.0",
"size": 9512
} | [
"com.caucho.ejb.EJBExceptionWrapper"
] | import com.caucho.ejb.EJBExceptionWrapper; | import com.caucho.ejb.*; | [
"com.caucho.ejb"
] | com.caucho.ejb; | 1,462,055 |
public Annotation[] annotations() {
return parent.annotations()[index];
} | Annotation[] function() { return parent.annotations()[index]; } | /**
* Gets all the annotations on this parameter.
*/ | Gets all the annotations on this parameter | annotations | {
"repo_name": "ErikVerheul/jenkins",
"path": "core/src/main/java/hudson/util/ReflectionUtils.java",
"license": "mit",
"size": 7413
} | [
"java.lang.annotation.Annotation"
] | import java.lang.annotation.Annotation; | import java.lang.annotation.*; | [
"java.lang"
] | java.lang; | 2,296,209 |
public Byte validate(String value, String pattern) {
return (Byte)parse(value, pattern, (Locale)null);
} | Byte function(String value, String pattern) { return (Byte)parse(value, pattern, (Locale)null); } | /**
* <p>Validate/convert a <code>Byte</code> using the
* specified <i>pattern</i>.
*
* @param value The value validation is being performed on.
* @param pattern The pattern used to validate the value against.
* @return The parsed <code>Byte</code> if valid or <code>null</code> if invalid.
*/ | Validate/convert a <code>Byte</code> using the specified pattern | validate | {
"repo_name": "ManfredTremmel/gwt-commons-validator",
"path": "src/main/java/org/apache/commons/validator/routines/ByteValidator.java",
"license": "apache-2.0",
"size": 9752
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 421,776 |
public com.squareup.okhttp.Call stewardsListAsync(String authorization, final ApiCallback<StewardsList> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; | com.squareup.okhttp.Call function(String authorization, final ApiCallback<StewardsList> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; | /**
* Get a listing of known stewards (asynchronously)
*
* @param authorization (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ | Get a listing of known stewards (asynchronously) | stewardsListAsync | {
"repo_name": "Circular-Money/Agent-Based-Model",
"path": "openmoney-api-client/src/main/java/io/swagger/client/api/StewardsApi.java",
"license": "gpl-3.0",
"size": 40410
} | [
"io.swagger.client.ApiCallback",
"io.swagger.client.ApiException",
"io.swagger.client.ProgressRequestBody",
"io.swagger.client.ProgressResponseBody",
"io.swagger.client.model.StewardsList"
] | import io.swagger.client.ApiCallback; import io.swagger.client.ApiException; import io.swagger.client.ProgressRequestBody; import io.swagger.client.ProgressResponseBody; import io.swagger.client.model.StewardsList; | import io.swagger.client.*; import io.swagger.client.model.*; | [
"io.swagger.client"
] | io.swagger.client; | 491,918 |
public static void skip(final Reader in, final long skipLen) {
try {
in.skip(skipLen);
} catch (final IOException e) {
try {
in.close();
} catch (final IOException f) {
throw new RuntimeException(LS + "Close Unsuccessful" + LS + f);
}
throw new RuntimeException(LS + "Reader.skip(len) unsuccessful: " + LS + e);
}
} | static void function(final Reader in, final long skipLen) { try { in.skip(skipLen); } catch (final IOException e) { try { in.close(); } catch (final IOException f) { throw new RuntimeException(LS + STR + LS + f); } throw new RuntimeException(LS + STR + LS + e); } } | /**
* Skips bytes in the given Reader object.
*
* @param in the given Reader
* @param skipLen in bytes.
* @throws RuntimeException if IOException occurs.
*/ | Skips bytes in the given Reader object | skip | {
"repo_name": "DataSketches/DataSketches.github.io",
"path": "src/main/java/org/apache/datasketches/Files.java",
"license": "apache-2.0",
"size": 37488
} | [
"java.io.IOException",
"java.io.Reader"
] | import java.io.IOException; import java.io.Reader; | import java.io.*; | [
"java.io"
] | java.io; | 1,832,591 |
EAttribute getEnvironmentPropertyType_Key();
| EAttribute getEnvironmentPropertyType_Key(); | /**
* Returns the meta object for the attribute '{@link es.itecban.deployment.model.configuration.EnvironmentPropertyType#getKey <em>Key</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Key</em>'.
* @see es.itecban.deployment.model.configuration.EnvironmentPropertyType#getKey()
* @see #getEnvironmentPropertyType()
* @generated
*/ | Returns the meta object for the attribute '<code>es.itecban.deployment.model.configuration.EnvironmentPropertyType#getKey Key</code>'. | getEnvironmentPropertyType_Key | {
"repo_name": "iLabrys/iLabrysOSGi",
"path": "es.itecban.deployment.model.configuration/src/es/itecban/deployment/model/configuration/ConfigurationPackage.java",
"license": "apache-2.0",
"size": 38571
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,241,112 |
public BeanDescriptor getBeanDescriptor()
{
return bd;
} | BeanDescriptor function() { return bd; } | /**
* Gets the beanDescriptor
*
* @return The beanDescriptor value
*/ | Gets the beanDescriptor | getBeanDescriptor | {
"repo_name": "mstritt/orbit-image-analysis",
"path": "src/main/java/com/l2fprod/common/swing/JFontChooserBeanInfo.java",
"license": "gpl-3.0",
"size": 5620
} | [
"java.beans.BeanDescriptor"
] | import java.beans.BeanDescriptor; | import java.beans.*; | [
"java.beans"
] | java.beans; | 706,306 |
public void removeUnviewableBlocks(Set<String> unviewableBlocks) {
if (isFieldUnviewable(currentAmountField, unviewableBlocks)) {
currentAmountField = null;
}
if (isFieldUnviewable(baseAmountField, unviewableBlocks)) {
baseAmountField = null;
}
}
| void function(Set<String> unviewableBlocks) { if (isFieldUnviewable(currentAmountField, unviewableBlocks)) { currentAmountField = null; } if (isFieldUnviewable(baseAmountField, unviewableBlocks)) { baseAmountField = null; } } | /**
* Checks to see if either the current amount or the base amount are unviewable; if so, sets them to null
* @see org.kuali.kfs.sys.document.web.FieldTableJoining#removeUnviewableBlocks(java.util.Set)
*/ | Checks to see if either the current amount or the base amount are unviewable; if so, sets them to null | removeUnviewableBlocks | {
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "work/src/org/kuali/kfs/sys/document/web/AccountingLineViewCurrentBaseAmount.java",
"license": "agpl-3.0",
"size": 14624
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 919,616 |
private void registerEntityElements(List<Element> entityElementList) {
for (Element entityElement : entityElementList) {
String entityName = entityElement.attributeValue(ATTRIBUTE_NAME);
String serviceName = entityElement.attributeValue(ATTRIBUTE_SERVICE_NAME);
List<String> serviceList = entityServiceNameMap.get(entityName);
if (serviceList == null) {
serviceList = new ArrayList<String>();
entityServiceNameMap.put(entityName, serviceList);
}
serviceList.add(serviceName);
}
}
| void function(List<Element> entityElementList) { for (Element entityElement : entityElementList) { String entityName = entityElement.attributeValue(ATTRIBUTE_NAME); String serviceName = entityElement.attributeValue(ATTRIBUTE_SERVICE_NAME); List<String> serviceList = entityServiceNameMap.get(entityName); if (serviceList == null) { serviceList = new ArrayList<String>(); entityServiceNameMap.put(entityName, serviceList); } serviceList.add(serviceName); } } | /**
* This method stores the data of all the entity tags into entityServiceMap
* @param entityElementList the root element of the XML document
*/ | This method stores the data of all the entity tags into entityServiceMap | registerEntityElements | {
"repo_name": "NCIP/cab2b",
"path": "software/cab2b/src/java/server/edu/wustl/cab2b/server/analyticalservice/EntityToAnalyticalServiceMapper.java",
"license": "bsd-3-clause",
"size": 11873
} | [
"java.util.ArrayList",
"java.util.List",
"org.dom4j.Element"
] | import java.util.ArrayList; import java.util.List; import org.dom4j.Element; | import java.util.*; import org.dom4j.*; | [
"java.util",
"org.dom4j"
] | java.util; org.dom4j; | 1,285,322 |
public synchronized JobStatus submitJob(JobID jobId) throws IOException {
if(jobs.containsKey(jobId)) {
//job already running, don't start twice
return jobs.get(jobId).getStatus();
}
JobInProgress job = new JobInProgress(jobId, this, this.conf);
// check for access
checkAccess(job, QueueManager.QueueOperation.SUBMIT_JOB);
return addJob(jobId, job);
} | synchronized JobStatus function(JobID jobId) throws IOException { if(jobs.containsKey(jobId)) { return jobs.get(jobId).getStatus(); } JobInProgress job = new JobInProgress(jobId, this, this.conf); checkAccess(job, QueueManager.QueueOperation.SUBMIT_JOB); return addJob(jobId, job); } | /**
* JobTracker.submitJob() kicks off a new job.
*
* Create a 'JobInProgress' object, which contains both JobProfile
* and JobStatus. Those two sub-objects are sometimes shipped outside
* of the JobTracker. But JobInProgress adds info that's useful for
* the JobTracker alone.
*/ | JobTracker.submitJob() kicks off a new job. Create a 'JobInProgress' object, which contains both JobProfile and JobStatus. Those two sub-objects are sometimes shipped outside of the JobTracker. But JobInProgress adds info that's useful for the JobTracker alone | submitJob | {
"repo_name": "four2five/0.19.2",
"path": "src/mapred/org/apache/hadoop/mapred/JobTracker.java",
"license": "apache-2.0",
"size": 108276
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 161,997 |
@Test
public void testDiscardReadBytes2() {
buffer.writerIndex(0);
for (int i = 0; i < buffer.capacity(); i ++) {
buffer.writeByte((byte) i);
}
ByteBuf copy = copiedBuffer(buffer);
// Discard the first (CAPACITY / 2 - 1) bytes.
buffer.setIndex(CAPACITY / 2 - 1, CAPACITY - 1);
buffer.discardReadBytes();
assertEquals(0, buffer.readerIndex());
assertEquals(CAPACITY / 2, buffer.writerIndex());
for (int i = 0; i < CAPACITY / 2; i ++) {
assertEquals(copy.slice(CAPACITY / 2 - 1 + i, CAPACITY / 2 - i), buffer.slice(i, CAPACITY / 2 - i));
}
copy.release();
} | void function() { buffer.writerIndex(0); for (int i = 0; i < buffer.capacity(); i ++) { buffer.writeByte((byte) i); } ByteBuf copy = copiedBuffer(buffer); buffer.setIndex(CAPACITY / 2 - 1, CAPACITY - 1); buffer.discardReadBytes(); assertEquals(0, buffer.readerIndex()); assertEquals(CAPACITY / 2, buffer.writerIndex()); for (int i = 0; i < CAPACITY / 2; i ++) { assertEquals(copy.slice(CAPACITY / 2 - 1 + i, CAPACITY / 2 - i), buffer.slice(i, CAPACITY / 2 - i)); } copy.release(); } | /**
* The similar test case with {@link #testDiscardReadBytes()} but this one
* discards a large chunk at once.
*/ | The similar test case with <code>#testDiscardReadBytes()</code> but this one discards a large chunk at once | testDiscardReadBytes2 | {
"repo_name": "s-gheldd/netty",
"path": "buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java",
"license": "apache-2.0",
"size": 151274
} | [
"io.netty.buffer.Unpooled",
"org.junit.Assert"
] | import io.netty.buffer.Unpooled; import org.junit.Assert; | import io.netty.buffer.*; import org.junit.*; | [
"io.netty.buffer",
"org.junit"
] | io.netty.buffer; org.junit; | 859,810 |
public void attemptLogin() {
if (mAuthTask != null) {
return;
}
// Reset errors.
mEmailView.setError(null);
mPasswordView.setError(null);
// Store values at the time of the login attempt.
mEmail = mEmailView.getText().toString();
mPassword = mPasswordView.getText().toString();
boolean cancel = false;
View focusView = null;
// Check for a valid password.
if (TextUtils.isEmpty(mPassword)) {
mPasswordView.setError(getString(R.string.login_error_field_required));
focusView = mPasswordView;
cancel = true;
} else if (mPassword.length() < 4) {
mPasswordView.setError(getString(R.string.login_error_invalid_password));
focusView = mPasswordView;
cancel = true;
}
// Check for a valid email address.
if (TextUtils.isEmpty(mEmail)) {
mEmailView.setError(getString(R.string.login_error_field_required));
focusView = mEmailView;
cancel = true;
} else if (!mEmail.contains("@")) {
mEmailView.setError(getString(R.string.login_error_invalid_email));
focusView = mEmailView;
cancel = true;
}
if (cancel) {
// There was an error; don't attempt login and focus the first
// form field with an error.
focusView.requestFocus();
} else {
// Show a progress spinner, and kick off a background task to
// perform the user login attempt.
mLoginStatusMessageView.setText(R.string.login_login_progress_signing_in);
showProgress(true);
mAuthTask = new UserLoginTask();
mAuthTask.execute((Void) null);
}
} | void function() { if (mAuthTask != null) { return; } mEmailView.setError(null); mPasswordView.setError(null); mEmail = mEmailView.getText().toString(); mPassword = mPasswordView.getText().toString(); boolean cancel = false; View focusView = null; if (TextUtils.isEmpty(mPassword)) { mPasswordView.setError(getString(R.string.login_error_field_required)); focusView = mPasswordView; cancel = true; } else if (mPassword.length() < 4) { mPasswordView.setError(getString(R.string.login_error_invalid_password)); focusView = mPasswordView; cancel = true; } if (TextUtils.isEmpty(mEmail)) { mEmailView.setError(getString(R.string.login_error_field_required)); focusView = mEmailView; cancel = true; } else if (!mEmail.contains("@")) { mEmailView.setError(getString(R.string.login_error_invalid_email)); focusView = mEmailView; cancel = true; } if (cancel) { focusView.requestFocus(); } else { mLoginStatusMessageView.setText(R.string.login_login_progress_signing_in); showProgress(true); mAuthTask = new UserLoginTask(); mAuthTask.execute((Void) null); } } | /**
* Attempts to sign in or register the account specified by the login form.
* If there are form errors (invalid email, missing fields, etc.), the
* errors are presented and no actual login attempt is made.
*/ | Attempts to sign in or register the account specified by the login form. If there are form errors (invalid email, missing fields, etc.), the errors are presented and no actual login attempt is made | attemptLogin | {
"repo_name": "juhnowski/gazros_android",
"path": "GazRos2/src/net/phreebie/gazros/LoginActivity.java",
"license": "mit",
"size": 7482
} | [
"android.text.TextUtils",
"android.view.View"
] | import android.text.TextUtils; import android.view.View; | import android.text.*; import android.view.*; | [
"android.text",
"android.view"
] | android.text; android.view; | 1,159,430 |
public boolean canHandle(File f);
| boolean function(File f); | /**
* not called in the AWT event dispatching thread
* */ | not called in the AWT event dispatching thread | canHandle | {
"repo_name": "mbshopM/openconcerto",
"path": "OpenConcerto/src/org/openconcerto/sql/view/FileDropHandler.java",
"license": "gpl-3.0",
"size": 989
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,646,234 |
private void setRect(double minLat, double minLng, double maxLat,
double maxLng) {
if (!(minLat < maxLat)) {
throw new IllegalArgumentException(
"GeoBounds is not valid - minLat must be less that maxLat.");
}
if (!(minLng < maxLng)) {
if (minLng > 0 && minLng < 180 && maxLng < 0) {
rects = new Rectangle2D[] {
// split into two rects e.g. 176.8793 to 180 and -180 to
// -175.0104
new Rectangle2D.Double(minLng, minLat, 180 - minLng,
maxLat - minLat),
new Rectangle2D.Double(-180, minLat, maxLng + 180,
maxLat - minLat) };
} else {
rects = new Rectangle2D[] { new Rectangle2D.Double(minLng,
minLat, maxLng - minLng, maxLat - minLat) };
throw new IllegalArgumentException(
"GeoBounds is not valid - minLng must be less that maxLng or "
+ "minLng must be greater than 0 and maxLng must be less than 0.");
}
} else {
rects = new Rectangle2D[] { new Rectangle2D.Double(minLng, minLat,
maxLng - minLng, maxLat - minLat) };
}
} | void function(double minLat, double minLng, double maxLat, double maxLng) { if (!(minLat < maxLat)) { throw new IllegalArgumentException( STR); } if (!(minLng < maxLng)) { if (minLng > 0 && minLng < 180 && maxLng < 0) { rects = new Rectangle2D[] { new Rectangle2D.Double(minLng, minLat, 180 - minLng, maxLat - minLat), new Rectangle2D.Double(-180, minLat, maxLng + 180, maxLat - minLat) }; } else { rects = new Rectangle2D[] { new Rectangle2D.Double(minLng, minLat, maxLng - minLng, maxLat - minLat) }; throw new IllegalArgumentException( STR + STR); } } else { rects = new Rectangle2D[] { new Rectangle2D.Double(minLng, minLat, maxLng - minLng, maxLat - minLat) }; } } | /**
* Sets the internal rectangle representation.
*
* @param minLat
* The minimum latitude.
* @param minLng
* The minimum longitude.
* @param maxLat
* The maximum latitude.
* @param maxLng
* The maximum longitude.
*/ | Sets the internal rectangle representation | setRect | {
"repo_name": "griffon/griffon-swingx-ws-plugin",
"path": "src/main/org/jdesktop/swingx/mapviewer/GeoBounds.java",
"license": "apache-2.0",
"size": 3869
} | [
"java.awt.geom.Rectangle2D"
] | import java.awt.geom.Rectangle2D; | import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 943,383 |
public static boolean hasExpired(AssertionType assertion) throws ConfigurationException {
boolean expiry = false;
// Check for validity of assertion
ConditionsType conditionsType = assertion.getConditions();
if (conditionsType != null) {
XMLGregorianCalendar now = XMLTimeUtil.getIssueInstant();
XMLGregorianCalendar notBefore = conditionsType.getNotBefore();
XMLGregorianCalendar notOnOrAfter = conditionsType.getNotOnOrAfter();
if (notBefore != null) {
logger.trace("Assertion: " + assertion.getID() + " ::Now=" + now.toXMLFormat() + " ::notBefore=" + notBefore.toXMLFormat());
}
if (notOnOrAfter != null) {
logger.trace("Assertion: " + assertion.getID() + " ::Now=" + now.toXMLFormat() + " ::notOnOrAfter=" + notOnOrAfter);
}
expiry = !XMLTimeUtil.isValid(now, notBefore, notOnOrAfter);
if (expiry) {
logger.samlAssertionExpired(assertion.getID());
}
}
// TODO: if conditions do not exist, assume the assertion to be everlasting?
return expiry;
} | static boolean function(AssertionType assertion) throws ConfigurationException { boolean expiry = false; ConditionsType conditionsType = assertion.getConditions(); if (conditionsType != null) { XMLGregorianCalendar now = XMLTimeUtil.getIssueInstant(); XMLGregorianCalendar notBefore = conditionsType.getNotBefore(); XMLGregorianCalendar notOnOrAfter = conditionsType.getNotOnOrAfter(); if (notBefore != null) { logger.trace(STR + assertion.getID() + STR + now.toXMLFormat() + STR + notBefore.toXMLFormat()); } if (notOnOrAfter != null) { logger.trace(STR + assertion.getID() + STR + now.toXMLFormat() + STR + notOnOrAfter); } expiry = !XMLTimeUtil.isValid(now, notBefore, notOnOrAfter); if (expiry) { logger.samlAssertionExpired(assertion.getID()); } } return expiry; } | /**
* Check whether the assertion has expired
*
* @param assertion
*
* @return
*
* @throws ConfigurationException
*/ | Check whether the assertion has expired | hasExpired | {
"repo_name": "didiez/keycloak",
"path": "saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/util/AssertionUtil.java",
"license": "apache-2.0",
"size": 22397
} | [
"javax.xml.datatype.XMLGregorianCalendar",
"org.keycloak.dom.saml.v2.assertion.AssertionType",
"org.keycloak.dom.saml.v2.assertion.ConditionsType",
"org.keycloak.saml.common.exceptions.ConfigurationException"
] | import javax.xml.datatype.XMLGregorianCalendar; import org.keycloak.dom.saml.v2.assertion.AssertionType; import org.keycloak.dom.saml.v2.assertion.ConditionsType; import org.keycloak.saml.common.exceptions.ConfigurationException; | import javax.xml.datatype.*; import org.keycloak.dom.saml.v2.assertion.*; import org.keycloak.saml.common.exceptions.*; | [
"javax.xml",
"org.keycloak.dom",
"org.keycloak.saml"
] | javax.xml; org.keycloak.dom; org.keycloak.saml; | 1,763,616 |
public Date getDateCreated() {
SimpleDateFormat format = new SimpleDateFormat(
"EEE, dd MMM yyyy HH:mm:ss Z");
try {
return format.parse(this.getProperty("date_created"));
} catch (ParseException e) {
return null;
}
} | Date function() { SimpleDateFormat format = new SimpleDateFormat( STR); try { return format.parse(this.getProperty(STR)); } catch (ParseException e) { return null; } } | /**
* Gets the date created.
*
* @return the date created
*/ | Gets the date created | getDateCreated | {
"repo_name": "Forestvap/Twilio-Project",
"path": "twilio-java/src/main/java/com/twilio/sdk/resource/instance/Participant.java",
"license": "mit",
"size": 5256
} | [
"java.text.ParseException",
"java.text.SimpleDateFormat",
"java.util.Date"
] | import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; | import java.text.*; import java.util.*; | [
"java.text",
"java.util"
] | java.text; java.util; | 980,556 |
public boolean isAbstract(final Class<?> clazz) {
return Modifier.isAbstract(clazz.getModifiers());
} | boolean function(final Class<?> clazz) { return Modifier.isAbstract(clazz.getModifiers()); } | /**
* Checks if the class is abstract.
*
* @param clazz The class to check.
* @return If the class is abstract.
*/ | Checks if the class is abstract | isAbstract | {
"repo_name": "blurpy/kouinject",
"path": "src/main/java/net/usikkert/kouinject/util/ReflectionUtils.java",
"license": "gpl-3.0",
"size": 12315
} | [
"java.lang.reflect.Modifier"
] | import java.lang.reflect.Modifier; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 654,113 |
public void updateByXml(Source source) throws IOException {
checkPermission(CONFIGURE);
XmlFile configXmlFile = getConfigFile();
final AtomicFileWriter out = new AtomicFileWriter(configXmlFile.getFile());
try {
try {
XMLUtils.safeTransform(source, new StreamResult(out));
out.close();
} catch (TransformerException | SAXException e) {
throw new IOException("Failed to persist config.xml", e);
}
// try to reflect the changes by reloading
Object o = new XmlFile(Items.XSTREAM, out.getTemporaryFile()).unmarshal(this);
if (o!=this) {
// ensure that we've got the same job type. extending this code to support updating
// to different job type requires destroying & creating a new job type
throw new IOException("Expecting "+this.getClass()+" but got "+o.getClass()+" instead");
} | void function(Source source) throws IOException { checkPermission(CONFIGURE); XmlFile configXmlFile = getConfigFile(); final AtomicFileWriter out = new AtomicFileWriter(configXmlFile.getFile()); try { try { XMLUtils.safeTransform(source, new StreamResult(out)); out.close(); } catch (TransformerException SAXException e) { throw new IOException(STR, e); } Object o = new XmlFile(Items.XSTREAM, out.getTemporaryFile()).unmarshal(this); if (o!=this) { throw new IOException(STR+this.getClass()+STR+o.getClass()+STR); } | /**
* Updates an Item by its XML definition.
* @param source source of the Item's new definition.
* The source should be either a <code>StreamSource</code> or a <code>SAXSource</code>, other
* sources may not be handled.
* @since 1.473
*/ | Updates an Item by its XML definition | updateByXml | {
"repo_name": "FarmGeek4Life/jenkins",
"path": "core/src/main/java/hudson/model/AbstractItem.java",
"license": "mit",
"size": 28649
} | [
"hudson.util.AtomicFileWriter",
"java.io.IOException",
"javax.xml.transform.Source",
"javax.xml.transform.TransformerException",
"javax.xml.transform.stream.StreamResult",
"org.xml.sax.SAXException"
] | import hudson.util.AtomicFileWriter; import java.io.IOException; import javax.xml.transform.Source; import javax.xml.transform.TransformerException; import javax.xml.transform.stream.StreamResult; import org.xml.sax.SAXException; | import hudson.util.*; import java.io.*; import javax.xml.transform.*; import javax.xml.transform.stream.*; import org.xml.sax.*; | [
"hudson.util",
"java.io",
"javax.xml",
"org.xml.sax"
] | hudson.util; java.io; javax.xml; org.xml.sax; | 409,049 |
protected final void handleErrorInDedent(ParseException e) throws ParseException {
addAndReport(e, "Handle dedent");
//lot's of tokens, but we'll bail out on an indent, so, that's OK.
AbstractTokenManager tokenManager = getTokenManager();
int indentId = tokenManager.getIndentId();
int dedentId = tokenManager.getDedentId();
int level = 0;
//lot's of tokens, but we'll bail out on an indent, so, that's OK.
TokensIterator iterTokens = this.getTokensIterator(getCurrentToken(), 50, false);
while (iterTokens.hasNext()) {
Token next = iterTokens.next();
if (level == 0) {
//we can only do it if we're in the same level we started.
if (next.kind == dedentId) {
setCurrentToken(next);
break;
}
}
if (next.kind == indentId) {
level += 1;
} else if (next.kind == dedentId) {
level -= 1;
}
}
} | final void function(ParseException e) throws ParseException { addAndReport(e, STR); AbstractTokenManager tokenManager = getTokenManager(); int indentId = tokenManager.getIndentId(); int dedentId = tokenManager.getDedentId(); int level = 0; TokensIterator iterTokens = this.getTokensIterator(getCurrentToken(), 50, false); while (iterTokens.hasNext()) { Token next = iterTokens.next(); if (level == 0) { if (next.kind == dedentId) { setCurrentToken(next); break; } } if (next.kind == indentId) { level += 1; } else if (next.kind == dedentId) { level -= 1; } } } | /**
* Called when there was an error trying to dedent. At this point, we must try to sync it to an
* actual dedent.
*/ | Called when there was an error trying to dedent. At this point, we must try to sync it to an actual dedent | handleErrorInDedent | {
"repo_name": "smkr/pyclipse",
"path": "plugins/org.python.pydev.parser/src/org/python/pydev/parser/grammarcommon/AbstractGrammarErrorHandlers.java",
"license": "epl-1.0",
"size": 7692
} | [
"org.python.pydev.parser.jython.ParseException",
"org.python.pydev.parser.jython.Token"
] | import org.python.pydev.parser.jython.ParseException; import org.python.pydev.parser.jython.Token; | import org.python.pydev.parser.jython.*; | [
"org.python.pydev"
] | org.python.pydev; | 342,764 |
public Object unmarshal(Exchange exchange, InputStream stream) throws IOException {
checkElementNameStrategy(exchange);
String soapAction = getSoapActionFromExchange(exchange);
// Determine the method name for an eventual BeanProcessor in the route
if (soapAction != null && elementNameStrategy instanceof ServiceInterfaceStrategy) {
ServiceInterfaceStrategy strategy = (ServiceInterfaceStrategy) elementNameStrategy;
String methodName = strategy.getMethodForSoapAction(soapAction);
exchange.getOut().setHeader(Exchange.BEAN_METHOD_NAME, methodName);
}
// Store soap action for an eventual later marshal step.
// This is necessary as the soap action in the message may get lost on the way
if (soapAction != null) {
exchange.setProperty(Exchange.SOAP_ACTION, soapAction);
}
Object unmarshalledObject = super.unmarshal(exchange, stream);
Object rootObject = JAXBIntrospector.getValue(unmarshalledObject);
return adapter.doUnmarshal(exchange, stream, rootObject);
} | Object function(Exchange exchange, InputStream stream) throws IOException { checkElementNameStrategy(exchange); String soapAction = getSoapActionFromExchange(exchange); if (soapAction != null && elementNameStrategy instanceof ServiceInterfaceStrategy) { ServiceInterfaceStrategy strategy = (ServiceInterfaceStrategy) elementNameStrategy; String methodName = strategy.getMethodForSoapAction(soapAction); exchange.getOut().setHeader(Exchange.BEAN_METHOD_NAME, methodName); } if (soapAction != null) { exchange.setProperty(Exchange.SOAP_ACTION, soapAction); } Object unmarshalledObject = super.unmarshal(exchange, stream); Object rootObject = JAXBIntrospector.getValue(unmarshalledObject); return adapter.doUnmarshal(exchange, stream, rootObject); } | /**
* Unmarshal a given SOAP xml stream and return the content of the SOAP body
*/ | Unmarshal a given SOAP xml stream and return the content of the SOAP body | unmarshal | {
"repo_name": "kevinearls/camel",
"path": "components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/SoapJaxbDataFormat.java",
"license": "apache-2.0",
"size": 13243
} | [
"java.io.IOException",
"java.io.InputStream",
"javax.xml.bind.JAXBIntrospector",
"org.apache.camel.Exchange",
"org.apache.camel.dataformat.soap.name.ServiceInterfaceStrategy"
] | import java.io.IOException; import java.io.InputStream; import javax.xml.bind.JAXBIntrospector; import org.apache.camel.Exchange; import org.apache.camel.dataformat.soap.name.ServiceInterfaceStrategy; | import java.io.*; import javax.xml.bind.*; import org.apache.camel.*; import org.apache.camel.dataformat.soap.name.*; | [
"java.io",
"javax.xml",
"org.apache.camel"
] | java.io; javax.xml; org.apache.camel; | 1,482,286 |
public ServiceFuture<List<AlertRuleResourceInner>> listByResourceGroupAsync(String resourceGroupName, String filter, final ServiceCallback<List<AlertRuleResourceInner>> serviceCallback) {
return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter), serviceCallback);
} | ServiceFuture<List<AlertRuleResourceInner>> function(String resourceGroupName, String filter, final ServiceCallback<List<AlertRuleResourceInner>> serviceCallback) { return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter), serviceCallback); } | /**
* List the alert rules within a resource group.
*
* @param resourceGroupName The name of the resource group.
* @param filter The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | List the alert rules within a resource group | listByResourceGroupAsync | {
"repo_name": "martinsawicki/azure-sdk-for-java",
"path": "azure-mgmt-insights/src/main/java/com/microsoft/azure/management/gallery/implementation/AlertRulesInner.java",
"license": "mit",
"size": 28641
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture",
"java.util.List"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import java.util.List; | import com.microsoft.rest.*; import java.util.*; | [
"com.microsoft.rest",
"java.util"
] | com.microsoft.rest; java.util; | 882,205 |
public static SkillCooldownEvent.Tick createSkillCooldownEventTick(SkillCaster caster, Skill skill, int originalCooldown, int remainingCooldown) {
HashMap<String, Object> values = new HashMap<>();
values.put("caster", caster);
values.put("skill", skill);
values.put("originalCooldown", originalCooldown);
values.put("remainingCooldown", remainingCooldown);
return SpongeEventFactoryUtils.createEventImpl(SkillCooldownEvent.Tick.class, values);
} | static SkillCooldownEvent.Tick function(SkillCaster caster, Skill skill, int originalCooldown, int remainingCooldown) { HashMap<String, Object> values = new HashMap<>(); values.put(STR, caster); values.put("skill", skill); values.put(STR, originalCooldown); values.put(STR, remainingCooldown); return SpongeEventFactoryUtils.createEventImpl(SkillCooldownEvent.Tick.class, values); } | /**
* AUTOMATICALLY GENERATED, DO NOT EDIT.
* Creates a new instance of
* {@link com.afterkraft.kraftrpg.api.event.skill.SkillCooldownEvent.Tick}.
*
* @param caster The caster
* @param skill The skill
* @param originalCooldown The original cooldown
* @param remainingCooldown The remaining cooldown
* @return A new tick skill cooldown event
*/ | AUTOMATICALLY GENERATED, DO NOT EDIT. Creates a new instance of <code>com.afterkraft.kraftrpg.api.event.skill.SkillCooldownEvent.Tick</code> | createSkillCooldownEventTick | {
"repo_name": "AfterKraft/KraftRPG-API",
"path": "src/main/java/com/afterkraft/kraftrpg/api/event/KraftRpgEventFactory.java",
"license": "mit",
"size": 6929
} | [
"com.afterkraft.kraftrpg.api.entity.SkillCaster",
"com.afterkraft.kraftrpg.api.event.skill.SkillCooldownEvent",
"com.afterkraft.kraftrpg.api.skill.Skill",
"java.util.HashMap",
"org.spongepowered.api.event.SpongeEventFactoryUtils"
] | import com.afterkraft.kraftrpg.api.entity.SkillCaster; import com.afterkraft.kraftrpg.api.event.skill.SkillCooldownEvent; import com.afterkraft.kraftrpg.api.skill.Skill; import java.util.HashMap; import org.spongepowered.api.event.SpongeEventFactoryUtils; | import com.afterkraft.kraftrpg.api.entity.*; import com.afterkraft.kraftrpg.api.event.skill.*; import com.afterkraft.kraftrpg.api.skill.*; import java.util.*; import org.spongepowered.api.event.*; | [
"com.afterkraft.kraftrpg",
"java.util",
"org.spongepowered.api"
] | com.afterkraft.kraftrpg; java.util; org.spongepowered.api; | 1,916,933 |
@NonNull
public FilePath[] list(final String includes, final String excludes) throws IOException, InterruptedException {
return list(includes, excludes, true);
} | FilePath[] function(final String includes, final String excludes) throws IOException, InterruptedException { return list(includes, excludes, true); } | /**
* List up files in this directory that matches the given Ant-style filter.
*
* @param includes
* See {@link FileSet} for the syntax. String like "foo/*.zip" or "foo/**/*.xml"
* @param excludes
* See {@link FileSet} for the syntax. String like "foo/*.zip" or "foo/**/*.xml"
* @return
* can be empty but always non-null.
* @since 1.407
*/ | List up files in this directory that matches the given Ant-style filter | list | {
"repo_name": "rsandell/jenkins",
"path": "core/src/main/java/hudson/FilePath.java",
"license": "mit",
"size": 148479
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,092,163 |
public ExecutorService getSchemaExecutorService() {
return schemaExecSvc;
} | ExecutorService function() { return schemaExecSvc; } | /**
* Executor service that is in charge of processing schema change messages.
*
* @return Executor service that is in charge of processing schema change messages.
*/ | Executor service that is in charge of processing schema change messages | getSchemaExecutorService | {
"repo_name": "NSAmelchev/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/pool/PoolProcessor.java",
"license": "apache-2.0",
"size": 48314
} | [
"java.util.concurrent.ExecutorService"
] | import java.util.concurrent.ExecutorService; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 598,159 |
@Override
protected void populateModel(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException {
if (operation.hasDefined(CommonAttributes.MOD_CLUSTER_CONFIG)) {
PathAddress opAddress = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR));
PathAddress parent = opAddress.append(ModClusterConfigResourceDefinition.PATH);
ModelNode targetOperation = Util.createAddOperation(parent);
for (AttributeDefinition def : ModClusterConfigResourceDefinition.ATTRIBUTES) {
def.validateAndSet(operation, targetOperation);
}
context.addStep(targetOperation, ModClusterConfigAdd.INSTANCE, OperationContext.Stage.MODEL, true);
}
// Inform handlers for child resources that we are part of the set of operations
// so they know we'll be utilizing any model they write. We do this in Stage.MODEL
// so in their Stage.MODEL they can decide to skip adding a runtime step
context.attach(SUBSYSTEM_ADD_KEY, Boolean.TRUE);
} | void function(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { if (operation.hasDefined(CommonAttributes.MOD_CLUSTER_CONFIG)) { PathAddress opAddress = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)); PathAddress parent = opAddress.append(ModClusterConfigResourceDefinition.PATH); ModelNode targetOperation = Util.createAddOperation(parent); for (AttributeDefinition def : ModClusterConfigResourceDefinition.ATTRIBUTES) { def.validateAndSet(operation, targetOperation); } context.addStep(targetOperation, ModClusterConfigAdd.INSTANCE, OperationContext.Stage.MODEL, true); } context.attach(SUBSYSTEM_ADD_KEY, Boolean.TRUE); } | /**
* This is here so legacy configuration can be supported.
*/ | This is here so legacy configuration can be supported | populateModel | {
"repo_name": "tomazzupan/wildfly",
"path": "mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSubsystemAdd.java",
"license": "lgpl-2.1",
"size": 12271
} | [
"org.jboss.as.controller.AttributeDefinition",
"org.jboss.as.controller.OperationContext",
"org.jboss.as.controller.OperationFailedException",
"org.jboss.as.controller.PathAddress",
"org.jboss.as.controller.descriptions.ModelDescriptionConstants",
"org.jboss.as.controller.operations.common.Util",
"org.jboss.as.controller.registry.Resource",
"org.jboss.dmr.ModelNode"
] | import org.jboss.as.controller.AttributeDefinition; import org.jboss.as.controller.OperationContext; import org.jboss.as.controller.OperationFailedException; import org.jboss.as.controller.PathAddress; import org.jboss.as.controller.descriptions.ModelDescriptionConstants; import org.jboss.as.controller.operations.common.Util; import org.jboss.as.controller.registry.Resource; import org.jboss.dmr.ModelNode; | import org.jboss.as.controller.*; import org.jboss.as.controller.descriptions.*; import org.jboss.as.controller.operations.common.*; import org.jboss.as.controller.registry.*; import org.jboss.dmr.*; | [
"org.jboss.as",
"org.jboss.dmr"
] | org.jboss.as; org.jboss.dmr; | 1,359,440 |
public static BufferedImage newBufferImage(int width, int height) {
return new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
} | static BufferedImage function(int width, int height) { return new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR); } | /**
* Create RGB BufferedImage
*
* @param width
* @param height
* @return
*/ | Create RGB BufferedImage | newBufferImage | {
"repo_name": "Sayi/poi-tl",
"path": "poi-tl/src/main/java/com/deepoove/poi/util/BufferedImageUtils.java",
"license": "apache-2.0",
"size": 3687
} | [
"java.awt.image.BufferedImage"
] | import java.awt.image.BufferedImage; | import java.awt.image.*; | [
"java.awt"
] | java.awt; | 2,764,978 |
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> disconnectVirtualNetworkGatewayVpnConnectionsWithResponseAsync(
String resourceGroupName, String virtualNetworkGatewayName, List<String> vpnConnectionIds) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (virtualNetworkGatewayName == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter virtualNetworkGatewayName is required and cannot be null."));
}
final String apiVersion = "2020-05-01";
P2SVpnConnectionRequest request = new P2SVpnConnectionRequest();
request.withVpnConnectionIds(vpnConnectionIds);
return FluxUtil
.withContext(
context ->
service
.disconnectVirtualNetworkGatewayVpnConnections(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
virtualNetworkGatewayName,
apiVersion,
request,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Flux<ByteBuffer>>> function( String resourceGroupName, String virtualNetworkGatewayName, List<String> vpnConnectionIds) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (virtualNetworkGatewayName == null) { return Mono .error( new IllegalArgumentException( STR)); } final String apiVersion = STR; P2SVpnConnectionRequest request = new P2SVpnConnectionRequest(); request.withVpnConnectionIds(vpnConnectionIds); return FluxUtil .withContext( context -> service .disconnectVirtualNetworkGatewayVpnConnections( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, virtualNetworkGatewayName, apiVersion, request, context)) .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); } | /**
* Disconnect vpn connections of virtual network gateway in the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param virtualNetworkGatewayName The name of the virtual network gateway.
* @param vpnConnectionIds List of p2s vpn connection Ids.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/ | Disconnect vpn connections of virtual network gateway in the specified resource group | disconnectVirtualNetworkGatewayVpnConnectionsWithResponseAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/VirtualNetworkGatewaysClientImpl.java",
"license": "mit",
"size": 322151
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.FluxUtil",
"com.azure.resourcemanager.network.models.P2SVpnConnectionRequest",
"java.nio.ByteBuffer",
"java.util.List"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.network.models.P2SVpnConnectionRequest; import java.nio.ByteBuffer; import java.util.List; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.network.models.*; import java.nio.*; import java.util.*; | [
"com.azure.core",
"com.azure.resourcemanager",
"java.nio",
"java.util"
] | com.azure.core; com.azure.resourcemanager; java.nio; java.util; | 2,797,443 |
default boolean is(String category) {
return nullSafeEquals(getCategory(), category);
} | default boolean is(String category) { return nullSafeEquals(getCategory(), category); } | /**
* Checks if the current type matches the given category
*
* @param category
* the category to check for
* @return true, if the given category matches to the category of the current type
*/ | Checks if the current type matches the given category | is | {
"repo_name": "SirmaITT/conservation-space-1.7.0",
"path": "docker/sirma-platform/platform/seip-parent/platform/domain-model/domain-model-api/src/main/java/com/sirma/itt/seip/domain/instance/InstanceType.java",
"license": "lgpl-3.0",
"size": 8952
} | [
"com.sirma.itt.seip.util.EqualsHelper"
] | import com.sirma.itt.seip.util.EqualsHelper; | import com.sirma.itt.seip.util.*; | [
"com.sirma.itt"
] | com.sirma.itt; | 2,879,144 |
private void readWorkspace( WorkspaceConfiguration workspaceConfiguration, Log logger )
{
List<IdeDependency> dependencies = new ArrayList<IdeDependency>();
File workspaceDirectory = workspaceConfiguration.getWorkspaceDirectory();
if ( workspaceDirectory != null )
{
for ( File projectLocation : readProjectLocations( workspaceDirectory, logger ) )
{
try
{
logger.debug( "read workpsace project " + projectLocation );
IdeDependency ideDependency = readArtefact( projectLocation, logger );
if ( ideDependency != null )
{
dependencies.add( ideDependency );
}
}
catch ( Exception e )
{
logger.warn( "could not read workspace project from:" + projectLocation, e );
}
}
}
logger.debug( dependencies.size() + " from workspace " + workspaceDirectory );
workspaceConfiguration.setWorkspaceArtefacts( dependencies.toArray( new IdeDependency[dependencies.size()] ) );
} | void function( WorkspaceConfiguration workspaceConfiguration, Log logger ) { List<IdeDependency> dependencies = new ArrayList<IdeDependency>(); File workspaceDirectory = workspaceConfiguration.getWorkspaceDirectory(); if ( workspaceDirectory != null ) { for ( File projectLocation : readProjectLocations( workspaceDirectory, logger ) ) { try { logger.debug( STR + projectLocation ); IdeDependency ideDependency = readArtefact( projectLocation, logger ); if ( ideDependency != null ) { dependencies.add( ideDependency ); } } catch ( Exception e ) { logger.warn( STR + projectLocation, e ); } } } logger.debug( dependencies.size() + STR + workspaceDirectory ); workspaceConfiguration.setWorkspaceArtefacts( dependencies.toArray( new IdeDependency[dependencies.size()] ) ); } | /**
* Scan the eclipse workspace and create a array with {@link IdeDependency} for all found artifacts.
*
* @param workspaceConfiguration the location of the eclipse workspace.
* @param logger the logger to report errors and debug info.
*/ | Scan the eclipse workspace and create a array with <code>IdeDependency</code> for all found artifacts | readWorkspace | {
"repo_name": "wcm-io-devops/maven-eclipse-plugin",
"path": "src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java",
"license": "apache-2.0",
"size": 26268
} | [
"java.io.File",
"java.util.ArrayList",
"java.util.List",
"org.apache.maven.plugin.eclipse.WorkspaceConfiguration",
"org.apache.maven.plugin.ide.IdeDependency",
"org.apache.maven.plugin.logging.Log"
] | import java.io.File; import java.util.ArrayList; import java.util.List; import org.apache.maven.plugin.eclipse.WorkspaceConfiguration; import org.apache.maven.plugin.ide.IdeDependency; import org.apache.maven.plugin.logging.Log; | import java.io.*; import java.util.*; import org.apache.maven.plugin.eclipse.*; import org.apache.maven.plugin.ide.*; import org.apache.maven.plugin.logging.*; | [
"java.io",
"java.util",
"org.apache.maven"
] | java.io; java.util; org.apache.maven; | 303,357 |
public void addValue(AttributeValue<?> attributeValue) {
if (this.values == EMPTY_ATTRIBUTE_VALUE_LIST) {
this.values = new ArrayList<AttributeValue<?>>();
}
this.values.add(attributeValue);
} | void function(AttributeValue<?> attributeValue) { if (this.values == EMPTY_ATTRIBUTE_VALUE_LIST) { this.values = new ArrayList<AttributeValue<?>>(); } this.values.add(attributeValue); } | /**
* Adds an {@link org.apache.openaz.xacml.api.AttributeValue} to this <code>StdMutableAttribute</code>.
*
* @param attributeValue the <code>AttributeValue</code> to add to this <code>StdMutableAttribute</code>.
*/ | Adds an <code>org.apache.openaz.xacml.api.AttributeValue</code> to this <code>StdMutableAttribute</code> | addValue | {
"repo_name": "ieugen/incubator-openaz",
"path": "openaz-xacml/src/main/java/org/apache/openaz/xacml/std/StdMutableAttribute.java",
"license": "apache-2.0",
"size": 16066
} | [
"java.util.ArrayList",
"org.apache.openaz.xacml.api.AttributeValue"
] | import java.util.ArrayList; import org.apache.openaz.xacml.api.AttributeValue; | import java.util.*; import org.apache.openaz.xacml.api.*; | [
"java.util",
"org.apache.openaz"
] | java.util; org.apache.openaz; | 45,657 |
public void testSemanticCheck( ) throws Exception
{
openDesign( semanticCheckFileName );
assertEquals( 2, design.getErrorList( ).size( ) );
ErrorDetail error = (ErrorDetail) design.getErrorList( ).get( 0 );
assertEquals( SemanticError.DESIGN_EXCEPTION_INVALID_MANIFEST, error
.getErrorCode( ) );
} | void function( ) throws Exception { openDesign( semanticCheckFileName ); assertEquals( 2, design.getErrorList( ).size( ) ); ErrorDetail error = (ErrorDetail) design.getErrorList( ).get( 0 ); assertEquals( SemanticError.DESIGN_EXCEPTION_INVALID_MANIFEST, error .getErrorCode( ) ); } | /**
* Test semantic errors.
*
* @throws Exception
*
*/ | Test semantic errors | testSemanticCheck | {
"repo_name": "Charling-Huang/birt",
"path": "model/org.eclipse.birt.report.model.tests/test/org/eclipse/birt/report/model/parser/OdaDataSourceParseTest.java",
"license": "epl-1.0",
"size": 7293
} | [
"org.eclipse.birt.report.model.api.ErrorDetail",
"org.eclipse.birt.report.model.api.elements.SemanticError"
] | import org.eclipse.birt.report.model.api.ErrorDetail; import org.eclipse.birt.report.model.api.elements.SemanticError; | import org.eclipse.birt.report.model.api.*; import org.eclipse.birt.report.model.api.elements.*; | [
"org.eclipse.birt"
] | org.eclipse.birt; | 2,586,308 |
public void throwException() throws AxelorException {
throw new AxelorException(I18n.get(text), IException.FUNCTIONNAL);
}
| void function() throws AxelorException { throw new AxelorException(I18n.get(text), IException.FUNCTIONNAL); } | /**
* Throws an equivalent <code>EbicsException</code>
* @throws EbicsException
*/ | Throws an equivalent <code>EbicsException</code> | throwException | {
"repo_name": "jph-axelor/axelor-business-suite",
"path": "axelor-account/src/main/java/com/axelor/apps/account/ebics/exception/ReturnCode.java",
"license": "agpl-3.0",
"size": 10229
} | [
"com.axelor.exception.AxelorException",
"com.axelor.exception.db.IException",
"com.axelor.i18n.I18n"
] | import com.axelor.exception.AxelorException; import com.axelor.exception.db.IException; import com.axelor.i18n.I18n; | import com.axelor.exception.*; import com.axelor.exception.db.*; import com.axelor.i18n.*; | [
"com.axelor.exception",
"com.axelor.i18n"
] | com.axelor.exception; com.axelor.i18n; | 430,728 |
public void _read(InputStream input)
{
value = IORHelper.read(input);
} | void function(InputStream input) { value = IORHelper.read(input); } | /**
* Fill in the {@link #value} by data from the CDR stream.
*
* @param input the org.omg.CORBA.portable stream to read.
*/ | Fill in the <code>#value</code> by data from the CDR stream | _read | {
"repo_name": "shaotuanchen/sunflower_exp",
"path": "tools/source/gcc-4.2.4/libjava/classpath/org/omg/IOP/IORHolder.java",
"license": "bsd-3-clause",
"size": 3042
} | [
"org.omg.CORBA"
] | import org.omg.CORBA; | import org.omg.*; | [
"org.omg"
] | org.omg; | 2,851,324 |
@ModelAttribute("allStatusMovie")
public List<StatusMovie> allStatusMovie() {
return Arrays.asList(StatusMovie.values());
} | @ModelAttribute(STR) List<StatusMovie> function() { return Arrays.asList(StatusMovie.values()); } | /**
* Return a list with all movies
*
* @return List<StatusMovie> list with all movies
*/ | Return a list with all movies | allStatusMovie | {
"repo_name": "crysmeira/Movie-Catalog",
"path": "src/main/java/com/crystianemeira/movie_catalog/controller/MovieController.java",
"license": "gpl-3.0",
"size": 4070
} | [
"com.crystianemeira.movie_catalog.model.StatusMovie",
"java.util.Arrays",
"java.util.List",
"org.springframework.web.bind.annotation.ModelAttribute"
] | import com.crystianemeira.movie_catalog.model.StatusMovie; import java.util.Arrays; import java.util.List; import org.springframework.web.bind.annotation.ModelAttribute; | import com.crystianemeira.movie_catalog.model.*; import java.util.*; import org.springframework.web.bind.annotation.*; | [
"com.crystianemeira.movie_catalog",
"java.util",
"org.springframework.web"
] | com.crystianemeira.movie_catalog; java.util; org.springframework.web; | 2,402,021 |
boolean changeDeviceStatus(DeviceIdentifier deviceIdentifier, EnrolmentInfo.Status newStatus)
throws DeviceManagementException; | boolean changeDeviceStatus(DeviceIdentifier deviceIdentifier, EnrolmentInfo.Status newStatus) throws DeviceManagementException; | /**
* Change device status.
*
* @param deviceIdentifier {@link DeviceIdentifier} object
* @param newStatus New status of the device
* @return Whether status is changed or not
* @throws DeviceManagementException on errors while trying to change device status
*/ | Change device status | changeDeviceStatus | {
"repo_name": "milanperera/carbon-device-mgt",
"path": "components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java",
"license": "apache-2.0",
"size": 15305
} | [
"org.wso2.carbon.device.mgt.common.DeviceIdentifier",
"org.wso2.carbon.device.mgt.common.DeviceManagementException",
"org.wso2.carbon.device.mgt.common.EnrolmentInfo"
] | import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; | import org.wso2.carbon.device.mgt.common.*; | [
"org.wso2.carbon"
] | org.wso2.carbon; | 1,849,610 |
private void handleASCIIDOCConversion(File file, File output, Report report, int backend) {
// check for hidden and other fancy files
if(file.isFile() && !file.getAbsolutePath().endsWith(".adoc")) {
return;
}
| void function(File file, File output, Report report, int backend) { if(file.isFile() && !file.getAbsolutePath().endsWith(".adoc")) { return; } | /**
* second iteration onwards
* @param file
* @param output
* @param report
*/ | second iteration onwards | handleASCIIDOCConversion | {
"repo_name": "ingosimonis/ERConverter",
"path": "src/main/java/org/ogc/er/EngineeringReportFolder.java",
"license": "gpl-3.0",
"size": 13168
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,829,483 |
public NotificationListResponse listNotification() {
NotificationListRequest listRequest = NotificationListRequest.of(null);
return listNotification(listRequest);
} | NotificationListResponse function() { NotificationListRequest listRequest = NotificationListRequest.of(null); return listNotification(listRequest); } | /**
* List all of the notifications.
*
* @return A listing notification response.
*/ | List all of the notifications | listNotification | {
"repo_name": "baidubce/bce-sdk-java",
"path": "src/main/java/com/baidubce/services/bvw/BvwClient.java",
"license": "apache-2.0",
"size": 39847
} | [
"com.baidubce.services.bvw.model.notification.NotificationListRequest",
"com.baidubce.services.bvw.model.notification.NotificationListResponse"
] | import com.baidubce.services.bvw.model.notification.NotificationListRequest; import com.baidubce.services.bvw.model.notification.NotificationListResponse; | import com.baidubce.services.bvw.model.notification.*; | [
"com.baidubce.services"
] | com.baidubce.services; | 903,904 |
public void check(List<String> words) throws MnemonicException {
toEntropy(words);
} | void function(List<String> words) throws MnemonicException { toEntropy(words); } | /**
* Check to see if a mnemonic word list is valid.
*/ | Check to see if a mnemonic word list is valid | check | {
"repo_name": "cbeams/bitcoinj",
"path": "core/src/main/java/com/google/bitcoin/crypto/MnemonicCode.java",
"license": "apache-2.0",
"size": 8090
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 934,117 |
@GET("/collection/{id}/icons")
Observable<IconsResponse> getCollectionIcons(@Path("id") int id,
@QueryMap Map<String, String> options ); | @GET(STR) Observable<IconsResponse> getCollectionIcons(@Path("id") int id, @QueryMap Map<String, String> options ); | /**
* Collection icons
* Requests example http://api.thenounproject.com/collection/55/icons?limit=4
* @param id - collection id
* @param options Map<String, String> of query params
* options.put("limit", 50), options.put("offset", 100), options.put("page", 2)
* @return Returns a list of icons associated with a collection
*/ | Collection icons Requests example HREF | getCollectionIcons | {
"repo_name": "graviton57/TheNounProject",
"path": "app/src/main/java/com/havrylyuk/thenounproject/data/remote/ApiInterface.java",
"license": "apache-2.0",
"size": 6486
} | [
"com.havrylyuk.thenounproject.data.remote.model.response.IconsResponse",
"io.reactivex.Observable",
"java.util.Map"
] | import com.havrylyuk.thenounproject.data.remote.model.response.IconsResponse; import io.reactivex.Observable; import java.util.Map; | import com.havrylyuk.thenounproject.data.remote.model.response.*; import io.reactivex.*; import java.util.*; | [
"com.havrylyuk.thenounproject",
"io.reactivex",
"java.util"
] | com.havrylyuk.thenounproject; io.reactivex; java.util; | 384,365 |
public Point getMinimum() {
int minx = Integer.MAX_VALUE, miny = Integer.MAX_VALUE;
for ( int i = 0; i < nrSteps(); i++ ) {
StepMeta stepMeta = getStep( i );
Point loc = stepMeta.getLocation();
if ( loc.x < minx ) {
minx = loc.x;
}
if ( loc.y < miny ) {
miny = loc.y;
}
}
for ( int i = 0; i < nrNotes(); i++ ) {
NotePadMeta notePadMeta = getNote( i );
Point loc = notePadMeta.getLocation();
if ( loc.x < minx ) {
minx = loc.x;
}
if ( loc.y < miny ) {
miny = loc.y;
}
}
if ( minx > BORDER_INDENT && minx != Integer.MAX_VALUE ) {
minx -= BORDER_INDENT;
} else {
minx = 0;
}
if ( miny > BORDER_INDENT && miny != Integer.MAX_VALUE ) {
miny -= BORDER_INDENT;
} else {
miny = 0;
}
return new Point( minx, miny );
} | Point function() { int minx = Integer.MAX_VALUE, miny = Integer.MAX_VALUE; for ( int i = 0; i < nrSteps(); i++ ) { StepMeta stepMeta = getStep( i ); Point loc = stepMeta.getLocation(); if ( loc.x < minx ) { minx = loc.x; } if ( loc.y < miny ) { miny = loc.y; } } for ( int i = 0; i < nrNotes(); i++ ) { NotePadMeta notePadMeta = getNote( i ); Point loc = notePadMeta.getLocation(); if ( loc.x < minx ) { minx = loc.x; } if ( loc.y < miny ) { miny = loc.y; } } if ( minx > BORDER_INDENT && minx != Integer.MAX_VALUE ) { minx -= BORDER_INDENT; } else { minx = 0; } if ( miny > BORDER_INDENT && miny != Integer.MAX_VALUE ) { miny -= BORDER_INDENT; } else { miny = 0; } return new Point( minx, miny ); } | /**
* Gets the minimum point on the canvas of a transformation.
*
* @return Minimum coordinate of a step in the transformation
*/ | Gets the minimum point on the canvas of a transformation | getMinimum | {
"repo_name": "TatsianaKasiankova/pentaho-kettle",
"path": "engine/src/main/java/org/pentaho/di/trans/TransMeta.java",
"license": "apache-2.0",
"size": 220790
} | [
"org.pentaho.di.core.NotePadMeta",
"org.pentaho.di.core.gui.Point",
"org.pentaho.di.trans.step.StepMeta"
] | import org.pentaho.di.core.NotePadMeta; import org.pentaho.di.core.gui.Point; import org.pentaho.di.trans.step.StepMeta; | import org.pentaho.di.core.*; import org.pentaho.di.core.gui.*; import org.pentaho.di.trans.step.*; | [
"org.pentaho.di"
] | org.pentaho.di; | 1,295,968 |
void setContent(ChannelBuffer content); | void setContent(ChannelBuffer content); | /**
* Sets the content of this chunk. If an empty buffer is specified,
* this chunk becomes the 'end of content' marker.
*/ | Sets the content of this chunk. If an empty buffer is specified, this chunk becomes the 'end of content' marker | setContent | {
"repo_name": "jroper/netty",
"path": "codec-http/src/main/java/io/netty/handler/codec/http/HttpChunk.java",
"license": "apache-2.0",
"size": 3565
} | [
"io.netty.buffer.ChannelBuffer"
] | import io.netty.buffer.ChannelBuffer; | import io.netty.buffer.*; | [
"io.netty.buffer"
] | io.netty.buffer; | 305,123 |
Promise<T> catchError(Consumer<Throwable> consumer); | Promise<T> catchError(Consumer<Throwable> consumer); | /**
* If a result is sent, and there is an error, then handle handle the error.
*
* @param consumer executed if result has error.
* @return this, fluent API
* @throws NullPointerException if result is present and {@code consumer} is null
*/ | If a result is sent, and there is an error, then handle handle the error | catchError | {
"repo_name": "advantageous/reakt",
"path": "src/main/java/io/advantageous/reakt/promise/Promise.java",
"license": "apache-2.0",
"size": 5674
} | [
"java.util.function.Consumer"
] | import java.util.function.Consumer; | import java.util.function.*; | [
"java.util"
] | java.util; | 848,148 |
public static List<NabuccoPropertyDescriptor> getPropertyDescriptorList() {
return PropertyCache.getInstance().retrieve(AuthorizationRoleMaintainMsg.class).getAllProperties();
}
| static List<NabuccoPropertyDescriptor> function() { return PropertyCache.getInstance().retrieve(AuthorizationRoleMaintainMsg.class).getAllProperties(); } | /**
* Getter for the PropertyDescriptorList.
*
* @return the List<NabuccoPropertyDescriptor>.
*/ | Getter for the PropertyDescriptorList | getPropertyDescriptorList | {
"repo_name": "NABUCCO/org.nabucco.framework.common.authorization",
"path": "org.nabucco.framework.common.authorization.facade.message/src/main/gen/org/nabucco/framework/common/authorization/facade/message/maintain/AuthorizationRoleMaintainMsg.java",
"license": "epl-1.0",
"size": 9943
} | [
"java.util.List",
"org.nabucco.framework.base.facade.datatype.property.NabuccoPropertyDescriptor",
"org.nabucco.framework.base.facade.datatype.property.PropertyCache"
] | import java.util.List; import org.nabucco.framework.base.facade.datatype.property.NabuccoPropertyDescriptor; import org.nabucco.framework.base.facade.datatype.property.PropertyCache; | import java.util.*; import org.nabucco.framework.base.facade.datatype.property.*; | [
"java.util",
"org.nabucco.framework"
] | java.util; org.nabucco.framework; | 2,358,565 |
public void writeExternal(ObjectOutput out) throws IOException {
out.writeFloat(x);
out.writeFloat(y);
out.writeFloat(z);
out.writeFloat(w);
}
| void function(ObjectOutput out) throws IOException { out.writeFloat(x); out.writeFloat(y); out.writeFloat(z); out.writeFloat(w); } | /**
* <code>writeExternal</code> writes this quaternion out to a
* <code>ObjectOutput</code> object. NOTE: Used with serialization. Not to
* be called manually.
*
* @param out
* the object to write to.
* @throws IOException
* if writing to the ObjectOutput fails.
* @see java.io.Externalizable
*/ | <code>writeExternal</code> writes this quaternion out to a be called manually | writeExternal | {
"repo_name": "asiermarzo/Ultraino",
"path": "AcousticFieldSim/src/acousticfield3d/math/Quaternion.java",
"license": "mit",
"size": 47813
} | [
"java.io.IOException",
"java.io.ObjectOutput"
] | import java.io.IOException; import java.io.ObjectOutput; | import java.io.*; | [
"java.io"
] | java.io; | 1,338,769 |
public String getNamePrefixed(String p_185174_1_)
{
return this.baseName == null ? p_185174_1_ + ((ResourceLocation)REGISTRY.getNameForObject(this)).getResourcePath() : p_185174_1_ + this.baseName;
} | String function(String p_185174_1_) { return this.baseName == null ? p_185174_1_ + ((ResourceLocation)REGISTRY.getNameForObject(this)).getResourcePath() : p_185174_1_ + this.baseName; } | /**
* Gets the name of this PotionType with a prefix (such as "Splash" or "Lingering") prepended
*/ | Gets the name of this PotionType with a prefix (such as "Splash" or "Lingering") prepended | getNamePrefixed | {
"repo_name": "TheGreatAndPowerfulWeegee/wipunknown",
"path": "build/tmp/recompileMc/sources/net/minecraft/potion/PotionType.java",
"license": "gpl-3.0",
"size": 7366
} | [
"net.minecraft.util.ResourceLocation"
] | import net.minecraft.util.ResourceLocation; | import net.minecraft.util.*; | [
"net.minecraft.util"
] | net.minecraft.util; | 829,967 |
@Nonnull
@RequiredReadAction
PsiReference[] getReferences(@Nonnull PsiReferenceService.Hints hints); | PsiReference[] getReferences(@Nonnull PsiReferenceService.Hints hints); | /**
* Same as {@link PsiElement#getReferences()}, but the implementation may take hints into account and return only references that match these hints.
* But it's not a hard requirement, so the clients should not rely that only matching references will be returned.
* @param hints the hints about the desired references
* @return the array of references, or an empty array if the element has no associated references.
*/ | Same as <code>PsiElement#getReferences()</code>, but the implementation may take hints into account and return only references that match these hints. But it's not a hard requirement, so the clients should not rely that only matching references will be returned | getReferences | {
"repo_name": "consulo/consulo",
"path": "modules/base/core-api/src/main/java/com/intellij/psi/HintedReferenceHost.java",
"license": "apache-2.0",
"size": 2777
} | [
"javax.annotation.Nonnull"
] | import javax.annotation.Nonnull; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 626,866 |
@Test
public void testOverlapAndOrphan() throws Exception {
String table = "tableOverlapAndOrphan";
try {
setupTable(table);
assertEquals(ROWKEYS.length, countRows());
// Mess it up by creating an overlap in the metadata
TEST_UTIL.getHBaseAdmin().disableTable(table);
deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes("A"),
Bytes.toBytes("B"), true, true, false, true);
TEST_UTIL.getHBaseAdmin().enableTable(table);
HRegionInfo hriOverlap = createRegion(conf, tbl.getTableDescriptor(),
Bytes.toBytes("A2"), Bytes.toBytes("B"));
TEST_UTIL.getHBaseCluster().getMaster().assignRegion(hriOverlap);
TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager()
.waitForAssignment(hriOverlap);
HBaseFsck hbck = doFsck(conf, false);
assertErrors(hbck, new ERROR_CODE[] {
ERROR_CODE.ORPHAN_HDFS_REGION, ERROR_CODE.NOT_IN_META_OR_DEPLOYED,
ERROR_CODE.HOLE_IN_REGION_CHAIN});
// fix the problem.
doFsck(conf, true);
// verify that overlaps are fixed
HBaseFsck hbck2 = doFsck(conf,false);
assertNoErrors(hbck2);
assertEquals(0, hbck2.getOverlapGroups(table).size());
assertEquals(ROWKEYS.length, countRows());
} finally {
deleteTable(table);
}
} | void function() throws Exception { String table = STR; try { setupTable(table); assertEquals(ROWKEYS.length, countRows()); TEST_UTIL.getHBaseAdmin().disableTable(table); deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes("A"), Bytes.toBytes("B"), true, true, false, true); TEST_UTIL.getHBaseAdmin().enableTable(table); HRegionInfo hriOverlap = createRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes("A2"), Bytes.toBytes("B")); TEST_UTIL.getHBaseCluster().getMaster().assignRegion(hriOverlap); TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager() .waitForAssignment(hriOverlap); HBaseFsck hbck = doFsck(conf, false); assertErrors(hbck, new ERROR_CODE[] { ERROR_CODE.ORPHAN_HDFS_REGION, ERROR_CODE.NOT_IN_META_OR_DEPLOYED, ERROR_CODE.HOLE_IN_REGION_CHAIN}); doFsck(conf, true); HBaseFsck hbck2 = doFsck(conf,false); assertNoErrors(hbck2); assertEquals(0, hbck2.getOverlapGroups(table).size()); assertEquals(ROWKEYS.length, countRows()); } finally { deleteTable(table); } } | /**
* This creates and fixes a bad table where a region is completely contained
* by another region, and there is a hole (sort of like a bad split)
*/ | This creates and fixes a bad table where a region is completely contained by another region, and there is a hole (sort of like a bad split) | testOverlapAndOrphan | {
"repo_name": "ay65535/hbase-0.94.0",
"path": "src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java",
"license": "apache-2.0",
"size": 33952
} | [
"org.apache.hadoop.hbase.HRegionInfo",
"org.apache.hadoop.hbase.util.hbck.HbckTestingUtil",
"org.junit.Assert"
] | import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.util.hbck.HbckTestingUtil; import org.junit.Assert; | import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.util.hbck.*; import org.junit.*; | [
"org.apache.hadoop",
"org.junit"
] | org.apache.hadoop; org.junit; | 353,692 |
public boolean onTouchEvent(MotionEvent event) {
mIsHandlingTouch = true;
int action = event.getActionMasked();
if (action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_POINTER_DOWN) {
extractGestureHandlers(event);
} else if (action == MotionEvent.ACTION_CANCEL) {
cancelAll();
}
deliverEventToGestureHandlers(event);
mIsHandlingTouch = false;
if (mFinishedHandlersCleanupScheduled && mHandlingChangeSemaphore == 0) {
cleanupFinishedHandlers();
}
return true;
} | boolean function(MotionEvent event) { mIsHandlingTouch = true; int action = event.getActionMasked(); if (action == MotionEvent.ACTION_DOWN action == MotionEvent.ACTION_POINTER_DOWN) { extractGestureHandlers(event); } else if (action == MotionEvent.ACTION_CANCEL) { cancelAll(); } deliverEventToGestureHandlers(event); mIsHandlingTouch = false; if (mFinishedHandlersCleanupScheduled && mHandlingChangeSemaphore == 0) { cleanupFinishedHandlers(); } return true; } | /**
* Should be called from the view wrapper
*/ | Should be called from the view wrapper | onTouchEvent | {
"repo_name": "exponentjs/exponent",
"path": "android/versioned-abis/expoview-abi42_0_0/src/main/java/abi42_0_0/host/exp/exponent/modules/api/components/gesturehandler/GestureHandlerOrchestrator.java",
"license": "bsd-3-clause",
"size": 21781
} | [
"android.view.MotionEvent"
] | import android.view.MotionEvent; | import android.view.*; | [
"android.view"
] | android.view; | 709,761 |
public void setWhenClauses(List<WhenDefinition> whenClauses) {
this.whenClauses = whenClauses;
} | void function(List<WhenDefinition> whenClauses) { this.whenClauses = whenClauses; } | /**
* Sets the when clauses
*/ | Sets the when clauses | setWhenClauses | {
"repo_name": "YMartsynkevych/camel",
"path": "camel-core/src/main/java/org/apache/camel/model/ChoiceDefinition.java",
"license": "apache-2.0",
"size": 10228
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,632,990 |
@Test
public void matchSctpDstTest() {
Criterion criterion = Criteria.matchSctpDst(40000);
ObjectNode result = criterionCodec.encode(criterion, context);
assertThat(result, matchesCriterion(criterion));
} | void function() { Criterion criterion = Criteria.matchSctpDst(40000); ObjectNode result = criterionCodec.encode(criterion, context); assertThat(result, matchesCriterion(criterion)); } | /**
* Tests destination SCTP criterion.
*/ | Tests destination SCTP criterion | matchSctpDstTest | {
"repo_name": "maxkondr/onos-porta",
"path": "core/common/src/test/java/org/onosproject/codec/impl/CriterionCodecTest.java",
"license": "apache-2.0",
"size": 14228
} | [
"com.fasterxml.jackson.databind.node.ObjectNode",
"org.hamcrest.MatcherAssert",
"org.onosproject.codec.impl.CriterionJsonMatcher",
"org.onosproject.net.flow.criteria.Criteria",
"org.onosproject.net.flow.criteria.Criterion"
] | import com.fasterxml.jackson.databind.node.ObjectNode; import org.hamcrest.MatcherAssert; import org.onosproject.codec.impl.CriterionJsonMatcher; import org.onosproject.net.flow.criteria.Criteria; import org.onosproject.net.flow.criteria.Criterion; | import com.fasterxml.jackson.databind.node.*; import org.hamcrest.*; import org.onosproject.codec.impl.*; import org.onosproject.net.flow.criteria.*; | [
"com.fasterxml.jackson",
"org.hamcrest",
"org.onosproject.codec",
"org.onosproject.net"
] | com.fasterxml.jackson; org.hamcrest; org.onosproject.codec; org.onosproject.net; | 2,495,166 |
@Override
public boolean addAll(Collection<? extends T> newElements) {
for (T newElement : newElements) {
add(newElement);
}
return true;
}
| boolean function(Collection<? extends T> newElements) { for (T newElement : newElements) { add(newElement); } return true; } | /**
* Inserts a collection of elements, looping on them.
*
* @param newElements Collection of elements to add
* @return Always true
*/ | Inserts a collection of elements, looping on them | addAll | {
"repo_name": "tectronics/javasimon",
"path": "core/src/main/java/org/javasimon/callback/lastsplits/CircularList.java",
"license": "bsd-3-clause",
"size": 6415
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 256,404 |
static int getNodeTypeReferenceCount(
Node node, int type, Predicate<Node> traverseChildrenPred) {
return getCount(node, new MatchNodeType(type), traverseChildrenPred);
} | static int getNodeTypeReferenceCount( Node node, int type, Predicate<Node> traverseChildrenPred) { return getCount(node, new MatchNodeType(type), traverseChildrenPred); } | /**
* Finds the number of times a type is referenced within the node tree.
*/ | Finds the number of times a type is referenced within the node tree | getNodeTypeReferenceCount | {
"repo_name": "PengXing/closure-compiler",
"path": "src/com/google/javascript/jscomp/NodeUtil.java",
"license": "apache-2.0",
"size": 99223
} | [
"com.google.common.base.Predicate",
"com.google.javascript.rhino.Node"
] | import com.google.common.base.Predicate; import com.google.javascript.rhino.Node; | import com.google.common.base.*; import com.google.javascript.rhino.*; | [
"com.google.common",
"com.google.javascript"
] | com.google.common; com.google.javascript; | 2,825,341 |
private void stopWaitingFor(InternalDistributedMember mbr) {
notRepliedYet.remove(mbr);
checkIfDone();
} | void function(InternalDistributedMember mbr) { notRepliedYet.remove(mbr); checkIfDone(); } | /**
* call with synchronized(this)
*/ | call with synchronized(this) | stopWaitingFor | {
"repo_name": "pivotal-amurmann/geode",
"path": "geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java",
"license": "apache-2.0",
"size": 98523
} | [
"org.apache.geode.distributed.internal.membership.InternalDistributedMember"
] | import org.apache.geode.distributed.internal.membership.InternalDistributedMember; | import org.apache.geode.distributed.internal.membership.*; | [
"org.apache.geode"
] | org.apache.geode; | 2,185,682 |
DataTagCacheObject tag = new DataTagCacheObject(10L);
tag.getDataTagQuality().addInvalidStatus(TagQualityStatus.INACCESSIBLE, "desc1");
tag.getDataTagQuality().addInvalidStatus(TagQualityStatus.UNINITIALISED, "desc1");
tag.getDataTagQuality().addInvalidStatus(TagQualityStatus.VALUE_OUT_OF_BOUNDS, "desc1");
assertNotNull(tag.getDataTagQuality());
Loggable loggable = converter.convertToLogged(tag);
TagRecord tagRecord = (TagRecord) loggable;
assertEquals(11, tagRecord.getTagQualityCode());
} | DataTagCacheObject tag = new DataTagCacheObject(10L); tag.getDataTagQuality().addInvalidStatus(TagQualityStatus.INACCESSIBLE, "desc1"); tag.getDataTagQuality().addInvalidStatus(TagQualityStatus.UNINITIALISED, "desc1"); tag.getDataTagQuality().addInvalidStatus(TagQualityStatus.VALUE_OUT_OF_BOUNDS, "desc1"); assertNotNull(tag.getDataTagQuality()); Loggable loggable = converter.convertToLogged(tag); TagRecord tagRecord = (TagRecord) loggable; assertEquals(11, tagRecord.getTagQualityCode()); } | /**
* Tests the quality code is correctly generated.
*/ | Tests the quality code is correctly generated | testCodeGeneration | {
"repo_name": "c2mon/c2mon",
"path": "c2mon-server/c2mon-server-history/src/test/java/cern/c2mon/server/history/structure/TagRecordConverterTest.java",
"license": "lgpl-3.0",
"size": 7825
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 682,633 |
public static Builder builder() {
return new Builder();
}
public static final class Builder extends ConnectivityIntent.Builder {
Set<Link> links;
Set<ConnectPoint> ingressPoints;
Set<ConnectPoint> egressPoints;
boolean egressTreatmentFlag;
private Builder() {
// Hide constructor
} | static Builder function() { return new Builder(); } public static final class Builder extends ConnectivityIntent.Builder { Set<Link> links; Set<ConnectPoint> ingressPoints; Set<ConnectPoint> egressPoints; boolean egressTreatmentFlag; private Builder() { } | /**
* Returns a new link collection intent builder. The application id,
* ingress point and egress points are required fields. If they are
* not set by calls to the appropriate methods, an exception will
* be thrown.
*
* @return single point to multi point builder
*/ | Returns a new link collection intent builder. The application id, ingress point and egress points are required fields. If they are not set by calls to the appropriate methods, an exception will be thrown | builder | {
"repo_name": "Shashikanth-Huawei/bmp",
"path": "core/api/src/main/java/org/onosproject/net/intent/LinkCollectionIntent.java",
"license": "apache-2.0",
"size": 8469
} | [
"java.util.Set",
"org.onosproject.net.ConnectPoint",
"org.onosproject.net.Link"
] | import java.util.Set; import org.onosproject.net.ConnectPoint; import org.onosproject.net.Link; | import java.util.*; import org.onosproject.net.*; | [
"java.util",
"org.onosproject.net"
] | java.util; org.onosproject.net; | 1,699,702 |
@GET
@Path("/images/json")
List<Image> images(@QueryParam("all") Integer all); | @Path(STR) List<Image> images(@QueryParam("all") Integer all); | /**
* Get the list of {@link Image}s.
*
* @param all 1/True/true or 0/False/false, Show all containers. Only running containers are shown by defaul
* @return
*/ | Get the list of <code>Image</code>s | images | {
"repo_name": "hekonsek/fabric8",
"path": "components/docker-api/src/main/java/io/fabric8/docker/api/Docker.java",
"license": "apache-2.0",
"size": 9552
} | [
"java.util.List",
"javax.ws.rs.Path",
"javax.ws.rs.QueryParam"
] | import java.util.List; import javax.ws.rs.Path; import javax.ws.rs.QueryParam; | import java.util.*; import javax.ws.rs.*; | [
"java.util",
"javax.ws"
] | java.util; javax.ws; | 2,685,354 |
@Test
public void testChallengeGET() {
final SimpleHttpRequest request = new SimpleHttpRequest();
request.setMethod("GET");
final SimpleHttpResponse response = new SimpleHttpResponse();
this.authenticator.authenticate(request, response, null);
final String[] wwwAuthenticates = response.getHeaderValues("WWW-Authenticate");
Assert.assertNotNull(wwwAuthenticates);
Assert.assertEquals(2, wwwAuthenticates.length);
Assert.assertEquals("Negotiate", wwwAuthenticates[0]);
Assert.assertEquals("NTLM", wwwAuthenticates[1]);
Assert.assertEquals("close", response.getHeader("Connection"));
Assert.assertEquals(2, response.getHeaderNames().length);
Assert.assertEquals(401, response.getStatus());
} | void function() { final SimpleHttpRequest request = new SimpleHttpRequest(); request.setMethod("GET"); final SimpleHttpResponse response = new SimpleHttpResponse(); this.authenticator.authenticate(request, response, null); final String[] wwwAuthenticates = response.getHeaderValues(STR); Assert.assertNotNull(wwwAuthenticates); Assert.assertEquals(2, wwwAuthenticates.length); Assert.assertEquals(STR, wwwAuthenticates[0]); Assert.assertEquals("NTLM", wwwAuthenticates[1]); Assert.assertEquals("close", response.getHeader(STR)); Assert.assertEquals(2, response.getHeaderNames().length); Assert.assertEquals(401, response.getStatus()); } | /**
* Test challenge get.
*/ | Test challenge get | testChallengeGET | {
"repo_name": "victorbriz/waffle",
"path": "Source/JNA/waffle-tomcat6/src/test/java/waffle/apache/NegotiateAuthenticatorTests.java",
"license": "epl-1.0",
"size": 13241
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,600,482 |
void onHandlePostRequestDone(@PostResult int result, boolean installEventWasSent) {} | void onHandlePostRequestDone(@PostResult int result, boolean installEventWasSent) {} | /**
* Called when {@link OmahaBase#registerNewRequest} finishes.
* @param timestampRequestMs When the next active user request should be generated.
* @param timestampPostMs Earliest time the next POST should be allowed.
*/ | Called when <code>OmahaBase#registerNewRequest</code> finishes | onRegisterNewRequestDone | {
"repo_name": "ric2b/Vivaldi-browser",
"path": "chromium/chrome/android/java/src/org/chromium/chrome/browser/omaha/OmahaDelegate.java",
"license": "bsd-3-clause",
"size": 2878
} | [
"org.chromium.chrome.browser.omaha.OmahaBase"
] | import org.chromium.chrome.browser.omaha.OmahaBase; | import org.chromium.chrome.browser.omaha.*; | [
"org.chromium.chrome"
] | org.chromium.chrome; | 2,871,102 |
public ServiceFuture<Void> postOptionalIntegerParameterAsync(Integer bodyParameter, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(postOptionalIntegerParameterWithServiceResponseAsync(bodyParameter), serviceCallback);
} | ServiceFuture<Void> function(Integer bodyParameter, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(postOptionalIntegerParameterWithServiceResponseAsync(bodyParameter), serviceCallback); } | /**
* Test explicitly optional integer. Please put null.
*
* @param bodyParameter the Integer value
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Test explicitly optional integer. Please put null | postOptionalIntegerParameterAsync | {
"repo_name": "lmazuel/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/requiredoptional/implementation/ExplicitsImpl.java",
"license": "mit",
"size": 119470
} | [
"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; | 254,264 |
public ParameterHandle findParameter( String paramName )
throws ReportServiceException
{
return BirtUtility.findParameter( this.reportDesignHandle, paramName );
} | ParameterHandle function( String paramName ) throws ReportServiceException { return BirtUtility.findParameter( this.reportDesignHandle, paramName ); } | /**
* find the parameter handle by parameter name
*
* @param paramName
* @return
* @throws ReportServiceException
*/ | find the parameter handle by parameter name | findParameter | {
"repo_name": "Charling-Huang/birt",
"path": "viewer/org.eclipse.birt.report.viewer/birt/WEB-INF/classes/org/eclipse/birt/report/context/ViewerAttributeBean.java",
"license": "epl-1.0",
"size": 33571
} | [
"org.eclipse.birt.report.model.api.ParameterHandle",
"org.eclipse.birt.report.service.api.ReportServiceException",
"org.eclipse.birt.report.utility.BirtUtility"
] | import org.eclipse.birt.report.model.api.ParameterHandle; import org.eclipse.birt.report.service.api.ReportServiceException; import org.eclipse.birt.report.utility.BirtUtility; | import org.eclipse.birt.report.model.api.*; import org.eclipse.birt.report.service.api.*; import org.eclipse.birt.report.utility.*; | [
"org.eclipse.birt"
] | org.eclipse.birt; | 2,298,952 |
List<Tweet> getListStatuses(String screenName, String listSlug, int pageSize, long sinceId, long maxId);
/**
* Create a new user list
* @param name the name of the list.
* @param description the list description.
* @param isPublic if true, the list will be public; if false the list will be private.
* @return the newly created {@link UserList} | List<Tweet> getListStatuses(String screenName, String listSlug, int pageSize, long sinceId, long maxId); /** * Create a new user list * @param name the name of the list. * @param description the list description. * @param isPublic if true, the list will be public; if false the list will be private. * @return the newly created {@link UserList} | /**
* Retrieves the timeline tweets for the given user list.
* Supports either user or application authorization.
* @param screenName the screen name of the Twitter user.
* @param listSlug the list's slug.
* @param pageSize The number of {@link Tweet}s per page.
* @param sinceId The minimum {@link Tweet} ID to return in the results
* @param maxId The maximum {@link Tweet} ID to return in the results
* @return a list of {@link Tweet} objects for the items in the user list timeline.
* @throws ApiException if there is an error while communicating with Twitter.
* @throws MissingAuthorizationException if TwitterTemplate was not created with OAuth credentials or an application access token.
*/ | Retrieves the timeline tweets for the given user list. Supports either user or application authorization | getListStatuses | {
"repo_name": "pagefreezer/spring-social-twitter",
"path": "spring-social-twitter/src/main/java/org/springframework/social/twitter/api/ListOperations.java",
"license": "apache-2.0",
"size": 21808
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,169,173 |
public boolean isDisplayFieldNameSet() {
return StringUtils.isNotBlank(displayFieldName);
}
| boolean function() { return StringUtils.isNotBlank(displayFieldName); } | /**
* This method returns true if the displayFieldName is set, otherwise it returns false. Whether the displayFieldName is set is
* defined by whether it has any non-whitespace content in it.
*
* @return
*/ | This method returns true if the displayFieldName is set, otherwise it returns false. Whether the displayFieldName is set is defined by whether it has any non-whitespace content in it | isDisplayFieldNameSet | {
"repo_name": "sbower/kuali-rice-1",
"path": "krad/krad-web-framework/src/main/java/org/kuali/rice/krad/datadictionary/ReferenceDefinition.java",
"license": "apache-2.0",
"size": 7910
} | [
"org.apache.commons.lang.StringUtils"
] | import org.apache.commons.lang.StringUtils; | import org.apache.commons.lang.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,845,117 |
@Override public void exitQueryTime(@NotNull AQLParser.QueryTimeContext ctx) { } | @Override public void exitQueryTime(@NotNull AQLParser.QueryTimeContext ctx) { } | /**
* {@inheritDoc}
* <p/>
* The default implementation does nothing.
*/ | The default implementation does nothing | enterQueryTime | {
"repo_name": "chriswhite199/jdbc-driver",
"path": "src/main/java/com/ibm/si/jaql/aql/AQLBaseListener.java",
"license": "apache-2.0",
"size": 13047
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 2,190,120 |
private void setCommonParametersForPolicy(PreparedStatement policyStatement, Policy policy) throws SQLException {
policyStatement.setString(1, policy.getPolicyName());
if(!StringUtils.isEmpty(policy.getDisplayName())) {
policyStatement.setString(2, policy.getDisplayName());
} else {
policyStatement.setString(2, policy.getPolicyName());
}
policyStatement.setInt(3, policy.getTenantId());
policyStatement.setString(4, policy.getDescription());
policyStatement.setString(5, policy.getDefaultQuotaPolicy().getType());
//TODO use requestCount in same format in all places
if (PolicyConstants.REQUEST_COUNT_TYPE.equalsIgnoreCase(policy.getDefaultQuotaPolicy().getType())) {
RequestCountLimit limit = (RequestCountLimit) policy.getDefaultQuotaPolicy().getLimit();
policyStatement.setLong(6, limit.getRequestCount());
policyStatement.setString(7, null);
} else if (PolicyConstants.BANDWIDTH_TYPE.equalsIgnoreCase(policy.getDefaultQuotaPolicy().getType())) {
BandwidthLimit limit = (BandwidthLimit) policy.getDefaultQuotaPolicy().getLimit();
policyStatement.setLong(6, limit.getDataAmount());
policyStatement.setString(7, limit.getDataUnit());
}
policyStatement.setLong(8, policy.getDefaultQuotaPolicy().getLimit().getUnitTime());
policyStatement.setString(9, policy.getDefaultQuotaPolicy().getLimit().getTimeUnit());
//policyStatement.setBoolean(9, APIUtil.isContentAwarePolicy(policy));
policyStatement.setBoolean(10, policy.isDeployed());
} | void function(PreparedStatement policyStatement, Policy policy) throws SQLException { policyStatement.setString(1, policy.getPolicyName()); if(!StringUtils.isEmpty(policy.getDisplayName())) { policyStatement.setString(2, policy.getDisplayName()); } else { policyStatement.setString(2, policy.getPolicyName()); } policyStatement.setInt(3, policy.getTenantId()); policyStatement.setString(4, policy.getDescription()); policyStatement.setString(5, policy.getDefaultQuotaPolicy().getType()); if (PolicyConstants.REQUEST_COUNT_TYPE.equalsIgnoreCase(policy.getDefaultQuotaPolicy().getType())) { RequestCountLimit limit = (RequestCountLimit) policy.getDefaultQuotaPolicy().getLimit(); policyStatement.setLong(6, limit.getRequestCount()); policyStatement.setString(7, null); } else if (PolicyConstants.BANDWIDTH_TYPE.equalsIgnoreCase(policy.getDefaultQuotaPolicy().getType())) { BandwidthLimit limit = (BandwidthLimit) policy.getDefaultQuotaPolicy().getLimit(); policyStatement.setLong(6, limit.getDataAmount()); policyStatement.setString(7, limit.getDataUnit()); } policyStatement.setLong(8, policy.getDefaultQuotaPolicy().getLimit().getUnitTime()); policyStatement.setString(9, policy.getDefaultQuotaPolicy().getLimit().getTimeUnit()); policyStatement.setBoolean(10, policy.isDeployed()); } | /**
* Populates common attribute data of the <code>policy</code> to <code>policyStatement</code>
*
* @param policyStatement prepared statement initialized of policy operation
* @param policy <code>Policy</code> object with data
* @throws SQLException
*/ | Populates common attribute data of the <code>policy</code> to <code>policyStatement</code> | setCommonParametersForPolicy | {
"repo_name": "dhanuka84/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java",
"license": "apache-2.0",
"size": 461690
} | [
"java.sql.PreparedStatement",
"java.sql.SQLException",
"org.apache.commons.lang.StringUtils",
"org.wso2.carbon.apimgt.api.model.policy.BandwidthLimit",
"org.wso2.carbon.apimgt.api.model.policy.Policy",
"org.wso2.carbon.apimgt.api.model.policy.PolicyConstants",
"org.wso2.carbon.apimgt.api.model.policy.RequestCountLimit"
] | import java.sql.PreparedStatement; import java.sql.SQLException; import org.apache.commons.lang.StringUtils; import org.wso2.carbon.apimgt.api.model.policy.BandwidthLimit; import org.wso2.carbon.apimgt.api.model.policy.Policy; import org.wso2.carbon.apimgt.api.model.policy.PolicyConstants; import org.wso2.carbon.apimgt.api.model.policy.RequestCountLimit; | import java.sql.*; import org.apache.commons.lang.*; import org.wso2.carbon.apimgt.api.model.policy.*; | [
"java.sql",
"org.apache.commons",
"org.wso2.carbon"
] | java.sql; org.apache.commons; org.wso2.carbon; | 2,822,756 |
private static void processResultRows(AmazonAthena athenaClient, String queryExecutionId)
{
GetQueryResultsRequest getQueryResultsRequest = new GetQueryResultsRequest()
// Max Results can be set but if its not set,
// it will choose the maximum page size
// As of the writing of this code, the maximum value is 1000
// .withMaxResults(1000)
.withQueryExecutionId(queryExecutionId);
GetQueryResultsResult getQueryResultsResult = athenaClient.getQueryResults(getQueryResultsRequest);
List<ColumnInfo> columnInfoList = getQueryResultsResult.getResultSet().getResultSetMetadata().getColumnInfo();
while (true) {
List<Row> results = getQueryResultsResult.getResultSet().getRows();
for (Row row : results) {
// Process the row. The first row of the first page holds the column names.
processRow(row, columnInfoList);
}
// If nextToken is null, there are no more pages to read. Break out of the loop.
if (getQueryResultsResult.getNextToken() == null) {
break;
}
getQueryResultsResult = athenaClient.getQueryResults(
getQueryResultsRequest.withNextToken(getQueryResultsResult.getNextToken()));
}
}
| static void function(AmazonAthena athenaClient, String queryExecutionId) { GetQueryResultsRequest getQueryResultsRequest = new GetQueryResultsRequest() .withQueryExecutionId(queryExecutionId); GetQueryResultsResult getQueryResultsResult = athenaClient.getQueryResults(getQueryResultsRequest); List<ColumnInfo> columnInfoList = getQueryResultsResult.getResultSet().getResultSetMetadata().getColumnInfo(); while (true) { List<Row> results = getQueryResultsResult.getResultSet().getRows(); for (Row row : results) { processRow(row, columnInfoList); } if (getQueryResultsResult.getNextToken() == null) { break; } getQueryResultsResult = athenaClient.getQueryResults( getQueryResultsRequest.withNextToken(getQueryResultsResult.getNextToken())); } } | /**
* This code calls Athena and retrieves the results of a query.
* The query must be in a completed state before the results can be retrieved and
* paginated. The first row of results are the column headers.
*/ | This code calls Athena and retrieves the results of a query. The query must be in a completed state before the results can be retrieved and paginated. The first row of results are the column headers | processResultRows | {
"repo_name": "awsdocs/aws-doc-sdk-examples",
"path": "java/example_code/athena/src/main/java/aws/example/athena/StartQueryExample.java",
"license": "apache-2.0",
"size": 7898
} | [
"com.amazonaws.services.athena.AmazonAthena",
"com.amazonaws.services.athena.model.ColumnInfo",
"com.amazonaws.services.athena.model.GetQueryResultsRequest",
"com.amazonaws.services.athena.model.GetQueryResultsResult",
"com.amazonaws.services.athena.model.Row",
"java.util.List"
] | import com.amazonaws.services.athena.AmazonAthena; import com.amazonaws.services.athena.model.ColumnInfo; import com.amazonaws.services.athena.model.GetQueryResultsRequest; import com.amazonaws.services.athena.model.GetQueryResultsResult; import com.amazonaws.services.athena.model.Row; import java.util.List; | import com.amazonaws.services.athena.*; import com.amazonaws.services.athena.model.*; import java.util.*; | [
"com.amazonaws.services",
"java.util"
] | com.amazonaws.services; java.util; | 635,936 |
public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight)
{
int[] var5 = this.biomePatternGeneratorChain.getInts(areaX, areaY, areaWidth, areaHeight);
int[] var6 = this.riverPatternGeneratorChain.getInts(areaX, areaY, areaWidth, areaHeight);
int[] var7 = IntCache.getIntCache(areaWidth * areaHeight);
for (int var8 = 0; var8 < areaWidth * areaHeight; ++var8)
{
if (var5[var8] != BiomeGenBase.ocean.biomeID && var5[var8] != BiomeGenBase.deepOcean.biomeID)
{
if (var6[var8] == BiomeGenBase.river.biomeID)
{
if (var5[var8] == BiomeGenBase.icePlains.biomeID)
{
var7[var8] = BiomeGenBase.frozenRiver.biomeID;
}
else if (var5[var8] != BiomeGenBase.mushroomIsland.biomeID && var5[var8] != BiomeGenBase.mushroomIslandShore.biomeID)
{
var7[var8] = var6[var8] & 255;
}
else
{
var7[var8] = BiomeGenBase.mushroomIslandShore.biomeID;
}
}
else
{
var7[var8] = var5[var8];
}
}
else
{
var7[var8] = var5[var8];
}
}
return var7;
} | int[] function(int areaX, int areaY, int areaWidth, int areaHeight) { int[] var5 = this.biomePatternGeneratorChain.getInts(areaX, areaY, areaWidth, areaHeight); int[] var6 = this.riverPatternGeneratorChain.getInts(areaX, areaY, areaWidth, areaHeight); int[] var7 = IntCache.getIntCache(areaWidth * areaHeight); for (int var8 = 0; var8 < areaWidth * areaHeight; ++var8) { if (var5[var8] != BiomeGenBase.ocean.biomeID && var5[var8] != BiomeGenBase.deepOcean.biomeID) { if (var6[var8] == BiomeGenBase.river.biomeID) { if (var5[var8] == BiomeGenBase.icePlains.biomeID) { var7[var8] = BiomeGenBase.frozenRiver.biomeID; } else if (var5[var8] != BiomeGenBase.mushroomIsland.biomeID && var5[var8] != BiomeGenBase.mushroomIslandShore.biomeID) { var7[var8] = var6[var8] & 255; } else { var7[var8] = BiomeGenBase.mushroomIslandShore.biomeID; } } else { var7[var8] = var5[var8]; } } else { var7[var8] = var5[var8]; } } return var7; } | /**
* Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
* amounts, or biomeList[] indices based on the particular GenLayer subclass.
*/ | Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall amounts, or biomeList[] indices based on the particular GenLayer subclass | getInts | {
"repo_name": "Hexeption/Youtube-Hacked-Client-1.8",
"path": "minecraft/net/minecraft/world/gen/layer/GenLayerRiverMix.java",
"license": "mit",
"size": 2595
} | [
"net.minecraft.world.biome.BiomeGenBase"
] | import net.minecraft.world.biome.BiomeGenBase; | import net.minecraft.world.biome.*; | [
"net.minecraft.world"
] | net.minecraft.world; | 589,537 |
public boolean followsInt(int x, int y) {
return follows(IntegerPos.make(x), IntegerPos.make(y));
} | boolean function(int x, int y) { return follows(IntegerPos.make(x), IntegerPos.make(y)); } | /**
* See discussion in XuInteger class comment about boxed vs unboxed integers
*/ | See discussion in XuInteger class comment about boxed vs unboxed integers | followsInt | {
"repo_name": "jonesd/udanax-gold2java",
"path": "abora-gold/src/generated-sources/translator/info/dgjones/abora/gold/spaces/basic/OrderSpec.java",
"license": "mit",
"size": 11044
} | [
"info.dgjones.abora.gold.spaces.integers.IntegerPos"
] | import info.dgjones.abora.gold.spaces.integers.IntegerPos; | import info.dgjones.abora.gold.spaces.integers.*; | [
"info.dgjones.abora"
] | info.dgjones.abora; | 1,740,541 |
@Deprecated
public static void write(StringBuffer data, OutputStream output, String encoding) throws IOException {
if (data != null) {
output.write(data.toString().getBytes(Charsets.toCharset(encoding)));
}
}
| static void function(StringBuffer data, OutputStream output, String encoding) throws IOException { if (data != null) { output.write(data.toString().getBytes(Charsets.toCharset(encoding))); } } | /**
* Writes chars from a <code>StringBuffer</code> to bytes on an
* <code>OutputStream</code> using the specified character encoding.
* <p>
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#getBytes(String)}.
*
* @param data the <code>StringBuffer</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @throws UnsupportedCharsetException
* thrown instead of {@link UnsupportedEncodingException} in version 2.2 if the encoding is not
* supported.
* @since 1.1
* @deprecated replaced by write(CharSequence, OutputStream, String)
*/ | Writes chars from a <code>StringBuffer</code> to bytes on an <code>OutputStream</code> using the specified character encoding. Character encoding names can be found at IANA. This method uses <code>String#getBytes(String)</code> | write | {
"repo_name": "Giraudux/java-quel-bazar",
"path": "src/org/apache/commons/io/IOUtils.java",
"license": "mit",
"size": 100484
} | [
"java.io.IOException",
"java.io.OutputStream"
] | import java.io.IOException; import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,696,229 |
private void validateDeprecatedJsDoc(Node n, JSDocInfo info) {
if (info != null && info.isExpose()) {
report(n, ANNOTATION_DEPRECATED, "@expose",
"Use @nocollapse or @export instead.");
}
} | void function(Node n, JSDocInfo info) { if (info != null && info.isExpose()) { report(n, ANNOTATION_DEPRECATED, STR, STR); } } | /**
* Checks that deprecated annotations such as @expose are not present
*/ | Checks that deprecated annotations such as @expose are not present | validateDeprecatedJsDoc | {
"repo_name": "tiobe/closure-compiler",
"path": "src/com/google/javascript/jscomp/CheckJSDoc.java",
"license": "apache-2.0",
"size": 20023
} | [
"com.google.javascript.rhino.JSDocInfo",
"com.google.javascript.rhino.Node"
] | import com.google.javascript.rhino.JSDocInfo; import com.google.javascript.rhino.Node; | import com.google.javascript.rhino.*; | [
"com.google.javascript"
] | com.google.javascript; | 1,834,900 |
public T soapjaxb() {
return dataFormat(new SoapJaxbDataFormat());
} | T function() { return dataFormat(new SoapJaxbDataFormat()); } | /**
* Uses the Soap 1.1 JAXB data format
*/ | Uses the Soap 1.1 JAXB data format | soapjaxb | {
"repo_name": "punkhorn/camel-upstream",
"path": "core/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java",
"license": "apache-2.0",
"size": 46443
} | [
"org.apache.camel.model.dataformat.SoapJaxbDataFormat"
] | import org.apache.camel.model.dataformat.SoapJaxbDataFormat; | import org.apache.camel.model.dataformat.*; | [
"org.apache.camel"
] | org.apache.camel; | 1,128,459 |
@Test(expectedExceptions = { IndexOutOfBoundsException.class })
public void testAppendCharacterArrayPortionNegativeLength()
throws Exception
{
ByteStringBuffer buffer = new ByteStringBuffer().append("foo");
assertEquals(buffer.length(), 3);
assertEquals(buffer.toString(), "foo");
buffer.append(new char[0], 0, -1);
} | @Test(expectedExceptions = { IndexOutOfBoundsException.class }) void function() throws Exception { ByteStringBuffer buffer = new ByteStringBuffer().append("foo"); assertEquals(buffer.length(), 3); assertEquals(buffer.toString(), "foo"); buffer.append(new char[0], 0, -1); } | /**
* Provides test coverage for the {@code append} method variant that takes a
* portion of a character array with a negative length.
*
* @throws Exception If an unexpected problem occurs.
*/ | Provides test coverage for the append method variant that takes a portion of a character array with a negative length | testAppendCharacterArrayPortionNegativeLength | {
"repo_name": "UnboundID/ldapsdk",
"path": "tests/unit/src/com/unboundid/util/ByteStringBufferTestCase.java",
"license": "gpl-2.0",
"size": 141047
} | [
"org.testng.annotations.Test"
] | import org.testng.annotations.Test; | import org.testng.annotations.*; | [
"org.testng.annotations"
] | org.testng.annotations; | 2,813,115 |
@Test public void rawEncodingRetained() throws Exception {
String urlString = "http://%6d%6D:%6d%6D@host/%6d%6D?%6d%6D#%6d%6D";
HttpUrl url = HttpUrl.parse(urlString);
assertEquals("%6d%6D", url.encodedUsername());
assertEquals("%6d%6D", url.encodedPassword());
assertEquals("/%6d%6D", url.encodedPath());
assertEquals(Arrays.asList("%6d%6D"), url.encodedPathSegments());
assertEquals("%6d%6D", url.encodedQuery());
assertEquals("%6d%6D", url.encodedFragment());
assertEquals(urlString, url.toString());
assertEquals(urlString, url.newBuilder().build().toString());
assertEquals("http://%6d%6D:%6d%6D@host/%6d%6D?%6d%6D", url.resolve("").toString());
} | @Test void function() throws Exception { String urlString = STR%6d%6DSTR%6d%6DSTR/%6d%6DSTR%6d%6DSTR%6d%6DSTR%6d%6DSTRhttp: } | /**
* Although HttpUrl prefers percent-encodings in uppercase, it should preserve the exact structure
* of the original encoding.
*/ | Although HttpUrl prefers percent-encodings in uppercase, it should preserve the exact structure of the original encoding | rawEncodingRetained | {
"repo_name": "hgl888/okhttp",
"path": "okhttp-tests/src/test/java/okhttp3/HttpUrlTest.java",
"license": "apache-2.0",
"size": 74030
} | [
"org.junit.Test"
] | import org.junit.Test; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,523,137 |
public List<FieldType> getSearchableFieldTypes(); | List<FieldType> function(); | /**
* Gets the dynamic searchable field types. For example, in solr, if you wanted to index a field as both
* text and string, you would have two searchable field types, String and Text
*
* @return the searchable types for this field
*/ | Gets the dynamic searchable field types. For example, in solr, if you wanted to index a field as both text and string, you would have two searchable field types, String and Text | getSearchableFieldTypes | {
"repo_name": "JDoIt/jreaper-common",
"path": "jreaper-common-model/src/main/java/com/jreaper/common/model/entity/search/Field.java",
"license": "apache-2.0",
"size": 3326
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,648,298 |
public boolean isDataFlavorSupported(DataFlavor df) {
return dataFlavor.match(df);
}
| boolean function(DataFlavor df) { return dataFlavor.match(df); } | /**
* Returns whether or not the specified data flavor is supported by this
* transferable.
*
* @param df the data flavor to check
*/ | Returns whether or not the specified data flavor is supported by this transferable | isDataFlavorSupported | {
"repo_name": "tectronics/rdv",
"path": "src/org/rdv/ui/ChannelListTransferable.java",
"license": "mit",
"size": 2951
} | [
"java.awt.datatransfer.DataFlavor"
] | import java.awt.datatransfer.DataFlavor; | import java.awt.datatransfer.*; | [
"java.awt"
] | java.awt; | 620,431 |
private InputStream createDownsampledInputStream(Parameters parameters) throws IOException {
String command = settingsService.getDownsamplingCommand();
return createTranscodeInputStream(command, parameters.getMaxBitRate(), parameters.getVideoTranscodingSettings(),
parameters.getMediaFile(), null);
}
| InputStream function(Parameters parameters) throws IOException { String command = settingsService.getDownsamplingCommand(); return createTranscodeInputStream(command, parameters.getMaxBitRate(), parameters.getVideoTranscodingSettings(), parameters.getMediaFile(), null); } | /**
* Returns a downsampled input stream to the music file.
*
* @param parameters Downsample parameters.
* @throws IOException If an I/O error occurs.
*/ | Returns a downsampled input stream to the music file | createDownsampledInputStream | {
"repo_name": "MadMarty/madsonic-server-5.0",
"path": "madsonic-main/src/main/java/net/sourceforge/subsonic/service/TranscodingService.java",
"license": "gpl-3.0",
"size": 23767
} | [
"java.io.IOException",
"java.io.InputStream"
] | import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,630,497 |
return SelectorProvider.provider().openDatagramChannel();
} | return SelectorProvider.provider().openDatagramChannel(); } | /**
* Creates an opened and not-connected datagram channel.
* <p>
* This channel is created by calling the <code>openDatagramChannel</code>
* method of the default {@link SelectorProvider} instance.
*
* @return the new channel which is open but not connected.
* @throws IOException
* if some I/O error occurs.
*/ | Creates an opened and not-connected datagram channel. This channel is created by calling the <code>openDatagramChannel</code> method of the default <code>SelectorProvider</code> instance | open | {
"repo_name": "freeVM/freeVM",
"path": "enhanced/java/classlib/modules/nio/src/main/java/common/java/nio/channels/DatagramChannel.java",
"license": "apache-2.0",
"size": 20504
} | [
"java.nio.channels.spi.SelectorProvider"
] | import java.nio.channels.spi.SelectorProvider; | import java.nio.channels.spi.*; | [
"java.nio"
] | java.nio; | 209,992 |
public static <T> Method[] getAllMetodsExcept(Class<T> type, String methodNameToExclude, Class<?>[] argumentTypes) {
Method[] methods = getAllMethods(type);
List<Method> methodList = new ArrayList<Method>();
outer:
for (Method method : methods) {
if (method.getName().equals(methodNameToExclude)) {
if (argumentTypes != null && argumentTypes.length > 0) {
final Class<?>[] args = method.getParameterTypes();
if (args != null && args.length == argumentTypes.length) {
for (int i = 0; i < args.length; i++) {
if (args[i].isAssignableFrom(getUnmockedType(argumentTypes[i]))) {
continue outer;
}
}
}
} else {
continue;
}
}
methodList.add(method);
}
return methodList.toArray(new Method[0]);
} | static <T> Method[] function(Class<T> type, String methodNameToExclude, Class<?>[] argumentTypes) { Method[] methods = getAllMethods(type); List<Method> methodList = new ArrayList<Method>(); outer: for (Method method : methods) { if (method.getName().equals(methodNameToExclude)) { if (argumentTypes != null && argumentTypes.length > 0) { final Class<?>[] args = method.getParameterTypes(); if (args != null && args.length == argumentTypes.length) { for (int i = 0; i < args.length; i++) { if (args[i].isAssignableFrom(getUnmockedType(argumentTypes[i]))) { continue outer; } } } } else { continue; } } methodList.add(method); } return methodList.toArray(new Method[0]); } | /**
* Gets the all metods except.
*
* @param <T> the generic type
* @param type the type
* @param methodNameToExclude the method name to exclude
* @param argumentTypes the argument types
* @return the all metods except
*/ | Gets the all metods except | getAllMetodsExcept | {
"repo_name": "thekingnothing/powermock",
"path": "reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java",
"license": "apache-2.0",
"size": 113110
} | [
"java.lang.reflect.Method",
"java.util.ArrayList",
"java.util.List"
] | import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; | import java.lang.reflect.*; import java.util.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 2,502,445 |
public boolean matches(final Relation relation, final boolean symmetric) {
final Entity sourceEntity = relation.getSource();
final Entity targetEntity = relation.getTarget();
final String sourceType = sourceEntity.getType().getName();
final String targetType = targetEntity.getType().getName();
final boolean relationType =
type.equalsIgnoreCase(relation.getRelationshipType())
&& subType.equalsIgnoreCase(relation.getRelationSubType());
if (!symmetric) {
return relationType && typesEqual(sourceType, targetType);
} else {
return relationType
&& (typesEqual(sourceType, targetType) || typesEqual(targetType, sourceType));
}
} | boolean function(final Relation relation, final boolean symmetric) { final Entity sourceEntity = relation.getSource(); final Entity targetEntity = relation.getTarget(); final String sourceType = sourceEntity.getType().getName(); final String targetType = targetEntity.getType().getName(); final boolean relationType = type.equalsIgnoreCase(relation.getRelationshipType()) && subType.equalsIgnoreCase(relation.getRelationSubType()); if (!symmetric) { return relationType && typesEqual(sourceType, targetType); } else { return relationType && (typesEqual(sourceType, targetType) typesEqual(targetType, sourceType)); } } | /**
* Check is the relation provided matches this constraint.
*
* <p>No inheritence and matches the full (not short) type name.
*
* @param relation the relation
* @param symmetric the symmetric (ie source and type can be swapped)
* @return true, if successful
*/ | Check is the relation provided matches this constraint. No inheritence and matches the full (not short) type name | matches | {
"repo_name": "dstl/baleen",
"path": "baleen-annotators/src/main/java/uk/gov/dstl/baleen/annotators/patterns/data/RelationConstraint.java",
"license": "apache-2.0",
"size": 5832
} | [
"uk.gov.dstl.baleen.types.semantic.Entity",
"uk.gov.dstl.baleen.types.semantic.Relation"
] | import uk.gov.dstl.baleen.types.semantic.Entity; import uk.gov.dstl.baleen.types.semantic.Relation; | import uk.gov.dstl.baleen.types.semantic.*; | [
"uk.gov.dstl"
] | uk.gov.dstl; | 277,799 |
@ApiModelProperty(example = "null", required = true, value = "The number of ships the aggressor has killed")
public Integer getShipsKilled() {
return shipsKilled;
} | @ApiModelProperty(example = "null", required = true, value = STR) Integer function() { return shipsKilled; } | /**
* The number of ships the aggressor has killed
* @return shipsKilled
**/ | The number of ships the aggressor has killed | getShipsKilled | {
"repo_name": "Tmin10/EVE-Security-Service",
"path": "server-api/src/main/java/ru/tmin10/EVESecurityService/serverApi/model/GetWarsWarIdAggressor.java",
"license": "gpl-3.0",
"size": 4713
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 1,561,444 |
@GetMapping
public ModelAndView getDefaultView() throws Exception {
final Map<String, Object> model = new HashMap<>();
model.put("logConfigurationFile", logConfigurationFile.getURI().toString());
return new ModelAndView(VIEW_CONFIG, model);
} | ModelAndView function() throws Exception { final Map<String, Object> model = new HashMap<>(); model.put(STR, logConfigurationFile.getURI().toString()); return new ModelAndView(VIEW_CONFIG, model); } | /**
* Gets default view.
*
* @return the default view
* @throws Exception the exception
*/ | Gets default view | getDefaultView | {
"repo_name": "gabedwrds/cas",
"path": "support/cas-server-support-reports/src/main/java/org/apereo/cas/web/report/LoggingConfigController.java",
"license": "apache-2.0",
"size": 13357
} | [
"java.util.HashMap",
"java.util.Map",
"org.springframework.web.servlet.ModelAndView"
] | import java.util.HashMap; import java.util.Map; import org.springframework.web.servlet.ModelAndView; | import java.util.*; import org.springframework.web.servlet.*; | [
"java.util",
"org.springframework.web"
] | java.util; org.springframework.web; | 803,350 |
public int processChunkData(ChunkPos chunkPos, NBTTagCompound chunkNBT, boolean simulate); | int function(ChunkPos chunkPos, NBTTagCompound chunkNBT, boolean simulate); | /**
* Handle processing of the raw Chunk NBT data.
* @param chunkPos The current Chunk position this method is called on
* @param chunkNBT The raw Chunk NBT data to process
* @param simulate If true, only simulate what would happen
* @return the number of operations that was done. The meaning is implementor-specific, <b>BUT</b>
* a value > 0 means that the Chunk NBT data will get written back to the RegionFile, if simulate is false.
*/ | Handle processing of the raw Chunk NBT data | processChunkData | {
"repo_name": "maruohon/worldutils",
"path": "src/main/java/fi/dy/masa/worldutils/data/IChunkDataHandler.java",
"license": "gpl-3.0",
"size": 733
} | [
"net.minecraft.nbt.NBTTagCompound",
"net.minecraft.util.math.ChunkPos"
] | import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.ChunkPos; | import net.minecraft.nbt.*; import net.minecraft.util.math.*; | [
"net.minecraft.nbt",
"net.minecraft.util"
] | net.minecraft.nbt; net.minecraft.util; | 859,146 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.