method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
list | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
list | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
|---|---|---|---|---|---|---|---|---|---|---|---|
public static Configuration configureWithWrapAuthentication(
String namespace, String authenticationName,
String authenticationPassword, String serviceBusRootUri,
String wrapRootUri) {
return configureWithWrapAuthentication(null,
Configuration.getInstance(), namespace, authenticationName,
authenticationPassword, serviceBusRootUri, wrapRootUri);
}
|
static Configuration function( String namespace, String authenticationName, String authenticationPassword, String serviceBusRootUri, String wrapRootUri) { return configureWithWrapAuthentication(null, Configuration.getInstance(), namespace, authenticationName, authenticationPassword, serviceBusRootUri, wrapRootUri); }
|
/**
* Creates a service bus configuration using the specified namespace, name,
* and password.
*
* @param namespace
* A <code>String</code> object that represents the namespace.
*
* @param authenticationName
* A <code>String</code> object that represents the
* authentication name.
*
* @param authenticationPassword
* A <code>String</code> object that represents the
* authentication password.
*
* @param serviceBusRootUri
* A <code>String</code> object containing the base URI that is
* added to your Service Bus namespace to form the URI to connect
* to the Service Bus service.
*
* To access the default public Azure service, pass
* ".servicebus.windows.net"
*
* @param wrapRootUri
* A <code>String</code> object containing the base URI that is
* added to your Service Bus namespace to form the URI to get an
* access token for the Service Bus service.
*
* To access the default public Azure service, pass
* "-sb.accesscontrol.windows.net/WRAPv0.9"
*
* @return A <code>Configuration</code> object that can be used when
* creating an instance of the <code>ServiceBusService</code> class.
*
*/
|
Creates a service bus configuration using the specified namespace, name, and password
|
configureWithWrapAuthentication
|
{
"repo_name": "oaastest/azure-sdk-for-java",
"path": "serviceBus/src/main/java/com/microsoft/windowsazure/services/servicebus/ServiceBusConfiguration.java",
"license": "apache-2.0",
"size": 14419
}
|
[
"com.microsoft.windowsazure.Configuration"
] |
import com.microsoft.windowsazure.Configuration;
|
import com.microsoft.windowsazure.*;
|
[
"com.microsoft.windowsazure"
] |
com.microsoft.windowsazure;
| 1,850,171
|
public static List<String> constructPubapi(TypeElement e, String class_loc_info) {
PubapiVisitor v = new PubapiVisitor();
if (class_loc_info != null) {
v.classLocInfo(class_loc_info);
}
v.construct(e);
return v.api;
}
|
static List<String> function(TypeElement e, String class_loc_info) { PubapiVisitor v = new PubapiVisitor(); if (class_loc_info != null) { v.classLocInfo(class_loc_info); } v.construct(e); return v.api; }
|
/**
* Visit the api of a class and return the constructed pubapi string.
*/
|
Visit the api of a class and return the constructed pubapi string
|
constructPubapi
|
{
"repo_name": "Techcable/sjavac",
"path": "src/main/java/com/sun/tools/sjavac/comp/Dependencies.java",
"license": "gpl-2.0",
"size": 10012
}
|
[
"java.util.List",
"javax.lang.model.element.TypeElement"
] |
import java.util.List; import javax.lang.model.element.TypeElement;
|
import java.util.*; import javax.lang.model.element.*;
|
[
"java.util",
"javax.lang"
] |
java.util; javax.lang;
| 710,830
|
public ScheduledFuture<?> schedule(TimeValue delay, String name, Runnable command) {
if (!Names.SAME.equals(name)) {
command = new ThreadedRunnable(command, executor(name));
}
return scheduler.schedule(new LoggingRunnable(command), delay.millis(), TimeUnit.MILLISECONDS);
}
|
ScheduledFuture<?> function(TimeValue delay, String name, Runnable command) { if (!Names.SAME.equals(name)) { command = new ThreadedRunnable(command, executor(name)); } return scheduler.schedule(new LoggingRunnable(command), delay.millis(), TimeUnit.MILLISECONDS); }
|
/**
* Schedules a one-shot command to run after a given delay. The command is not run in the context of the calling thread. To preserve the
* context of the calling thread you may call <code>threadPool.getThreadContext().preserveContext</code> on the runnable before passing
* it to this method.
*
* @param delay delay before the task executes
* @param name the name of the thread pool on which to execute this task. SAME means "execute on the scheduler thread" which changes the
* meaning of the ScheduledFuture returned by this method. In that case the ScheduledFuture will complete only when the command
* completes.
* @param command the command to run
* @return a ScheduledFuture who's get will return when the task is has been added to its target thread pool and throw an exception if
* the task is canceled before it was added to its target thread pool. Once the task has been added to its target thread pool
* the ScheduledFuture will cannot interact with it.
*/
|
Schedules a one-shot command to run after a given delay. The command is not run in the context of the calling thread. To preserve the context of the calling thread you may call <code>threadPool.getThreadContext().preserveContext</code> on the runnable before passing it to this method
|
schedule
|
{
"repo_name": "mapr/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java",
"license": "apache-2.0",
"size": 44078
}
|
[
"java.util.concurrent.ScheduledFuture",
"java.util.concurrent.TimeUnit",
"org.elasticsearch.common.unit.TimeValue"
] |
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import org.elasticsearch.common.unit.TimeValue;
|
import java.util.concurrent.*; import org.elasticsearch.common.unit.*;
|
[
"java.util",
"org.elasticsearch.common"
] |
java.util; org.elasticsearch.common;
| 799,354
|
private void setUpSendService() {
if (log.isInfoEnabled())
log.info("");
lock.lock();
try {
// Allocate the send service.
sendService = new HASendService();
final UUID downstreamId = member.getDownstreamServiceId();
// The address of the next service in the pipeline.
final PipelineState<S> nextState = getAddrNext(downstreamId);
if (nextState != null) {
// // The address of the next service in the pipeline.
// final InetSocketAddress addrNext = member.getService(
// downstreamId).getWritePipelineAddr();
// Start the send service.
sendService.start(nextState.addr);
}
// populate and/or clear the cache.
pipelineStateRef.set(nextState);
// cachePipelineState(downstreamId);
// Signal pipeline change.
pipelineChanged.signalAll();
} catch (Throwable t) {
try {
tearDown();
} catch (Throwable t2) {
log.error(t2, t2);
}
throw new RuntimeException(t);
} finally {
lock.unlock();
}
}
|
void function() { if (log.isInfoEnabled()) log.info(""); lock.lock(); try { sendService = new HASendService(); final UUID downstreamId = member.getDownstreamServiceId(); final PipelineState<S> nextState = getAddrNext(downstreamId); if (nextState != null) { sendService.start(nextState.addr); } pipelineStateRef.set(nextState); pipelineChanged.signalAll(); } catch (Throwable t) { try { tearDown(); } catch (Throwable t2) { log.error(t2, t2); } throw new RuntimeException(t); } finally { lock.unlock(); } }
|
/**
* Setup the send service.
*/
|
Setup the send service
|
setUpSendService
|
{
"repo_name": "blazegraph/database",
"path": "bigdata-core/bigdata/src/java/com/bigdata/ha/QuorumPipelineImpl.java",
"license": "gpl-2.0",
"size": 106731
}
|
[
"com.bigdata.ha.pipeline.HASendService"
] |
import com.bigdata.ha.pipeline.HASendService;
|
import com.bigdata.ha.pipeline.*;
|
[
"com.bigdata.ha"
] |
com.bigdata.ha;
| 2,845,870
|
public boolean onUnbind(Intent intent) {
return false;
}
|
boolean function(Intent intent) { return false; }
|
/**
* Called when all clients have disconnected from a particular interface
* published by the service. The default implementation does nothing and
* returns false.
*
* @param intent The Intent that was used to bind to this service,
* as given to {@link android.content.Context#bindService
* Context.bindService}. Note that any extras that were included with
* the Intent at that point will <em>not</em> be seen here.
*
* @return Return true if you would like to have the service's
* {@link #onRebind} method later called when new clients bind to it.
*/
|
Called when all clients have disconnected from a particular interface published by the service. The default implementation does nothing and returns false
|
onUnbind
|
{
"repo_name": "xorware/android_frameworks_base",
"path": "core/java/android/app/Service.java",
"license": "apache-2.0",
"size": 36286
}
|
[
"android.content.Intent"
] |
import android.content.Intent;
|
import android.content.*;
|
[
"android.content"
] |
android.content;
| 109,080
|
String getParent(String path) {
return path.substring(0, path.lastIndexOf(Path.SEPARATOR));
}
|
String getParent(String path) { return path.substring(0, path.lastIndexOf(Path.SEPARATOR)); }
|
/**
* Return string representing the parent of the given path.
*/
|
Return string representing the parent of the given path
|
getParent
|
{
"repo_name": "thisisvoa/hadoop-0.20",
"path": "src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java",
"license": "apache-2.0",
"size": 62398
}
|
[
"org.apache.hadoop.fs.Path"
] |
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.*;
|
[
"org.apache.hadoop"
] |
org.apache.hadoop;
| 346,611
|
public Dimension getMinimumSize(JComponent c)
{
return getPreferredSize(c);
}
|
Dimension function(JComponent c) { return getPreferredSize(c); }
|
/**
* This method returns the minimum size of the given JComponent for this UI.
*
* @param c The JComponent to find a minimum size for.
*
* @return The minimum size for this UI.
*/
|
This method returns the minimum size of the given JComponent for this UI
|
getMinimumSize
|
{
"repo_name": "shaotuanchen/sunflower_exp",
"path": "tools/source/gcc-4.2.4/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java",
"license": "bsd-3-clause",
"size": 43307
}
|
[
"java.awt.Dimension",
"javax.swing.JComponent"
] |
import java.awt.Dimension; import javax.swing.JComponent;
|
import java.awt.*; import javax.swing.*;
|
[
"java.awt",
"javax.swing"
] |
java.awt; javax.swing;
| 1,334,033
|
public String paramString()
{
// Unlike Sun, we don't throw NullPointerException or ClassCastException
// when source was illegally changed.
switch (id)
{
case COMPONENT_MOVED:
return "COMPONENT_MOVED "
+ (source instanceof Component
? ((Component) source).getBounds() : (Object) "");
case COMPONENT_RESIZED:
return "COMPONENT_RESIZED "
+ (source instanceof Component
? ((Component) source).getBounds() : (Object) "");
case COMPONENT_SHOWN:
return "COMPONENT_SHOWN";
case COMPONENT_HIDDEN:
return "COMPONENT_HIDDEN";
default:
return "unknown type";
}
}
|
String function() { switch (id) { case COMPONENT_MOVED: return STR + (source instanceof Component ? ((Component) source).getBounds() : (Object) STRCOMPONENT_RESIZED STRSTRCOMPONENT_SHOWNSTRCOMPONENT_HIDDENSTRunknown type"; } }
|
/**
* This method returns a string identifying this event. This is the field
* name of the id type, and for COMPONENT_MOVED or COMPONENT_RESIZED, the
* new bounding box of the component.
*
* @return a string identifying this event
*/
|
This method returns a string identifying this event. This is the field name of the id type, and for COMPONENT_MOVED or COMPONENT_RESIZED, the new bounding box of the component
|
paramString
|
{
"repo_name": "shaotuanchen/sunflower_exp",
"path": "tools/source/gcc-4.2.4/libjava/classpath/java/awt/event/ComponentEvent.java",
"license": "bsd-3-clause",
"size": 4903
}
|
[
"java.awt.Component"
] |
import java.awt.Component;
|
import java.awt.*;
|
[
"java.awt"
] |
java.awt;
| 721,753
|
public FieldQuery getSha256(final int index) {
return ListUtil.get(this.sha256, index);
}
|
FieldQuery function(final int index) { return ListUtil.get(this.sha256, index); }
|
/**
* Get the sha256 query at the input index.
*
* @param index Index of the sha256 query to get.
* @return {@link FieldQuery} at the input index.
*/
|
Get the sha256 query at the input index
|
getSha256
|
{
"repo_name": "CitrineInformatics/java-citrination-client",
"path": "src/main/java/io/citrine/jcc/search/pif/query/core/FileReferenceQuery.java",
"license": "apache-2.0",
"size": 16721
}
|
[
"io.citrine.jcc.util.ListUtil"
] |
import io.citrine.jcc.util.ListUtil;
|
import io.citrine.jcc.util.*;
|
[
"io.citrine.jcc"
] |
io.citrine.jcc;
| 2,307,062
|
private static int[][][] compileCompositionIndirection(final int parameters, final int order,
final DSCompiler valueCompiler,
final DSCompiler derivativeCompiler,
final int[][] sizes,
final int[][] derivativesIndirection)
throws NumberIsTooLargeException {
if ((parameters == 0) || (order == 0)) {
return new int[][][] { { { 1, 0 } } };
}
final int vSize = valueCompiler.compIndirection.length;
final int dSize = derivativeCompiler.compIndirection.length;
final int[][][] compIndirection = new int[vSize + dSize][][];
// the composition rules from the value part can be reused as is
System.arraycopy(valueCompiler.compIndirection, 0, compIndirection, 0, vSize);
// the composition rules for the derivative part are deduced by
// differentiation the rules from the underlying compiler once
// with respect to the parameter this compiler handles and the
// underlying one did not handle
for (int i = 0; i < dSize; ++i) {
List<int[]> row = new ArrayList<int[]>();
for (int[] term : derivativeCompiler.compIndirection[i]) {
// handle term p * f_k(g(x)) * g_l1(x) * g_l2(x) * ... * g_lp(x)
// derive the first factor in the term: f_k with respect to new parameter
int[] derivedTermF = new int[term.length + 1];
derivedTermF[0] = term[0]; // p
derivedTermF[1] = term[1] + 1; // f_(k+1)
int[] orders = new int[parameters];
orders[parameters - 1] = 1;
derivedTermF[term.length] = getPartialDerivativeIndex(parameters, order, sizes, orders); // g_1
for (int j = 2; j < term.length; ++j) {
// convert the indices as the mapping for the current order
// is different from the mapping with one less order
derivedTermF[j] = convertIndex(term[j], parameters,
derivativeCompiler.derivativesIndirection,
parameters, order, sizes);
}
Arrays.sort(derivedTermF, 2, derivedTermF.length);
row.add(derivedTermF);
// derive the various g_l
for (int l = 2; l < term.length; ++l) {
int[] derivedTermG = new int[term.length];
derivedTermG[0] = term[0];
derivedTermG[1] = term[1];
for (int j = 2; j < term.length; ++j) {
// convert the indices as the mapping for the current order
// is different from the mapping with one less order
derivedTermG[j] = convertIndex(term[j], parameters,
derivativeCompiler.derivativesIndirection,
parameters, order, sizes);
if (j == l) {
// derive this term
System.arraycopy(derivativesIndirection[derivedTermG[j]], 0, orders, 0, parameters);
orders[parameters - 1]++;
derivedTermG[j] = getPartialDerivativeIndex(parameters, order, sizes, orders);
}
}
Arrays.sort(derivedTermG, 2, derivedTermG.length);
row.add(derivedTermG);
}
}
// combine terms with similar derivation orders
final List<int[]> combined = new ArrayList<int[]>(row.size());
for (int j = 0; j < row.size(); ++j) {
final int[] termJ = row.get(j);
if (termJ[0] > 0) {
for (int k = j + 1; k < row.size(); ++k) {
final int[] termK = row.get(k);
boolean equals = termJ.length == termK.length;
for (int l = 1; equals && l < termJ.length; ++l) {
equals &= termJ[l] == termK[l];
}
if (equals) {
// combine termJ and termK
termJ[0] += termK[0];
// make sure we will skip termK later on in the outer loop
termK[0] = 0;
}
}
combined.add(termJ);
}
}
compIndirection[vSize + i] = combined.toArray(new int[combined.size()][]);
}
return compIndirection;
}
/** Get the index of a partial derivative in the array.
* <p>
* If all orders are set to 0, then the 0<sup>th</sup> order derivative
* is returned, which is the value of the function.
* </p>
* <p>The indices of derivatives are between 0 and {@link #getSize() getSize()} - 1.
* Their specific order is fixed for a given compiler, but otherwise not
* publicly specified. There are however some simple cases which have guaranteed
* indices:
* </p>
* <ul>
* <li>the index of 0<sup>th</sup> order derivative is always 0</li>
* <li>if there is only 1 {@link #getFreeParameters() free parameter}, then the
* derivatives are sorted in increasing derivation order (i.e. f at index 0, df/dp
* at index 1, d<sup>2</sup>f/dp<sup>2</sup> at index 2 ...
* d<sup>k</sup>f/dp<sup>k</sup> at index k),</li>
* <li>if the {@link #getOrder() derivation order} is 1, then the derivatives
* are sorted in increasing free parameter order (i.e. f at index 0, df/dx<sub>1</sub>
* at index 1, df/dx<sub>2</sub> at index 2 ... df/dx<sub>k</sub> at index k),</li>
* <li>all other cases are not publicly specified</li>
* </ul>
* <p>
* This method is the inverse of method {@link #getPartialDerivativeOrders(int)}
|
static int[][][] function(final int parameters, final int order, final DSCompiler valueCompiler, final DSCompiler derivativeCompiler, final int[][] sizes, final int[][] derivativesIndirection) throws NumberIsTooLargeException { if ((parameters == 0) (order == 0)) { return new int[][][] { { { 1, 0 } } }; } final int vSize = valueCompiler.compIndirection.length; final int dSize = derivativeCompiler.compIndirection.length; final int[][][] compIndirection = new int[vSize + dSize][][]; System.arraycopy(valueCompiler.compIndirection, 0, compIndirection, 0, vSize); for (int i = 0; i < dSize; ++i) { List<int[]> row = new ArrayList<int[]>(); for (int[] term : derivativeCompiler.compIndirection[i]) { int[] derivedTermF = new int[term.length + 1]; derivedTermF[0] = term[0]; derivedTermF[1] = term[1] + 1; int[] orders = new int[parameters]; orders[parameters - 1] = 1; derivedTermF[term.length] = getPartialDerivativeIndex(parameters, order, sizes, orders); for (int j = 2; j < term.length; ++j) { derivedTermF[j] = convertIndex(term[j], parameters, derivativeCompiler.derivativesIndirection, parameters, order, sizes); } Arrays.sort(derivedTermF, 2, derivedTermF.length); row.add(derivedTermF); for (int l = 2; l < term.length; ++l) { int[] derivedTermG = new int[term.length]; derivedTermG[0] = term[0]; derivedTermG[1] = term[1]; for (int j = 2; j < term.length; ++j) { derivedTermG[j] = convertIndex(term[j], parameters, derivativeCompiler.derivativesIndirection, parameters, order, sizes); if (j == l) { System.arraycopy(derivativesIndirection[derivedTermG[j]], 0, orders, 0, parameters); orders[parameters - 1]++; derivedTermG[j] = getPartialDerivativeIndex(parameters, order, sizes, orders); } } Arrays.sort(derivedTermG, 2, derivedTermG.length); row.add(derivedTermG); } } final List<int[]> combined = new ArrayList<int[]>(row.size()); for (int j = 0; j < row.size(); ++j) { final int[] termJ = row.get(j); if (termJ[0] > 0) { for (int k = j + 1; k < row.size(); ++k) { final int[] termK = row.get(k); boolean equals = termJ.length == termK.length; for (int l = 1; equals && l < termJ.length; ++l) { equals &= termJ[l] == termK[l]; } if (equals) { termJ[0] += termK[0]; termK[0] = 0; } } combined.add(termJ); } } compIndirection[vSize + i] = combined.toArray(new int[combined.size()][]); } return compIndirection; } /** Get the index of a partial derivative in the array. * <p> * If all orders are set to 0, then the 0<sup>th</sup> order derivative * is returned, which is the value of the function. * </p> * <p>The indices of derivatives are between 0 and {@link #getSize() getSize()} - 1. * Their specific order is fixed for a given compiler, but otherwise not * publicly specified. There are however some simple cases which have guaranteed * indices: * </p> * <ul> * <li>the index of 0<sup>th</sup> order derivative is always 0</li> * <li>if there is only 1 {@link #getFreeParameters() free parameter}, then the * derivatives are sorted in increasing derivation order (i.e. f at index 0, df/dp * at index 1, d<sup>2</sup>f/dp<sup>2</sup> at index 2 ... * d<sup>k</sup>f/dp<sup>k</sup> at index k),</li> * <li>if the {@link #getOrder() derivation order} is 1, then the derivatives * are sorted in increasing free parameter order (i.e. f at index 0, df/dx<sub>1</sub> * at index 1, df/dx<sub>2</sub> at index 2 ... df/dx<sub>k</sub> at index k),</li> * <li>all other cases are not publicly specified</li> * </ul> * <p> * This method is the inverse of method {@link #getPartialDerivativeOrders(int)}
|
/** Compile the function composition indirection array.
* <p>
* This indirection array contains the indices of all sets of elements
* involved when computing a composition. This allows a straightforward
* loop-based composition (see {@link #compose(double[], int, double[], double[], int)}).
* </p>
* @param parameters number of free parameters
* @param order derivation order
* @param valueCompiler compiler for the value part
* @param derivativeCompiler compiler for the derivative part
* @param sizes sizes array
* @param derivativesIndirection derivatives indirection array
* @return multiplication indirection array
* @throws NumberIsTooLargeException if order is too large
*/
|
Compile the function composition indirection array. This indirection array contains the indices of all sets of elements involved when computing a composition. This allows a straightforward loop-based composition (see <code>#compose(double[], int, double[], double[], int)</code>).
|
compileCompositionIndirection
|
{
"repo_name": "tbepler/seq-svm",
"path": "src/org/apache/commons/math3/analysis/differentiation/DSCompiler.java",
"license": "mit",
"size": 78372
}
|
[
"java.util.ArrayList",
"java.util.Arrays",
"java.util.List",
"org.apache.commons.math3.exception.NumberIsTooLargeException"
] |
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.commons.math3.exception.NumberIsTooLargeException;
|
import java.util.*; import org.apache.commons.math3.exception.*;
|
[
"java.util",
"org.apache.commons"
] |
java.util; org.apache.commons;
| 2,514,915
|
private static HiscoreEndpoint toEndPoint(final AccountType accountType)
{
switch (accountType)
{
case IRONMAN:
return HiscoreEndpoint.IRONMAN;
case ULTIMATE_IRONMAN:
return HiscoreEndpoint.ULTIMATE_IRONMAN;
case HARDCORE_IRONMAN:
return HiscoreEndpoint.HARDCORE_IRONMAN;
default:
return HiscoreEndpoint.NORMAL;
}
}
@Value
private static class HiscoreLookup
{
private final String name;
private final HiscoreEndpoint endpoint;
}
|
static HiscoreEndpoint function(final AccountType accountType) { switch (accountType) { case IRONMAN: return HiscoreEndpoint.IRONMAN; case ULTIMATE_IRONMAN: return HiscoreEndpoint.ULTIMATE_IRONMAN; case HARDCORE_IRONMAN: return HiscoreEndpoint.HARDCORE_IRONMAN; default: return HiscoreEndpoint.NORMAL; } } private static class HiscoreLookup { private final String name; private final HiscoreEndpoint endpoint; }
|
/**
* Converts account type to hiscore endpoint
*
* @param accountType account type
* @return hiscore endpoint
*/
|
Converts account type to hiscore endpoint
|
toEndPoint
|
{
"repo_name": "l2-/runelite",
"path": "runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java",
"license": "bsd-2-clause",
"size": 46471
}
|
[
"net.runelite.api.vars.AccountType",
"net.runelite.http.api.hiscore.HiscoreEndpoint"
] |
import net.runelite.api.vars.AccountType; import net.runelite.http.api.hiscore.HiscoreEndpoint;
|
import net.runelite.api.vars.*; import net.runelite.http.api.hiscore.*;
|
[
"net.runelite.api",
"net.runelite.http"
] |
net.runelite.api; net.runelite.http;
| 2,841,316
|
public List<String> populateCommandsList() {
List<String> cmdList = new ArrayList<String>();
StringTokenizer token = new StringTokenizer(mandatorycmds, ";");
while (token.hasMoreTokens()) {
String eachCmd = token.nextToken();
cmdList.add(eachCmd);
}
return cmdList;
}
|
List<String> function() { List<String> cmdList = new ArrayList<String>(); StringTokenizer token = new StringTokenizer(mandatorycmds, ";"); while (token.hasMoreTokens()) { String eachCmd = token.nextToken(); cmdList.add(eachCmd); } return cmdList; }
|
/**
* This method populates the list of commands from ";" seperated String of commands.
*/
|
This method populates the list of commands from ";" seperated String of commands
|
populateCommandsList
|
{
"repo_name": "ungerik/ephesoft",
"path": "Ephesoft_Community_Release_4.0.2.0/source/dcma-ocropus/src/main/java/com/ephesoft/dcma/ocr/OcrReader.java",
"license": "agpl-3.0",
"size": 14164
}
|
[
"java.util.ArrayList",
"java.util.List",
"java.util.StringTokenizer"
] |
import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 744,742
|
public void setInputSource(XMLInputSource inputSource) throws IOException {
fEntityManager.setEntityHandler(this);
fEntityManager.startEntity("$fragment$", inputSource, false, true);
//fDocumentSystemId = fEntityManager.expandSystemId(inputSource.getSystemId());
} // setInputSource(XMLInputSource)
|
void function(XMLInputSource inputSource) throws IOException { fEntityManager.setEntityHandler(this); fEntityManager.startEntity(STR, inputSource, false, true); }
|
/**
* Sets the input source.
*
* @param inputSource The input source.
*
* @throws IOException Thrown on i/o error.
*/
|
Sets the input source
|
setInputSource
|
{
"repo_name": "ronsigal/xerces",
"path": "src/org/apache/xerces/impl/XMLDocumentFragmentScannerImpl.java",
"license": "apache-2.0",
"size": 69892
}
|
[
"java.io.IOException",
"org.apache.xerces.xni.parser.XMLInputSource"
] |
import java.io.IOException; import org.apache.xerces.xni.parser.XMLInputSource;
|
import java.io.*; import org.apache.xerces.xni.parser.*;
|
[
"java.io",
"org.apache.xerces"
] |
java.io; org.apache.xerces;
| 1,309,497
|
@SuppressWarnings("unchecked")
public long getCumFreq(Comparable<?> v) {
if (getSumFreq() == 0) {
return 0;
}
if (v instanceof Integer) {
return getCumFreq(((Integer) v).longValue());
}
Comparator<Comparable<?>> c = (Comparator<Comparable<?>>) freqTable.comparator();
if (c == null) {
c = new NaturalComparator();
}
long result = 0;
try {
Long value = freqTable.get(v);
if (value != null) {
result = value.longValue();
}
} catch (ClassCastException ex) {
return result; // v is not comparable
}
if (c.compare(v, freqTable.firstKey()) < 0) {
return 0; // v is comparable, but less than first value
}
if (c.compare(v, freqTable.lastKey()) >= 0) {
return getSumFreq(); // v is comparable, but greater than the last value
}
Iterator<Comparable<?>> values = valuesIterator();
while (values.hasNext()) {
Comparable<?> nextValue = values.next();
if (c.compare(v, nextValue) > 0) {
result += getCount(nextValue);
} else {
return result;
}
}
return result;
}
|
@SuppressWarnings(STR) long function(Comparable<?> v) { if (getSumFreq() == 0) { return 0; } if (v instanceof Integer) { return getCumFreq(((Integer) v).longValue()); } Comparator<Comparable<?>> c = (Comparator<Comparable<?>>) freqTable.comparator(); if (c == null) { c = new NaturalComparator(); } long result = 0; try { Long value = freqTable.get(v); if (value != null) { result = value.longValue(); } } catch (ClassCastException ex) { return result; } if (c.compare(v, freqTable.firstKey()) < 0) { return 0; } if (c.compare(v, freqTable.lastKey()) >= 0) { return getSumFreq(); } Iterator<Comparable<?>> values = valuesIterator(); while (values.hasNext()) { Comparable<?> nextValue = values.next(); if (c.compare(v, nextValue) > 0) { result += getCount(nextValue); } else { return result; } } return result; }
|
/**
* Returns the cumulative frequency of values less than or equal to v.
* <p>
* Returns 0 if v is not comparable to the values set.</p>
*
* @param v the value to lookup.
* @return the proportion of values equal to v
*/
|
Returns the cumulative frequency of values less than or equal to v. Returns 0 if v is not comparable to the values set
|
getCumFreq
|
{
"repo_name": "SpoonLabs/astor",
"path": "examples/math_85/src/java/org/apache/commons/math/stat/Frequency.java",
"license": "gpl-2.0",
"size": 18933
}
|
[
"java.util.Comparator",
"java.util.Iterator"
] |
import java.util.Comparator; import java.util.Iterator;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 907,393
|
public FsVolumeSpi getVolume() {
return volume;
}
|
FsVolumeSpi function() { return volume; }
|
/**
* Get the volume where this replica is located on disk
* @return the volume where this replica is located on disk
*/
|
Get the volume where this replica is located on disk
|
getVolume
|
{
"repo_name": "jonathangizmo/HadoopDistJ",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ReplicaInfo.java",
"license": "mit",
"size": 9790
}
|
[
"org.apache.hadoop.hdfs.server.datanode.fsdataset.FsVolumeSpi"
] |
import org.apache.hadoop.hdfs.server.datanode.fsdataset.FsVolumeSpi;
|
import org.apache.hadoop.hdfs.server.datanode.fsdataset.*;
|
[
"org.apache.hadoop"
] |
org.apache.hadoop;
| 1,824,088
|
void configureTextIndex(Collection<String> indexedTextFields);
|
void configureTextIndex(Collection<String> indexedTextFields);
|
/**
* Configures the text search
* @param indexedTextFields - text field IDs (see above) used for indexing
*/
|
Configures the text search
|
configureTextIndex
|
{
"repo_name": "bdaum/zoraPD",
"path": "com.bdaum.zoom.core/src/com/bdaum/zoom/core/internal/lucene/ILuceneService.java",
"license": "gpl-2.0",
"size": 4485
}
|
[
"java.util.Collection"
] |
import java.util.Collection;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 89,761
|
private String clearApostrophes(String artifactPattern) {
return StringUtils.removeEnd(StringUtils.removeStart(artifactPattern, "\""), "\"");
}
|
String function(String artifactPattern) { return StringUtils.removeEnd(StringUtils.removeStart(artifactPattern, "\"STR\""); }
|
/**
* Clears the extra apostrophes from the start and the end of the string
*/
|
Clears the extra apostrophes from the start and the end of the string
|
clearApostrophes
|
{
"repo_name": "hudson3-plugins/artifactory-plugin",
"path": "src/main/java/org/jfrog/hudson/ivy/ArtifactoryIvyConfigurator.java",
"license": "apache-2.0",
"size": 14586
}
|
[
"org.apache.commons.lang.StringUtils"
] |
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.*;
|
[
"org.apache.commons"
] |
org.apache.commons;
| 707,990
|
private static void rdf_NodeElementList(XMPMetaImpl xmp, XMPNode xmpParent, Node rdfRdfNode)
throws XMPException
{
for (int i = 0; i < rdfRdfNode.getChildNodes().getLength(); i++)
{
Node child = rdfRdfNode.getChildNodes().item(i);
// filter whitespaces (and all text nodes)
if (!isWhitespaceNode(child))
{
rdf_NodeElement (xmp, xmpParent, child, true);
}
}
}
|
static void function(XMPMetaImpl xmp, XMPNode xmpParent, Node rdfRdfNode) throws XMPException { for (int i = 0; i < rdfRdfNode.getChildNodes().getLength(); i++) { Node child = rdfRdfNode.getChildNodes().item(i); if (!isWhitespaceNode(child)) { rdf_NodeElement (xmp, xmpParent, child, true); } } }
|
/**
* 7.2.10 nodeElementList<br>
* ws* ( nodeElement ws* )*
*
* Note: this method is only called from the rdf:RDF-node (top level)
* @param xmp the xmp metadata object that is generated
* @param xmpParent the parent xmp node
* @param rdfRdfNode the top-level xml node
* @throws XMPException thown on parsing errors
*/
|
7.2.10 nodeElementList ws* ( nodeElement ws* ) Note: this method is only called from the rdf:RDF-node (top level)
|
rdf_NodeElementList
|
{
"repo_name": "bdaum/zoraPD",
"path": "xmp/src/com/adobe/xmp/impl/ParseRDF.java",
"license": "gpl-2.0",
"size": 38937
}
|
[
"com.adobe.xmp.XMPException",
"org.w3c.dom.Node"
] |
import com.adobe.xmp.XMPException; import org.w3c.dom.Node;
|
import com.adobe.xmp.*; import org.w3c.dom.*;
|
[
"com.adobe.xmp",
"org.w3c.dom"
] |
com.adobe.xmp; org.w3c.dom;
| 2,207,020
|
private static int getNextEntryEventTypeId() {
int higherTypeId = Integer.MIN_VALUE;
int i = 0;
EntryEventType[] values = EntryEventType.values();
for (EntryEventType value : values) {
int typeId = value.getType();
if (i == 0) {
higherTypeId = typeId;
} else {
if (typeId > higherTypeId) {
higherTypeId = typeId;
}
}
i++;
}
int eventFlagPosition = Integer.numberOfTrailingZeros(higherTypeId);
return 1 << ++eventFlagPosition;
}
|
static int function() { int higherTypeId = Integer.MIN_VALUE; int i = 0; EntryEventType[] values = EntryEventType.values(); for (EntryEventType value : values) { int typeId = value.getType(); if (i == 0) { higherTypeId = typeId; } else { if (typeId > higherTypeId) { higherTypeId = typeId; } } i++; } int eventFlagPosition = Integer.numberOfTrailingZeros(higherTypeId); return 1 << ++eventFlagPosition; }
|
/**
* Returns next event type ID.
*
* @return next event type ID
* @see EntryEventType
*/
|
Returns next event type ID
|
getNextEntryEventTypeId
|
{
"repo_name": "tombujok/hazelcast",
"path": "hazelcast/src/main/java/com/hazelcast/map/EventLostEvent.java",
"license": "apache-2.0",
"size": 2868
}
|
[
"com.hazelcast.core.EntryEventType"
] |
import com.hazelcast.core.EntryEventType;
|
import com.hazelcast.core.*;
|
[
"com.hazelcast.core"
] |
com.hazelcast.core;
| 2,535,293
|
public static ClassifiedService getClassifiedService() {
return ServiceProvider.getService(ClassifiedService.class);
}
private ClassifiedServiceProvider() {
}
|
static ClassifiedService function() { return ServiceProvider.getService(ClassifiedService.class); } private ClassifiedServiceProvider() { }
|
/**
* Gets a classified service instance from the underlying IoC container.
* @return a ClassifiedService instance.
*/
|
Gets a classified service instance from the underlying IoC container
|
getClassifiedService
|
{
"repo_name": "auroreallibe/Silverpeas-Components",
"path": "classifieds/classifieds-library/src/main/java/org/silverpeas/components/classifieds/service/ClassifiedServiceProvider.java",
"license": "agpl-3.0",
"size": 1754
}
|
[
"org.silverpeas.core.util.ServiceProvider"
] |
import org.silverpeas.core.util.ServiceProvider;
|
import org.silverpeas.core.util.*;
|
[
"org.silverpeas.core"
] |
org.silverpeas.core;
| 242,073
|
EAttribute getTypeArguments_T2();
|
EAttribute getTypeArguments_T2();
|
/**
* Returns the meta object for the attribute '{@link com.euclideanspace.spad.editor.TypeArguments#getT2 <em>T2</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>T2</em>'.
* @see com.euclideanspace.spad.editor.TypeArguments#getT2()
* @see #getTypeArguments()
* @generated
*/
|
Returns the meta object for the attribute '<code>com.euclideanspace.spad.editor.TypeArguments#getT2 T2</code>'.
|
getTypeArguments_T2
|
{
"repo_name": "martinbaker/euclideanspace",
"path": "com.euclideanspace.spad/src-gen/com/euclideanspace/spad/editor/EditorPackage.java",
"license": "agpl-3.0",
"size": 593321
}
|
[
"org.eclipse.emf.ecore.EAttribute"
] |
import org.eclipse.emf.ecore.EAttribute;
|
import org.eclipse.emf.ecore.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 1,228,632
|
public static Object convertToWrappedPrimitive(Object source, Class<?> wrapper) {
if (source == null || wrapper == null) {
return null;
}
if (wrapper.isInstance(source)) {
return source;
}
if (wrapper.isAssignableFrom(source.getClass())) {
return source;
}
if (source instanceof Number) {
return convertNumberToWrapper((Number) source, wrapper);
} else {
//ensure we dont try to convert text to a number, prevent NumberFormatException
if (Number.class.isAssignableFrom(wrapper)) {
//test for int or fp number
if (!source.toString().matches(NUMERIC_TYPE)) {
throw new ConversionException(String.format("Unable to convert string %s its not a number type: %s", source, wrapper));
}
}
return convertStringToWrapper(source.toString(), wrapper);
}
}
|
static Object function(Object source, Class<?> wrapper) { if (source == null wrapper == null) { return null; } if (wrapper.isInstance(source)) { return source; } if (wrapper.isAssignableFrom(source.getClass())) { return source; } if (source instanceof Number) { return convertNumberToWrapper((Number) source, wrapper); } else { if (Number.class.isAssignableFrom(wrapper)) { if (!source.toString().matches(NUMERIC_TYPE)) { throw new ConversionException(String.format(STR, source, wrapper)); } } return convertStringToWrapper(source.toString(), wrapper); } }
|
/**
* Convert to wrapped primitive
* @param source Source object
* @param wrapper Primitive wrapper type
* @return Converted object
*/
|
Convert to wrapped primitive
|
convertToWrappedPrimitive
|
{
"repo_name": "cwpenhale/red5-mobileconsole",
"path": "red5_server/src/main/java/org/red5/server/util/ConversionUtils.java",
"license": "apache-2.0",
"size": 15903
}
|
[
"org.apache.commons.beanutils.ConversionException"
] |
import org.apache.commons.beanutils.ConversionException;
|
import org.apache.commons.beanutils.*;
|
[
"org.apache.commons"
] |
org.apache.commons;
| 1,790,735
|
public void adjust(Verrechnet verrechnet);
|
void function(Verrechnet verrechnet);
|
/**
* Adjust the created {@link Verrechnet}.
*
* @param verrechnet
* the Verrechnet object to adjust
*/
|
Adjust the created <code>Verrechnet</code>
|
adjust
|
{
"repo_name": "sazgin/elexis-3-core",
"path": "ch.elexis.core.data/src/ch/elexis/core/data/interfaces/IVerrechnetAdjuster.java",
"license": "epl-1.0",
"size": 1245
}
|
[
"ch.elexis.data.Verrechnet"
] |
import ch.elexis.data.Verrechnet;
|
import ch.elexis.data.*;
|
[
"ch.elexis.data"
] |
ch.elexis.data;
| 1,612,263
|
public void setFields(List<ColumnInfo> fields) {
this.fields = fields;
}
|
void function(List<ColumnInfo> fields) { this.fields = fields; }
|
/**
* set the fields
*
* @param fields
* the fields to set
*/
|
set the fields
|
setFields
|
{
"repo_name": "qqming113/bi-platform",
"path": "designer/src/main/java/com/baidu/rigel/biplatform/ma/resource/view/RelationTableView.java",
"license": "apache-2.0",
"size": 2281
}
|
[
"com.baidu.rigel.biplatform.ma.model.meta.ColumnInfo",
"java.util.List"
] |
import com.baidu.rigel.biplatform.ma.model.meta.ColumnInfo; import java.util.List;
|
import com.baidu.rigel.biplatform.ma.model.meta.*; import java.util.*;
|
[
"com.baidu.rigel",
"java.util"
] |
com.baidu.rigel; java.util;
| 194,525
|
@RPCMethod
Boolean containsUnitTemplate(final UnitTemplate unitTemplate);
|
Boolean containsUnitTemplate(final UnitTemplate unitTemplate);
|
/**
* Method returns true if the unit template with the given id is
* registered, otherwise false. The unit template id field is used for the
* comparison.
*
* Note: Method returns true in case the registry is not available. Maybe you need to check this in advance.
*
* @param unitTemplate the unit template which is tested
* @return if the unit template with the given id is registered, otherwise false
*/
|
Method returns true if the unit template with the given id is registered, otherwise false. The unit template id field is used for the comparison. Note: Method returns true in case the registry is not available. Maybe you need to check this in advance
|
containsUnitTemplate
|
{
"repo_name": "DivineCooperation/bco.registry",
"path": "lib/src/main/java/org/openbase/bco/registry/lib/provider/template/UnitTemplateCollectionProvider.java",
"license": "gpl-3.0",
"size": 4834
}
|
[
"org.openbase.type.domotic.unit.UnitTemplateType"
] |
import org.openbase.type.domotic.unit.UnitTemplateType;
|
import org.openbase.type.domotic.unit.*;
|
[
"org.openbase.type"
] |
org.openbase.type;
| 107,681
|
SSLContextHolder sslContextHolder(SSLConfiguration sslConfiguration) {
Objects.requireNonNull(sslConfiguration, "SSL Configuration cannot be null");
SSLContextHolder holder = sslContexts.get(sslConfiguration);
if (holder == null) {
throw new IllegalArgumentException("did not find an SSLContext for [" + sslConfiguration.toString() + "]");
}
return holder;
}
|
SSLContextHolder sslContextHolder(SSLConfiguration sslConfiguration) { Objects.requireNonNull(sslConfiguration, STR); SSLContextHolder holder = sslContexts.get(sslConfiguration); if (holder == null) { throw new IllegalArgumentException(STR + sslConfiguration.toString() + "]"); } return holder; }
|
/**
* Returns the existing {@link SSLContextHolder} for the configuration
*
* @throws IllegalArgumentException if not found
*/
|
Returns the existing <code>SSLContextHolder</code> for the configuration
|
sslContextHolder
|
{
"repo_name": "robin13/elasticsearch",
"path": "x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/SSLService.java",
"license": "apache-2.0",
"size": 41290
}
|
[
"java.util.Objects"
] |
import java.util.Objects;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,410,839
|
//-------------------------------------------------------------------------
public void onClose() {
MEMEApp.getDatabase().connChanged.removeListener(this);
MEMEApp.getViewsDb().viewsDbChanged.removeListener(this);
if (jViewsList != null) {
jViewsList.setListData(new Object[0]);
jViewsList = null;
if (jInfoPanel != null) {
jInfoPanel.removeAll();
jInfoPanel = null;
}
}
}
|
void function() { MEMEApp.getDatabase().connChanged.removeListener(this); MEMEApp.getViewsDb().viewsDbChanged.removeListener(this); if (jViewsList != null) { jViewsList.setListData(new Object[0]); jViewsList = null; if (jInfoPanel != null) { jInfoPanel.removeAll(); jInfoPanel = null; } } }
|
/**
* The container of 'this' JPanel is responsible to call this method
* when the container is disposed, to remove various listeners from
* external objects, which cannot be removed automatically.
* Note: this method clears the selection, thus related methods
* (getSelectedView(), getColumnsOfSelectedView() etc.) should
* not be used after this method.
*/
|
The container of 'this' JPanel is responsible to call this method when the container is disposed, to remove various listeners from external objects, which cannot be removed automatically. Note: this method clears the selection, thus related methods (getSelectedView(), getColumnsOfSelectedView() etc.) should not be used after this method
|
onClose
|
{
"repo_name": "lgulyas/MEME",
"path": "src/ai/aitia/meme/gui/ViewsBrowser.java",
"license": "gpl-3.0",
"size": 45853
}
|
[
"ai.aitia.meme.MEMEApp"
] |
import ai.aitia.meme.MEMEApp;
|
import ai.aitia.meme.*;
|
[
"ai.aitia.meme"
] |
ai.aitia.meme;
| 336,290
|
public Builder addExpand(String element) {
if (this.expand == null) {
this.expand = new ArrayList<>();
}
this.expand.add(element);
return this;
}
|
Builder function(String element) { if (this.expand == null) { this.expand = new ArrayList<>(); } this.expand.add(element); return this; }
|
/**
* Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and
* subsequent calls adds additional elements to the original list. See {@link
* EphemeralKeyCreateParams#expand} for the field documentation.
*/
|
Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See <code>EphemeralKeyCreateParams#expand</code> for the field documentation
|
addExpand
|
{
"repo_name": "stripe/stripe-java",
"path": "src/main/java/com/stripe/param/EphemeralKeyCreateParams.java",
"license": "mit",
"size": 2622
}
|
[
"java.util.ArrayList"
] |
import java.util.ArrayList;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 802,421
|
public SolutionTaskType findById(int id)
{
return repository.findOne(id);
}
|
SolutionTaskType function(int id) { return repository.findOne(id); }
|
/**
* Find by id.
*
* @param id
*
* @return The target item.
*/
|
Find by id
|
findById
|
{
"repo_name": "alistairrutherford/trader-rater",
"path": "trader-rater-common-jpa/src/main/java/com/netthreads/trader/service/SolutionTaskTypeService.java",
"license": "apache-2.0",
"size": 1326
}
|
[
"com.netthreads.trader.domain.SolutionTaskType"
] |
import com.netthreads.trader.domain.SolutionTaskType;
|
import com.netthreads.trader.domain.*;
|
[
"com.netthreads.trader"
] |
com.netthreads.trader;
| 1,844,765
|
public List<NetworkIntentPolicyConfiguration> networkIntentPolicyConfigurations() {
return this.networkIntentPolicyConfigurations;
}
|
List<NetworkIntentPolicyConfiguration> function() { return this.networkIntentPolicyConfigurations; }
|
/**
* Get a list of NetworkIntentPolicyConfiguration.
*
* @return the networkIntentPolicyConfigurations value
*/
|
Get a list of NetworkIntentPolicyConfiguration
|
networkIntentPolicyConfigurations
|
{
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/network/v2020_03_01/PrepareNetworkPoliciesRequest.java",
"license": "mit",
"size": 2221
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,178,416
|
// TODO remove since only test and merge use this
public static void addRegionToMETA(final HRegion meta, final HRegion r) throws IOException {
meta.checkResources();
// The row key is the region name
byte[] row = r.getRegionName();
final long now = EnvironmentEdgeManager.currentTimeMillis();
final List<KeyValue> cells = new ArrayList<KeyValue>(2);
cells.add(new KeyValue(row, HConstants.CATALOG_FAMILY,
HConstants.REGIONINFO_QUALIFIER, now,
r.getRegionInfo().toByteArray()));
// Set into the root table the version of the meta table.
cells.add(new KeyValue(row, HConstants.CATALOG_FAMILY,
HConstants.META_VERSION_QUALIFIER, now,
Bytes.toBytes(HConstants.META_VERSION)));
meta.put(row, HConstants.CATALOG_FAMILY, cells);
}
|
static void function(final HRegion meta, final HRegion r) throws IOException { meta.checkResources(); byte[] row = r.getRegionName(); final long now = EnvironmentEdgeManager.currentTimeMillis(); final List<KeyValue> cells = new ArrayList<KeyValue>(2); cells.add(new KeyValue(row, HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER, now, r.getRegionInfo().toByteArray())); cells.add(new KeyValue(row, HConstants.CATALOG_FAMILY, HConstants.META_VERSION_QUALIFIER, now, Bytes.toBytes(HConstants.META_VERSION))); meta.put(row, HConstants.CATALOG_FAMILY, cells); }
|
/**
* Inserts a new region's meta information into the passed
* <code>meta</code> region. Used by the HMaster bootstrap code adding
* new table to META table.
*
* @param meta META HRegion to be updated
* @param r HRegion to add to <code>meta</code>
*
* @throws IOException
*/
|
Inserts a new region's meta information into the passed <code>meta</code> region. Used by the HMaster bootstrap code adding new table to META table
|
addRegionToMETA
|
{
"repo_name": "francisliu/hbase_namespace",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java",
"license": "apache-2.0",
"size": 208409
}
|
[
"java.io.IOException",
"java.util.ArrayList",
"java.util.List",
"org.apache.hadoop.hbase.HConstants",
"org.apache.hadoop.hbase.KeyValue",
"org.apache.hadoop.hbase.util.Bytes",
"org.apache.hadoop.hbase.util.EnvironmentEdgeManager"
] |
import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
|
import java.io.*; import java.util.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.util.*;
|
[
"java.io",
"java.util",
"org.apache.hadoop"
] |
java.io; java.util; org.apache.hadoop;
| 320,151
|
private void setSetting(SonyProjectorItem item, byte[] data) throws SonyProjectorException {
logger.debug("Set setting {} data {}", item.getName(), HexUtils.bytesToHex(data));
try {
executeCommand(item, false, data);
} catch (SonyProjectorException e) {
logger.debug("Set setting {} failed: {}", item.getName(), e.getMessage());
throw new SonyProjectorException("Set setting " + item.getName() + " failed: " + e.getMessage());
}
logger.debug("Set setting {} succeeded", item.getName());
}
|
void function(SonyProjectorItem item, byte[] data) throws SonyProjectorException { logger.debug(STR, item.getName(), HexUtils.bytesToHex(data)); try { executeCommand(item, false, data); } catch (SonyProjectorException e) { logger.debug(STR, item.getName(), e.getMessage()); throw new SonyProjectorException(STR + item.getName() + STR + e.getMessage()); } logger.debug(STR, item.getName()); }
|
/**
* Request the projector to set a new value for a setting
*
* @param item the projector setting to set
* @param data the value to set for the setting
*
* @throws SonyProjectorException - In case of any problem
*/
|
Request the projector to set a new value for a setting
|
setSetting
|
{
"repo_name": "openhab/openhab2",
"path": "bundles/org.openhab.binding.sonyprojector/src/main/java/org/openhab/binding/sonyprojector/internal/communication/SonyProjectorConnector.java",
"license": "epl-1.0",
"size": 43215
}
|
[
"org.openhab.binding.sonyprojector.internal.SonyProjectorException",
"org.openhab.core.util.HexUtils"
] |
import org.openhab.binding.sonyprojector.internal.SonyProjectorException; import org.openhab.core.util.HexUtils;
|
import org.openhab.binding.sonyprojector.internal.*; import org.openhab.core.util.*;
|
[
"org.openhab.binding",
"org.openhab.core"
] |
org.openhab.binding; org.openhab.core;
| 93,733
|
public Builder setImageUrl(@Nullable final Uri imageUrl) {
this.imageUrl = imageUrl;
return this;
}
|
Builder function(@Nullable final Uri imageUrl) { this.imageUrl = imageUrl; return this; }
|
/**
* Sets the URL to the photo.
* @param imageUrl {@link android.net.Uri} that points to a network location or the location
* of the photo on disk.
* @return The builder.
*/
|
Sets the URL to the photo
|
setImageUrl
|
{
"repo_name": "yudiandreanp/SocioBlood",
"path": "facebook/src/com/facebook/share/model/SharePhoto.java",
"license": "apache-2.0",
"size": 7350
}
|
[
"android.net.Uri",
"android.support.annotation.Nullable"
] |
import android.net.Uri; import android.support.annotation.Nullable;
|
import android.net.*; import android.support.annotation.*;
|
[
"android.net",
"android.support"
] |
android.net; android.support;
| 1,986,894
|
public static String getNodeValue(NodeList node)
{
StringBuilder buf = new StringBuilder();
NodeList list = node;
int n = list.getLength();
for (int i = 0; i < n; ++i) {
String val = getNodeValue(list.item(i));
if (val != null) {
buf.append(val);
}
}
return buf.toString();
}
|
static String function(NodeList node) { StringBuilder buf = new StringBuilder(); NodeList list = node; int n = list.getLength(); for (int i = 0; i < n; ++i) { String val = getNodeValue(list.item(i)); if (val != null) { buf.append(val); } } return buf.toString(); }
|
/**
* Return the value of a NodeList as concatenation of values of all nodes
* contained in the list.
*
* @param node
* the node list
* @return the nodes value
*/
|
Return the value of a NodeList as concatenation of values of all nodes contained in the list
|
getNodeValue
|
{
"repo_name": "green-vulcano/gv-engine",
"path": "gvengine/gvbase/src/main/java/it/greenvulcano/configuration/XMLConfig.java",
"license": "lgpl-3.0",
"size": 77533
}
|
[
"org.w3c.dom.NodeList"
] |
import org.w3c.dom.NodeList;
|
import org.w3c.dom.*;
|
[
"org.w3c.dom"
] |
org.w3c.dom;
| 2,805,781
|
public Collection<P> getList(NodeRef nodeRef, QName classQName, QName propertyQName)
{
checkPropertyType(propertyQName);
return factory.createList(new ClassFeatureBehaviourBinding(dictionary, nodeRef, classQName, propertyQName));
}
|
Collection<P> function(NodeRef nodeRef, QName classQName, QName propertyQName) { checkPropertyType(propertyQName); return factory.createList(new ClassFeatureBehaviourBinding(dictionary, nodeRef, classQName, propertyQName)); }
|
/**
* Gets the collection of Policy implementations for the specified Class and Property
*
* @param nodeRef the node reference
* @param classQName the class qualified name
* @param propertyQName the property qualified name
* @return the collection of policies
*/
|
Gets the collection of Policy implementations for the specified Class and Property
|
getList
|
{
"repo_name": "daniel-he/community-edition",
"path": "projects/repository/source/java/org/alfresco/repo/policy/PropertyPolicyDelegate.java",
"license": "lgpl-3.0",
"size": 7566
}
|
[
"java.util.Collection",
"org.alfresco.service.cmr.repository.NodeRef",
"org.alfresco.service.namespace.QName"
] |
import java.util.Collection; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.QName;
|
import java.util.*; import org.alfresco.service.cmr.repository.*; import org.alfresco.service.namespace.*;
|
[
"java.util",
"org.alfresco.service"
] |
java.util; org.alfresco.service;
| 473,838
|
public void testAcDeployConfiguration() {
List<Integer> revisions = new ArrayList<Integer>();
revisions.add(ConfigTestUtils.createConfigRevision(
this.admin.getOrg()).getId().intValue());
assertEquals(new Integer(BaseHandler.VALID),
this.ach.addConfigurationDeployment(this.admin,
CHAIN_LABEL,
this.server.getId().intValue(),
revisions));
}
|
void function() { List<Integer> revisions = new ArrayList<Integer>(); revisions.add(ConfigTestUtils.createConfigRevision( this.admin.getOrg()).getId().intValue()); assertEquals(new Integer(BaseHandler.VALID), this.ach.addConfigurationDeployment(this.admin, CHAIN_LABEL, this.server.getId().intValue(), revisions)); }
|
/**
* Deploy configuration.
*/
|
Deploy configuration
|
testAcDeployConfiguration
|
{
"repo_name": "xkollar/spacewalk",
"path": "java/code/src/com/redhat/rhn/frontend/xmlrpc/chain/test/ActionChainHandlerTest.java",
"license": "gpl-2.0",
"size": 26780
}
|
[
"com.redhat.rhn.frontend.xmlrpc.BaseHandler",
"com.redhat.rhn.testing.ConfigTestUtils",
"java.util.ArrayList",
"java.util.List"
] |
import com.redhat.rhn.frontend.xmlrpc.BaseHandler; import com.redhat.rhn.testing.ConfigTestUtils; import java.util.ArrayList; import java.util.List;
|
import com.redhat.rhn.frontend.xmlrpc.*; import com.redhat.rhn.testing.*; import java.util.*;
|
[
"com.redhat.rhn",
"java.util"
] |
com.redhat.rhn; java.util;
| 113,138
|
public boolean JoinImage(BufferedImage frontRasterImage)
throws Exception
{
if (this.generateDistributedImage == true) {
throw new Exception("[OverlayOperator][JoinImage] The back image is distributed. Please don't use centralized format.");
}
if (backRasterImage.getWidth() != frontRasterImage.getWidth() || backRasterImage.getHeight() != frontRasterImage.getHeight()) {
throw new Exception("[OverlayOperator][JoinImage] The two given image don't have the same width or the same height.");
}
int w = Math.max(backRasterImage.getWidth(), frontRasterImage.getWidth());
int h = Math.max(backRasterImage.getHeight(), frontRasterImage.getHeight());
BufferedImage combinedImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
Graphics graphics = combinedImage.getGraphics();
graphics.drawImage(backRasterImage, 0, 0, null);
graphics.drawImage(frontRasterImage, 0, 0, null);
this.backRasterImage = combinedImage;
return true;
}
|
boolean function(BufferedImage frontRasterImage) throws Exception { if (this.generateDistributedImage == true) { throw new Exception(STR); } if (backRasterImage.getWidth() != frontRasterImage.getWidth() backRasterImage.getHeight() != frontRasterImage.getHeight()) { throw new Exception(STR); } int w = Math.max(backRasterImage.getWidth(), frontRasterImage.getWidth()); int h = Math.max(backRasterImage.getHeight(), frontRasterImage.getHeight()); BufferedImage combinedImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); Graphics graphics = combinedImage.getGraphics(); graphics.drawImage(backRasterImage, 0, 0, null); graphics.drawImage(frontRasterImage, 0, 0, null); this.backRasterImage = combinedImage; return true; }
|
/**
* Join image.
*
* @param frontRasterImage the front raster image
* @return true, if successful
* @throws Exception the exception
*/
|
Join image
|
JoinImage
|
{
"repo_name": "Sarwat/GeoSpark",
"path": "viz/src/main/java/org/datasyslab/geosparkviz/core/RasterOverlayOperator.java",
"license": "mit",
"size": 6368
}
|
[
"java.awt.Graphics",
"java.awt.image.BufferedImage"
] |
import java.awt.Graphics; import java.awt.image.BufferedImage;
|
import java.awt.*; import java.awt.image.*;
|
[
"java.awt"
] |
java.awt;
| 1,524,530
|
public static boolean isOptional(IAType type) {
return type.getTypeTag() == ATypeTag.UNION && ((AUnionType) type).isUnknownableType();
}
|
static boolean function(IAType type) { return type.getTypeTag() == ATypeTag.UNION && ((AUnionType) type).isUnknownableType(); }
|
/**
* Decide whether a type is an optional type
*
* @param type
* @return true if it is optional; false otherwise
*/
|
Decide whether a type is an optional type
|
isOptional
|
{
"repo_name": "heriram/incubator-asterixdb",
"path": "asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/NonTaggedFormatUtil.java",
"license": "apache-2.0",
"size": 11394
}
|
[
"org.apache.asterix.om.types.ATypeTag",
"org.apache.asterix.om.types.AUnionType",
"org.apache.asterix.om.types.IAType"
] |
import org.apache.asterix.om.types.ATypeTag; import org.apache.asterix.om.types.AUnionType; import org.apache.asterix.om.types.IAType;
|
import org.apache.asterix.om.types.*;
|
[
"org.apache.asterix"
] |
org.apache.asterix;
| 280,822
|
public LookupClassBuilder<E, S> withAfterCloseListener(Consumer<AfterScreenCloseEvent<S>> listener) {
this.closeListener = listener;
return this;
}
|
LookupClassBuilder<E, S> function(Consumer<AfterScreenCloseEvent<S>> listener) { this.closeListener = listener; return this; }
|
/**
* Adds {@link Screen.AfterCloseEvent} listener to the screen.
*
* @param listener listener
*/
|
Adds <code>Screen.AfterCloseEvent</code> listener to the screen
|
withAfterCloseListener
|
{
"repo_name": "cuba-platform/cuba",
"path": "modules/gui/src/com/haulmont/cuba/gui/builders/LookupClassBuilder.java",
"license": "apache-2.0",
"size": 4293
}
|
[
"java.util.function.Consumer"
] |
import java.util.function.Consumer;
|
import java.util.function.*;
|
[
"java.util"
] |
java.util;
| 449,625
|
public void setLabel(ViewCanvas<?> view2d, Double xPos, Double yPos, String... labels);
|
void function(ViewCanvas<?> view2d, Double xPos, Double yPos, String... labels);
|
/**
* Sets label strings and compute bounding rectangle size and position in pixel world according to the DefaultView
* which defines current "Font"<br>
*/
|
Sets label strings and compute bounding rectangle size and position in pixel world according to the DefaultView which defines current "Font"
|
setLabel
|
{
"repo_name": "mischwarz/Weasis",
"path": "weasis-core/weasis-core-ui/src/main/java/org/weasis/core/ui/model/graphic/GraphicLabel.java",
"license": "epl-1.0",
"size": 2687
}
|
[
"org.weasis.core.ui.editor.image.ViewCanvas"
] |
import org.weasis.core.ui.editor.image.ViewCanvas;
|
import org.weasis.core.ui.editor.image.*;
|
[
"org.weasis.core"
] |
org.weasis.core;
| 2,880,973
|
public final void setSmallIcon(@DrawableRes int smallIconResourceId) {
if (this.smallIconResourceId != smallIconResourceId) {
this.smallIconResourceId = smallIconResourceId;
invalidate();
}
}
|
final void function(@DrawableRes int smallIconResourceId) { if (this.smallIconResourceId != smallIconResourceId) { this.smallIconResourceId = smallIconResourceId; invalidate(); } }
|
/**
* Sets the small icon of the notification which is also shown in the system status bar.
*
* <p>See {@link NotificationCompat.Builder#setSmallIcon(int)}.
*
* @param smallIconResourceId The resource id of the small icon.
*/
|
Sets the small icon of the notification which is also shown in the system status bar. See <code>NotificationCompat.Builder#setSmallIcon(int)</code>
|
setSmallIcon
|
{
"repo_name": "ened/ExoPlayer",
"path": "library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java",
"license": "apache-2.0",
"size": 59588
}
|
[
"androidx.annotation.DrawableRes"
] |
import androidx.annotation.DrawableRes;
|
import androidx.annotation.*;
|
[
"androidx.annotation"
] |
androidx.annotation;
| 2,473,368
|
public java.awt.Image getImage(String fileName) throws IOException {
//System.out.println(imageCache);
java.awt.Image img = (java.awt.Image) imageCache.get(fileName);
if (img != null)
return img;
InputStream is = openInputStream(fileName);
if (is == null)
throw new RuntimeException("null stream opening: " + fileName);
img = createImage(is);
imageCache.put(fileName, img);
return img;
}
|
java.awt.Image function(String fileName) throws IOException { java.awt.Image img = (java.awt.Image) imageCache.get(fileName); if (img != null) return img; InputStream is = openInputStream(fileName); if (is == null) throw new RuntimeException(STR + fileName); img = createImage(is); imageCache.put(fileName, img); return img; }
|
/**
* loads an image from the given file name, using the
* openInputStream() method. If the file extension is PNG or png,
* the image is loaded using the sixlegs png library. */
|
loads an image from the given file name, using the openInputStream() method. If the file extension is PNG or png
|
getImage
|
{
"repo_name": "Icenowy/me4se-mobianthon",
"path": "src/javax/microedition/midlet/ApplicationManager.java",
"license": "gpl-2.0",
"size": 37087
}
|
[
"java.io.IOException",
"java.io.InputStream"
] |
import java.io.IOException; import java.io.InputStream;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 2,561,425
|
public void registerBrowserSession(BrowserSessionInfo sessionInfo) {
driver.registerBrowserSession(sessionInfo);
}
|
void function(BrowserSessionInfo sessionInfo) { driver.registerBrowserSession(sessionInfo); }
|
/**
* Registers a running browser session
*/
|
Registers a running browser session
|
registerBrowserSession
|
{
"repo_name": "jmt4/Selenium2",
"path": "java/server/src/org/openqa/selenium/server/SeleniumServer.java",
"license": "apache-2.0",
"size": 31222
}
|
[
"org.openqa.selenium.server.BrowserSessionFactory"
] |
import org.openqa.selenium.server.BrowserSessionFactory;
|
import org.openqa.selenium.server.*;
|
[
"org.openqa.selenium"
] |
org.openqa.selenium;
| 54,671
|
public void addRoundRectangleStraightLeft(final float x, final float y,
final float width, final float height, final float arcWidth,
final float arcHeight) {
if (isDisposed()) {
SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
}
// Top left corner
moveTo(x, y);
lineTo((x + width) - arcWidth, y);
// Top right corner
cubicTo(x + width, y, x + width, y, (x + width) - arcWidth, y);
cubicTo(x + width, y, x + width, y, x + width, y + arcHeight);
// Bottom right corner
cubicTo(x + width, y + height, x + width, y + height, x + width,
(y + height) - arcHeight);
cubicTo(x + width, y + height, x + width, y + height, (x + width)
- arcWidth, y + height);
// Bottom left corner
lineTo(x, y + height);
lineTo(x, y);
}
|
void function(final float x, final float y, final float width, final float height, final float arcWidth, final float arcHeight) { if (isDisposed()) { SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); } moveTo(x, y); lineTo((x + width) - arcWidth, y); cubicTo(x + width, y, x + width, y, (x + width) - arcWidth, y); cubicTo(x + width, y, x + width, y, x + width, y + arcHeight); cubicTo(x + width, y + height, x + width, y + height, x + width, (y + height) - arcHeight); cubicTo(x + width, y + height, x + width, y + height, (x + width) - arcWidth, y + height); lineTo(x, y + height); lineTo(x, y); }
|
/**
* Adds to the receiver the rectangle specified by x, y, width and height.<br/>
* This rectangle is round-cornered on the right, and straight on the left.
*
* @param x
* the x coordinate of the rectangle to add
* @param y
* the y coordinate of the rectangle to add
* @param width
* the width of the rectangle to add
* @param height
* the height of the rectangle to add
* @param arcWidth
* the width of the arc
* @param arcHeight
* the height of the arc
* @exception SWTException
* <ul>
* <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed
* </li>
* </ul>
*/
|
Adds to the receiver the rectangle specified by x, y, width and height. This rectangle is round-cornered on the right, and straight on the left
|
addRoundRectangleStraightLeft
|
{
"repo_name": "Haixing-Hu/swt-widgets",
"path": "src/main/java/com/github/haixing_hu/swt/utils/AdvancedPath.java",
"license": "epl-1.0",
"size": 6453
}
|
[
"org.eclipse.swt.SWT"
] |
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.*;
|
[
"org.eclipse.swt"
] |
org.eclipse.swt;
| 2,597,982
|
public static ims.icps.configuration.domain.objects.ICP extractICP(ims.domain.ILightweightDomainFactory domainFactory, ims.icp.vo.ICPLiteVo valueObject)
{
return extractICP(domainFactory, valueObject, new HashMap());
}
|
static ims.icps.configuration.domain.objects.ICP function(ims.domain.ILightweightDomainFactory domainFactory, ims.icp.vo.ICPLiteVo valueObject) { return extractICP(domainFactory, valueObject, new HashMap()); }
|
/**
* Create the domain object from the value object.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param valueObject - extract the domain object fields from this.
*/
|
Create the domain object from the value object
|
extractICP
|
{
"repo_name": "open-health-hub/openMAXIMS",
"path": "openmaxims_workspace/ValueObjects/src/ims/icp/vo/domain/ICPLiteVoAssembler.java",
"license": "agpl-3.0",
"size": 17173
}
|
[
"java.util.HashMap"
] |
import java.util.HashMap;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,089,683
|
private List<ScoreEntry> loadScoreList() throws FileNotFoundException {
List<ScoreEntry> scores = new ArrayList<>();
try (Scanner reader = new Scanner(file, "UTF-8")) {
while (reader.hasNextLine()) {
String line = reader.nextLine();
if (line.isEmpty()) {
continue;
}
ScoreEntry entry = new ScoreEntry(line);
scores.add(entry);
}
}
return scores;
}
|
List<ScoreEntry> function() throws FileNotFoundException { List<ScoreEntry> scores = new ArrayList<>(); try (Scanner reader = new Scanner(file, "UTF-8")) { while (reader.hasNextLine()) { String line = reader.nextLine(); if (line.isEmpty()) { continue; } ScoreEntry entry = new ScoreEntry(line); scores.add(entry); } } return scores; }
|
/**
* Loads the score list from file.
* @return all score entries loaded in the file
* @throws FileNotFoundException
*/
|
Loads the score list from file
|
loadScoreList
|
{
"repo_name": "seece/yotris",
"path": "yotris/src/main/java/com/lofibucket/yotris/util/FileDAO.java",
"license": "mit",
"size": 2902
}
|
[
"java.io.FileNotFoundException",
"java.util.ArrayList",
"java.util.List",
"java.util.Scanner"
] |
import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.List; import java.util.Scanner;
|
import java.io.*; import java.util.*;
|
[
"java.io",
"java.util"
] |
java.io; java.util;
| 1,912,083
|
@Override
public JsonObject deepCopy() {
JsonObject result = new JsonObject();
for (Map.Entry<String, JsonElement> entry : members.entrySet()) {
result.add(entry.getKey(), entry.getValue().deepCopy());
}
return result;
}
|
JsonObject function() { JsonObject result = new JsonObject(); for (Map.Entry<String, JsonElement> entry : members.entrySet()) { result.add(entry.getKey(), entry.getValue().deepCopy()); } return result; }
|
/**
* Creates a deep copy of this element and all its children
* @since 2.8.2
*/
|
Creates a deep copy of this element and all its children
|
deepCopy
|
{
"repo_name": "joseantonnio/gastock",
"path": "Gastock/src/com/google/gson/JsonObject.java",
"license": "unlicense",
"size": 6706
}
|
[
"java.util.Map"
] |
import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,780,975
|
private List<Set<String>> getInchiChunks(Set<String> inchis, Integer chunkSize) {
List<Set<String>> inchiChunks = new ArrayList<>();
Set<String> inchiChunk = new HashSet<>();
for (String inchi: inchis) {
inchiChunk.add(inchi);
if (inchiChunk.size() == chunkSize) {
inchiChunks.add(inchiChunk);
inchiChunk = new HashSet<>();
}
}
if (inchiChunk.size() > 0) {
inchiChunks.add(inchiChunk);
}
return inchiChunks;
}
|
List<Set<String>> function(Set<String> inchis, Integer chunkSize) { List<Set<String>> inchiChunks = new ArrayList<>(); Set<String> inchiChunk = new HashSet<>(); for (String inchi: inchis) { inchiChunk.add(inchi); if (inchiChunk.size() == chunkSize) { inchiChunks.add(inchiChunk); inchiChunk = new HashSet<>(); } } if (inchiChunk.size() > 0) { inchiChunks.add(inchiChunk); } return inchiChunks; }
|
/**
* Divide a large set of Strings into a list of smaller sets (chunks) of size `chunkSize`
* @param inchis set of String (possibly representing InChIs)
* @param chunkSize (Integer) the size of resulting chunks
* @return inchiChunks: a list of "chunks", smaller sets of strings
*/
|
Divide a large set of Strings into a list of smaller sets (chunks) of size `chunkSize`
|
getInchiChunks
|
{
"repo_name": "20n/act",
"path": "reachables/src/main/java/act/installer/bing/BingSearchRanker.java",
"license": "gpl-3.0",
"size": 23338
}
|
[
"java.util.ArrayList",
"java.util.HashSet",
"java.util.List",
"java.util.Set"
] |
import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,593,841
|
@Test
public void listAllWorkers() throws Exception{
String header = "Bearer "+token;
ResultActions result = sendListAllWorkersRequest(header);
result.andExpect(status().isOk());
MockHttpServletResponse mockResponse = result.andReturn().getResponse();
assertTrue(mockResponse.getContentAsString().equals(WORKERS_LIST));
}
|
void function() throws Exception{ String header = STR+token; ResultActions result = sendListAllWorkersRequest(header); result.andExpect(status().isOk()); MockHttpServletResponse mockResponse = result.andReturn().getResponse(); assertTrue(mockResponse.getContentAsString().equals(WORKERS_LIST)); }
|
/**
* Checks if the process to list all workers in the systemas
* works correctly.
*/
|
Checks if the process to list all workers in the systemas works correctly
|
listAllWorkers
|
{
"repo_name": "UNIZAR-30249-2016-SmartCampUZ/smartCampUZ",
"path": "src/test/java/es/unizar/smartcampuz/application/controller/AdminDashboardControllerTest.java",
"license": "mit",
"size": 19642
}
|
[
"org.junit.Assert",
"org.springframework.mock.web.MockHttpServletResponse",
"org.springframework.test.web.servlet.ResultActions"
] |
import org.junit.Assert; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.test.web.servlet.ResultActions;
|
import org.junit.*; import org.springframework.mock.web.*; import org.springframework.test.web.servlet.*;
|
[
"org.junit",
"org.springframework.mock",
"org.springframework.test"
] |
org.junit; org.springframework.mock; org.springframework.test;
| 1,721,783
|
EList<S_Assignment> getEquations();
|
EList<S_Assignment> getEquations();
|
/**
* Returns the value of the '<em><b>Equations</b></em>' containment reference list.
* The list contents are of type {@link msi.gama.lang.gaml.gaml.S_Assignment}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Equations</em>' containment reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Equations</em>' containment reference list.
* @see msi.gama.lang.gaml.gaml.GamlPackage#getS_Equations_Equations()
* @model containment="true"
* @generated
*/
|
Returns the value of the 'Equations' containment reference list. The list contents are of type <code>msi.gama.lang.gaml.gaml.S_Assignment</code>. If the meaning of the 'Equations' containment reference list isn't clear, there really should be more of a description here...
|
getEquations
|
{
"repo_name": "hqnghi88/gamaClone",
"path": "msi.gama.lang.gaml/src-gen/msi/gama/lang/gaml/gaml/S_Equations.java",
"license": "gpl-3.0",
"size": 1215
}
|
[
"org.eclipse.emf.common.util.EList"
] |
import org.eclipse.emf.common.util.EList;
|
import org.eclipse.emf.common.util.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 210,774
|
void onPlayerJoin(final Player player, final World world,
final long timeNow, final WorldDataManager worldDataManager,
final Collection<Class<? extends IDataOnJoin>> types) {
// Only update world if the data hasn't just been created.
updateCurrentWorld(world, worldDataManager);
invalidateOffline();
for (final Class<? extends IDataOnJoin> type : types) {
final IDataOnJoin instance = dataCache.get(type);
if (instance != null && instance.dataOnJoin(player, this)) {
dataCache.remove(type);
}
}
requestLazyPermissionUpdate(permissionRegistry.getPreferKeepUpdatedOffline());
lastJoinTime = timeNow;
}
|
void onPlayerJoin(final Player player, final World world, final long timeNow, final WorldDataManager worldDataManager, final Collection<Class<? extends IDataOnJoin>> types) { updateCurrentWorld(world, worldDataManager); invalidateOffline(); for (final Class<? extends IDataOnJoin> type : types) { final IDataOnJoin instance = dataCache.get(type); if (instance != null && instance.dataOnJoin(player, this)) { dataCache.remove(type); } } requestLazyPermissionUpdate(permissionRegistry.getPreferKeepUpdatedOffline()); lastJoinTime = timeNow; }
|
/**
* Early adaption on player join.
*
* @param world
* @param timeNow
* @param types
*/
|
Early adaption on player join
|
onPlayerJoin
|
{
"repo_name": "NoCheatPlus/NoCheatPlus",
"path": "NCPCore/src/main/java/fr/neatmonster/nocheatplus/players/PlayerData.java",
"license": "gpl-3.0",
"size": 36450
}
|
[
"fr.neatmonster.nocheatplus.components.data.IDataOnJoin",
"fr.neatmonster.nocheatplus.worlds.WorldDataManager",
"java.util.Collection",
"org.bukkit.World",
"org.bukkit.entity.Player"
] |
import fr.neatmonster.nocheatplus.components.data.IDataOnJoin; import fr.neatmonster.nocheatplus.worlds.WorldDataManager; import java.util.Collection; import org.bukkit.World; import org.bukkit.entity.Player;
|
import fr.neatmonster.nocheatplus.components.data.*; import fr.neatmonster.nocheatplus.worlds.*; import java.util.*; import org.bukkit.*; import org.bukkit.entity.*;
|
[
"fr.neatmonster.nocheatplus",
"java.util",
"org.bukkit",
"org.bukkit.entity"
] |
fr.neatmonster.nocheatplus; java.util; org.bukkit; org.bukkit.entity;
| 633,301
|
public SafeStringBuilder append(Date value) {
this.appendObjectWithDefault(value, this.dateDefault);
return this;
}
|
SafeStringBuilder function(Date value) { this.appendObjectWithDefault(value, this.dateDefault); return this; }
|
/**
* Appends a Date to the final string, using dateDefault if null
*
* @param value Date to be appended
* @return SafeStringBuilder for method chaining
*/
|
Appends a Date to the final string, using dateDefault if null
|
append
|
{
"repo_name": "lastfm/lastcommons-lang",
"path": "src/main/java/fm/last/commons/lang/string/SafeStringBuilder.java",
"license": "apache-2.0",
"size": 4859
}
|
[
"java.util.Date"
] |
import java.util.Date;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,734,330
|
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
// Type check the 'select' expression if present
if (_select != null) {
_type = _select.typeCheck(stable);
}
// Type check the element contents otherwise
else if (hasContents()) {
typeCheckContents(stable);
_type = Type.ResultTree;
}
else {
_type = Type.Reference;
}
// The return type is void as the variable element does not leave
// anything on the JVM's stack. The '_type' global will be returned
// by the references to this variable, and not by the variable itself.
return Type.Void;
}
|
Type function(SymbolTable stable) throws TypeCheckError { if (_select != null) { _type = _select.typeCheck(stable); } else if (hasContents()) { typeCheckContents(stable); _type = Type.ResultTree; } else { _type = Type.Reference; } return Type.Void; }
|
/**
* Runs a type check on either the variable element body or the
* expression in the 'select' attribute
*/
|
Runs a type check on either the variable element body or the expression in the 'select' attribute
|
typeCheck
|
{
"repo_name": "srnsw/xena",
"path": "xena/ext/src/xalan-j_2_7_1/src/org/apache/xalan/xsltc/compiler/Variable.java",
"license": "gpl-3.0",
"size": 7149
}
|
[
"org.apache.xalan.xsltc.compiler.util.Type",
"org.apache.xalan.xsltc.compiler.util.TypeCheckError"
] |
import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError;
|
import org.apache.xalan.xsltc.compiler.util.*;
|
[
"org.apache.xalan"
] |
org.apache.xalan;
| 1,131,716
|
@Test public void testParameterConvert() throws Exception {
final StringBuilder sql = new StringBuilder("select 1");
final Map<SqlType, Integer> map = Maps.newHashMap();
for (Map.Entry<Class, SqlType> entry : SqlType.getSetConversions()) {
final SqlType sqlType = entry.getValue();
switch (sqlType) {
case BIT:
case LONGVARCHAR:
case LONGVARBINARY:
case NCHAR:
case NVARCHAR:
case LONGNVARCHAR:
case BLOB:
case CLOB:
case NCLOB:
case ARRAY:
case REF:
case STRUCT:
case DATALINK:
case ROWID:
case JAVA_OBJECT:
case SQLXML:
continue;
}
if (!map.containsKey(sqlType)) {
sql.append(", cast(? as ").append(sqlType).append(")");
map.put(sqlType, map.size() + 1);
}
}
sql.append(" from (values 1)");
final PreparedStatement statement =
localConnection.prepareStatement(sql.toString());
for (Map.Entry<SqlType, Integer> entry : map.entrySet()) {
statement.setNull(entry.getValue(), entry.getKey().id);
}
for (Map.Entry<Class, SqlType> entry : SqlType.getSetConversions()) {
final SqlType sqlType = entry.getValue();
if (!map.containsKey(sqlType)) {
continue;
}
int param = map.get(sqlType);
Class clazz = entry.getKey();
for (Object sampleValue : values(sqlType.boxedClass())) {
switch (sqlType) {
case DATE:
case TIME:
case TIMESTAMP:
continue; // FIXME
}
if (clazz == Calendar.class) {
continue; // FIXME
}
final Object o;
try {
o = convert(sampleValue, clazz);
} catch (IllegalArgumentException | ParseException e) {
continue;
}
out.println("check " + o + " (originally "
+ sampleValue.getClass() + ", now " + o.getClass()
+ ") converted to " + sqlType);
if (o instanceof Double && o.equals(Double.POSITIVE_INFINITY)
|| o instanceof Float && o.equals(Float.POSITIVE_INFINITY)) {
continue;
}
statement.setObject(param, o, sqlType.id);
final ResultSet resultSet = statement.executeQuery();
assertThat(resultSet.next(), is(true));
out.println(resultSet.getString(param + 1));
}
}
statement.close();
}
|
@Test void function() throws Exception { final StringBuilder sql = new StringBuilder(STR); final Map<SqlType, Integer> map = Maps.newHashMap(); for (Map.Entry<Class, SqlType> entry : SqlType.getSetConversions()) { final SqlType sqlType = entry.getValue(); switch (sqlType) { case BIT: case LONGVARCHAR: case LONGVARBINARY: case NCHAR: case NVARCHAR: case LONGNVARCHAR: case BLOB: case CLOB: case NCLOB: case ARRAY: case REF: case STRUCT: case DATALINK: case ROWID: case JAVA_OBJECT: case SQLXML: continue; } if (!map.containsKey(sqlType)) { sql.append(STR).append(sqlType).append(")"); map.put(sqlType, map.size() + 1); } } sql.append(STR); final PreparedStatement statement = localConnection.prepareStatement(sql.toString()); for (Map.Entry<SqlType, Integer> entry : map.entrySet()) { statement.setNull(entry.getValue(), entry.getKey().id); } for (Map.Entry<Class, SqlType> entry : SqlType.getSetConversions()) { final SqlType sqlType = entry.getValue(); if (!map.containsKey(sqlType)) { continue; } int param = map.get(sqlType); Class clazz = entry.getKey(); for (Object sampleValue : values(sqlType.boxedClass())) { switch (sqlType) { case DATE: case TIME: case TIMESTAMP: continue; } if (clazz == Calendar.class) { continue; } final Object o; try { o = convert(sampleValue, clazz); } catch (IllegalArgumentException ParseException e) { continue; } out.println(STR + o + STR + sampleValue.getClass() + STR + o.getClass() + STR + sqlType); if (o instanceof Double && o.equals(Double.POSITIVE_INFINITY) o instanceof Float && o.equals(Float.POSITIVE_INFINITY)) { continue; } statement.setObject(param, o, sqlType.id); final ResultSet resultSet = statement.executeQuery(); assertThat(resultSet.next(), is(true)); out.println(resultSet.getString(param + 1)); } } statement.close(); }
|
/** For each (source, destination) type, make sure that we can convert bind
* variables. */
|
For each (source, destination) type, make sure that we can convert bind
|
testParameterConvert
|
{
"repo_name": "YrAuYong/incubator-calcite",
"path": "core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java",
"license": "apache-2.0",
"size": 23771
}
|
[
"com.google.common.collect.Maps",
"java.sql.PreparedStatement",
"java.sql.ResultSet",
"java.text.ParseException",
"java.util.Calendar",
"java.util.Map",
"org.apache.calcite.avatica.SqlType",
"org.hamcrest.CoreMatchers",
"org.junit.Assert",
"org.junit.Test"
] |
import com.google.common.collect.Maps; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.text.ParseException; import java.util.Calendar; import java.util.Map; import org.apache.calcite.avatica.SqlType; import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.junit.Test;
|
import com.google.common.collect.*; import java.sql.*; import java.text.*; import java.util.*; import org.apache.calcite.avatica.*; import org.hamcrest.*; import org.junit.*;
|
[
"com.google.common",
"java.sql",
"java.text",
"java.util",
"org.apache.calcite",
"org.hamcrest",
"org.junit"
] |
com.google.common; java.sql; java.text; java.util; org.apache.calcite; org.hamcrest; org.junit;
| 368,780
|
Builder setPrerequisites(OrderedSetMultimap<Attribute, ConfiguredTarget> prerequisiteMap) {
this.prerequisiteMap = Preconditions.checkNotNull(prerequisiteMap);
return this;
}
|
Builder setPrerequisites(OrderedSetMultimap<Attribute, ConfiguredTarget> prerequisiteMap) { this.prerequisiteMap = Preconditions.checkNotNull(prerequisiteMap); return this; }
|
/**
* Sets the prerequisites and checks their visibility. It also generates appropriate error or
* warning messages and sets the error flag as appropriate.
*/
|
Sets the prerequisites and checks their visibility. It also generates appropriate error or warning messages and sets the error flag as appropriate
|
setPrerequisites
|
{
"repo_name": "mrdomino/bazel",
"path": "src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java",
"license": "apache-2.0",
"size": 82752
}
|
[
"com.google.devtools.build.lib.packages.Attribute",
"com.google.devtools.build.lib.util.OrderedSetMultimap",
"com.google.devtools.build.lib.util.Preconditions"
] |
import com.google.devtools.build.lib.packages.Attribute; import com.google.devtools.build.lib.util.OrderedSetMultimap; import com.google.devtools.build.lib.util.Preconditions;
|
import com.google.devtools.build.lib.packages.*; import com.google.devtools.build.lib.util.*;
|
[
"com.google.devtools"
] |
com.google.devtools;
| 1,018,862
|
Collection<MPDSong> findGenre(String genre);
/**
* Returns a {@link org.bff.javampd.song.MPDSong} for the given album and artist
*
* @param name name of the {@link MPDSong}
* @param album name of the album
* @param artist name of the artist
* @return the {@link MPDSong or null if none found}
|
Collection<MPDSong> findGenre(String genre); /** * Returns a {@link org.bff.javampd.song.MPDSong} for the given album and artist * * @param name name of the {@link MPDSong} * @param album name of the album * @param artist name of the artist * @return the {@link MPDSong or null if none found}
|
/**
* Returns a {@link java.util.Collection} of {@link org.bff.javampd.song.MPDSong}s for a genre.
*
* @param genre the genre to find
* @return a {@link java.util.Collection} of {@link org.bff.javampd.song.MPDSong}s
*/
|
Returns a <code>java.util.Collection</code> of <code>org.bff.javampd.song.MPDSong</code>s for a genre
|
findGenre
|
{
"repo_name": "billf5293/javampd",
"path": "src/main/java/org/bff/javampd/song/SongDatabase.java",
"license": "gpl-2.0",
"size": 9895
}
|
[
"java.util.Collection"
] |
import java.util.Collection;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,797,665
|
protected boolean createNonCashEntry(GlInterfaceBatchProcessKemLine transactionArchive, PrintStream OUTPUT_KEM_TO_GL_DATA_FILE_ps, java.util.Date postedDate, GLInterfaceBatchStatisticsReportDetailTableRow statisticsDataRow) {
boolean success = true;
OriginEntryFull oef = createOriginEntryFull(transactionArchive, postedDate, statisticsDataRow);
BigDecimal transactionAmount = getTransactionAmount(transactionArchive);
try {
createOutputEntry(oef, OUTPUT_KEM_TO_GL_DATA_FILE_ps);
statisticsDataRow.increaseGLEntriesGeneratedCount();
updateTotalsProcessed(transactionArchive);
} catch (Exception ex) {
//write the error details to the exception report...
statisticsDataRow.increaseNumberOfExceptionsCount();
writeExceptionRecord(transactionArchive, ex.getMessage());
return false;
}
//create the offset or (loss/gain entry for EAD) document types where subtype is Non-Cash
if (!EndowConstants.DocumentTypeNames.ENDOWMENT_CORPORATE_REORGANZATION.equalsIgnoreCase(transactionArchive.getTypeCode())) {
success = createOffsetEntry(oef, transactionArchive, OUTPUT_KEM_TO_GL_DATA_FILE_ps, statisticsDataRow);
}
return success;
}
|
boolean function(GlInterfaceBatchProcessKemLine transactionArchive, PrintStream OUTPUT_KEM_TO_GL_DATA_FILE_ps, java.util.Date postedDate, GLInterfaceBatchStatisticsReportDetailTableRow statisticsDataRow) { boolean success = true; OriginEntryFull oef = createOriginEntryFull(transactionArchive, postedDate, statisticsDataRow); BigDecimal transactionAmount = getTransactionAmount(transactionArchive); try { createOutputEntry(oef, OUTPUT_KEM_TO_GL_DATA_FILE_ps); statisticsDataRow.increaseGLEntriesGeneratedCount(); updateTotalsProcessed(transactionArchive); } catch (Exception ex) { statisticsDataRow.increaseNumberOfExceptionsCount(); writeExceptionRecord(transactionArchive, ex.getMessage()); return false; } if (!EndowConstants.DocumentTypeNames.ENDOWMENT_CORPORATE_REORGANZATION.equalsIgnoreCase(transactionArchive.getTypeCode())) { success = createOffsetEntry(oef, transactionArchive, OUTPUT_KEM_TO_GL_DATA_FILE_ps, statisticsDataRow); } return success; }
|
/**
* method to create non-cash entry GL record
* @param transactionArchive,OUTPUT_KEM_TO_GL_DATA_FILE_ps, postedDate
* @return true if successful, else false
*/
|
method to create non-cash entry GL record
|
createNonCashEntry
|
{
"repo_name": "Ariah-Group/Finance",
"path": "af_webapp/src/main/java/org/kuali/kfs/module/endow/batch/service/impl/GeneralLedgerInterfaceBatchProcessServiceImpl.java",
"license": "apache-2.0",
"size": 58405
}
|
[
"java.io.PrintStream",
"java.math.BigDecimal",
"org.kuali.kfs.gl.businessobject.OriginEntryFull",
"org.kuali.kfs.module.endow.EndowConstants",
"org.kuali.kfs.module.endow.businessobject.GLInterfaceBatchStatisticsReportDetailTableRow",
"org.kuali.kfs.module.endow.businessobject.GlInterfaceBatchProcessKemLine"
] |
import java.io.PrintStream; import java.math.BigDecimal; import org.kuali.kfs.gl.businessobject.OriginEntryFull; import org.kuali.kfs.module.endow.EndowConstants; import org.kuali.kfs.module.endow.businessobject.GLInterfaceBatchStatisticsReportDetailTableRow; import org.kuali.kfs.module.endow.businessobject.GlInterfaceBatchProcessKemLine;
|
import java.io.*; import java.math.*; import org.kuali.kfs.gl.businessobject.*; import org.kuali.kfs.module.endow.*; import org.kuali.kfs.module.endow.businessobject.*;
|
[
"java.io",
"java.math",
"org.kuali.kfs"
] |
java.io; java.math; org.kuali.kfs;
| 388,736
|
public Dialog getJoinDialog(JoinHeader joinHeader);
|
Dialog function(JoinHeader joinHeader);
|
/**
* Get the dialog in the Join header.
*
* @return Dialog object matching the Join header, provided it is in an appropriate state to
* be replaced, <code>null</code> otherwise
*
* @since 2.0
*/
|
Get the dialog in the Join header
|
getJoinDialog
|
{
"repo_name": "fhg-fokus-nubomedia/signaling-plane",
"path": "modules/lib-sip/src/main/java/gov/nist/javax/sip/SipStackExt.java",
"license": "apache-2.0",
"size": 6103
}
|
[
"gov.nist.javax.sip.header.extensions.JoinHeader",
"javax.sip.Dialog"
] |
import gov.nist.javax.sip.header.extensions.JoinHeader; import javax.sip.Dialog;
|
import gov.nist.javax.sip.header.extensions.*; import javax.sip.*;
|
[
"gov.nist.javax",
"javax.sip"
] |
gov.nist.javax; javax.sip;
| 1,461,451
|
private String getSplitPath(String relPath) {
Volume defaultVolume = master.getFileSystem().getDefaultVolume();
String uri = defaultVolume.getFileSystem().getUri().toString();
String basePath = defaultVolume.getBasePath();
return uri + basePath + relPath;
}
|
String function(String relPath) { Volume defaultVolume = master.getFileSystem().getDefaultVolume(); String uri = defaultVolume.getFileSystem().getUri().toString(); String basePath = defaultVolume.getBasePath(); return uri + basePath + relPath; }
|
/**
* Get full path to location where initial splits are stored on file system.
*/
|
Get full path to location where initial splits are stored on file system
|
getSplitPath
|
{
"repo_name": "keith-turner/accumulo",
"path": "server/master/src/main/java/org/apache/accumulo/master/FateServiceHandler.java",
"license": "apache-2.0",
"size": 36073
}
|
[
"org.apache.accumulo.core.volume.Volume"
] |
import org.apache.accumulo.core.volume.Volume;
|
import org.apache.accumulo.core.volume.*;
|
[
"org.apache.accumulo"
] |
org.apache.accumulo;
| 1,837,690
|
BigDecimal getThreshold();
|
BigDecimal getThreshold();
|
/**
* Returns the value of the '<em><b>Threshold</b></em>' attribute.
* The default value is <code>"0"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Threshold</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Threshold</em>' attribute.
* @see #setThreshold(BigDecimal)
* @see org.openhab.binding.tinkerforge.internal.model.ModelPackage#getLaserRangeFinderDistance_Threshold()
* @model default="0" unique="false"
* @generated
*/
|
Returns the value of the 'Threshold' attribute. The default value is <code>"0"</code>. If the meaning of the 'Threshold' attribute isn't clear, there really should be more of a description here...
|
getThreshold
|
{
"repo_name": "cschneider/openhab",
"path": "bundles/binding/org.openhab.binding.tinkerforge/src/main/java/org/openhab/binding/tinkerforge/internal/model/LaserRangeFinderDistance.java",
"license": "epl-1.0",
"size": 3005
}
|
[
"java.math.BigDecimal"
] |
import java.math.BigDecimal;
|
import java.math.*;
|
[
"java.math"
] |
java.math;
| 1,222,773
|
public Properties getProperties(String usage) {
return properties.get(usage);
}
|
Properties function(String usage) { return properties.get(usage); }
|
/**
* Return properties that apply to the indicated usage in this context.
*
* @param usage is the usage for the properties
* @return the properties
*/
|
Return properties that apply to the indicated usage in this context
|
getProperties
|
{
"repo_name": "rdesantis/hauldata",
"path": "dbpa/src/main/java/com/hauldata/dbpa/process/ContextProperties.java",
"license": "apache-2.0",
"size": 7175
}
|
[
"java.util.Properties"
] |
import java.util.Properties;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 947,250
|
public static KeyInfoCredentialResolver buildBasicInlineKeyInfoResolver() {
List<KeyInfoProvider> providers = new ArrayList<KeyInfoProvider>();
providers.add( new RSAKeyValueProvider() );
providers.add( new DSAKeyValueProvider() );
providers.add( new InlineX509DataProvider() );
return new BasicProviderKeyInfoCredentialResolver(providers);
}
static {
// We use some Apache XML Security utility functions, so need to make sure library
// is initialized.
if (!Init.isInitialized()) {
Init.init();
}
}
|
static KeyInfoCredentialResolver function() { List<KeyInfoProvider> providers = new ArrayList<KeyInfoProvider>(); providers.add( new RSAKeyValueProvider() ); providers.add( new DSAKeyValueProvider() ); providers.add( new InlineX509DataProvider() ); return new BasicProviderKeyInfoCredentialResolver(providers); } static { if (!Init.isInitialized()) { Init.init(); } }
|
/**
* Get a basic KeyInfo credential resolver which can process standard inline
* data - RSAKeyValue, DSAKeyValue, X509Data.
*
* @return a new KeyInfoCredentialResolver instance
*/
|
Get a basic KeyInfo credential resolver which can process standard inline data - RSAKeyValue, DSAKeyValue, X509Data
|
buildBasicInlineKeyInfoResolver
|
{
"repo_name": "duck1123/java-xmltooling",
"path": "src/main/java/org/opensaml/xml/security/SecurityTestHelper.java",
"license": "apache-2.0",
"size": 13458
}
|
[
"java.util.ArrayList",
"java.util.List",
"org.apache.xml.security.Init",
"org.opensaml.xml.security.keyinfo.BasicProviderKeyInfoCredentialResolver",
"org.opensaml.xml.security.keyinfo.KeyInfoCredentialResolver",
"org.opensaml.xml.security.keyinfo.KeyInfoProvider",
"org.opensaml.xml.security.keyinfo.provider.DSAKeyValueProvider",
"org.opensaml.xml.security.keyinfo.provider.InlineX509DataProvider",
"org.opensaml.xml.security.keyinfo.provider.RSAKeyValueProvider"
] |
import java.util.ArrayList; import java.util.List; import org.apache.xml.security.Init; import org.opensaml.xml.security.keyinfo.BasicProviderKeyInfoCredentialResolver; import org.opensaml.xml.security.keyinfo.KeyInfoCredentialResolver; import org.opensaml.xml.security.keyinfo.KeyInfoProvider; import org.opensaml.xml.security.keyinfo.provider.DSAKeyValueProvider; import org.opensaml.xml.security.keyinfo.provider.InlineX509DataProvider; import org.opensaml.xml.security.keyinfo.provider.RSAKeyValueProvider;
|
import java.util.*; import org.apache.xml.security.*; import org.opensaml.xml.security.keyinfo.*; import org.opensaml.xml.security.keyinfo.provider.*;
|
[
"java.util",
"org.apache.xml",
"org.opensaml.xml"
] |
java.util; org.apache.xml; org.opensaml.xml;
| 1,066,211
|
public void setBpm(long newBpmRate)
{
// cleanup from last updates
updateTimer.cancel();
btnBpm.setChecked(false);
setAllMetronomeSegments(false);
// set new BPM values
btnBpm.setText(String.valueOf(newBpmRate));
btnBpm.setTextOn(String.valueOf(newBpmRate));
btnBpm.setTextOff(String.valueOf(newBpmRate));
if (newBpmRate > 0)
{
updateTimer = new Timer();
updateTimer.schedule(new BpmUpdateTask(), 0, 60000 / 2 / newBpmRate);
}
}
|
void function(long newBpmRate) { updateTimer.cancel(); btnBpm.setChecked(false); setAllMetronomeSegments(false); btnBpm.setText(String.valueOf(newBpmRate)); btnBpm.setTextOn(String.valueOf(newBpmRate)); btnBpm.setTextOff(String.valueOf(newBpmRate)); if (newBpmRate > 0) { updateTimer = new Timer(); updateTimer.schedule(new BpmUpdateTask(), 0, 60000 / 2 / newBpmRate); } }
|
/**
* Set BPM rate for display toggle
*
* @param newBpmRate new BPM rate
*/
|
Set BPM rate for display toggle
|
setBpm
|
{
"repo_name": "fr3ts0n/StageFever",
"path": "app/src/main/java/com/fr3ts0n/stagefever/SongItemFragment.java",
"license": "gpl-3.0",
"size": 7629
}
|
[
"java.util.Timer"
] |
import java.util.Timer;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,497,716
|
private void setUpListeners() {
getServer().getPluginManager().registerEvents(new DispenserListener(),
this);
getServer().getPluginManager().registerEvents(new BlockPlaceListener(),
this);
getServer().getPluginManager()
.registerEvents(new LoginListener(), this);
getServer().getPluginManager().registerEvents(new SpawnEggListener(),
this);
getServer().getPluginManager().registerEvents(
new EntitySpawnListener(), this);
getServer().getPluginManager().registerEvents(new TargetListener(),
this);
getServer().getPluginManager().registerEvents(new ExplosionListener(),
this);
getServer().getPluginManager()
.registerEvents(new ThrowListener(), this);
getServer().getPluginManager().registerEvents(new ExpListener(), this);
getServer().getPluginManager().registerEvents(
new EnchantmentListener(), this);
getServer().getPluginManager().registerEvents(new EntitiesListener(),
this);
getServer().getPluginManager().registerEvents(new DropManager(), this);
}
|
void function() { getServer().getPluginManager().registerEvents(new DispenserListener(), this); getServer().getPluginManager().registerEvents(new BlockPlaceListener(), this); getServer().getPluginManager() .registerEvents(new LoginListener(), this); getServer().getPluginManager().registerEvents(new SpawnEggListener(), this); getServer().getPluginManager().registerEvents( new EntitySpawnListener(), this); getServer().getPluginManager().registerEvents(new TargetListener(), this); getServer().getPluginManager().registerEvents(new ExplosionListener(), this); getServer().getPluginManager() .registerEvents(new ThrowListener(), this); getServer().getPluginManager().registerEvents(new ExpListener(), this); getServer().getPluginManager().registerEvents( new EnchantmentListener(), this); getServer().getPluginManager().registerEvents(new EntitiesListener(), this); getServer().getPluginManager().registerEvents(new DropManager(), this); }
|
/**
* Sets the up listeners.
*/
|
Sets the up listeners
|
setUpListeners
|
{
"repo_name": "Mitsugaru/EntityManager",
"path": "src/net/milkycraft/EntityManager.java",
"license": "isc",
"size": 11524
}
|
[
"net.milkycraft.api.DropManager",
"net.milkycraft.listeners.BlockPlaceListener",
"net.milkycraft.listeners.DispenserListener",
"net.milkycraft.listeners.EnchantmentListener",
"net.milkycraft.listeners.EntitiesListener",
"net.milkycraft.listeners.EntitySpawnListener",
"net.milkycraft.listeners.ExpListener",
"net.milkycraft.listeners.ExplosionListener",
"net.milkycraft.listeners.LoginListener",
"net.milkycraft.listeners.SpawnEggListener",
"net.milkycraft.listeners.TargetListener",
"net.milkycraft.listeners.ThrowListener"
] |
import net.milkycraft.api.DropManager; import net.milkycraft.listeners.BlockPlaceListener; import net.milkycraft.listeners.DispenserListener; import net.milkycraft.listeners.EnchantmentListener; import net.milkycraft.listeners.EntitiesListener; import net.milkycraft.listeners.EntitySpawnListener; import net.milkycraft.listeners.ExpListener; import net.milkycraft.listeners.ExplosionListener; import net.milkycraft.listeners.LoginListener; import net.milkycraft.listeners.SpawnEggListener; import net.milkycraft.listeners.TargetListener; import net.milkycraft.listeners.ThrowListener;
|
import net.milkycraft.api.*; import net.milkycraft.listeners.*;
|
[
"net.milkycraft.api",
"net.milkycraft.listeners"
] |
net.milkycraft.api; net.milkycraft.listeners;
| 2,107,615
|
public static GlyphList getZapfDingbats()
{
return ZAPF_DINGBATS;
}
// read-only mappings, never modified outside GlyphList's constructor
private final Map<String, String> nameToUnicode;
private final Map<String, String> unicodeToName;
// additional read/write cache for uniXXXX names
private final Map<String, String> uniNameToUnicodeCache = new ConcurrentHashMap<>();
public GlyphList(InputStream input, int numberOfEntries) throws IOException
{
nameToUnicode = new HashMap<>(numberOfEntries);
unicodeToName = new HashMap<>(numberOfEntries);
loadList(input);
}
public GlyphList(GlyphList glyphList, InputStream input) throws IOException
{
nameToUnicode = new HashMap<>(glyphList.nameToUnicode);
unicodeToName = new HashMap<>(glyphList.unicodeToName);
loadList(input);
}
|
static GlyphList function() { return ZAPF_DINGBATS; } private final Map<String, String> nameToUnicode; private final Map<String, String> unicodeToName; private final Map<String, String> uniNameToUnicodeCache = new ConcurrentHashMap<>(); public GlyphList(InputStream input, int numberOfEntries) throws IOException { nameToUnicode = new HashMap<>(numberOfEntries); unicodeToName = new HashMap<>(numberOfEntries); loadList(input); } public GlyphList(GlyphList glyphList, InputStream input) throws IOException { nameToUnicode = new HashMap<>(glyphList.nameToUnicode); unicodeToName = new HashMap<>(glyphList.unicodeToName); loadList(input); }
|
/**
* Returns the Zapf Dingbats glyph list.
*/
|
Returns the Zapf Dingbats glyph list
|
getZapfDingbats
|
{
"repo_name": "kalaspuffar/pdfbox",
"path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/GlyphList.java",
"license": "apache-2.0",
"size": 10333
}
|
[
"java.io.IOException",
"java.io.InputStream",
"java.util.HashMap",
"java.util.Map",
"java.util.concurrent.ConcurrentHashMap"
] |
import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap;
|
import java.io.*; import java.util.*; import java.util.concurrent.*;
|
[
"java.io",
"java.util"
] |
java.io; java.util;
| 1,584,600
|
@Override
public Logger getParentLogger() {
return super.getLogger();
}
|
Logger function() { return super.getLogger(); }
|
/**
* The logger used by this driver.
*/
|
The logger used by this driver
|
getParentLogger
|
{
"repo_name": "desruisseaux/sis",
"path": "storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java",
"license": "apache-2.0",
"size": 4536
}
|
[
"java.util.logging.Logger"
] |
import java.util.logging.Logger;
|
import java.util.logging.*;
|
[
"java.util"
] |
java.util;
| 995,433
|
@Test
public void testJavaFileUsing15() {
LanguageVersionDiscoverer discoverer = new LanguageVersionDiscoverer();
discoverer.setDefaultLanguageVersion(LanguageVersion.JAVA_14);
File javaFile = new File("/path/to/MyClass.java");
LanguageVersion languageVersion = discoverer.getDefaultLanguageVersionForFile(javaFile);
assertEquals("LanguageVersion must be Java 1.4!", LanguageVersion.JAVA_14, languageVersion);
}
|
void function() { LanguageVersionDiscoverer discoverer = new LanguageVersionDiscoverer(); discoverer.setDefaultLanguageVersion(LanguageVersion.JAVA_14); File javaFile = new File(STR); LanguageVersion languageVersion = discoverer.getDefaultLanguageVersionForFile(javaFile); assertEquals(STR, LanguageVersion.JAVA_14, languageVersion); }
|
/**
* Test on Java file with Java version set to 1.4.
*/
|
Test on Java file with Java version set to 1.4
|
testJavaFileUsing15
|
{
"repo_name": "daejunpark/jsaf",
"path": "third_party/pmd/src/test/java/net/sourceforge/pmd/LanguageVersionDiscovererTest.java",
"license": "bsd-3-clause",
"size": 1921
}
|
[
"java.io.File",
"net.sourceforge.pmd.lang.LanguageVersion",
"net.sourceforge.pmd.lang.LanguageVersionDiscoverer",
"org.junit.Assert"
] |
import java.io.File; import net.sourceforge.pmd.lang.LanguageVersion; import net.sourceforge.pmd.lang.LanguageVersionDiscoverer; import org.junit.Assert;
|
import java.io.*; import net.sourceforge.pmd.lang.*; import org.junit.*;
|
[
"java.io",
"net.sourceforge.pmd",
"org.junit"
] |
java.io; net.sourceforge.pmd; org.junit;
| 193,917
|
public List<EntityHeader> getEntityHeader(UserInfo userInfo, List<Reference> references) throws NotFoundException, DatastoreException, UnauthorizedException;
|
List<EntityHeader> function(UserInfo userInfo, List<Reference> references) throws NotFoundException, DatastoreException, UnauthorizedException;
|
/**
* Get an entity header for each reference.
*
* @param userInfo
* @param references
* @return
* @throws NotFoundException
* @throws DatastoreException
* @throws UnauthorizedException
*/
|
Get an entity header for each reference
|
getEntityHeader
|
{
"repo_name": "hhu94/Synapse-Repository-Services",
"path": "services/repository-managers/src/main/java/org/sagebionetworks/repo/manager/EntityManager.java",
"license": "apache-2.0",
"size": 15103
}
|
[
"java.util.List",
"org.sagebionetworks.repo.model.DatastoreException",
"org.sagebionetworks.repo.model.EntityHeader",
"org.sagebionetworks.repo.model.Reference",
"org.sagebionetworks.repo.model.UnauthorizedException",
"org.sagebionetworks.repo.model.UserInfo",
"org.sagebionetworks.repo.web.NotFoundException"
] |
import java.util.List; import org.sagebionetworks.repo.model.DatastoreException; import org.sagebionetworks.repo.model.EntityHeader; import org.sagebionetworks.repo.model.Reference; import org.sagebionetworks.repo.model.UnauthorizedException; import org.sagebionetworks.repo.model.UserInfo; import org.sagebionetworks.repo.web.NotFoundException;
|
import java.util.*; import org.sagebionetworks.repo.model.*; import org.sagebionetworks.repo.web.*;
|
[
"java.util",
"org.sagebionetworks.repo"
] |
java.util; org.sagebionetworks.repo;
| 1,792,620
|
public void open() {
try {
mailTransport.connect();
} catch (MessagingException msex) {
throw new MailException("Failed to connect", msex);
}
}
|
void function() { try { mailTransport.connect(); } catch (MessagingException msex) { throw new MailException(STR, msex); } }
|
/**
* Opens mail session.
*/
|
Opens mail session
|
open
|
{
"repo_name": "wsldl123292/jodd",
"path": "jodd-mail/src/main/java/jodd/mail/SendMailSession.java",
"license": "bsd-3-clause",
"size": 7743
}
|
[
"javax.mail.MessagingException"
] |
import javax.mail.MessagingException;
|
import javax.mail.*;
|
[
"javax.mail"
] |
javax.mail;
| 1,016,930
|
public DeliverDetail[] getUserDeliverDetails(UserID userID,String semester,String subject,int activityIndex) throws ExecPelpException,InvalidEngineException,AuthorizationException;
|
DeliverDetail[] function(UserID userID,String semester,String subject,int activityIndex) throws ExecPelpException,InvalidEngineException,AuthorizationException;
|
/**
* Get a detailed information for all delivers from a given user to given activity
* @param userID User identifier
* @param semester Semester code
* @param subject Subject code
* @param activityIndex Activity Index
* @return Array of Object with summary information of the delivers
* @throws ExecPelpException if some error accurs during process execution
* @throws InvalidEngineException if the engine is not properly initialized
* @throws AuthorizationException if user is not a teacher of this classroom
*/
|
Get a detailed information for all delivers from a given user to given activity
|
getUserDeliverDetails
|
{
"repo_name": "UOC/PeLP",
"path": "src/main/java/edu/uoc/pelp/bussines/UOC/UOCPelpBussines.java",
"license": "gpl-3.0",
"size": 21812
}
|
[
"edu.uoc.pelp.bussines.exception.AuthorizationException",
"edu.uoc.pelp.bussines.exception.InvalidEngineException",
"edu.uoc.pelp.bussines.vo.DeliverDetail",
"edu.uoc.pelp.engine.campus.UOC",
"edu.uoc.pelp.exception.ExecPelpException"
] |
import edu.uoc.pelp.bussines.exception.AuthorizationException; import edu.uoc.pelp.bussines.exception.InvalidEngineException; import edu.uoc.pelp.bussines.vo.DeliverDetail; import edu.uoc.pelp.engine.campus.UOC; import edu.uoc.pelp.exception.ExecPelpException;
|
import edu.uoc.pelp.bussines.exception.*; import edu.uoc.pelp.bussines.vo.*; import edu.uoc.pelp.engine.campus.*; import edu.uoc.pelp.exception.*;
|
[
"edu.uoc.pelp"
] |
edu.uoc.pelp;
| 2,011,136
|
public void readCompleteChangeSet(java.io.ObjectInputStream stream) throws java.io.IOException, ClassNotFoundException {
readIdentityInformation(stream);
// bug 3526981 - avoid side effects of setter methods by directly assigning variables
// still calling setOldKey to avoid duplicating the code in that method
this.changes = (List)stream.readObject();
this.oldKey = stream.readObject();
this.newKey = stream.readObject();
this.protectedForeignKeys = (AbstractRecord)stream.readObject();
}
|
void function(java.io.ObjectInputStream stream) throws java.io.IOException, ClassNotFoundException { readIdentityInformation(stream); this.changes = (List)stream.readObject(); this.oldKey = stream.readObject(); this.newKey = stream.readObject(); this.protectedForeignKeys = (AbstractRecord)stream.readObject(); }
|
/**
* INTERNAL:
* Helper method used by readObject to read a completely serialized change set from
* the stream.
*/
|
Helper method used by readObject to read a completely serialized change set from the stream
|
readCompleteChangeSet
|
{
"repo_name": "RallySoftware/eclipselink.runtime",
"path": "foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/ObjectChangeSet.java",
"license": "epl-1.0",
"size": 56003
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,189,223
|
@SuppressWarnings("deprecation")
public void sendTo(Location center, double range)
throws IllegalArgumentException {
if (range < 1) {
throw new IllegalArgumentException("The range is lower than 1");
}
String worldName = center.getWorld().getName();
double squared = range * range;
for (Player player : Bukkit.getOnlinePlayers()) {
if (!player.getWorld().getName().equals(worldName) || player.getLocation().distanceSquared(center) > squared) {
continue;
}
sendTo(center, player);
}
}
private static final class VersionIncompatibleException extends RuntimeException {
private static final long serialVersionUID = 3203085387160737484L;
public VersionIncompatibleException(String message, Throwable cause) {
super(message, cause);
}
}
private static final class PacketInstantiationException extends RuntimeException {
private static final long serialVersionUID = 3203085387160737484L;
public PacketInstantiationException(String message, Throwable cause) {
super(message, cause);
}
}
private static final class PacketSendingException extends RuntimeException {
private static final long serialVersionUID = 3203085387160737484L;
public PacketSendingException(String message, Throwable cause) {
super(message, cause);
}
}
}
|
@SuppressWarnings(STR) void function(Location center, double range) throws IllegalArgumentException { if (range < 1) { throw new IllegalArgumentException(STR); } String worldName = center.getWorld().getName(); double squared = range * range; for (Player player : Bukkit.getOnlinePlayers()) { if (!player.getWorld().getName().equals(worldName) player.getLocation().distanceSquared(center) > squared) { continue; } sendTo(center, player); } } private static final class VersionIncompatibleException extends RuntimeException { private static final long serialVersionUID = 3203085387160737484L; public VersionIncompatibleException(String message, Throwable cause) { super(message, cause); } } private static final class PacketInstantiationException extends RuntimeException { private static final long serialVersionUID = 3203085387160737484L; public PacketInstantiationException(String message, Throwable cause) { super(message, cause); } } private static final class PacketSendingException extends RuntimeException { private static final long serialVersionUID = 3203085387160737484L; public PacketSendingException(String message, Throwable cause) { super(message, cause); } } }
|
/**
* Sends the packet to all players in a certain range
*
* @param center Center location of the effect
* @param range Range in which players will receive the packet (Maximum range for particles is usually 16, but it can differ for some types)
* @throws IllegalArgumentException If the range is lower than 1
* @see #sendTo(Location center, Player player)
*/
|
Sends the packet to all players in a certain range
|
sendTo
|
{
"repo_name": "CHollasch/ParticleLib",
"path": "src/main/java/me/imodzombies4fun/particle/lib/view/ParticleEngine.java",
"license": "gpl-2.0",
"size": 57785
}
|
[
"org.bukkit.Bukkit",
"org.bukkit.Location",
"org.bukkit.entity.Player"
] |
import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player;
|
import org.bukkit.*; import org.bukkit.entity.*;
|
[
"org.bukkit",
"org.bukkit.entity"
] |
org.bukkit; org.bukkit.entity;
| 2,699,147
|
try {
for (IFilter f : Global.getSingleton().getGlobalRequestFilterList()) {// request
// 请求全局过滤
if (context.getExecFilter() == ExecFilterType.All || context.getExecFilter() == ExecFilterType.RequestOnly) {
f.filter(context);
}
}
if (context.isDoInvoke()) {// 调用真实服务
doInvoke(context);
}
logger.debug("begin response filter");
// response filter
for (IFilter f : Global.getSingleton().getGlobalResponseFilterList()) {// Response
// 响应全局过滤
if (context.getExecFilter() == ExecFilterType.All || context.getExecFilter() == ExecFilterType.ResponseOnly) {
f.filter(context);
}
}
context.getServerHandler().writeResponse(context);
} catch (Exception ex) {
context.setError(ex);
context.getServerHandler().writeResponse(context);
logger.error("in async messageReceived", ex);
// MonitorErrorLog.sendError("in async messageReceived");//消息发送到监测者
}
}
|
try { for (IFilter f : Global.getSingleton().getGlobalRequestFilterList()) { if (context.getExecFilter() == ExecFilterType.All context.getExecFilter() == ExecFilterType.RequestOnly) { f.filter(context); } } if (context.isDoInvoke()) { doInvoke(context); } logger.debug(STR); for (IFilter f : Global.getSingleton().getGlobalResponseFilterList()) { if (context.getExecFilter() == ExecFilterType.All context.getExecFilter() == ExecFilterType.ResponseOnly) { f.filter(context); } } context.getServerHandler().writeResponse(context); } catch (Exception ex) { context.setError(ex); context.getServerHandler().writeResponse(context); logger.error(STR, ex); } }
|
/**
* create protocol and invoke service proxy
*/
|
create protocol and invoke service proxy
|
invoke
|
{
"repo_name": "liyzhou/iscoder.rpc",
"path": "scf-server/src/main/java/com/github/leeyazhou/scf/server/core/handler/sync/SyncHandler.java",
"license": "apache-2.0",
"size": 1949
}
|
[
"com.github.leeyazhou.scf.server.contract.context.ExecFilterType",
"com.github.leeyazhou.scf.server.contract.context.Global",
"com.github.leeyazhou.scf.server.filter.IFilter"
] |
import com.github.leeyazhou.scf.server.contract.context.ExecFilterType; import com.github.leeyazhou.scf.server.contract.context.Global; import com.github.leeyazhou.scf.server.filter.IFilter;
|
import com.github.leeyazhou.scf.server.contract.context.*; import com.github.leeyazhou.scf.server.filter.*;
|
[
"com.github.leeyazhou"
] |
com.github.leeyazhou;
| 134,028
|
public void correctPathSeparators() {
resultDir = LpeStringUtils.correctFileSeparator(resultDir);
if (resultDir.endsWith(System.getProperty("file.separator"))) {
resultDir = resultDir.substring(0, resultDir.length() - 1);
}
analysisPath = LpeStringUtils.correctFileSeparator(analysisPath);
}
|
void function() { resultDir = LpeStringUtils.correctFileSeparator(resultDir); if (resultDir.endsWith(System.getProperty(STR))) { resultDir = resultDir.substring(0, resultDir.length() - 1); } analysisPath = LpeStringUtils.correctFileSeparator(analysisPath); }
|
/**
* corrects all paths to OS specific representation.
*/
|
corrects all paths to OS specific representation
|
correctPathSeparators
|
{
"repo_name": "sopeco/LPE-Common",
"path": "org.lpe.common.loadgenerator/src/org/lpe/common/loadgenerator/config/LGMeasurementConfig.java",
"license": "apache-2.0",
"size": 2739
}
|
[
"org.lpe.common.util.LpeStringUtils"
] |
import org.lpe.common.util.LpeStringUtils;
|
import org.lpe.common.util.*;
|
[
"org.lpe.common"
] |
org.lpe.common;
| 2,383,428
|
public void processRecord(ARCRecord record, OutputStream os) {
}
|
void function(ARCRecord record, OutputStream os) { }
|
/**
* Does nothing.
*/
|
Does nothing
|
processRecord
|
{
"repo_name": "netarchivesuite/netarchivesuite-svngit-migration",
"path": "tests/dk/netarkivet/common/utils/arc/ARCBatchJobTester.java",
"license": "lgpl-2.1",
"size": 12486
}
|
[
"java.io.OutputStream",
"org.archive.io.arc.ARCRecord"
] |
import java.io.OutputStream; import org.archive.io.arc.ARCRecord;
|
import java.io.*; import org.archive.io.arc.*;
|
[
"java.io",
"org.archive.io"
] |
java.io; org.archive.io;
| 16,510
|
@Test
public void testMultiAppend2() throws Exception {
Configuration conf = new HdfsConfiguration();
conf.set("dfs.client.block.write.replace-datanode-on-failure.enable",
"false");
MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(3)
.build();
DistributedFileSystem fs = null;
final String hello = "hello\n";
try {
fs = cluster.getFileSystem();
Path path = new Path("/test");
FSDataOutputStream out = fs.create(path);
out.writeBytes(hello);
out.close();
// stop one datanode
DataNodeProperties dnProp = cluster.stopDataNode(0);
String dnAddress = dnProp.datanode.getXferAddress().toString();
if (dnAddress.startsWith("/")) {
dnAddress = dnAddress.substring(1);
}
// append again to bump genstamps
for (int i = 0; i < 2; i++) {
out = fs.append(path,
EnumSet.of(CreateFlag.APPEND, CreateFlag.NEW_BLOCK), 4096, null);
out.writeBytes(hello);
out.close();
}
// re-open and make the block state as underconstruction
out = fs.append(path, EnumSet.of(CreateFlag.APPEND, CreateFlag.NEW_BLOCK),
4096, null);
cluster.restartDataNode(dnProp, true);
// wait till the block report comes
Thread.sleep(2000);
out.writeBytes(hello);
out.close();
// check the block locations
LocatedBlocks blocks = fs.getClient().getLocatedBlocks(path.toString(), 0L);
// since we append the file 3 time, we should be 4 blocks
assertEquals(4, blocks.getLocatedBlocks().size());
for (LocatedBlock block : blocks.getLocatedBlocks()) {
assertEquals(hello.length(), block.getBlockSize());
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 4; i++) {
sb.append(hello);
}
final byte[] content = sb.toString().getBytes();
AppendTestUtil.checkFullFile(fs, path, content.length, content,
"Read /test");
// restart namenode to make sure the editlog can be properly applied
cluster.restartNameNode(true);
cluster.waitActive();
AppendTestUtil.checkFullFile(fs, path, content.length, content,
"Read /test");
blocks = fs.getClient().getLocatedBlocks(path.toString(), 0L);
// since we append the file 3 time, we should be 4 blocks
assertEquals(4, blocks.getLocatedBlocks().size());
for (LocatedBlock block : blocks.getLocatedBlocks()) {
assertEquals(hello.length(), block.getBlockSize());
}
} finally {
IOUtils.closeStream(fs);
cluster.shutdown();
}
}
|
void function() throws Exception { Configuration conf = new HdfsConfiguration(); conf.set(STR, "false"); MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(3) .build(); DistributedFileSystem fs = null; final String hello = STR; try { fs = cluster.getFileSystem(); Path path = new Path("/test"); FSDataOutputStream out = fs.create(path); out.writeBytes(hello); out.close(); DataNodeProperties dnProp = cluster.stopDataNode(0); String dnAddress = dnProp.datanode.getXferAddress().toString(); if (dnAddress.startsWith("/")) { dnAddress = dnAddress.substring(1); } for (int i = 0; i < 2; i++) { out = fs.append(path, EnumSet.of(CreateFlag.APPEND, CreateFlag.NEW_BLOCK), 4096, null); out.writeBytes(hello); out.close(); } out = fs.append(path, EnumSet.of(CreateFlag.APPEND, CreateFlag.NEW_BLOCK), 4096, null); cluster.restartDataNode(dnProp, true); Thread.sleep(2000); out.writeBytes(hello); out.close(); LocatedBlocks blocks = fs.getClient().getLocatedBlocks(path.toString(), 0L); assertEquals(4, blocks.getLocatedBlocks().size()); for (LocatedBlock block : blocks.getLocatedBlocks()) { assertEquals(hello.length(), block.getBlockSize()); } StringBuilder sb = new StringBuilder(); for (int i = 0; i < 4; i++) { sb.append(hello); } final byte[] content = sb.toString().getBytes(); AppendTestUtil.checkFullFile(fs, path, content.length, content, STR); cluster.restartNameNode(true); cluster.waitActive(); AppendTestUtil.checkFullFile(fs, path, content.length, content, STR); blocks = fs.getClient().getLocatedBlocks(path.toString(), 0L); assertEquals(4, blocks.getLocatedBlocks().size()); for (LocatedBlock block : blocks.getLocatedBlocks()) { assertEquals(hello.length(), block.getBlockSize()); } } finally { IOUtils.closeStream(fs); cluster.shutdown(); } }
|
/**
* Old replica of the block should not be accepted as valid for append/read
*/
|
Old replica of the block should not be accepted as valid for append/read
|
testMultiAppend2
|
{
"repo_name": "Authorlove/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestFileAppend.java",
"license": "apache-2.0",
"size": 22079
}
|
[
"java.util.EnumSet",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.fs.CreateFlag",
"org.apache.hadoop.fs.FSDataOutputStream",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hdfs.MiniDFSCluster",
"org.apache.hadoop.hdfs.protocol.LocatedBlock",
"org.apache.hadoop.hdfs.protocol.LocatedBlocks",
"org.apache.hadoop.io.IOUtils",
"org.junit.Assert"
] |
import java.util.EnumSet; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.CreateFlag; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.MiniDFSCluster; import org.apache.hadoop.hdfs.protocol.LocatedBlock; import org.apache.hadoop.hdfs.protocol.LocatedBlocks; import org.apache.hadoop.io.IOUtils; import org.junit.Assert;
|
import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.io.*; import org.junit.*;
|
[
"java.util",
"org.apache.hadoop",
"org.junit"
] |
java.util; org.apache.hadoop; org.junit;
| 515,767
|
public VirtualNetworkBgpCommunities bgpCommunities() {
return this.bgpCommunities;
}
|
VirtualNetworkBgpCommunities function() { return this.bgpCommunities; }
|
/**
* Get bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET.
*
* @return the bgpCommunities value
*/
|
Get bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET
|
bgpCommunities
|
{
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_11_01/src/main/java/com/microsoft/azure/management/network/v2019_11_01/implementation/VirtualNetworkInner.java",
"license": "mit",
"size": 9813
}
|
[
"com.microsoft.azure.management.network.v2019_11_01.VirtualNetworkBgpCommunities"
] |
import com.microsoft.azure.management.network.v2019_11_01.VirtualNetworkBgpCommunities;
|
import com.microsoft.azure.management.network.v2019_11_01.*;
|
[
"com.microsoft.azure"
] |
com.microsoft.azure;
| 916,839
|
public Plan getPlan(
final UUID project,
final String id) {
final UUID locationId = UUID.fromString("0b42cb47-cd73-4810-ac90-19c9ba147453"); //$NON-NLS-1$
final ApiResourceVersion apiVersion = new ApiResourceVersion("3.1-preview.1"); //$NON-NLS-1$
final Map<String, Object> routeValues = new HashMap<String, Object>();
routeValues.put("project", project); //$NON-NLS-1$
routeValues.put("id", id); //$NON-NLS-1$
final VssRestRequest httpRequest = super.createRequest(HttpMethod.GET,
locationId,
routeValues,
apiVersion,
VssMediaTypes.APPLICATION_JSON_TYPE);
return super.sendRequest(httpRequest, Plan.class);
}
|
Plan function( final UUID project, final String id) { final UUID locationId = UUID.fromString(STR); final ApiResourceVersion apiVersion = new ApiResourceVersion(STR); final Map<String, Object> routeValues = new HashMap<String, Object>(); routeValues.put(STR, project); routeValues.put("id", id); final VssRestRequest httpRequest = super.createRequest(HttpMethod.GET, locationId, routeValues, apiVersion, VssMediaTypes.APPLICATION_JSON_TYPE); return super.sendRequest(httpRequest, Plan.class); }
|
/**
* [Preview API 3.1-preview.1] Get the information for the specified plan
*
* @param project
* Project ID
* @param id
* Identifier of the plan
* @return Plan
*/
|
[Preview API 3.1-preview.1] Get the information for the specified plan
|
getPlan
|
{
"repo_name": "Microsoft/vso-httpclient-java",
"path": "Rest/alm-tfs-client/src/main/generated/com/microsoft/alm/teamfoundation/work/webapi/WorkHttpClientBase.java",
"license": "mit",
"size": 234377
}
|
[
"com.microsoft.alm.client.HttpMethod",
"com.microsoft.alm.client.VssMediaTypes",
"com.microsoft.alm.client.VssRestRequest",
"com.microsoft.alm.teamfoundation.work.webapi.Plan",
"com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion",
"java.util.HashMap",
"java.util.Map",
"java.util.UUID"
] |
import com.microsoft.alm.client.HttpMethod; import com.microsoft.alm.client.VssMediaTypes; import com.microsoft.alm.client.VssRestRequest; import com.microsoft.alm.teamfoundation.work.webapi.Plan; import com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion; import java.util.HashMap; import java.util.Map; import java.util.UUID;
|
import com.microsoft.alm.client.*; import com.microsoft.alm.teamfoundation.work.webapi.*; import com.microsoft.alm.visualstudio.services.webapi.*; import java.util.*;
|
[
"com.microsoft.alm",
"java.util"
] |
com.microsoft.alm; java.util;
| 880,849
|
public List<PartnerDivision> findAll();
|
List<PartnerDivision> function();
|
/**
* This method gets a list of partnerDivision that are active
*
* @return a list from PartnerDivision null if no exist records
*/
|
This method gets a list of partnerDivision that are active
|
findAll
|
{
"repo_name": "CCAFS/MARLO",
"path": "marlo-data/src/main/java/org/cgiar/ccafs/marlo/data/dao/PartnerDivisionDAO.java",
"license": "gpl-3.0",
"size": 2577
}
|
[
"java.util.List",
"org.cgiar.ccafs.marlo.data.model.PartnerDivision"
] |
import java.util.List; import org.cgiar.ccafs.marlo.data.model.PartnerDivision;
|
import java.util.*; import org.cgiar.ccafs.marlo.data.model.*;
|
[
"java.util",
"org.cgiar.ccafs"
] |
java.util; org.cgiar.ccafs;
| 1,952,011
|
public void registerItem(Object dummyParent) {
if (StringUtils.isEmpty(getAliasFor())) {
configure();
}
items.put(getName(), this);
log.debug("globalItemList registered item [" + toString() + "]");
}
|
void function(Object dummyParent) { if (StringUtils.isEmpty(getAliasFor())) { configure(); } items.put(getName(), this); log.debug(STR + toString() + "]"); }
|
/**
* Register an item in the list
*/
|
Register an item in the list
|
registerItem
|
{
"repo_name": "smhoekstra/iaf",
"path": "JavaSource/nl/nn/adapterframework/util/GlobalListItem.java",
"license": "apache-2.0",
"size": 3825
}
|
[
"org.apache.commons.lang.StringUtils"
] |
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.*;
|
[
"org.apache.commons"
] |
org.apache.commons;
| 365,190
|
private static final long serialVersionUID = 1L;
private final JPanel contentPanel = new JPanel();
private JTextField usernameTextField;
private JTextField firstNameTextField;
private JTextField middleNameTextField;
private JTextField lastNameTextField;
private JTextField emailTextField;
private JComboBox securityComboBox;
private JComboBox comboBox;
private CourseDAO crsdao= new CourseDAO();
private JPasswordField answerTextField;
private final ButtonGroup buttonGroup = new ButtonGroup();
private JPasswordField passwordField;
private ProfessorDAO profDAO;
private DefaultListModel<String> model;
private JList clist;
private static Thread t=null;
private static Thread t2=null;
//private AddCourse addcrs=null;
public static void main(String[] args) {
try {
AddFacultyForm dialog = new AddFacultyForm();
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
@SuppressWarnings({ "unchecked", "rawtypes" })
public AddFacultyForm()throws Exception {
Thread.currentThread().setName("Dialog thread");
t2=Thread.currentThread();
System.out.println("The thread"+Thread.currentThread().getName());
setTitle("Add Faculty");
setBounds(400, 100, 500, 650);
getContentPane().setLayout(new BorderLayout());
contentPanel.setFont(new Font("Comic Sans MS", Font.BOLD, 14));
contentPanel.setDoubleBuffered(false);
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
profDAO=new ProfessorDAO();
contentPanel.setLayout(null);
{
JLabel lblUsername = new JLabel("Username :");
lblUsername.setBounds(76, 9, 84, 21);
lblUsername.setFont(new Font("Century Gothic", Font.BOLD, 14));
contentPanel.add(lblUsername);
}
{
usernameTextField = new JTextField();
usernameTextField.setBounds(190, 11, 265, 20);
contentPanel.add(usernameTextField);
usernameTextField.setColumns(10);
}
{
JLabel lblFirstName = new JLabel("First Name :");
lblFirstName.setBounds(76, 40, 84, 21);
lblFirstName.setFont(new Font("Century Gothic", Font.BOLD, 14));
contentPanel.add(lblFirstName);
}
{
firstNameTextField = new JTextField();
firstNameTextField.setBounds(190, 42, 265, 20);
contentPanel.add(firstNameTextField);
firstNameTextField.setColumns(10);
}
{
JLabel lblMiddleName = new JLabel("Middle Name :");
lblMiddleName.setBounds(76, 71, 100, 21);
lblMiddleName.setFont(new Font("Comic Sans MS", Font.BOLD, 14));
lblMiddleName.setForeground(new Color(0, 0, 0));
contentPanel.add(lblMiddleName);
}
{
middleNameTextField = new JTextField();
middleNameTextField.setBounds(190, 73, 265, 20);
contentPanel.add(middleNameTextField);
middleNameTextField.setColumns(10);
}
{
JLabel lblLastName = new JLabel("Last Name :");
lblLastName.setBounds(76, 103, 84, 21);
lblLastName.setFont(new Font("Century Gothic", Font.BOLD, 14));
lblLastName.setForeground(new Color(0, 0, 0));
contentPanel.add(lblLastName);
}
{
lastNameTextField = new JTextField();
lastNameTextField.setBounds(190, 104, 265, 20);
contentPanel.add(lastNameTextField);
lastNameTextField.setColumns(10);
}
{
JLabel lblEmail = new JLabel("Email :");
lblEmail.setBounds(76, 133, 56, 21);
lblEmail.setFont(new Font("Century Gothic", Font.BOLD, 14));
contentPanel.add(lblEmail);
}
{
emailTextField = new JTextField();
emailTextField.setBounds(190, 135, 265, 20);
contentPanel.add(emailTextField);
emailTextField.setColumns(10);
}
{
JLabel lblSex = new JLabel("Sex : ");
lblSex.setBounds(76, 173, 56, 21);
lblSex.setFont(new Font("Comic Sans MS", Font.BOLD, 14));
contentPanel.add(lblSex);
}
{
JPanel panel_gender = new JPanel();
panel_gender.setBounds(190, 173, 265, 35);
contentPanel.add(panel_gender);
panel_gender.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
{
JRadioButton rdbtnM = new JRadioButton("M");
rdbtnM.setActionCommand("M");
rdbtnM.setFont(new Font("Tahoma", Font.BOLD, 14));
buttonGroup.add(rdbtnM);
panel_gender.add(rdbtnM);
}
{
JRadioButton rdbtnF = new JRadioButton("F");
rdbtnF.setFont(new Font("Tahoma", Font.BOLD, 14));
buttonGroup.add(rdbtnF);
rdbtnF.setActionCommand("F");
panel_gender.add(rdbtnF);
}
}
{
JLabel lblEmail = new JLabel("Password :");
lblEmail.setBounds(76, 217, 84, 21);
lblEmail.setFont(new Font("Century Gothic", Font.BOLD, 14));
contentPanel.add(lblEmail);
}
{
passwordField = new JPasswordField();
passwordField.setBounds(190, 219, 265, 20);
passwordField.setColumns(30);
contentPanel.add(passwordField);
}
{
JLabel lblSecurityQuestion = new JLabel("Security Question :");
lblSecurityQuestion.setBounds(76, 248, 123, 21);
lblSecurityQuestion.setFont(new Font("Century Gothic", Font.BOLD, 12));
contentPanel.add(lblSecurityQuestion);
}
{
String ques[]={"Where do you live?","Which is your favourite book?","Which is your favourite movie?","Who is your role model?","What time of the day were you born?"};
securityComboBox=new JComboBox(ques);
securityComboBox.setBounds(190, 250, 265, 20);
securityComboBox.setSelectedItem(null);
contentPanel.add(securityComboBox);
}
{
JLabel lblAnswer = new JLabel("Answer :");
lblAnswer.setBounds(76, 279, 84, 21);
lblAnswer.setFont(new Font("Century Gothic", Font.BOLD, 14));
lblAnswer.setForeground(new Color(0, 0, 0));
contentPanel.add(lblAnswer);
}
{
answerTextField = new JPasswordField();
answerTextField.setBounds(190, 281, 265, 20);
contentPanel.add(answerTextField);
}
{
JLabel lblNewLabel = new JLabel("If your courses are not present in the dropdown please register your course by");
lblNewLabel.setFont(new Font("Arial Unicode MS", Font.ITALIC, 12));
lblNewLabel.setBounds(12, 488, 443, 21);
contentPanel.add(lblNewLabel);
}
{
JLabel lblProvidingTheRelevent = new JLabel(" providing the relevent details on the course side panel.");
lblProvidingTheRelevent.setFont(new Font("Arial Unicode MS", Font.ITALIC, 12));
lblProvidingTheRelevent.setBounds(10, 508, 293, 14);
contentPanel.add(lblProvidingTheRelevent);
}
JLabel lblCourses = new JLabel("Courses : ");
lblCourses.setFont(new Font("Century Gothic", Font.BOLD, 14));
lblCourses.setBounds(76, 321, 84, 14);
contentPanel.add(lblCourses);
model = new DefaultListModel<String>();
clist = new JList(model);
clist.setBackground(new Color(224, 255, 255));
clist.setBorder(new MatteBorder(1, 1, 2, 2, (Color) new Color(0, 0, 0)));
clist.setBounds(190, 351, 201, 126);
contentPanel.add(clist);
|
static final long serialVersionUID = 1L; private final JPanel contentPanel = new JPanel(); private JTextField usernameTextField; private JTextField firstNameTextField; private JTextField middleNameTextField; private JTextField lastNameTextField; private JTextField emailTextField; private JComboBox securityComboBox; private JComboBox comboBox; private CourseDAO crsdao= new CourseDAO(); private JPasswordField answerTextField; private final ButtonGroup buttonGroup = new ButtonGroup(); private JPasswordField passwordField; private ProfessorDAO profDAO; private DefaultListModel<String> model; private JList clist; private static Thread t=null; private static Thread t2=null; public static void function(String[] args) { try { AddFacultyForm dialog = new AddFacultyForm(); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } @SuppressWarnings({ STR, STR }) public AddFacultyForm()throws Exception { Thread.currentThread().setName(STR); t2=Thread.currentThread(); System.out.println(STR+Thread.currentThread().getName()); setTitle(STR); setBounds(400, 100, 500, 650); getContentPane().setLayout(new BorderLayout()); contentPanel.setFont(new Font(STR, Font.BOLD, 14)); contentPanel.setDoubleBuffered(false); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); profDAO=new ProfessorDAO(); contentPanel.setLayout(null); { JLabel lblUsername = new JLabel(STR); lblUsername.setBounds(76, 9, 84, 21); lblUsername.setFont(new Font(STR, Font.BOLD, 14)); contentPanel.add(lblUsername); } { usernameTextField = new JTextField(); usernameTextField.setBounds(190, 11, 265, 20); contentPanel.add(usernameTextField); usernameTextField.setColumns(10); } { JLabel lblFirstName = new JLabel(STR); lblFirstName.setBounds(76, 40, 84, 21); lblFirstName.setFont(new Font(STR, Font.BOLD, 14)); contentPanel.add(lblFirstName); } { firstNameTextField = new JTextField(); firstNameTextField.setBounds(190, 42, 265, 20); contentPanel.add(firstNameTextField); firstNameTextField.setColumns(10); } { JLabel lblMiddleName = new JLabel(STR); lblMiddleName.setBounds(76, 71, 100, 21); lblMiddleName.setFont(new Font(STR, Font.BOLD, 14)); lblMiddleName.setForeground(new Color(0, 0, 0)); contentPanel.add(lblMiddleName); } { middleNameTextField = new JTextField(); middleNameTextField.setBounds(190, 73, 265, 20); contentPanel.add(middleNameTextField); middleNameTextField.setColumns(10); } { JLabel lblLastName = new JLabel(STR); lblLastName.setBounds(76, 103, 84, 21); lblLastName.setFont(new Font(STR, Font.BOLD, 14)); lblLastName.setForeground(new Color(0, 0, 0)); contentPanel.add(lblLastName); } { lastNameTextField = new JTextField(); lastNameTextField.setBounds(190, 104, 265, 20); contentPanel.add(lastNameTextField); lastNameTextField.setColumns(10); } { JLabel lblEmail = new JLabel(STR); lblEmail.setBounds(76, 133, 56, 21); lblEmail.setFont(new Font(STR, Font.BOLD, 14)); contentPanel.add(lblEmail); } { emailTextField = new JTextField(); emailTextField.setBounds(190, 135, 265, 20); contentPanel.add(emailTextField); emailTextField.setColumns(10); } { JLabel lblSex = new JLabel(STR); lblSex.setBounds(76, 173, 56, 21); lblSex.setFont(new Font(STR, Font.BOLD, 14)); contentPanel.add(lblSex); } { JPanel panel_gender = new JPanel(); panel_gender.setBounds(190, 173, 265, 35); contentPanel.add(panel_gender); panel_gender.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); { JRadioButton rdbtnM = new JRadioButton("M"); rdbtnM.setActionCommand("M"); rdbtnM.setFont(new Font(STR, Font.BOLD, 14)); buttonGroup.add(rdbtnM); panel_gender.add(rdbtnM); } { JRadioButton rdbtnF = new JRadioButton("F"); rdbtnF.setFont(new Font(STR, Font.BOLD, 14)); buttonGroup.add(rdbtnF); rdbtnF.setActionCommand("F"); panel_gender.add(rdbtnF); } } { JLabel lblEmail = new JLabel(STR); lblEmail.setBounds(76, 217, 84, 21); lblEmail.setFont(new Font(STR, Font.BOLD, 14)); contentPanel.add(lblEmail); } { passwordField = new JPasswordField(); passwordField.setBounds(190, 219, 265, 20); passwordField.setColumns(30); contentPanel.add(passwordField); } { JLabel lblSecurityQuestion = new JLabel(STR); lblSecurityQuestion.setBounds(76, 248, 123, 21); lblSecurityQuestion.setFont(new Font(STR, Font.BOLD, 12)); contentPanel.add(lblSecurityQuestion); } { String ques[]={STR,STR,STR,STR,STR}; securityComboBox=new JComboBox(ques); securityComboBox.setBounds(190, 250, 265, 20); securityComboBox.setSelectedItem(null); contentPanel.add(securityComboBox); } { JLabel lblAnswer = new JLabel(STR); lblAnswer.setBounds(76, 279, 84, 21); lblAnswer.setFont(new Font(STR, Font.BOLD, 14)); lblAnswer.setForeground(new Color(0, 0, 0)); contentPanel.add(lblAnswer); } { answerTextField = new JPasswordField(); answerTextField.setBounds(190, 281, 265, 20); contentPanel.add(answerTextField); } { JLabel lblNewLabel = new JLabel(STR); lblNewLabel.setFont(new Font(STR, Font.ITALIC, 12)); lblNewLabel.setBounds(12, 488, 443, 21); contentPanel.add(lblNewLabel); } { JLabel lblProvidingTheRelevent = new JLabel(STR); lblProvidingTheRelevent.setFont(new Font(STR, Font.ITALIC, 12)); lblProvidingTheRelevent.setBounds(10, 508, 293, 14); contentPanel.add(lblProvidingTheRelevent); } JLabel lblCourses = new JLabel(STR); lblCourses.setFont(new Font(STR, Font.BOLD, 14)); lblCourses.setBounds(76, 321, 84, 14); contentPanel.add(lblCourses); model = new DefaultListModel<String>(); clist = new JList(model); clist.setBackground(new Color(224, 255, 255)); clist.setBorder(new MatteBorder(1, 1, 2, 2, (Color) new Color(0, 0, 0))); clist.setBounds(190, 351, 201, 126); contentPanel.add(clist);
|
/**
* Launch the application.
*/
|
Launch the application
|
main
|
{
"repo_name": "jtatia/Course-Management-System",
"path": "src/main/admin/adminpanel/addfaculty/AddFacultyForm.java",
"license": "mit",
"size": 11329
}
|
[
"java.awt.BorderLayout",
"java.awt.Color",
"java.awt.FlowLayout",
"java.awt.Font",
"javax.swing.ButtonGroup",
"javax.swing.DefaultListModel",
"javax.swing.JComboBox",
"javax.swing.JDialog",
"javax.swing.JLabel",
"javax.swing.JList",
"javax.swing.JPanel",
"javax.swing.JPasswordField",
"javax.swing.JRadioButton",
"javax.swing.JTextField",
"javax.swing.border.EmptyBorder",
"javax.swing.border.MatteBorder"
] |
import java.awt.BorderLayout; import java.awt.Color; import java.awt.FlowLayout; import java.awt.Font; import javax.swing.ButtonGroup; import javax.swing.DefaultListModel; import javax.swing.JComboBox; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.border.EmptyBorder; import javax.swing.border.MatteBorder;
|
import java.awt.*; import javax.swing.*; import javax.swing.border.*;
|
[
"java.awt",
"javax.swing"
] |
java.awt; javax.swing;
| 2,579,367
|
private Heartbeater startHeartbeat(long initialDelay) throws LockException {
long heartbeatInterval = getHeartbeatInterval(conf);
assert heartbeatInterval > 0;
UserGroupInformation currentUser;
try {
currentUser = UserGroupInformation.getCurrentUser();
} catch (IOException e) {
throw new LockException("error while getting current user,", e);
}
try {
heartbeatTaskLock.lock();
if (heartbeatTask != null) {
throw new IllegalStateException("Heartbeater is already started.");
}
Heartbeater heartbeater = new Heartbeater(this, conf, queryId, currentUser);
heartbeatTask = startHeartbeat(initialDelay, heartbeatInterval, heartbeater);
LOG.debug("Started heartbeat with delay/interval = " + initialDelay + "/" + heartbeatInterval +
" " + TimeUnit.MILLISECONDS + " for query: " + queryId);
return heartbeater;
} finally {
heartbeatTaskLock.unlock();
}
}
|
Heartbeater function(long initialDelay) throws LockException { long heartbeatInterval = getHeartbeatInterval(conf); assert heartbeatInterval > 0; UserGroupInformation currentUser; try { currentUser = UserGroupInformation.getCurrentUser(); } catch (IOException e) { throw new LockException(STR, e); } try { heartbeatTaskLock.lock(); if (heartbeatTask != null) { throw new IllegalStateException(STR); } Heartbeater heartbeater = new Heartbeater(this, conf, queryId, currentUser); heartbeatTask = startHeartbeat(initialDelay, heartbeatInterval, heartbeater); LOG.debug(STR + initialDelay + "/" + heartbeatInterval + " " + TimeUnit.MILLISECONDS + STR + queryId); return heartbeater; } finally { heartbeatTaskLock.unlock(); } }
|
/**
* Start the heartbeater threadpool and return the task.
* @param initialDelay time to delay before first execution, in milliseconds
* @return heartbeater
*/
|
Start the heartbeater threadpool and return the task
|
startHeartbeat
|
{
"repo_name": "anishek/hive",
"path": "ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java",
"license": "apache-2.0",
"size": 44118
}
|
[
"java.io.IOException",
"java.util.concurrent.TimeUnit",
"org.apache.hadoop.security.UserGroupInformation"
] |
import java.io.IOException; import java.util.concurrent.TimeUnit; import org.apache.hadoop.security.UserGroupInformation;
|
import java.io.*; import java.util.concurrent.*; import org.apache.hadoop.security.*;
|
[
"java.io",
"java.util",
"org.apache.hadoop"
] |
java.io; java.util; org.apache.hadoop;
| 1,988,672
|
public ArrayList<WalletTableData> createActiveWalletData(final BitcoinController bitcoinController) {
return createWalletDataInternal(bitcoinController, this.getActivePerWalletModelData());
}
|
ArrayList<WalletTableData> function(final BitcoinController bitcoinController) { return createWalletDataInternal(bitcoinController, this.getActivePerWalletModelData()); }
|
/**
* Convert the active wallet info into walletdata records as they are easier
* to show to the user in tabular form.
*/
|
Convert the active wallet info into walletdata records as they are easier to show to the user in tabular form
|
createActiveWalletData
|
{
"repo_name": "PaulSnow/multibit",
"path": "src/main/java/org/multibit/model/bitcoin/BitcoinModel.java",
"license": "mit",
"size": 29100
}
|
[
"java.util.ArrayList",
"org.multibit.controller.bitcoin.BitcoinController",
"org.multibit.model.bitcoin.WalletTableData"
] |
import java.util.ArrayList; import org.multibit.controller.bitcoin.BitcoinController; import org.multibit.model.bitcoin.WalletTableData;
|
import java.util.*; import org.multibit.controller.bitcoin.*; import org.multibit.model.bitcoin.*;
|
[
"java.util",
"org.multibit.controller",
"org.multibit.model"
] |
java.util; org.multibit.controller; org.multibit.model;
| 2,578,376
|
private byte[] calculuateOValue(
byte[] ownerPassword, byte[] userPassword,
int keyBitLength, int revision)
throws GeneralSecurityException {
// Steps 1-4
final byte[] rc4KeyBytes =
getInitialOwnerPasswordKeyBytes(
ownerPassword, keyBitLength, revision);
final Cipher rc4 = createRC4Cipher();
initEncryption(rc4, createRC4Key(rc4KeyBytes));
// Step 5: Pad or truncate the user password string as described in step
// 1 of Algorithm 3.2.
// Step 6: Encrypt the result of step 5, using an RC4 encryption
// function with the encryption key obtained in step 4.
byte[] pwvalue = crypt(rc4, padPassword(userPassword));
// Step 7: (Revision 3 or greater) Do the following 19 times: Take the
// output from the previous invocation of the RC4 function and pass it
// as input to a new invocation of the function; use an encryption key
// generated by taking each byte of the encryption key obtained in step
// 4 and performing an XOR (exclusive or) operation between
if (revision >= 3) {
rc4shuffle(pwvalue, rc4KeyBytes, rc4);
}
assert pwvalue.length == 32;
return pwvalue;
}
|
byte[] function( byte[] ownerPassword, byte[] userPassword, int keyBitLength, int revision) throws GeneralSecurityException { final byte[] rc4KeyBytes = getInitialOwnerPasswordKeyBytes( ownerPassword, keyBitLength, revision); final Cipher rc4 = createRC4Cipher(); initEncryption(rc4, createRC4Key(rc4KeyBytes)); byte[] pwvalue = crypt(rc4, padPassword(userPassword)); if (revision >= 3) { rc4shuffle(pwvalue, rc4KeyBytes, rc4); } assert pwvalue.length == 32; return pwvalue; }
|
/**
* Calculate what the O value of the Encrypt dict should look like given a
* particular configuration. Not used, but useful for reference; this
* process is reversed to determine whether a given password is the
* owner password. Corresponds to Algorithm 3.3 of the PDF Reference
* version 1.7.
*
* @see #checkOwnerPassword
* @param ownerPassword the owner password
* @param userPassword the user password
* @param keyBitLength the key length in bits (40-128)
* @param revision the security handler revision
* @return the O value entry
* @throws GeneralSecurityException if ciphers are unavailable or
* inappropriately used
*/
|
Calculate what the O value of the Encrypt dict should look like given a particular configuration. Not used, but useful for reference; this process is reversed to determine whether a given password is the owner password. Corresponds to Algorithm 3.3 of the PDF Reference version 1.7
|
calculuateOValue
|
{
"repo_name": "oswetto/LoboEvolution",
"path": "LoboPDF/src/main/java/org/loboevolution/pdfview/decrypt/StandardDecrypter.java",
"license": "gpl-3.0",
"size": 47290
}
|
[
"java.security.GeneralSecurityException",
"javax.crypto.Cipher"
] |
import java.security.GeneralSecurityException; import javax.crypto.Cipher;
|
import java.security.*; import javax.crypto.*;
|
[
"java.security",
"javax.crypto"
] |
java.security; javax.crypto;
| 930,203
|
private void updateRootQueueMetrics() {
rootMetrics.setAvailableResourcesToQueue(
Resources.subtract(
getClusterResource(), rootMetrics.getAllocatedResources()));
}
|
void function() { rootMetrics.setAvailableResourcesToQueue( Resources.subtract( getClusterResource(), rootMetrics.getAllocatedResources())); }
|
/**
* Subqueue metrics might be a little out of date because fair shares are
* recalculated at the update interval, but the root queue metrics needs to
* be updated synchronously with allocations and completions so that cluster
* metrics will be consistent.
*/
|
Subqueue metrics might be a little out of date because fair shares are recalculated at the update interval, but the root queue metrics needs to be updated synchronously with allocations and completions so that cluster metrics will be consistent
|
updateRootQueueMetrics
|
{
"repo_name": "NJUJYB/disYarn",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FairScheduler.java",
"license": "apache-2.0",
"size": 68132
}
|
[
"org.apache.hadoop.yarn.util.resource.Resources"
] |
import org.apache.hadoop.yarn.util.resource.Resources;
|
import org.apache.hadoop.yarn.util.resource.*;
|
[
"org.apache.hadoop"
] |
org.apache.hadoop;
| 843,466
|
public XPathResult evaluate(String pXPath, DOM pContextNode)
throws ExBadPath {
return evaluate(pXPath, pContextNode, null, FoxXPathResultType.DOM_LIST);
}
|
XPathResult function(String pXPath, DOM pContextNode) throws ExBadPath { return evaluate(pXPath, pContextNode, null, FoxXPathResultType.DOM_LIST); }
|
/**
* Evaluates pXPath and returns the result of the evaluation. No :{context}s are supported in the XPath.
* @param pXPath The XPath string to be evaluated.
* @param pContextNode The initial context item of the XPath evaluation.
* @return The result of the XPath evaluation.
* @throws ExBadPath If the XPath syntax is invalid.
*/
|
Evaluates pXPath and returns the result of the evaluation. No :{context}s are supported in the XPath
|
evaluate
|
{
"repo_name": "Fivium/FOXopen",
"path": "src/main/java/net/foxopen/fox/dom/xpath/FoxXPathEvaluator.java",
"license": "gpl-3.0",
"size": 8281
}
|
[
"net.foxopen.fox.ex.ExBadPath"
] |
import net.foxopen.fox.ex.ExBadPath;
|
import net.foxopen.fox.ex.*;
|
[
"net.foxopen.fox"
] |
net.foxopen.fox;
| 2,242,788
|
public static List<ItemStack> getOres(String name)
{
return getOres(getOreID(name));
}
|
static List<ItemStack> function(String name) { return getOres(getOreID(name)); }
|
/**
* Retrieves the ArrayList of items that are registered to this ore type.
* Creates the list as empty if it did not exist.
*
* The returned List is unmodifiable, but will be updated if a new ore
* is registered using registerOre
*
* @param name The ore name, directly calls getOreID
* @return An arrayList containing ItemStacks registered for this ore
*/
|
Retrieves the ArrayList of items that are registered to this ore type. Creates the list as empty if it did not exist. The returned List is unmodifiable, but will be updated if a new ore is registered using registerOre
|
getOres
|
{
"repo_name": "KyuRicard/MagicMod",
"path": "build/tmp/recompileMc/sources/net/minecraftforge/oredict/OreDictionary.java",
"license": "lgpl-2.1",
"size": 29574
}
|
[
"java.util.List",
"net.minecraft.item.ItemStack"
] |
import java.util.List; import net.minecraft.item.ItemStack;
|
import java.util.*; import net.minecraft.item.*;
|
[
"java.util",
"net.minecraft.item"
] |
java.util; net.minecraft.item;
| 2,268,535
|
public static <M extends Map<K, V>, K, V> StepAssertor<M> containsAny(final StepAssertor<M> step, final Map<K, V> map,
final MessageAssertor message) {
return contains(step, map, MSG.MAP.CONTAINS_MAP_ANY, false, message);
}
|
static <M extends Map<K, V>, K, V> StepAssertor<M> function(final StepAssertor<M> step, final Map<K, V> map, final MessageAssertor message) { return contains(step, map, MSG.MAP.CONTAINS_MAP_ANY, false, message); }
|
/**
* Prepare the next step to validate if the {@link Map} contains any
* {@code map} entries
*
* <p>
* precondition: neither {@link Map} can be {@code null} or empty
* </p>
*
* @param step
* the current step
* @param map
* the map containing entries to find
* @param message
* the message if invalid
* @param <M>
* the {@link Map} type
* @param <K>
* the {@link Map} key elements type
* @param <V>
* the {@link Map} value elements type
* @return the next step
*/
|
Prepare the next step to validate if the <code>Map</code> contains any map entries precondition: neither <code>Map</code> can be null or empty
|
containsAny
|
{
"repo_name": "Gilandel/utils-assertor",
"path": "src/main/java/fr/landel/utils/assertor/utils/AssertorMap.java",
"license": "apache-2.0",
"size": 32870
}
|
[
"fr.landel.utils.assertor.StepAssertor",
"fr.landel.utils.assertor.commons.MessageAssertor",
"java.util.Map"
] |
import fr.landel.utils.assertor.StepAssertor; import fr.landel.utils.assertor.commons.MessageAssertor; import java.util.Map;
|
import fr.landel.utils.assertor.*; import fr.landel.utils.assertor.commons.*; import java.util.*;
|
[
"fr.landel.utils",
"java.util"
] |
fr.landel.utils; java.util;
| 2,571,066
|
public static void show(final DialogFragmentActivity activity,
final int requestCode, final String title, final String message,
ArrayList<Reference> choices, final int selectedChoice) {
show(activity, requestCode, title, message, choices, selectedChoice,
new RefDialogFragment());
}
|
static void function(final DialogFragmentActivity activity, final int requestCode, final String title, final String message, ArrayList<Reference> choices, final int selectedChoice) { show(activity, requestCode, title, message, choices, selectedChoice, new RefDialogFragment()); }
|
/**
* Confirm message and deliver callback to given activity
*
* @param activity
* @param requestCode
* @param title
* @param message
* @param choices
* @param selectedChoice
*/
|
Confirm message and deliver callback to given activity
|
show
|
{
"repo_name": "ywk248248/Forkhub_cloned",
"path": "app/src/main/java/com/github/mobile/ui/ref/RefDialogFragment.java",
"license": "apache-2.0",
"size": 4904
}
|
[
"com.github.mobile.ui.DialogFragmentActivity",
"java.util.ArrayList",
"org.eclipse.egit.github.core.Reference"
] |
import com.github.mobile.ui.DialogFragmentActivity; import java.util.ArrayList; import org.eclipse.egit.github.core.Reference;
|
import com.github.mobile.ui.*; import java.util.*; import org.eclipse.egit.github.core.*;
|
[
"com.github.mobile",
"java.util",
"org.eclipse.egit"
] |
com.github.mobile; java.util; org.eclipse.egit;
| 38,244
|
@Test(timeOut = 7000, dataProvider = "subType")
public void testUnsupportedBatchMessageConsumer(SubscriptionType subType) throws Exception {
log.info("-- Starting {} test --", methodName);
final String topicName = "persistent://my-property/my-ns/my-topic1";
final String subscriptionName = "my-subscriber-name" + subType;
ConsumerImpl<byte[]> consumer1 = (ConsumerImpl<byte[]>) pulsarClient.newConsumer().topic(topicName)
.subscriptionName(subscriptionName).subscriptionType(subType).subscribe();
final int numMessagesPerBatch = 10;
Producer<byte[]> producer = pulsarClient.newProducer().topic(topicName).create();
Producer<byte[]> batchProducer = pulsarClient.newProducer().topic(topicName).enableBatching(true)
.batchingMaxPublishDelay(Long.MAX_VALUE, TimeUnit.SECONDS)
.batchingMaxMessages(numMessagesPerBatch).create();
// update consumer's version to incompatible batch-message version = Version.V3
Topic topic = pulsar.getBrokerService().getOrCreateTopic(topicName).get();
org.apache.pulsar.broker.service.Consumer brokerConsumer = topic.getSubscriptions().get(subscriptionName)
.getConsumers().get(0);
Field cnxField = org.apache.pulsar.broker.service.Consumer.class.getDeclaredField("cnx");
cnxField.setAccessible(true);
PulsarHandler cnx = (PulsarHandler) cnxField.get(brokerConsumer);
Field versionField = PulsarHandler.class.getDeclaredField("remoteEndpointProtocolVersion");
versionField.setAccessible(true);
versionField.set(cnx, 3);
// (1) send non-batch message: consumer should be able to consume
for (int i = 0; i < numMessagesPerBatch; i++) {
String message = "my-message-" + i;
producer.send(message.getBytes());
}
Set<String> messageSet = Sets.newHashSet();
Message<byte[]> msg = null;
for (int i = 0; i < numMessagesPerBatch; i++) {
msg = consumer1.receive(1, TimeUnit.SECONDS);
String receivedMessage = new String(msg.getData());
String expectedMessage = "my-message-" + i;
testMessageOrderAndDuplicates(messageSet, receivedMessage, expectedMessage);
consumer1.acknowledge(msg);
}
// Also set clientCnx of the consumer to null so, it avoid reconnection so, other consumer can consume for
// verification
consumer1.setClientCnx(null);
// (2) send batch-message which should not be able to consume: as broker will disconnect the consumer
for (int i = 0; i < numMessagesPerBatch; i++) {
String message = "my-message-" + i;
batchProducer.sendAsync(message.getBytes());
}
batchProducer.flush();
// consumer should have not received any message as it should have been disconnected
msg = consumer1.receive(2, TimeUnit.SECONDS);
assertNull(msg);
// subscrie consumer2 with supporting batch version
Consumer<byte[]> consumer2 = pulsarClient.newConsumer().topic(topicName).subscriptionName(subscriptionName)
.subscribe();
messageSet.clear();
for (int i = 0; i < numMessagesPerBatch; i++) {
msg = consumer2.receive(1, TimeUnit.SECONDS);
String receivedMessage = new String(msg.getData());
log.debug("Received message: [{}]", receivedMessage);
String expectedMessage = "my-message-" + i;
testMessageOrderAndDuplicates(messageSet, receivedMessage, expectedMessage);
consumer2.acknowledge(msg);
}
consumer2.close();
producer.close();
batchProducer.close();
log.info("-- Exiting {} test --", methodName);
}
|
@Test(timeOut = 7000, dataProvider = STR) void function(SubscriptionType subType) throws Exception { log.info(STR, methodName); final String topicName = STRmy-subscriber-nameSTRcnxSTRremoteEndpointProtocolVersionSTRmy-message-STRmy-message-STRmy-message-STRReceived message: [{}]STRmy-message-STR-- Exiting {} test --", methodName); }
|
/**
* It verifies that consumer which doesn't support batch-message:
* <p>
* 1. broker disconnects that consumer
* <p>
* 2. redeliver all those messages to other supported consumer under the same subscription
*
* @param subType
* @throws Exception
*/
|
It verifies that consumer which doesn't support batch-message: 1. broker disconnects that consumer 2. redeliver all those messages to other supported consumer under the same subscription
|
testUnsupportedBatchMessageConsumer
|
{
"repo_name": "ArvinDevel/incubator-pulsar",
"path": "pulsar-broker/src/test/java/org/apache/pulsar/client/impl/BrokerClientIntegrationTest.java",
"license": "apache-2.0",
"size": 33215
}
|
[
"org.apache.pulsar.client.api.SubscriptionType",
"org.testng.annotations.Test"
] |
import org.apache.pulsar.client.api.SubscriptionType; import org.testng.annotations.Test;
|
import org.apache.pulsar.client.api.*; import org.testng.annotations.*;
|
[
"org.apache.pulsar",
"org.testng.annotations"
] |
org.apache.pulsar; org.testng.annotations;
| 2,899,207
|
public boolean isPackageArchived(String name) {
Node folderNode = this.getAreaNode( RULE_PACKAGE_AREA );
try {
Node node = folderNode.getNode( name );
return node.getProperty( AssetItem.CONTENT_PROPERTY_ARCHIVE_FLAG ).getBoolean();
} catch ( RepositoryException e ) {
throw new RulesRepositoryException( e );
}
}
|
boolean function(String name) { Node folderNode = this.getAreaNode( RULE_PACKAGE_AREA ); try { Node node = folderNode.getNode( name ); return node.getProperty( AssetItem.CONTENT_PROPERTY_ARCHIVE_FLAG ).getBoolean(); } catch ( RepositoryException e ) { throw new RulesRepositoryException( e ); } }
|
/**
* Check if package is archived.
*/
|
Check if package is archived
|
isPackageArchived
|
{
"repo_name": "dylanswartz/nakamura",
"path": "sandbox/drools/drools-repository/src/main/java/org/drools/repository/RulesRepository.java",
"license": "apache-2.0",
"size": 58085
}
|
[
"javax.jcr.Node",
"javax.jcr.RepositoryException"
] |
import javax.jcr.Node; import javax.jcr.RepositoryException;
|
import javax.jcr.*;
|
[
"javax.jcr"
] |
javax.jcr;
| 1,877,126
|
@Override
protected boolean reloadScript(final String scriptBody) {
// note we are starting here with a fresh listing of validation
// results since we are (re)loading a new/updated script. any
// existing validation results are not relevant
final Collection<ValidationResult> results = new HashSet<>();
try {
// get the engine and ensure its invocable
if (scriptEngine instanceof Invocable) {
final Invocable invocable = (Invocable) scriptEngine;
// Find a custom configurator and invoke their eval() method
ScriptEngineConfigurator configurator = scriptingComponentHelper.scriptEngineConfiguratorMap.get(scriptingComponentHelper.getScriptEngineName().toLowerCase());
if (configurator != null) {
configurator.eval(scriptEngine, scriptBody, scriptingComponentHelper.getModules());
} else {
// evaluate the script
scriptEngine.eval(scriptBody);
}
// get configured processor from the script (if it exists)
final Object obj = scriptEngine.get("writer");
if (obj != null) {
final ComponentLog logger = getLogger();
try {
// set the logger if the processor wants it
invocable.invokeMethod(obj, "setLogger", logger);
} catch (final NoSuchMethodException nsme) {
if (logger.isDebugEnabled()) {
logger.debug("Configured script RecordSetWriterFactory does not contain a setLogger method.");
}
}
if (configurationContext != null) {
try {
// set the logger if the processor wants it
invocable.invokeMethod(obj, "setConfigurationContext", configurationContext);
} catch (final NoSuchMethodException nsme) {
if (logger.isDebugEnabled()) {
logger.debug("Configured script RecordSetWriterFactory does not contain a setConfigurationContext method.");
}
}
}
// record the processor for use later
final RecordSetWriterFactory scriptedWriter = invocable.getInterface(obj, RecordSetWriterFactory.class);
recordFactory.set(scriptedWriter);
} else {
throw new ScriptException("No RecordSetWriterFactory was defined by the script.");
}
}
} catch (final Exception ex) {
final ComponentLog logger = getLogger();
final String message = "Unable to load script: " + ex.getLocalizedMessage();
logger.error(message, ex);
results.add(new ValidationResult.Builder()
.subject("ScriptValidation")
.valid(false)
.explanation("Unable to load script due to " + ex.getLocalizedMessage())
.input(scriptingComponentHelper.getScriptPath())
.build());
}
// store the updated validation results
validationResults.set(results);
// return whether there was any issues loading the configured script
return results.isEmpty();
}
|
boolean function(final String scriptBody) { final Collection<ValidationResult> results = new HashSet<>(); try { if (scriptEngine instanceof Invocable) { final Invocable invocable = (Invocable) scriptEngine; ScriptEngineConfigurator configurator = scriptingComponentHelper.scriptEngineConfiguratorMap.get(scriptingComponentHelper.getScriptEngineName().toLowerCase()); if (configurator != null) { configurator.eval(scriptEngine, scriptBody, scriptingComponentHelper.getModules()); } else { scriptEngine.eval(scriptBody); } final Object obj = scriptEngine.get(STR); if (obj != null) { final ComponentLog logger = getLogger(); try { invocable.invokeMethod(obj, STR, logger); } catch (final NoSuchMethodException nsme) { if (logger.isDebugEnabled()) { logger.debug(STR); } } if (configurationContext != null) { try { invocable.invokeMethod(obj, STR, configurationContext); } catch (final NoSuchMethodException nsme) { if (logger.isDebugEnabled()) { logger.debug(STR); } } } final RecordSetWriterFactory scriptedWriter = invocable.getInterface(obj, RecordSetWriterFactory.class); recordFactory.set(scriptedWriter); } else { throw new ScriptException(STR); } } } catch (final Exception ex) { final ComponentLog logger = getLogger(); final String message = STR + ex.getLocalizedMessage(); logger.error(message, ex); results.add(new ValidationResult.Builder() .subject(STR) .valid(false) .explanation(STR + ex.getLocalizedMessage()) .input(scriptingComponentHelper.getScriptPath()) .build()); } validationResults.set(results); return results.isEmpty(); }
|
/**
* Reloads the script RecordSetWriterFactory. This must be called within the lock.
*
* @param scriptBody An input stream associated with the script content
* @return Whether the script was successfully reloaded
*/
|
Reloads the script RecordSetWriterFactory. This must be called within the lock
|
reloadScript
|
{
"repo_name": "InspurUSA/nifi",
"path": "nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/record/script/ScriptedRecordSetWriter.java",
"license": "apache-2.0",
"size": 7331
}
|
[
"java.util.Collection",
"java.util.HashSet",
"javax.script.Invocable",
"javax.script.ScriptException",
"org.apache.nifi.components.ValidationResult",
"org.apache.nifi.logging.ComponentLog",
"org.apache.nifi.processors.script.ScriptEngineConfigurator",
"org.apache.nifi.serialization.RecordSetWriterFactory"
] |
import java.util.Collection; import java.util.HashSet; import javax.script.Invocable; import javax.script.ScriptException; import org.apache.nifi.components.ValidationResult; import org.apache.nifi.logging.ComponentLog; import org.apache.nifi.processors.script.ScriptEngineConfigurator; import org.apache.nifi.serialization.RecordSetWriterFactory;
|
import java.util.*; import javax.script.*; import org.apache.nifi.components.*; import org.apache.nifi.logging.*; import org.apache.nifi.processors.script.*; import org.apache.nifi.serialization.*;
|
[
"java.util",
"javax.script",
"org.apache.nifi"
] |
java.util; javax.script; org.apache.nifi;
| 75,969
|
public View getEmptyView() {
return mEmptyView;
}
|
View function() { return mEmptyView; }
|
/**
* When the current adapter is empty, the AdapterView can display a special
* view call the empty view. The empty view is used to provide feedback to
* the user that no data is available in this AdapterView.
*
* @return The view to show if the adapter is empty.
*/
|
When the current adapter is empty, the AdapterView can display a special view call the empty view. The empty view is used to provide feedback to the user that no data is available in this AdapterView
|
getEmptyView
|
{
"repo_name": "wuzhendev/samples",
"path": "EcoGalleryDemo/app/src/main/java/us/feras/ecogallery/EcoGalleryAdapterView.java",
"license": "apache-2.0",
"size": 36922
}
|
[
"android.view.View"
] |
import android.view.View;
|
import android.view.*;
|
[
"android.view"
] |
android.view;
| 1,479,541
|
private Ignite startGridNoOptimize(String igniteInstanceName) throws Exception {
return G.start(getConfiguration(igniteInstanceName));
}
|
Ignite function(String igniteInstanceName) throws Exception { return G.start(getConfiguration(igniteInstanceName)); }
|
/**
* Starts new grid with given name. Method optimize is not invoked.
*
* @param igniteInstanceName Ignite instance name.
* @return Started grid.
* @throws Exception If failed.
*/
|
Starts new grid with given name. Method optimize is not invoked
|
startGridNoOptimize
|
{
"repo_name": "alexzaitzev/ignite",
"path": "modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java",
"license": "apache-2.0",
"size": 82878
}
|
[
"org.apache.ignite.Ignite",
"org.apache.ignite.internal.util.typedef.G"
] |
import org.apache.ignite.Ignite; import org.apache.ignite.internal.util.typedef.G;
|
import org.apache.ignite.*; import org.apache.ignite.internal.util.typedef.*;
|
[
"org.apache.ignite"
] |
org.apache.ignite;
| 1,284,017
|
public void updateBufferData(VertexBuffer vb);
|
void function(VertexBuffer vb);
|
/**
* Uploads a vertex buffer to the GPU.
*
* @param vb The vertex buffer to upload
*/
|
Uploads a vertex buffer to the GPU
|
updateBufferData
|
{
"repo_name": "d235j/jmonkeyengine",
"path": "jme3-core/src/main/java/com/jme3/renderer/Renderer.java",
"license": "bsd-3-clause",
"size": 13497
}
|
[
"com.jme3.scene.VertexBuffer"
] |
import com.jme3.scene.VertexBuffer;
|
import com.jme3.scene.*;
|
[
"com.jme3.scene"
] |
com.jme3.scene;
| 2,181,330
|
@Source("com/google/appinventor/images/yandex.png")
ImageResource yandex();
|
@Source(STR) ImageResource yandex();
|
/**
* Designer palette item: YandexTranslate
*/
|
Designer palette item: YandexTranslate
|
yandex
|
{
"repo_name": "codimeo/codi-studio",
"path": "appinventor/appengine/src/com/google/appinventor/client/Images.java",
"license": "apache-2.0",
"size": 13788
}
|
[
"com.google.gwt.resources.client.ImageResource"
] |
import com.google.gwt.resources.client.ImageResource;
|
import com.google.gwt.resources.client.*;
|
[
"com.google.gwt"
] |
com.google.gwt;
| 1,823,416
|
@Test
public void testDisableNotExistingSchema() throws Exception
{
// check that the 'wrong' schema is not loaded
assertFalse( IntegrationUtils.isLoaded( getService(), "wrong" ) );
// now disable the 'wrong' schema
try
{
IntegrationUtils.disableSchema( getService(), "wrong" );
fail();
}
catch ( LdapException lnnfe )
{
// Expected
assertTrue( true );
}
// Test again that the schema is not loaded
assertFalse( IntegrationUtils.isLoaded( getService(), "wrong" ) );
}
|
void function() throws Exception { assertFalse( IntegrationUtils.isLoaded( getService(), "wrong" ) ); try { IntegrationUtils.disableSchema( getService(), "wrong" ); fail(); } catch ( LdapException lnnfe ) { assertTrue( true ); } assertFalse( IntegrationUtils.isLoaded( getService(), "wrong" ) ); }
|
/**
* Checks that trying to disable a non existing schema does not work
*
* @throws Exception on error
*/
|
Checks that trying to disable a non existing schema does not work
|
testDisableNotExistingSchema
|
{
"repo_name": "drankye/directory-server",
"path": "core-integ/src/test/java/org/apache/directory/server/core/schema/MetaSchemaHandlerIT.java",
"license": "apache-2.0",
"size": 34369
}
|
[
"org.apache.directory.api.ldap.model.exception.LdapException",
"org.apache.directory.server.core.integ.IntegrationUtils",
"org.junit.Assert"
] |
import org.apache.directory.api.ldap.model.exception.LdapException; import org.apache.directory.server.core.integ.IntegrationUtils; import org.junit.Assert;
|
import org.apache.directory.api.ldap.model.exception.*; import org.apache.directory.server.core.integ.*; import org.junit.*;
|
[
"org.apache.directory",
"org.junit"
] |
org.apache.directory; org.junit;
| 2,661,105
|
public static void main(String[] args)
throws Exception {
Writer w = null;
if (args.length != 0) {
final String outFile = args[0];
System.err.println("Outputting RTF to file '" + outFile + "'");
w = new BufferedWriter(new FileWriter(outFile));
} else {
System.err.println("Outputting RTF code to standard output");
w = new BufferedWriter(new OutputStreamWriter(System.out));
}
final RtfFile f = new RtfFile(w);
final RtfSection sect = f.startDocumentArea().newSection();
final RtfParagraph p = sect.newParagraph();
p.newText("Hello, RTF world.\n", null);
final RtfAttributes attr = new RtfAttributes();
attr.set(RtfText.ATTR_BOLD);
attr.set(RtfText.ATTR_ITALIC);
attr.set(RtfText.ATTR_FONT_SIZE, 36);
p.newText("This is bold, italic, 36 points", attr);
f.flush();
System.err.println("RtfFile test: all done.");
}
|
static void function(String[] args) throws Exception { Writer w = null; if (args.length != 0) { final String outFile = args[0]; System.err.println(STR + outFile + "'"); w = new BufferedWriter(new FileWriter(outFile)); } else { System.err.println(STR); w = new BufferedWriter(new OutputStreamWriter(System.out)); } final RtfFile f = new RtfFile(w); final RtfSection sect = f.startDocumentArea().newSection(); final RtfParagraph p = sect.newParagraph(); p.newText(STR, null); final RtfAttributes attr = new RtfAttributes(); attr.set(RtfText.ATTR_BOLD); attr.set(RtfText.ATTR_ITALIC); attr.set(RtfText.ATTR_FONT_SIZE, 36); p.newText(STR, attr); f.flush(); System.err.println(STR); }
|
/**
* minimal test and usage example
* @param args command-line arguments
* @throws Exception for problems
*/
|
minimal test and usage example
|
main
|
{
"repo_name": "apache/fop",
"path": "fop-core/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFile.java",
"license": "apache-2.0",
"size": 8133
}
|
[
"java.io.BufferedWriter",
"java.io.FileWriter",
"java.io.OutputStreamWriter",
"java.io.Writer"
] |
import java.io.BufferedWriter; import java.io.FileWriter; import java.io.OutputStreamWriter; import java.io.Writer;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 2,542,134
|
@Override
public void initFromProperties(SettingBundle rs) {
// Database Settings
// -----------------
ldapimpl = rs.getString("database.LDAPImpl", null);
configuration.setLdapHost(rs.getString("database.LDAPHost", null));
configuration.setLdapPort(rs.getInteger("database.LDAPPort", configuration.getLdapPort()));
ldapProtocolVer = rs.getInteger("database.LDAPProtocolVer", LDAPConnection.LDAP_V3);
ldapOpAttributesUsed = rs.getBoolean("database.LDAPOpAttributesUsed", ldapOpAttributesUsed);
ldapProtocolVer = LDAPConnection.LDAP_V3; // Only compatible with V3
configuration.setUsername(rs.getString("database.LDAPAccessLoginDN", null));
configuration
.setPassword(rs.getString("database.LDAPAccessPasswd", "").getBytes(Charsets.UTF_8));
ldapUserBaseDN = rs.getString("database.LDAPUserBaseDN", null);
ldapMaxMsClientTimeLimit =
rs.getInteger("database.LDAPMaxMsClientTimeLimit", ldapMaxMsClientTimeLimit);
ldapMaxSecServerTimeLimit =
rs.getInteger("database.LDAPMaxSecServerTimeLimit", ldapMaxSecServerTimeLimit);
ldapMaxNbEntryReturned =
rs.getInteger("database.LDAPMaxNbEntryReturned", ldapMaxNbEntryReturned);
ldapMaxNbReferrals = rs.getInteger("database.LDAPMaxNbReferrals", ldapMaxNbReferrals);
ldapBatchSize = rs.getInteger("database.LDAPBatchSize", ldapBatchSize);
ldapSearchRecurs = rs.getBoolean("database.LDAPSearchRecurs", ldapSearchRecurs);
configuration.setSecure(rs.getBoolean("database.LDAPSecured", false));
if (configuration.isSecure()) {
configuration.setLdapPort(rs.getInteger("database.LDAPPortSecured", 636));
}
sortControlSupported = rs.getBoolean("database.SortControlSupported", !"openldap".
equalsIgnoreCase(ldapimpl));
ldapDefaultSearchConstraints = getSearchConstraints(true);
ldapDefaultConstraints = getConstraints(true);
// Synchro parameters
// -------------------
synchroAutomatic = rs.getBoolean("synchro.Automatic", synchroAutomatic);
synchroRecursToGroups = rs.getBoolean("synchro.RecursToGroups", synchroRecursToGroups);
synchroThreaded = rs.getBoolean("synchro.Threaded", synchroThreaded);
synchroCacheEnabled = rs.getBoolean("synchro.CacheEnabled", synchroCacheEnabled);
synchroImportUsers = rs.getBoolean("synchro.importUsers", true);
// Users Settings
// --------------
usersType = rs.getString("users.Type", null);
usersClassName = rs.getString("users.ClassName", null);
usersFilter = rs.getString("users.Filter", null);
// AdminUser
usersIdField = rs.getString("users.IdField", null);
usersLoginField = rs.getString("users.LoginField", null);
usersFirstNameField = rs.getString("users.FirstNameField", null);
usersLastNameField = rs.getString("users.LastNameField", null);
usersEmailField = rs.getString("users.EmailField", "");
usersAccountControl = rs.getString("users.accountControl", "");
usersDisabledAccountFlag = rs.getString("users.accountControl.disabledFlags", "");
// Groups Settings
// ---------------
groupsType = rs.getString("groups.Type", null);
groupsClassName = rs.getString("groups.ClassName", null);
groupsInheritProfiles = rs.getBoolean("groups.InheritProfiles", groupsInheritProfiles);
groupsFilter = rs.getString("groups.Filter", null);
groupsNamingDepth = rs.getInteger("groups.NamingDepth", groupsNamingDepth);
groupsIdField = rs.getString("groups.IdField", null);
groupsIncludeEmptyGroups =
rs.getBoolean("groups.IncludeEmptyGroups", groupsIncludeEmptyGroups);
groupsSpecificGroupsBaseDN = rs.getString("groups.SpecificGroupsBaseDN", "");
groupsMemberField = rs.getString("groups.MemberField", "");
groupsNameField = rs.getString("groups.NameField", "");
groupsDescriptionField = rs.getString("groups.DescriptionField", "");
// IHM Settings
// ------------
ihmImportUsers = rs.getBoolean("ihm.importUsers", true);
ihmImportGroups = rs.getBoolean("ihm.importGroups", true);
}
|
void function(SettingBundle rs) { ldapimpl = rs.getString(STR, null); configuration.setLdapHost(rs.getString(STR, null)); configuration.setLdapPort(rs.getInteger(STR, configuration.getLdapPort())); ldapProtocolVer = rs.getInteger(STR, LDAPConnection.LDAP_V3); ldapOpAttributesUsed = rs.getBoolean(STR, ldapOpAttributesUsed); ldapProtocolVer = LDAPConnection.LDAP_V3; configuration.setUsername(rs.getString(STR, null)); configuration .setPassword(rs.getString(STR, STRdatabase.LDAPUserBaseDNSTRdatabase.LDAPMaxMsClientTimeLimitSTRdatabase.LDAPMaxSecServerTimeLimitSTRdatabase.LDAPMaxNbEntryReturnedSTRdatabase.LDAPMaxNbReferralsSTRdatabase.LDAPBatchSizeSTRdatabase.LDAPSearchRecursSTRdatabase.LDAPSecuredSTRdatabase.LDAPPortSecuredSTRdatabase.SortControlSupportedSTRopenldapSTRsynchro.AutomaticSTRsynchro.RecursToGroupsSTRsynchro.ThreadedSTRsynchro.CacheEnabledSTRsynchro.importUsersSTRusers.TypeSTRusers.ClassNameSTRusers.FilterSTRusers.IdFieldSTRusers.LoginFieldSTRusers.FirstNameFieldSTRusers.LastNameFieldSTRusers.EmailFieldSTRSTRusers.accountControlSTRSTRusers.accountControl.disabledFlagsSTRSTRgroups.TypeSTRgroups.ClassNameSTRgroups.InheritProfilesSTRgroups.FilterSTRgroups.NamingDepthSTRgroups.IdFieldSTRgroups.IncludeEmptyGroupsSTRgroups.SpecificGroupsBaseDNSTRSTRgroups.MemberFieldSTRSTRgroups.NameFieldSTRSTRgroups.DescriptionFieldSTRSTRihm.importUsersSTRihm.importGroups", true); }
|
/**
* Performs initialization from a properties file. The optional properties are retreive with
* getSureString.
* @param rs Properties resource file
*/
|
Performs initialization from a properties file. The optional properties are retreive with getSureString
|
initFromProperties
|
{
"repo_name": "SilverDav/Silverpeas-Core",
"path": "core-library/src/main/java/org/silverpeas/core/admin/domain/driver/ldapdriver/LDAPSettings.java",
"license": "agpl-3.0",
"size": 16616
}
|
[
"com.novell.ldap.LDAPConnection",
"org.silverpeas.core.util.SettingBundle"
] |
import com.novell.ldap.LDAPConnection; import org.silverpeas.core.util.SettingBundle;
|
import com.novell.ldap.*; import org.silverpeas.core.util.*;
|
[
"com.novell.ldap",
"org.silverpeas.core"
] |
com.novell.ldap; org.silverpeas.core;
| 2,540,996
|
public void drawItem(Graphics2D g2, XYItemRendererState state,
Rectangle2D dataArea, XYPlot plot, ValueAxis domainAxis,
ValueAxis rangeAxis, XYDataset dataset, int series, int item,
boolean selected, int pass) {
PlotOrientation orientation = plot.getOrientation();
if (orientation == PlotOrientation.HORIZONTAL) {
drawHorizontalItem(g2, state, dataArea, plot, domainAxis, rangeAxis,
dataset, series, item, selected, pass);
}
else if (orientation == PlotOrientation.VERTICAL) {
drawVerticalItem(g2, state, dataArea, plot, domainAxis, rangeAxis,
dataset, series, item, selected, pass);
}
}
|
void function(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, boolean selected, int pass) { PlotOrientation orientation = plot.getOrientation(); if (orientation == PlotOrientation.HORIZONTAL) { drawHorizontalItem(g2, state, dataArea, plot, domainAxis, rangeAxis, dataset, series, item, selected, pass); } else if (orientation == PlotOrientation.VERTICAL) { drawVerticalItem(g2, state, dataArea, plot, domainAxis, rangeAxis, dataset, series, item, selected, pass); } }
|
/**
* Draws the visual representation of a single data item.
*
* @param g2 the graphics device.
* @param state the renderer state.
* @param dataArea the area within which the plot is being drawn.
* @param plot the plot (can be used to obtain standard color
* information etc).
* @param domainAxis the domain axis.
* @param rangeAxis the range axis.
* @param dataset the dataset (must be an instance of
* {@link BoxAndWhiskerXYDataset}).
* @param series the series index (zero-based).
* @param item the item index (zero-based).
* @param pass the pass index.
*/
|
Draws the visual representation of a single data item
|
drawItem
|
{
"repo_name": "ilyessou/jfreechart",
"path": "source/org/jfree/chart/renderer/xy/XYBoxAndWhiskerRenderer.java",
"license": "lgpl-2.1",
"size": 31991
}
|
[
"java.awt.Graphics2D",
"java.awt.geom.Rectangle2D",
"org.jfree.chart.axis.ValueAxis",
"org.jfree.chart.plot.PlotOrientation",
"org.jfree.chart.plot.XYPlot",
"org.jfree.data.xy.XYDataset"
] |
import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; import org.jfree.data.xy.XYDataset;
|
import java.awt.*; import java.awt.geom.*; import org.jfree.chart.axis.*; import org.jfree.chart.plot.*; import org.jfree.data.xy.*;
|
[
"java.awt",
"org.jfree.chart",
"org.jfree.data"
] |
java.awt; org.jfree.chart; org.jfree.data;
| 196,826
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.