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 void errorUnsupportedIfMatchesKeyword(SqlLexerToken token, String... keywords) {
if (F.isEmpty(keywords))
return;
for (String keyword : keywords)
errorUnsupportedIfMatchesKeyword(token, keyword);
} | static void function(SqlLexerToken token, String... keywords) { if (F.isEmpty(keywords)) return; for (String keyword : keywords) errorUnsupportedIfMatchesKeyword(token, keyword); } | /**
* Throw unsupported token exception if one of passed keywords is found.
*
* @param token Token.
* @param keywords Keywords.
*/ | Throw unsupported token exception if one of passed keywords is found | errorUnsupportedIfMatchesKeyword | {
"repo_name": "NSAmelchev/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/sql/SqlParserUtils.java",
"license": "apache-2.0",
"size": 12916
} | [
"org.apache.ignite.internal.util.typedef.F"
] | import org.apache.ignite.internal.util.typedef.F; | import org.apache.ignite.internal.util.typedef.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 2,382,383 |
private void emitMetric(String name, String type, String value)
throws IOException {
String units = getUnits(name);
int slope = getSlope(name);
int tmax = getTmax(name);
int dmax = getDmax(name);
offset_ = 0;
xdr_int(0); // metric_user_defined
xdr_string(type);
xdr_string(name);
xdr_string(value);
xdr_string(units);
xdr_int(slope);
xdr_int(tmax);
xdr_int(dmax);
for (InetSocketAddress socketAddress : metricsServers_) {
DatagramPacket packet = new DatagramPacket(buffer_, offset_,
socketAddress);
datagramSocket_.send(packet);
}
}
| void function(String name, String type, String value) throws IOException { String units = getUnits(name); int slope = getSlope(name); int tmax = getTmax(name); int dmax = getDmax(name); offset_ = 0; xdr_int(0); xdr_string(type); xdr_string(name); xdr_string(value); xdr_string(units); xdr_int(slope); xdr_int(tmax); xdr_int(dmax); for (InetSocketAddress socketAddress : metricsServers_) { DatagramPacket packet = new DatagramPacket(buffer_, offset_, socketAddress); datagramSocket_.send(packet); } } | /**
* Helper which actually writes the metric in XDR format.
*
* @param name
* @param type
* @param value
* @throws IOException
*/ | Helper which actually writes the metric in XDR format | emitMetric | {
"repo_name": "toddlipcon/helenus",
"path": "src/java/com/facebook/infrastructure/analytics/AnalyticsContext.java",
"license": "apache-2.0",
"size": 20665
} | [
"java.io.IOException",
"java.net.DatagramPacket",
"java.net.InetSocketAddress"
] | import java.io.IOException; import java.net.DatagramPacket; import java.net.InetSocketAddress; | import java.io.*; import java.net.*; | [
"java.io",
"java.net"
] | java.io; java.net; | 1,480,057 |
public void setExperimenterCount(TreeImageSet expNode, int index, Object v)
{
if (expNode == null)
throw new IllegalArgumentException("Node not valid.");
Object ho = expNode.getUserObject();
if (!(ho instanceof ExperimenterData || ho instanceof GroupData))
throw new IllegalArgumentException("Node not valid.");
int browserType = model.getBrowserType();
if (!(browserType == IMAGES_EXPLORER || browserType == FILES_EXPLORER
|| browserType == TAGS_EXPLORER))
return;
boolean b = model.setExperimenterCount(expNode, index);
if (index != -1 && v != null) {
view.setCountValues(expNode, index, v);
}
if (b) view.getTreeDisplay().repaint();
model.getParentModel().setStatus(false, "", true);
fireStateChange();
} | void function(TreeImageSet expNode, int index, Object v) { if (expNode == null) throw new IllegalArgumentException(STR); Object ho = expNode.getUserObject(); if (!(ho instanceof ExperimenterData ho instanceof GroupData)) throw new IllegalArgumentException(STR); int browserType = model.getBrowserType(); if (!(browserType == IMAGES_EXPLORER browserType == FILES_EXPLORER browserType == TAGS_EXPLORER)) return; boolean b = model.setExperimenterCount(expNode, index); if (index != -1 && v != null) { view.setCountValues(expNode, index, v); } if (b) view.getTreeDisplay().repaint(); model.getParentModel().setStatus(false, "", true); fireStateChange(); } | /**
* Implemented as specified by the {@link Browser} interface.
* @see Browser#setExperimenterCount(TreeImageSet, int, int)
*/ | Implemented as specified by the <code>Browser</code> interface | setExperimenterCount | {
"repo_name": "tp81/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/browser/BrowserComponent.java",
"license": "gpl-2.0",
"size": 78666
} | [
"org.openmicroscopy.shoola.agents.util.browser.TreeImageSet"
] | import org.openmicroscopy.shoola.agents.util.browser.TreeImageSet; | import org.openmicroscopy.shoola.agents.util.browser.*; | [
"org.openmicroscopy.shoola"
] | org.openmicroscopy.shoola; | 1,749,650 |
public static BooleanValue ensureDef(BooleanFactory factory, Environment<?, ?> env,
BooleanValue value, DefCond ... dcs) {
if (!factory.noOverflow)
return value;
List<DefCond> univQuantInts = new ArrayList<DefCond>(dcs.length);
List<DefCond> extQuantInts = new ArrayList<DefCond>(dcs.length);
for (DefCond e : dcs) {
if (isUnivQuant(env, e))
univQuantInts.add(e);
else
extQuantInts.add(e);
}
BooleanValue ret = value;
if (!env.isNegated()) {
for (DefCond e : extQuantInts) ret = factory.and(ret, factory.not(e.getAccumOverflow()));
for (DefCond e : univQuantInts) ret = factory.or(ret, e.getAccumOverflow());
} else {
for (DefCond e : extQuantInts) ret = factory.or(ret, e.getAccumOverflow());
for (DefCond e : univQuantInts) ret = factory.and(ret, factory.not(e.getAccumOverflow()));
}
return ret;
} | static BooleanValue function(BooleanFactory factory, Environment<?, ?> env, BooleanValue value, DefCond ... dcs) { if (!factory.noOverflow) return value; List<DefCond> univQuantInts = new ArrayList<DefCond>(dcs.length); List<DefCond> extQuantInts = new ArrayList<DefCond>(dcs.length); for (DefCond e : dcs) { if (isUnivQuant(env, e)) univQuantInts.add(e); else extQuantInts.add(e); } BooleanValue ret = value; if (!env.isNegated()) { for (DefCond e : extQuantInts) ret = factory.and(ret, factory.not(e.getAccumOverflow())); for (DefCond e : univQuantInts) ret = factory.or(ret, e.getAccumOverflow()); } else { for (DefCond e : extQuantInts) ret = factory.or(ret, e.getAccumOverflow()); for (DefCond e : univQuantInts) ret = factory.and(ret, factory.not(e.getAccumOverflow())); } return ret; } | /**
* If overflow checking is disabled returns <code>value</code>. Otherwise,
* returns a conjunction of <code>value</code>, <code>lhs.accumOverflow</code>,
* and <code>rhs.accumOverflow</code>.
*
* ~~~ NOTE ~~~: Every time a BooleanValue is returned as a result of an operation
* over Ints, one of the <code>ensureNoOverflow</code> methods
* should be called.
*/ | If overflow checking is disabled returns <code>value</code>. Otherwise, returns a conjunction of <code>value</code>, <code>lhs.accumOverflow</code>, and <code>rhs.accumOverflow</code>. ~~~ NOTE ~~~: Every time a BooleanValue is returned as a result of an operation over Ints, one of the <code>ensureNoOverflow</code> methods should be called | ensureDef | {
"repo_name": "ModelWriter/Tarski",
"path": "Source/eu.modelwriter.alloyanalyzer/src/kodkod/engine/bool/DefCond.java",
"license": "epl-1.0",
"size": 4693
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,684,820 |
private void closeAnimate(View view, int position) {
if (opened.get(position)) {
generateRevealAnimate(view, true, false, position);
}
}
| void function(View view, int position) { if (opened.get(position)) { generateRevealAnimate(view, true, false, position); } } | /**
* Close item
*
* @param view
* affected view
* @param position
* Position of list
*/ | Close item | closeAnimate | {
"repo_name": "UnoZheng/Xmpp_Android_Client",
"path": "src/com/zxq/ui/swipelistview/SwipeListViewTouchListener.java",
"license": "apache-2.0",
"size": 22308
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 674,173 |
public synchronized void stop() throws IOException, TimeoutException {
if (this.stopped) {
return;
}
LOGGER.info("Stopping the " + GobblinYarnAppLauncher.class.getSimpleName());
try {
if (this.applicationId.isPresent() && !this.applicationCompleted) {
// Only send the shutdown message if the application has been successfully submitted and is still running
sendShutdownRequest();
}
if (this.serviceManager.isPresent()) {
this.serviceManager.get().stopAsync().awaitStopped(5, TimeUnit.MINUTES);
}
ExecutorsUtils.shutdownExecutorService(this.applicationStatusMonitor, Optional.of(LOGGER), 5, TimeUnit.MINUTES);
stopYarnClient();
disconnectHelixManager();
} finally {
try {
if (this.applicationId.isPresent()) {
cleanUpAppWorkDirectory(this.applicationId.get());
}
} finally {
this.closer.close();
}
}
this.stopped = true;
} | synchronized void function() throws IOException, TimeoutException { if (this.stopped) { return; } LOGGER.info(STR + GobblinYarnAppLauncher.class.getSimpleName()); try { if (this.applicationId.isPresent() && !this.applicationCompleted) { sendShutdownRequest(); } if (this.serviceManager.isPresent()) { this.serviceManager.get().stopAsync().awaitStopped(5, TimeUnit.MINUTES); } ExecutorsUtils.shutdownExecutorService(this.applicationStatusMonitor, Optional.of(LOGGER), 5, TimeUnit.MINUTES); stopYarnClient(); disconnectHelixManager(); } finally { try { if (this.applicationId.isPresent()) { cleanUpAppWorkDirectory(this.applicationId.get()); } } finally { this.closer.close(); } } this.stopped = true; } | /**
* Stop this {@link GobblinYarnAppLauncher} instance.
*
* @throws IOException if this {@link GobblinYarnAppLauncher} instance fails to clean up its working directory.
*/ | Stop this <code>GobblinYarnAppLauncher</code> instance | stop | {
"repo_name": "ydai1124/gobblin-1",
"path": "gobblin-yarn/src/main/java/gobblin/yarn/GobblinYarnAppLauncher.java",
"license": "apache-2.0",
"size": 37152
} | [
"com.google.common.base.Optional",
"java.io.IOException",
"java.util.concurrent.TimeUnit",
"java.util.concurrent.TimeoutException"
] | import com.google.common.base.Optional; import java.io.IOException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; | import com.google.common.base.*; import java.io.*; import java.util.concurrent.*; | [
"com.google.common",
"java.io",
"java.util"
] | com.google.common; java.io; java.util; | 1,215,407 |
EAttribute getTProcessEvents_Generate(); | EAttribute getTProcessEvents_Generate(); | /**
* Returns the meta object for the attribute '{@link org.eclipse.bpel.apache.ode.deploy.model.dd.TProcessEvents#getGenerate <em>Generate</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Generate</em>'.
* @see org.eclipse.bpel.apache.ode.deploy.model.dd.TProcessEvents#getGenerate()
* @see #getTProcessEvents()
* @generated
*/ | Returns the meta object for the attribute '<code>org.eclipse.bpel.apache.ode.deploy.model.dd.TProcessEvents#getGenerate Generate</code>'. | getTProcessEvents_Generate | {
"repo_name": "Drifftr/devstudio-tooling-bps",
"path": "plugins/org.eclipse.bpel.apache.ode.deploy.model/src/org/eclipse/bpel/apache/ode/deploy/model/dd/ddPackage.java",
"license": "apache-2.0",
"size": 68076
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,518,230 |
static Object[] getVarArgs(final Object[] args, final Class<?>[] methodParameterTypes) {
if (args.length == methodParameterTypes.length
&& args[args.length - 1].getClass().equals(methodParameterTypes[methodParameterTypes.length - 1])) {
// The args array is already in the canonical form for the method.
return args;
}
// Construct a new array matching the method's declared parameter types.
final Object[] newArgs = new Object[methodParameterTypes.length];
// Copy the normal (non-varargs) parameters
System.arraycopy(args, 0, newArgs, 0, methodParameterTypes.length - 1);
// Construct a new array for the variadic parameters
final Class<?> varArgComponentType = methodParameterTypes[methodParameterTypes.length - 1].getComponentType();
final int varArgLength = args.length - methodParameterTypes.length + 1;
Object varArgsArray = Array.newInstance(ClassUtils.primitiveToWrapper(varArgComponentType), varArgLength);
// Copy the variadic arguments into the varargs array.
System.arraycopy(args, methodParameterTypes.length - 1, varArgsArray, 0, varArgLength);
if(varArgComponentType.isPrimitive()) {
// unbox from wrapper type to primitive type
varArgsArray = ArrayUtils.toPrimitive(varArgsArray);
}
// Store the varargs array in the last position of the array to return
newArgs[methodParameterTypes.length - 1] = varArgsArray;
// Return the canonical varargs array.
return newArgs;
} | static Object[] getVarArgs(final Object[] args, final Class<?>[] methodParameterTypes) { if (args.length == methodParameterTypes.length && args[args.length - 1].getClass().equals(methodParameterTypes[methodParameterTypes.length - 1])) { return args; } final Object[] newArgs = new Object[methodParameterTypes.length]; System.arraycopy(args, 0, newArgs, 0, methodParameterTypes.length - 1); final Class<?> varArgComponentType = methodParameterTypes[methodParameterTypes.length - 1].getComponentType(); final int varArgLength = args.length - methodParameterTypes.length + 1; Object varArgsArray = Array.newInstance(ClassUtils.primitiveToWrapper(varArgComponentType), varArgLength); System.arraycopy(args, methodParameterTypes.length - 1, varArgsArray, 0, varArgLength); if(varArgComponentType.isPrimitive()) { varArgsArray = ArrayUtils.toPrimitive(varArgsArray); } newArgs[methodParameterTypes.length - 1] = varArgsArray; return newArgs; } | /**
* <p>Given an arguments array passed to a varargs method, return an array of arguments in the canonical form,
* i.e. an array with the declared number of parameters, and whose last parameter is an array of the varargs type.
* </p>
*
* @param args the array of arguments passed to the varags method
* @param methodParameterTypes the declared array of method parameter types
* @return an array of the variadic arguments passed to the method
* @since 3.5
*/ | Given an arguments array passed to a varargs method, return an array of arguments in the canonical form, i.e. an array with the declared number of parameters, and whose last parameter is an array of the varargs type. | getVarArgs | {
"repo_name": "weston100721/commons-lang",
"path": "src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java",
"license": "apache-2.0",
"size": 38642
} | [
"java.lang.reflect.Array",
"org.apache.commons.lang3.ArrayUtils",
"org.apache.commons.lang3.ClassUtils"
] | import java.lang.reflect.Array; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ClassUtils; | import java.lang.reflect.*; import org.apache.commons.lang3.*; | [
"java.lang",
"org.apache.commons"
] | java.lang; org.apache.commons; | 913,959 |
public static boolean contains(double[] self, Object value) {
for (double next : self) {
if (DefaultTypeTransformation.compareEqual(value, next)) return true;
}
return false;
} | static boolean function(double[] self, Object value) { for (double next : self) { if (DefaultTypeTransformation.compareEqual(value, next)) return true; } return false; } | /**
* Checks whether the array contains the given value.
*
* @param self the array we are searching
* @param value the value being searched for
* @return true if the array contains the value
* @since 1.8.6
*/ | Checks whether the array contains the given value | contains | {
"repo_name": "armsargis/groovy",
"path": "src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java",
"license": "apache-2.0",
"size": 698233
} | [
"org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation"
] | import org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation; | import org.codehaus.groovy.runtime.typehandling.*; | [
"org.codehaus.groovy"
] | org.codehaus.groovy; | 2,497,292 |
public static MetricsInfo info(String name, String description) {
Map<String, MetricsInfo> map = infoCache.getUnchecked(name);
MetricsInfo info = map.get(description);
if (info == null) {
info = new MetricsInfoImpl(name, description);
map.put(description, info);
}
return info;
} | static MetricsInfo function(String name, String description) { Map<String, MetricsInfo> map = infoCache.getUnchecked(name); MetricsInfo info = map.get(description); if (info == null) { info = new MetricsInfoImpl(name, description); map.put(description, info); } return info; } | /**
* Get a metric info object
*
* @return an interned metric info object
*/ | Get a metric info object | info | {
"repo_name": "JingchengDu/hbase",
"path": "hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/metrics/Interns.java",
"license": "apache-2.0",
"size": 3494
} | [
"java.util.Map",
"org.apache.hadoop.metrics2.MetricsInfo"
] | import java.util.Map; import org.apache.hadoop.metrics2.MetricsInfo; | import java.util.*; import org.apache.hadoop.metrics2.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 2,777,052 |
public String get(String url){
this.url = url;
httpGet = new HttpGet();
try {
httpGet.setURI(composeURI());
httpGet.setHeader("Cookie",composeCookieHeader());
return connect(httpGet);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
| String function(String url){ this.url = url; httpGet = new HttpGet(); try { httpGet.setURI(composeURI()); httpGet.setHeader(STR,composeCookieHeader()); return connect(httpGet); } catch (Exception e) { e.printStackTrace(); return null; } } | /**
* execute GET method
* @param url
* @return
*/ | execute GET method | get | {
"repo_name": "doomdagger/jextractor",
"path": "src/com/doomdagger/jextractor/addon/JExtractorFetchUrl.java",
"license": "apache-2.0",
"size": 11363
} | [
"org.apache.http.client.methods.HttpGet"
] | import org.apache.http.client.methods.HttpGet; | import org.apache.http.client.methods.*; | [
"org.apache.http"
] | org.apache.http; | 1,428,158 |
private List<String> getAllSortFieldNames() throws SolrServerException, IOException {
LukeRequest req = new LukeRequest("/admin/luke");
req.setShowSchema(true);
NamedList<Object> rsp = controlClient.request(req);
NamedList<Object> fields = (NamedList) ((NamedList)rsp.get("schema")).get("fields");
ArrayList<String> names = new ArrayList<>(fields.size());
for (Map.Entry<String,Object> item : fields) {
names.add(item.getKey());
}
return CursorPagingTest.pruneAndDeterministicallySort(names);
} | List<String> function() throws SolrServerException, IOException { LukeRequest req = new LukeRequest(STR); req.setShowSchema(true); NamedList<Object> rsp = controlClient.request(req); NamedList<Object> fields = (NamedList) ((NamedList)rsp.get(STR)).get(STR); ArrayList<String> names = new ArrayList<>(fields.size()); for (Map.Entry<String,Object> item : fields) { names.add(item.getKey()); } return CursorPagingTest.pruneAndDeterministicallySort(names); } | /**
* Asks the LukeRequestHandler on the control client for a list of the fields in the
* schema and then prunes that list down to just the fields that can be used for sorting,
* and returns them as an immutable list in a deterministically random order.
*/ | Asks the LukeRequestHandler on the control client for a list of the fields in the schema and then prunes that list down to just the fields that can be used for sorting, and returns them as an immutable list in a deterministically random order | getAllSortFieldNames | {
"repo_name": "q474818917/solr-5.2.0",
"path": "solr/core/src/test/org/apache/solr/cloud/DistribCursorPagingTest.java",
"license": "apache-2.0",
"size": 29693
} | [
"java.io.IOException",
"java.util.ArrayList",
"java.util.List",
"java.util.Map",
"org.apache.solr.CursorPagingTest",
"org.apache.solr.client.solrj.SolrServerException",
"org.apache.solr.client.solrj.request.LukeRequest",
"org.apache.solr.common.util.NamedList"
] | import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.solr.CursorPagingTest; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.request.LukeRequest; import org.apache.solr.common.util.NamedList; | import java.io.*; import java.util.*; import org.apache.solr.*; import org.apache.solr.client.solrj.*; import org.apache.solr.client.solrj.request.*; import org.apache.solr.common.util.*; | [
"java.io",
"java.util",
"org.apache.solr"
] | java.io; java.util; org.apache.solr; | 2,362,555 |
public static java.util.List extractTCIForPatientElectiveListList(ims.domain.ILightweightDomainFactory domainFactory, ims.RefMan.vo.ElectiveTCIForReferralDetailsVoCollection voCollection)
{
return extractTCIForPatientElectiveListList(domainFactory, voCollection, null, new HashMap());
}
| static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.RefMan.vo.ElectiveTCIForReferralDetailsVoCollection voCollection) { return extractTCIForPatientElectiveListList(domainFactory, voCollection, null, new HashMap()); } | /**
* Create the ims.RefMan.domain.objects.TCIForPatientElectiveList list from the value object collection.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param voCollection - the collection of value objects
*/ | Create the ims.RefMan.domain.objects.TCIForPatientElectiveList list from the value object collection | extractTCIForPatientElectiveListList | {
"repo_name": "FreudianNM/openMAXIMS",
"path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/RefMan/vo/domain/ElectiveTCIForReferralDetailsVoAssembler.java",
"license": "agpl-3.0",
"size": 20945
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 1,577,327 |
private void compressTable()
throws StandardException
{
long newHeapConglom;
Properties properties = new Properties();
RowLocation rl;
if (SanityManager.DEBUG)
{
if (lockGranularity != '\0')
{
SanityManager.THROWASSERT(
"lockGranularity expected to be '\0', not " +
lockGranularity);
}
SanityManager.ASSERT(! compressTable || columnInfo == null,
"columnInfo expected to be null");
SanityManager.ASSERT(constraintActions == null,
"constraintActions expected to be null");
}
ExecRow emptyHeapRow = td.getEmptyExecRow();
int[] collation_ids = td.getColumnCollationIds();
compressHeapCC =
tc.openConglomerate(
td.getHeapConglomerateId(),
false,
TransactionController.OPENMODE_FORUPDATE,
TransactionController.MODE_TABLE,
TransactionController.ISOLATION_SERIALIZABLE);
rl = compressHeapCC.newRowLocationTemplate();
// Get the properties on the old heap
compressHeapCC.getInternalTablePropertySet(properties);
compressHeapCC.close();
compressHeapCC = null;
// Create an array to put base row template
baseRow = new ExecRow[bulkFetchSize];
baseRowArray = new DataValueDescriptor[bulkFetchSize][];
validRow = new boolean[bulkFetchSize];
getAffectedIndexes();
// Get an array of RowLocation template
compressRL = new RowLocation[bulkFetchSize];
indexRows = new ExecIndexRow[numIndexes];
if (!compressTable)
{
// must be a drop column, thus the number of columns in the
// new template row and the collation template is one less.
ExecRow newRow =
activation.getExecutionFactory().getValueRow(
emptyHeapRow.nColumns() - 1);
int[] new_collation_ids = new int[collation_ids.length - 1];
for (int i = 0; i < newRow.nColumns(); i++)
{
newRow.setColumn(
i + 1,
i < droppedColumnPosition - 1 ?
emptyHeapRow.getColumn(i + 1) :
emptyHeapRow.getColumn(i + 1 + 1));
new_collation_ids[i] =
collation_ids[
(i < droppedColumnPosition - 1) ? i : (i + 1)];
}
emptyHeapRow = newRow;
collation_ids = new_collation_ids;
}
setUpAllSorts(emptyHeapRow, rl);
// Start by opening a full scan on the base table.
openBulkFetchScan(td.getHeapConglomerateId());
// Get the estimated row count for the sorters
estimatedRowCount = compressHeapGSC.getEstimatedRowCount();
// Create the array of base row template
for (int i = 0; i < bulkFetchSize; i++)
{
// create a base row template
baseRow[i] = td.getEmptyExecRow();
baseRowArray[i] = baseRow[i].getRowArray();
compressRL[i] = compressHeapGSC.newRowLocationTemplate();
}
newHeapConglom =
tc.createAndLoadConglomerate(
"heap",
emptyHeapRow.getRowArray(),
null, //column sort order - not required for heap
collation_ids,
properties,
TransactionController.IS_DEFAULT,
this,
(long[]) null);
closeBulkFetchScan();
// Set the "estimated" row count
ScanController compressHeapSC = tc.openScan(
newHeapConglom,
false,
TransactionController.OPENMODE_FORUPDATE,
TransactionController.MODE_TABLE,
TransactionController.ISOLATION_SERIALIZABLE,
(FormatableBitSet) null,
(DataValueDescriptor[]) null,
0,
(Qualifier[][]) null,
(DataValueDescriptor[]) null,
0);
compressHeapSC.setEstimatedRowCount(rowCount);
compressHeapSC.close();
compressHeapSC = null; // RESOLVE DJD CLEANUP
dd.startWriting(lcc);
// Update all indexes
if (compressIRGs.length > 0)
{
updateAllIndexes(newHeapConglom, dd);
}
// Get the ConglomerateDescriptor for the heap
long oldHeapConglom = td.getHeapConglomerateId();
ConglomerateDescriptor cd =
td.getConglomerateDescriptor(oldHeapConglom);
// Update sys.sysconglomerates with new conglomerate #
dd.updateConglomerateDescriptor(cd, newHeapConglom, tc);
// Now that the updated information is available in the system tables,
// we should invalidate all statements that use the old conglomerates
dm.invalidateFor(td, DependencyManager.COMPRESS_TABLE, lcc);
// Drop the old conglomerate
tc.dropConglomerate(oldHeapConglom);
cleanUp();
}
| void function() throws StandardException { long newHeapConglom; Properties properties = new Properties(); RowLocation rl; if (SanityManager.DEBUG) { if (lockGranularity != '\0') { SanityManager.THROWASSERT( STR + lockGranularity); } SanityManager.ASSERT(! compressTable columnInfo == null, STR); SanityManager.ASSERT(constraintActions == null, STR); } ExecRow emptyHeapRow = td.getEmptyExecRow(); int[] collation_ids = td.getColumnCollationIds(); compressHeapCC = tc.openConglomerate( td.getHeapConglomerateId(), false, TransactionController.OPENMODE_FORUPDATE, TransactionController.MODE_TABLE, TransactionController.ISOLATION_SERIALIZABLE); rl = compressHeapCC.newRowLocationTemplate(); compressHeapCC.getInternalTablePropertySet(properties); compressHeapCC.close(); compressHeapCC = null; baseRow = new ExecRow[bulkFetchSize]; baseRowArray = new DataValueDescriptor[bulkFetchSize][]; validRow = new boolean[bulkFetchSize]; getAffectedIndexes(); compressRL = new RowLocation[bulkFetchSize]; indexRows = new ExecIndexRow[numIndexes]; if (!compressTable) { ExecRow newRow = activation.getExecutionFactory().getValueRow( emptyHeapRow.nColumns() - 1); int[] new_collation_ids = new int[collation_ids.length - 1]; for (int i = 0; i < newRow.nColumns(); i++) { newRow.setColumn( i + 1, i < droppedColumnPosition - 1 ? emptyHeapRow.getColumn(i + 1) : emptyHeapRow.getColumn(i + 1 + 1)); new_collation_ids[i] = collation_ids[ (i < droppedColumnPosition - 1) ? i : (i + 1)]; } emptyHeapRow = newRow; collation_ids = new_collation_ids; } setUpAllSorts(emptyHeapRow, rl); openBulkFetchScan(td.getHeapConglomerateId()); estimatedRowCount = compressHeapGSC.getEstimatedRowCount(); for (int i = 0; i < bulkFetchSize; i++) { baseRow[i] = td.getEmptyExecRow(); baseRowArray[i] = baseRow[i].getRowArray(); compressRL[i] = compressHeapGSC.newRowLocationTemplate(); } newHeapConglom = tc.createAndLoadConglomerate( "heap", emptyHeapRow.getRowArray(), null, collation_ids, properties, TransactionController.IS_DEFAULT, this, (long[]) null); closeBulkFetchScan(); ScanController compressHeapSC = tc.openScan( newHeapConglom, false, TransactionController.OPENMODE_FORUPDATE, TransactionController.MODE_TABLE, TransactionController.ISOLATION_SERIALIZABLE, (FormatableBitSet) null, (DataValueDescriptor[]) null, 0, (Qualifier[][]) null, (DataValueDescriptor[]) null, 0); compressHeapSC.setEstimatedRowCount(rowCount); compressHeapSC.close(); compressHeapSC = null; dd.startWriting(lcc); if (compressIRGs.length > 0) { updateAllIndexes(newHeapConglom, dd); } long oldHeapConglom = td.getHeapConglomerateId(); ConglomerateDescriptor cd = td.getConglomerateDescriptor(oldHeapConglom); dd.updateConglomerateDescriptor(cd, newHeapConglom, tc); dm.invalidateFor(td, DependencyManager.COMPRESS_TABLE, lcc); tc.dropConglomerate(oldHeapConglom); cleanUp(); } | /**
* routine to process compress table or ALTER TABLE <t> DROP COLUMN <c>;
* <p>
* Uses class level variable "compressTable" to determine if processing
* compress table or drop column:
* if (!compressTable)
* must be drop column.
* <p>
* Handles rebuilding of base conglomerate and all necessary indexes.
**/ | routine to process compress table or ALTER TABLE DROP COLUMN ; Uses class level variable "compressTable" to determine if processing compress table or drop column: if (!compressTable) must be drop column. Handles rebuilding of base conglomerate and all necessary indexes | compressTable | {
"repo_name": "trejkaz/derby",
"path": "java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java",
"license": "apache-2.0",
"size": 131348
} | [
"java.util.Properties",
"org.apache.derby.iapi.error.StandardException",
"org.apache.derby.iapi.services.io.FormatableBitSet",
"org.apache.derby.iapi.sql.depend.DependencyManager",
"org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor",
"org.apache.derby.iapi.sql.execute.ExecIndexRow",
"org.apach... | import java.util.Properties; import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.services.io.FormatableBitSet; import org.apache.derby.iapi.sql.depend.DependencyManager; import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor; import org.apache.derby.iapi.sql.execute.ExecIndexRow; import org.apache.derby.iapi.sql.execute.ExecRow; import org.apache.derby.iapi.store.access.Qualifier; import org.apache.derby.iapi.store.access.ScanController; import org.apache.derby.iapi.store.access.TransactionController; import org.apache.derby.iapi.types.DataValueDescriptor; import org.apache.derby.iapi.types.RowLocation; import org.apache.derby.shared.common.sanity.SanityManager; | import java.util.*; import org.apache.derby.iapi.error.*; import org.apache.derby.iapi.services.io.*; import org.apache.derby.iapi.sql.depend.*; import org.apache.derby.iapi.sql.dictionary.*; import org.apache.derby.iapi.sql.execute.*; import org.apache.derby.iapi.store.access.*; import org.apache.derby.iapi.types.*; import org.apache.derby.shared.common.sanity.*; | [
"java.util",
"org.apache.derby"
] | java.util; org.apache.derby; | 332,071 |
protected Collection<String> getInitialObjectNames() {
if (initialObjectNames == null) {
initialObjectNames = new ArrayList<String>();
for (EClassifier eClassifier : mobaIndexPackage.getEClassifiers()) {
if (eClassifier instanceof EClass) {
EClass eClass = (EClass)eClassifier;
if (!eClass.isAbstract()) {
initialObjectNames.add(eClass.getName());
}
}
}
Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
}
return initialObjectNames;
} | Collection<String> function() { if (initialObjectNames == null) { initialObjectNames = new ArrayList<String>(); for (EClassifier eClassifier : mobaIndexPackage.getEClassifiers()) { if (eClassifier instanceof EClass) { EClass eClass = (EClass)eClassifier; if (!eClass.isAbstract()) { initialObjectNames.add(eClass.getName()); } } } Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); } return initialObjectNames; } | /**
* Returns the names of the types that can be created as the root object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | Returns the names of the types that can be created as the root object. | getInitialObjectNames | {
"repo_name": "florianpirchner/mobadsl",
"path": "org.mobadsl.semantic.model.editor/src/org/mobadsl/semantic/model/moba/index/presentation/MobaIndexModelWizard.java",
"license": "apache-2.0",
"size": 17817
} | [
"java.util.ArrayList",
"java.util.Collection",
"java.util.Collections",
"org.eclipse.emf.common.CommonPlugin",
"org.eclipse.emf.ecore.EClass",
"org.eclipse.emf.ecore.EClassifier"
] | import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import org.eclipse.emf.common.CommonPlugin; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EClassifier; | import java.util.*; import org.eclipse.emf.common.*; import org.eclipse.emf.ecore.*; | [
"java.util",
"org.eclipse.emf"
] | java.util; org.eclipse.emf; | 2,771,348 |
public static boolean wakeUpSession(@NonNull Context context) {
return wakeUpSession(context, null);
} | static boolean function(@NonNull Context context) { return wakeUpSession(context, null); } | /**
* Checks if an access token exist and performs a try to use it again
*
* @param context An application context for store an access token
* @return true, if an access token exists and not expired
*/ | Checks if an access token exist and performs a try to use it again | wakeUpSession | {
"repo_name": "DrMoriarty/cordova-social-vk",
"path": "src/android/vksdk_library/src/com/vk/sdk/VKSdk.java",
"license": "apache-2.0",
"size": 21043
} | [
"android.content.Context",
"com.android.annotations.NonNull"
] | import android.content.Context; import com.android.annotations.NonNull; | import android.content.*; import com.android.annotations.*; | [
"android.content",
"com.android.annotations"
] | android.content; com.android.annotations; | 1,133,010 |
public String findInLine(String pattern) {
return findInLine(Pattern.compile(pattern));
}
/**
* Tries to find the pattern in the input between the current position and the specified
* horizon. Delimiters are ignored. If the pattern is found, the matched
* string will be returned, and the {@code Scanner} will advance to the end of the
* matched string. Otherwise, null will be returned and {@code Scanner} will not
* advance. When waiting for input, the {@code Scanner} may be blocked.
* <p>
* The {@code Scanner}'s search will never go more than {@code horizon} code points from current
* position. The position of {@code horizon} does have an effect on the result of the
* match. For example, when the input is "123" and current position is at zero,
* {@code findWithinHorizon(Pattern.compile("\\p{Digit}{3}"), 2)}
* will return {@code null}. While
* {@code findWithinHorizon(Pattern.compile("\\p{Digit}{3}"), 3)} | String function(String pattern) { return findInLine(Pattern.compile(pattern)); } /** * Tries to find the pattern in the input between the current position and the specified * horizon. Delimiters are ignored. If the pattern is found, the matched * string will be returned, and the {@code Scanner} will advance to the end of the * matched string. Otherwise, null will be returned and {@code Scanner} will not * advance. When waiting for input, the {@code Scanner} may be blocked. * <p> * The {@code Scanner}'s search will never go more than {@code horizon} code points from current * position. The position of {@code horizon} does have an effect on the result of the * match. For example, when the input is "123" and current position is at zero, * {@code findWithinHorizon(Pattern.compile(STR), 2)} * will return {@code null}. While * {@code findWithinHorizon(Pattern.compile(STR), 3)} | /**
* Compiles the pattern string and tries to find a substing matching it in the input data. The
* delimiter will be ignored. This is the same as invoking
* {@code findInLine(Pattern.compile(pattern))}.
*
* @param pattern
* a string used to construct a pattern which is in turn used to
* match a substring of the input data.
* @return the matched string or {@code null} if the pattern is not found
* before the next line terminator.
* @throws IllegalStateException
* if the {@code Scanner} is closed.
* @see #findInLine(Pattern)
*/ | Compiles the pattern string and tries to find a substing matching it in the input data. The delimiter will be ignored. This is the same as invoking findInLine(Pattern.compile(pattern)) | findInLine | {
"repo_name": "freeVM/freeVM",
"path": "enhanced/java/classlib/modules/luni/src/main/java/java/util/Scanner.java",
"license": "apache-2.0",
"size": 85607
} | [
"java.util.regex.Pattern"
] | import java.util.regex.Pattern; | import java.util.regex.*; | [
"java.util"
] | java.util; | 1,589,187 |
protected void assertSimplify(String sql, String expected) {
SqlAdvisor advisor = tester.getFactory().createAdvisor();
SqlParserUtil.StringAndPos sap = SqlParserUtil.findPos(sql);
String actual = advisor.simplifySql(sap.sql, sap.cursor);
Assert.assertEquals(expected, actual);
} | void function(String sql, String expected) { SqlAdvisor advisor = tester.getFactory().createAdvisor(); SqlParserUtil.StringAndPos sap = SqlParserUtil.findPos(sql); String actual = advisor.simplifySql(sap.sql, sap.cursor); Assert.assertEquals(expected, actual); } | /**
* Tests that a given SQL statement simplifies to the salesTables result.
*
* @param sql SQL statement to simplify. The SQL statement must contain
* precisely one caret '^', which marks the location where
* completion is to occur.
* @param expected Expected result after simplification.
*/ | Tests that a given SQL statement simplifies to the salesTables result | assertSimplify | {
"repo_name": "dindin5258/calcite",
"path": "core/src/test/java/org/apache/calcite/sql/test/SqlAdvisorTest.java",
"license": "apache-2.0",
"size": 52601
} | [
"org.apache.calcite.sql.advise.SqlAdvisor",
"org.apache.calcite.sql.parser.SqlParserUtil",
"org.junit.Assert"
] | import org.apache.calcite.sql.advise.SqlAdvisor; import org.apache.calcite.sql.parser.SqlParserUtil; import org.junit.Assert; | import org.apache.calcite.sql.advise.*; import org.apache.calcite.sql.parser.*; import org.junit.*; | [
"org.apache.calcite",
"org.junit"
] | org.apache.calcite; org.junit; | 994,724 |
void enterInferredFormalParameterList(@NotNull Java8Parser.InferredFormalParameterListContext ctx); | void enterInferredFormalParameterList(@NotNull Java8Parser.InferredFormalParameterListContext ctx); | /**
* Enter a parse tree produced by {@link Java8Parser#inferredFormalParameterList}.
*
* @param ctx the parse tree
*/ | Enter a parse tree produced by <code>Java8Parser#inferredFormalParameterList</code> | enterInferredFormalParameterList | {
"repo_name": "BigDaddy-Germany/WHOAMI",
"path": "WHOAMI/src/de/aima13/whoami/modules/syntaxcheck/languages/antlrgen/Java8Listener.java",
"license": "mit",
"size": 97945
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 100,496 |
public void assertContainsOnlyDigits(AssertionInfo info, CharSequence actual) {
assertNotNull(info, actual);
if (actual.length() == 0) throw failures.failure(info, shouldContainOnlyDigits(actual));
for (int index = 0; index < actual.length(); index++) {
char character = actual.charAt(index);
if (!isDigit(character)) throw failures.failure(info, shouldContainOnlyDigits(actual, character, index));
}
} | void function(AssertionInfo info, CharSequence actual) { assertNotNull(info, actual); if (actual.length() == 0) throw failures.failure(info, shouldContainOnlyDigits(actual)); for (int index = 0; index < actual.length(); index++) { char character = actual.charAt(index); if (!isDigit(character)) throw failures.failure(info, shouldContainOnlyDigits(actual, character, index)); } } | /**
* Verifies that the given {@code CharSequence} contains only digits.
*
* @param info contains information about the assertion.
* @param actual the given {@code CharSequence}.
* @throws NullPointerException if {@code actual} is {@code null}.
* @throws AssertionError if {@code actual} contains non-digit characters or contains no digits at all.
*/ | Verifies that the given CharSequence contains only digits | assertContainsOnlyDigits | {
"repo_name": "xasx/assertj-core",
"path": "src/main/java/org/assertj/core/internal/Strings.java",
"license": "apache-2.0",
"size": 53576
} | [
"org.assertj.core.api.AssertionInfo",
"org.assertj.core.error.ShouldContainOnlyDigits"
] | import org.assertj.core.api.AssertionInfo; import org.assertj.core.error.ShouldContainOnlyDigits; | import org.assertj.core.api.*; import org.assertj.core.error.*; | [
"org.assertj.core"
] | org.assertj.core; | 2,731,737 |
public void setPeopleDirectoryService(
com.rivetlogic.service.PeopleDirectoryService peopleDirectoryService) {
this.peopleDirectoryService = peopleDirectoryService;
} | void function( com.rivetlogic.service.PeopleDirectoryService peopleDirectoryService) { this.peopleDirectoryService = peopleDirectoryService; } | /**
* Sets the people directory remote service.
*
* @param peopleDirectoryService the people directory remote service
*/ | Sets the people directory remote service | setPeopleDirectoryService | {
"repo_name": "rivetlogic/mobile-people-directory",
"path": "portlets/people-directory-services-portlet/docroot/WEB-INF/src/com/rivetlogic/service/base/PeopleDirectoryServiceBaseImpl.java",
"license": "gpl-3.0",
"size": 7209
} | [
"com.rivetlogic.service.PeopleDirectoryService"
] | import com.rivetlogic.service.PeopleDirectoryService; | import com.rivetlogic.service.*; | [
"com.rivetlogic.service"
] | com.rivetlogic.service; | 1,115,200 |
private List<IndicatorFormulaIdentifier> getNonExistingIdentifiersInIndicators()
{
List<IndicatorFormulaIdentifier> identifiers = new ArrayList<>();
for ( Indicator indicator : indicators )
{
Set<DataElementOperand> operands = expressionService.getOperandsInExpression( indicator.getNumerator() );
for ( DataElementOperand operand : operands )
{
if ( !dataElementIdentifiers.contains( operand.getDataElementId() ) )
{
identifiers.add( new IndicatorFormulaIdentifier( indicator.getName(), NUMERATOR, operand.getDataElementId() ) );
}
}
operands = expressionService.getOperandsInExpression( indicator.getDenominator() );
for ( DataElementOperand operand : operands )
{
if ( !dataElementIdentifiers.contains( operand.getDataElementId() ) )
{
identifiers.add( new IndicatorFormulaIdentifier( indicator.getName(), DENOMINATOR, operand.getDataElementId() ) );
}
}
}
log.info( "Found " + identifiers.size() + " non-existing data element identifiers after searching " + indicators.size() + " indicators" );
return identifiers;
}
| List<IndicatorFormulaIdentifier> function() { List<IndicatorFormulaIdentifier> identifiers = new ArrayList<>(); for ( Indicator indicator : indicators ) { Set<DataElementOperand> operands = expressionService.getOperandsInExpression( indicator.getNumerator() ); for ( DataElementOperand operand : operands ) { if ( !dataElementIdentifiers.contains( operand.getDataElementId() ) ) { identifiers.add( new IndicatorFormulaIdentifier( indicator.getName(), NUMERATOR, operand.getDataElementId() ) ); } } operands = expressionService.getOperandsInExpression( indicator.getDenominator() ); for ( DataElementOperand operand : operands ) { if ( !dataElementIdentifiers.contains( operand.getDataElementId() ) ) { identifiers.add( new IndicatorFormulaIdentifier( indicator.getName(), DENOMINATOR, operand.getDataElementId() ) ); } } } log.info( STR + identifiers.size() + STR + indicators.size() + STR ); return identifiers; } | /**
* Sorts out non-existing data element identifiers in indicator numerator and
* denominators.
*/ | Sorts out non-existing data element identifiers in indicator numerator and denominators | getNonExistingIdentifiersInIndicators | {
"repo_name": "kakada/dhis2",
"path": "dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/analysis/DefaultImportAnalyser.java",
"license": "bsd-3-clause",
"size": 9180
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.Set",
"org.hisp.dhis.dataelement.DataElementOperand",
"org.hisp.dhis.indicator.Indicator"
] | import java.util.ArrayList; import java.util.List; import java.util.Set; import org.hisp.dhis.dataelement.DataElementOperand; import org.hisp.dhis.indicator.Indicator; | import java.util.*; import org.hisp.dhis.dataelement.*; import org.hisp.dhis.indicator.*; | [
"java.util",
"org.hisp.dhis"
] | java.util; org.hisp.dhis; | 2,297,493 |
private NodeConnector findHost(InetAddress srcIP){
Set<NodeConnector> connectors = this.topologyManager.getNodeConnectorWithHost();
for (Iterator<NodeConnector> it = connectors.iterator(); it.hasNext(); ) {
NodeConnector temp = it.next();
List<Host> hosts= this.topologyManager.getHostsAttachedToNodeConnector(temp);
for(Iterator<Host> ith = hosts.iterator(); ith.hasNext();){
Host temp2 = ith.next();
if(temp2.getNetworkAddress().equals(srcIP)){
return temp;
}
}
}
return null;
} | NodeConnector function(InetAddress srcIP){ Set<NodeConnector> connectors = this.topologyManager.getNodeConnectorWithHost(); for (Iterator<NodeConnector> it = connectors.iterator(); it.hasNext(); ) { NodeConnector temp = it.next(); List<Host> hosts= this.topologyManager.getHostsAttachedToNodeConnector(temp); for(Iterator<Host> ith = hosts.iterator(); ith.hasNext();){ Host temp2 = ith.next(); if(temp2.getNetworkAddress().equals(srcIP)){ return temp; } } } return null; } | /**
*This function return the NodeConnector where a Host is attached
*@param srcIP The inetAddress
*@return NodeConnector The NodeConnector where the InetAddress is attached
*/ | This function return the NodeConnector where a Host is attached | findHost | {
"repo_name": "alfonsito92/routeApp",
"path": "src/main/java/ugr/cristian/routeApp/RouteHandler.java",
"license": "gpl-3.0",
"size": 42604
} | [
"java.net.InetAddress",
"java.util.Iterator",
"java.util.List",
"java.util.Set",
"org.opendaylight.controller.sal.core.Host",
"org.opendaylight.controller.sal.core.NodeConnector"
] | import java.net.InetAddress; import java.util.Iterator; import java.util.List; import java.util.Set; import org.opendaylight.controller.sal.core.Host; import org.opendaylight.controller.sal.core.NodeConnector; | import java.net.*; import java.util.*; import org.opendaylight.controller.sal.core.*; | [
"java.net",
"java.util",
"org.opendaylight.controller"
] | java.net; java.util; org.opendaylight.controller; | 859,176 |
public void fatal(String message) {
log(message, Level.FATAL);
} | void function(String message) { log(message, Level.FATAL); } | /**
* Logs a message object to the Coordinator log with the {@link Level#FATAL} Level.
*
* @param message the message object to log
*/ | Logs a message object to the Coordinator log with the <code>Level#FATAL</code> Level | fatal | {
"repo_name": "hasancelik/hazelcast-stabilizer",
"path": "simulator/src/main/java/com/hazelcast/simulator/common/CoordinatorLogger.java",
"license": "apache-2.0",
"size": 2832
} | [
"org.apache.log4j.Level"
] | import org.apache.log4j.Level; | import org.apache.log4j.*; | [
"org.apache.log4j"
] | org.apache.log4j; | 2,885,821 |
protected void resetSpineBean(final SpineBean sBean, final Object wrapper) {
sBean.setDescription("");
sBean.setModifiedDate(new Date());
}
| void function(final SpineBean sBean, final Object wrapper) { sBean.setDescription(""); sBean.setModifiedDate(new Date()); } | /**
* Resets the SpineBean by reseting Modified date and the bean's description
*
* @param sBean The SpineBean to reset
* @param wrapper The object passed to this method, is not used in this implementation
*/ | Resets the SpineBean by reseting Modified date and the bean's description | resetSpineBean | {
"repo_name": "davidlad123/spine",
"path": "spine/src/com/zphinx/spine/core/AbstractBuilder.java",
"license": "gpl-3.0",
"size": 10437
} | [
"com.zphinx.spine.vo.dto.SpineBean",
"java.util.Date"
] | import com.zphinx.spine.vo.dto.SpineBean; import java.util.Date; | import com.zphinx.spine.vo.dto.*; import java.util.*; | [
"com.zphinx.spine",
"java.util"
] | com.zphinx.spine; java.util; | 1,716,123 |
public static Range findRangeBounds(CategoryDataset dataset) {
return findRangeBounds(dataset, true);
}
| static Range function(CategoryDataset dataset) { return findRangeBounds(dataset, true); } | /**
* Returns the range of values in the range for the dataset.
*
* @param dataset the dataset (<code>null</code> not permitted).
*
* @return The range (possibly <code>null</code>).
*/ | Returns the range of values in the range for the dataset | findRangeBounds | {
"repo_name": "sebkur/JFreeChart",
"path": "src/main/java/org/jfree/data/general/DatasetUtilities.java",
"license": "lgpl-3.0",
"size": 97375
} | [
"org.jfree.data.Range",
"org.jfree.data.category.CategoryDataset"
] | import org.jfree.data.Range; import org.jfree.data.category.CategoryDataset; | import org.jfree.data.*; import org.jfree.data.category.*; | [
"org.jfree.data"
] | org.jfree.data; | 2,137,943 |
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<RoleDefinitionInner> getWithResponse(String scope, String roleDefinitionId, Context context) {
return getWithResponseAsync(scope, roleDefinitionId, context).block();
} | @ServiceMethod(returns = ReturnType.SINGLE) Response<RoleDefinitionInner> function(String scope, String roleDefinitionId, Context context) { return getWithResponseAsync(scope, roleDefinitionId, context).block(); } | /**
* Get role definition by name (GUID).
*
* @param scope The scope of the role definition.
* @param roleDefinitionId The ID of the role definition.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return role definition by name (GUID).
*/ | Get role definition by name (GUID) | getWithResponse | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-authorization/src/main/java/com/azure/resourcemanager/authorization/implementation/RoleDefinitionsClientImpl.java",
"license": "mit",
"size": 42857
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context",
"com.azure.resourcemanager.authorization.fluent.models.RoleDefinitionInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.authorization.fluent.models.RoleDefinitionInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.authorization.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,227,775 |
public static <D, W, I extends D> void testMethodForwarding(
Class<D> delegateClass,
Function<I, W> wrapperFactory,
Supplier<I> delegateObjectSupplier)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
testMethodForwarding(delegateClass, wrapperFactory, delegateObjectSupplier, Collections.emptySet());
} | static <D, W, I extends D> void function( Class<D> delegateClass, Function<I, W> wrapperFactory, Supplier<I> delegateObjectSupplier) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { testMethodForwarding(delegateClass, wrapperFactory, delegateObjectSupplier, Collections.emptySet()); } | /**
* This is a best effort automatic test for method forwarding between a delegate and its wrapper, where the wrapper
* class is a subtype of the delegate. This ignores methods that are inherited from Object.
*
* @param delegateClass the class for the delegate.
* @param wrapperFactory factory that produces a wrapper from a delegate.
* @param delegateObjectSupplier supplier for the delegate object passed to the wrapper factory.
* @param <D> type of the delegate
* @param <W> type of the wrapper
* @param <I> type of the object created as delegate, is a subtype of D.
*/ | This is a best effort automatic test for method forwarding between a delegate and its wrapper, where the wrapper class is a subtype of the delegate. This ignores methods that are inherited from Object | testMethodForwarding | {
"repo_name": "hequn8128/flink",
"path": "flink-core/src/test/java/org/apache/flink/util/MethodForwardingTestUtil.java",
"license": "apache-2.0",
"size": 6961
} | [
"java.lang.reflect.InvocationTargetException",
"java.util.Collections",
"java.util.function.Function",
"java.util.function.Supplier"
] | import java.lang.reflect.InvocationTargetException; import java.util.Collections; import java.util.function.Function; import java.util.function.Supplier; | import java.lang.reflect.*; import java.util.*; import java.util.function.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 1,112,536 |
static Map getOrCreateExpectedTypeMap(Class pExpectedType) {
synchronized (sCachedExpectedTypes) {
Map ret = (Map) sCachedExpectedTypes.get(pExpectedType);
if (ret == null) {
ret = Collections.synchronizedMap(new HashMap());
sCachedExpectedTypes.put(pExpectedType, ret);
}
return ret;
}
}
//------------------------------------- | static Map getOrCreateExpectedTypeMap(Class pExpectedType) { synchronized (sCachedExpectedTypes) { Map ret = (Map) sCachedExpectedTypes.get(pExpectedType); if (ret == null) { ret = Collections.synchronizedMap(new HashMap()); sCachedExpectedTypes.put(pExpectedType, ret); } return ret; } } | /**
* Creates or returns the Map that maps string literals to parsed
* values for the specified expected type.
*/ | Creates or returns the Map that maps string literals to parsed values for the specified expected type | getOrCreateExpectedTypeMap | {
"repo_name": "ctomc/jboss-jstl-api_spec",
"path": "src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java",
"license": "apache-2.0",
"size": 18228
} | [
"java.util.Collections",
"java.util.HashMap",
"java.util.Map"
] | import java.util.Collections; import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,077,502 |
@Override
public boolean isSameRM(XAResource xares) {
debugCode("isSameRM(xares);");
return xares == this;
} | boolean function(XAResource xares) { debugCode(STR); return xares == this; } | /**
* Checks if this is the same XAResource.
*
* @param xares the other object
* @return true if this is the same object
*/ | Checks if this is the same XAResource | isSameRM | {
"repo_name": "miloszpiglas/h2mod",
"path": "src/main/org/h2/jdbcx/JdbcXAConnection.java",
"license": "mpl-2.0",
"size": 14282
} | [
"javax.transaction.xa.XAResource"
] | import javax.transaction.xa.XAResource; | import javax.transaction.xa.*; | [
"javax.transaction"
] | javax.transaction; | 2,475,561 |
private void indicateInternalUsage() {
lblPicture.setIcon(new ImageIcon(StadtbilderUtils.ERROR_IMAGE));
lblPicture.setText("<html>Bild ist nicht zur Publikation freigegeben!</html>");
lblPicture.setToolTipText("");
showWait(false);
} | void function() { lblPicture.setIcon(new ImageIcon(StadtbilderUtils.ERROR_IMAGE)); lblPicture.setText(STR); lblPicture.setToolTipText(""); showWait(false); } | /**
* DOCUMENT ME!
*/ | DOCUMENT ME | indicateInternalUsage | {
"repo_name": "cismet/cids-custom-wuppertal",
"path": "src/main/java/de/cismet/cids/custom/objecteditors/utils/Sb_StadtbildPreviewImage.java",
"license": "lgpl-3.0",
"size": 33015
} | [
"de.cismet.cids.custom.utils.StadtbilderUtils",
"javax.swing.ImageIcon"
] | import de.cismet.cids.custom.utils.StadtbilderUtils; import javax.swing.ImageIcon; | import de.cismet.cids.custom.utils.*; import javax.swing.*; | [
"de.cismet.cids",
"javax.swing"
] | de.cismet.cids; javax.swing; | 856,978 |
public CommandInfo setChatType(Chat.Type type) {
chatType = type;
return this;
} | CommandInfo function(Chat.Type type) { chatType = type; return this; } | /**
* Restricts the command to only the given type of chat.
*
* @param type The type of chat to restrict the command to.
*
* @return this
*/ | Restricts the command to only the given type of chat | setChatType | {
"repo_name": "rasmussaks/chatty",
"path": "src/main/java/org/superfuntime/chatty/commands/CommandInfo.java",
"license": "gpl-2.0",
"size": 6536
} | [
"org.superfuntime.chatty.chat.Chat"
] | import org.superfuntime.chatty.chat.Chat; | import org.superfuntime.chatty.chat.*; | [
"org.superfuntime.chatty"
] | org.superfuntime.chatty; | 2,718,602 |
synchronized Token<BlockTokenIdentifier> getBlockToken() {
return getStreamer().getBlockToken();
} | synchronized Token<BlockTokenIdentifier> getBlockToken() { return getStreamer().getBlockToken(); } | /**
* Returns the access token currently used by streamer, for testing only
*/ | Returns the access token currently used by streamer, for testing only | getBlockToken | {
"repo_name": "adouang/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java",
"license": "apache-2.0",
"size": 33931
} | [
"org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier",
"org.apache.hadoop.security.token.Token"
] | import org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier; import org.apache.hadoop.security.token.Token; | import org.apache.hadoop.hdfs.security.token.block.*; import org.apache.hadoop.security.token.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,679,095 |
@Ignore
@Test
public void testLoginAndLogout()
throws Exception
{
String username = "kapua-sys";
char[] password = "kapua-password".toCharArray();
KapuaLocator locator = KapuaLocator.getInstance();
UsernamePasswordTokenFactory usernamePasswordTokenFactory = locator.getFactory(UsernamePasswordTokenFactory.class);
UsernamePasswordToken credentialsToken = usernamePasswordTokenFactory.newInstance(username, password);
AuthenticationService authenticationService = locator.getService(AuthenticationService.class);
authenticationService.login(credentialsToken);
Subject currentSubject = SecurityUtils.getSubject();
assertTrue(currentSubject.isAuthenticated());
assertEquals(username, currentSubject.getPrincipal());
authenticationService.logout();
assertFalse(currentSubject.isAuthenticated());
assertNull(currentSubject.getPrincipal());
} | void function() throws Exception { String username = STR; char[] password = STR.toCharArray(); KapuaLocator locator = KapuaLocator.getInstance(); UsernamePasswordTokenFactory usernamePasswordTokenFactory = locator.getFactory(UsernamePasswordTokenFactory.class); UsernamePasswordToken credentialsToken = usernamePasswordTokenFactory.newInstance(username, password); AuthenticationService authenticationService = locator.getService(AuthenticationService.class); authenticationService.login(credentialsToken); Subject currentSubject = SecurityUtils.getSubject(); assertTrue(currentSubject.isAuthenticated()); assertEquals(username, currentSubject.getPrincipal()); authenticationService.logout(); assertFalse(currentSubject.isAuthenticated()); assertNull(currentSubject.getPrincipal()); } | /**
* We should ignore this test until schema loading feature is provided.
*/ | We should ignore this test until schema loading feature is provided | testLoginAndLogout | {
"repo_name": "muros-ct/kapua",
"path": "service/security/shiro/src/test/java/org/eclipse/kapua/service/authentication/shiro/AuthenticationServiceTest.java",
"license": "epl-1.0",
"size": 2350
} | [
"org.apache.shiro.SecurityUtils",
"org.apache.shiro.subject.Subject",
"org.eclipse.kapua.locator.KapuaLocator",
"org.eclipse.kapua.service.authentication.AuthenticationService",
"org.eclipse.kapua.service.authentication.UsernamePasswordToken",
"org.eclipse.kapua.service.authentication.UsernamePasswordToke... | import org.apache.shiro.SecurityUtils; import org.apache.shiro.subject.Subject; import org.eclipse.kapua.locator.KapuaLocator; import org.eclipse.kapua.service.authentication.AuthenticationService; import org.eclipse.kapua.service.authentication.UsernamePasswordToken; import org.eclipse.kapua.service.authentication.UsernamePasswordTokenFactory; | import org.apache.shiro.*; import org.apache.shiro.subject.*; import org.eclipse.kapua.locator.*; import org.eclipse.kapua.service.authentication.*; | [
"org.apache.shiro",
"org.eclipse.kapua"
] | org.apache.shiro; org.eclipse.kapua; | 249,783 |
public static org.opennms.netmgt.config.xmpDataCollection.Group unmarshal(
final java.io.Reader reader)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
return (org.opennms.netmgt.config.xmpDataCollection.Group) Unmarshaller.unmarshal(org.opennms.netmgt.config.xmpDataCollection.Group.class, reader);
} | static org.opennms.netmgt.config.xmpDataCollection.Group function( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.opennms.netmgt.config.xmpDataCollection.Group) Unmarshaller.unmarshal(org.opennms.netmgt.config.xmpDataCollection.Group.class, reader); } | /**
* Method unmarshal.
*
* @param reader
* @throws org.exolab.castor.xml.MarshalException if object is
* null or if any SAXException is thrown during marshaling
* @throws org.exolab.castor.xml.ValidationException if this
* object is an invalid instance according to the schema
* @return the unmarshaled
* org.opennms.netmgt.config.xmpDataCollection.Group
*/ | Method unmarshal | unmarshal | {
"repo_name": "qoswork/opennmszh",
"path": "protocols/xmp/src/main/java/org/opennms/netmgt/config/xmpDataCollection/Group.java",
"license": "gpl-2.0",
"size": 22118
} | [
"org.exolab.castor.xml.Unmarshaller"
] | import org.exolab.castor.xml.Unmarshaller; | import org.exolab.castor.xml.*; | [
"org.exolab.castor"
] | org.exolab.castor; | 352,362 |
public static IViewEditpart getViewEditpart(YView yView) {
return getEditpart(yView);
} | static IViewEditpart function(YView yView) { return getEditpart(yView); } | /**
* Returns the view editpart for the given yView.
*
* @param yView
* @return
*/ | Returns the view editpart for the given yView | getViewEditpart | {
"repo_name": "lunifera/lunifera-ecview",
"path": "org.lunifera.ecview.core.util.emf/src/org/lunifera/ecview/core/util/emf/ModelUtil.java",
"license": "epl-1.0",
"size": 11819
} | [
"org.lunifera.ecview.core.common.editpart.IViewEditpart",
"org.lunifera.ecview.core.common.model.core.YView"
] | import org.lunifera.ecview.core.common.editpart.IViewEditpart; import org.lunifera.ecview.core.common.model.core.YView; | import org.lunifera.ecview.core.common.editpart.*; import org.lunifera.ecview.core.common.model.core.*; | [
"org.lunifera.ecview"
] | org.lunifera.ecview; | 870,222 |
private JMenuItem getJMenuItemRedo() {
if (jMenuItemRedo == null) {
ImageIcon redoIcon = new ImageIcon(JOptionsEditionByMousePopupMenu.class.getResource("images/edit-redo.png"), Messages.getText("edit_redo"));
jMenuItemRedo = new JMenuItem(Messages.getText("edit_redo"), redoIcon);
jMenuItemRedo.setHorizontalTextPosition(JMenuItem.RIGHT);
jMenuItemRedo.addActionListener(this.getMenuListener());
map.put(Messages.getText("edit_redo"), Integer.toString(JOptionsEditionByMousePopupMenu.REDO));
}
return jMenuItemRedo;
} | JMenuItem function() { if (jMenuItemRedo == null) { ImageIcon redoIcon = new ImageIcon(JOptionsEditionByMousePopupMenu.class.getResource(STR), Messages.getText(STR)); jMenuItemRedo = new JMenuItem(Messages.getText(STR), redoIcon); jMenuItemRedo.setHorizontalTextPosition(JMenuItem.RIGHT); jMenuItemRedo.addActionListener(this.getMenuListener()); map.put(Messages.getText(STR), Integer.toString(JOptionsEditionByMousePopupMenu.REDO)); } return jMenuItemRedo; } | /**
* This method initializes jMenuItemRedo
*
* @return javax.swing.JMenuItem
*/ | This method initializes jMenuItemRedo | getJMenuItemRedo | {
"repo_name": "iCarto/siga",
"path": "libUIComponent/src/org/gvsig/gui/beans/editionpopupmenu/JOptionsEditionByMousePopupMenu.java",
"license": "gpl-3.0",
"size": 13441
} | [
"javax.swing.ImageIcon",
"javax.swing.JMenuItem",
"org.gvsig.gui.beans.Messages"
] | import javax.swing.ImageIcon; import javax.swing.JMenuItem; import org.gvsig.gui.beans.Messages; | import javax.swing.*; import org.gvsig.gui.beans.*; | [
"javax.swing",
"org.gvsig.gui"
] | javax.swing; org.gvsig.gui; | 1,311,036 |
private void cbUseAuthActionPerformed(ActionEvent evt) { // NOSONAR This method is used through lambda
tfAuthUsername.setEditable(cbUseAuth.isSelected());
tfAuthPassword.setEditable(cbUseAuth.isSelected());
} | void function(ActionEvent evt) { tfAuthUsername.setEditable(cbUseAuth.isSelected()); tfAuthPassword.setEditable(cbUseAuth.isSelected()); } | /**
* ActionPerformed-method for checkbox "useAuth"
*
* @param evt
* ActionEvent to be handled
*/ | ActionPerformed-method for checkbox "useAuth" | cbUseAuthActionPerformed | {
"repo_name": "ra0077/jmeter",
"path": "src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/gui/SmtpPanel.java",
"license": "apache-2.0",
"size": 38588
} | [
"java.awt.event.ActionEvent"
] | import java.awt.event.ActionEvent; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 636,702 |
public ServiceFuture<Map<String, List<String>>> getArrayItemEmptyAsync(final ServiceCallback<Map<String, List<String>>> serviceCallback) {
return ServiceFuture.fromResponse(getArrayItemEmptyWithServiceResponseAsync(), serviceCallback);
} | ServiceFuture<Map<String, List<String>>> function(final ServiceCallback<Map<String, List<String>>> serviceCallback) { return ServiceFuture.fromResponse(getArrayItemEmptyWithServiceResponseAsync(), serviceCallback); } | /**
* Get an array of array of strings [{"0": ["1", "2", "3"], "1": [], "2": ["7", "8", "9"]}.
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Get an array of array of strings [{"0": ["1", "2", "3"], "1": [], "2": ["7", "8", "9"]} | getArrayItemEmptyAsync | {
"repo_name": "balajikris/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodydictionary/implementation/DictionarysImpl.java",
"license": "mit",
"size": 243390
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture",
"java.util.List",
"java.util.Map"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import java.util.List; import java.util.Map; | import com.microsoft.rest.*; import java.util.*; | [
"com.microsoft.rest",
"java.util"
] | com.microsoft.rest; java.util; | 1,317,477 |
public void setDataElements(int x, int y, Raster inRaster) {
int dstOffX = inRaster.getMinX() + x;
int dstOffY = inRaster.getMinY() + y;
int width = inRaster.getWidth();
int height = inRaster.getHeight();
if ((dstOffX < this.minX) || (dstOffY < this.minY) ||
(dstOffX + width > this.maxX) || (dstOffY + height > this.maxY)) {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
setDataElements(dstOffX, dstOffY, width, height, inRaster);
} | void function(int x, int y, Raster inRaster) { int dstOffX = inRaster.getMinX() + x; int dstOffY = inRaster.getMinY() + y; int width = inRaster.getWidth(); int height = inRaster.getHeight(); if ((dstOffX < this.minX) (dstOffY < this.minY) (dstOffX + width > this.maxX) (dstOffY + height > this.maxY)) { throw new ArrayIndexOutOfBoundsException (STR); } setDataElements(dstOffX, dstOffY, width, height, inRaster); } | /**
* Stores the Raster data at the specified location.
* An ArrayIndexOutOfBounds exception will be thrown at runtime
* if the pixel coordinates are out of bounds.
* @param x The X coordinate of the pixel location.
* @param y The Y coordinate of the pixel location.
* @param inRaster Raster of data to place at x,y location.
*/ | Stores the Raster data at the specified location. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds | setDataElements | {
"repo_name": "isaacl/openjdk-jdk",
"path": "src/share/classes/sun/awt/image/ByteComponentRaster.java",
"license": "gpl-2.0",
"size": 39452
} | [
"java.awt.image.Raster"
] | import java.awt.image.Raster; | import java.awt.image.*; | [
"java.awt"
] | java.awt; | 2,637,356 |
//------------//
// getMeasure //
//------------//
public Measure getMeasure ()
{
return measure;
}
| Measure function () { return measure; } | /**
* Report the containing measure, if any.
*
* @return containing measure or null
*/ | Report the containing measure, if any | getMeasure | {
"repo_name": "Audiveris/audiveris",
"path": "src/main/org/audiveris/omr/sig/inter/AbstractChordInter.java",
"license": "agpl-3.0",
"size": 41317
} | [
"org.audiveris.omr.sheet.rhythm.Measure"
] | import org.audiveris.omr.sheet.rhythm.Measure; | import org.audiveris.omr.sheet.rhythm.*; | [
"org.audiveris.omr"
] | org.audiveris.omr; | 1,509,327 |
public static String join(Object[] items, String delimiter) {
return join(Arrays.asList(items), delimiter, 0, items.length - 1);
} | static String function(Object[] items, String delimiter) { return join(Arrays.asList(items), delimiter, 0, items.length - 1); } | /**
* Returns all <code>items</code>, concatenated as a string with each of the entries divided
* by the <code>delimiter</code>.
*
* @param items Collection of items which should be joined.
* @param delimiter The string to insert between the <code>items</code>.
* @return A string containing all the items, separated by <code>delimiter</code>.
*/ | Returns all <code>items</code>, concatenated as a string with each of the entries divided by the <code>delimiter</code> | join | {
"repo_name": "mineground/mineground-plugin",
"path": "src/main/java/com/mineground/base/StringUtils.java",
"license": "gpl-3.0",
"size": 6699
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 145,928 |
@Override
public void setNextProcessor(Processor processor) {
nextProcessor = processor;
} | void function(Processor processor) { nextProcessor = processor; } | /**
* Set next processor element in processor chain
*
* @param processor Processor to be set as next element of processor chain
*/ | Set next processor element in processor chain | setNextProcessor | {
"repo_name": "lasanthafdo/siddhi",
"path": "modules/siddhi-core/src/main/java/org/wso2/siddhi/core/query/input/stream/join/JoinProcessor.java",
"license": "apache-2.0",
"size": 5701
} | [
"org.wso2.siddhi.core.query.processor.Processor"
] | import org.wso2.siddhi.core.query.processor.Processor; | import org.wso2.siddhi.core.query.processor.*; | [
"org.wso2.siddhi"
] | org.wso2.siddhi; | 2,693,026 |
public static ImageDescriptor findImageDescriptor(String path) {
final IPath p = new Path(path);
if (p.isAbsolute() && p.segmentCount() > 1) {
return AbstractUIPlugin.imageDescriptorFromPlugin(
p.segment(0), p.removeFirstSegments(1).makeAbsolute().toString());
} else {
return getBundledImageDescriptor(p.makeAbsolute().toString());
}
}
| static ImageDescriptor function(String path) { final IPath p = new Path(path); if (p.isAbsolute() && p.segmentCount() > 1) { return AbstractUIPlugin.imageDescriptorFromPlugin( p.segment(0), p.removeFirstSegments(1).makeAbsolute().toString()); } else { return getBundledImageDescriptor(p.makeAbsolute().toString()); } } | /**
* Respects images residing in any plug-in. If path is relative,
* then this bundle is looked up for the image, otherwise, for absolute
* path, first segment is taken as id of plug-in with image
*
* @param path
* the path to image, either absolute (with plug-in id as first segment), or relative for bundled images
* @return the image descriptor
*/ | Respects images residing in any plug-in. If path is relative, then this bundle is looked up for the image, otherwise, for absolute path, first segment is taken as id of plug-in with image | findImageDescriptor | {
"repo_name": "drbgfc/mdht",
"path": "core/plugins/org.openhealthtools.mdht.uml.ui.navigator/src/org/openhealthtools/mdht/uml/ui/navigator/internal/plugin/Activator.java",
"license": "epl-1.0",
"size": 3506
} | [
"org.eclipse.core.runtime.IPath",
"org.eclipse.core.runtime.Path",
"org.eclipse.jface.resource.ImageDescriptor",
"org.eclipse.ui.plugin.AbstractUIPlugin"
] | import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.plugin.AbstractUIPlugin; | import org.eclipse.core.runtime.*; import org.eclipse.jface.resource.*; import org.eclipse.ui.plugin.*; | [
"org.eclipse.core",
"org.eclipse.jface",
"org.eclipse.ui"
] | org.eclipse.core; org.eclipse.jface; org.eclipse.ui; | 2,465,295 |
@PublicEvolving
public static List<Field> getAllDeclaredFields(Class<?> clazz, boolean ignoreDuplicates) {
List<Field> result = new ArrayList<Field>();
while (clazz != null) {
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
if(Modifier.isTransient(field.getModifiers()) || Modifier.isStatic(field.getModifiers())) {
continue; // we have no use for transient or static fields
}
if(hasFieldWithSameName(field.getName(), result)) {
if (ignoreDuplicates) {
continue;
} else {
throw new InvalidTypesException("The field "+field+" is already contained in the hierarchy of the "+clazz+"."
+ "Please use unique field names through your classes hierarchy");
}
}
result.add(field);
}
clazz = clazz.getSuperclass();
}
return result;
} | static List<Field> function(Class<?> clazz, boolean ignoreDuplicates) { List<Field> result = new ArrayList<Field>(); while (clazz != null) { Field[] fields = clazz.getDeclaredFields(); for (Field field : fields) { if(Modifier.isTransient(field.getModifiers()) Modifier.isStatic(field.getModifiers())) { continue; } if(hasFieldWithSameName(field.getName(), result)) { if (ignoreDuplicates) { continue; } else { throw new InvalidTypesException(STR+field+STR+clazz+"." + STR); } } result.add(field); } clazz = clazz.getSuperclass(); } return result; } | /**
* Recursively determine all declared fields
* This is required because class.getFields() is not returning fields defined
* in parent classes.
*
* @param clazz class to be analyzed
* @param ignoreDuplicates if true, in case of duplicate field names only the lowest one
* in a hierarchy will be returned; throws an exception otherwise
* @return list of fields
*/ | Recursively determine all declared fields This is required because class.getFields() is not returning fields defined in parent classes | getAllDeclaredFields | {
"repo_name": "hongyuhong/flink",
"path": "flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java",
"license": "apache-2.0",
"size": 83220
} | [
"java.lang.reflect.Field",
"java.lang.reflect.Modifier",
"java.util.ArrayList",
"java.util.List",
"org.apache.flink.api.common.functions.InvalidTypesException"
] | import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.List; import org.apache.flink.api.common.functions.InvalidTypesException; | import java.lang.reflect.*; import java.util.*; import org.apache.flink.api.common.functions.*; | [
"java.lang",
"java.util",
"org.apache.flink"
] | java.lang; java.util; org.apache.flink; | 2,251,315 |
protected boolean openJARs() {
if (started && (jarFiles.length > 0)) {
lastJarAccessed = System.currentTimeMillis();
if (jarFiles[0] == null) {
for (int i = 0; i < jarFiles.length; i++) {
try {
jarFiles[i] = new JarFile(jarRealFiles[i]);
} catch (IOException e) {
if (log.isDebugEnabled()) {
log.debug("Failed to open JAR", e);
}
return false;
}
}
}
}
return true;
}
| boolean function() { if (started && (jarFiles.length > 0)) { lastJarAccessed = System.currentTimeMillis(); if (jarFiles[0] == null) { for (int i = 0; i < jarFiles.length; i++) { try { jarFiles[i] = new JarFile(jarRealFiles[i]); } catch (IOException e) { if (log.isDebugEnabled()) { log.debug(STR, e); } return false; } } } } return true; } | /**
* Used to periodically signal to the classloader to release JAR resources.
*/ | Used to periodically signal to the classloader to release JAR resources | openJARs | {
"repo_name": "yuyupapa/OpenSource",
"path": "apache-tomcat-6.0.48/java/org/apache/catalina/loader/WebappClassLoader.java",
"license": "apache-2.0",
"size": 126194
} | [
"java.io.IOException",
"java.util.jar.JarFile"
] | import java.io.IOException; import java.util.jar.JarFile; | import java.io.*; import java.util.jar.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,523,733 |
Collection<Option<?>> getOptions(); | Collection<Option<?>> getOptions(); | /**
* Get a list of all options for this mode.
*
* @return non-null list of options
*/ | Get a list of all options for this mode | getOptions | {
"repo_name": "endercrest/VoidSpawn",
"path": "src/main/java/com/endercrest/voidspawn/options/container/OptionContainer.java",
"license": "lgpl-2.1",
"size": 1210
} | [
"com.endercrest.voidspawn.options.Option",
"java.util.Collection"
] | import com.endercrest.voidspawn.options.Option; import java.util.Collection; | import com.endercrest.voidspawn.options.*; import java.util.*; | [
"com.endercrest.voidspawn",
"java.util"
] | com.endercrest.voidspawn; java.util; | 1,065,866 |
public static Type1Font createWithPFB(InputStream pfbStream) throws IOException
{
PfbParser pfb = new PfbParser(pfbStream);
Type1Parser parser = new Type1Parser();
return parser.parse(pfb.getSegment1(), pfb.getSegment2());
} | static Type1Font function(InputStream pfbStream) throws IOException { PfbParser pfb = new PfbParser(pfbStream); Type1Parser parser = new Type1Parser(); return parser.parse(pfb.getSegment1(), pfb.getSegment2()); } | /**
* Constructs a new Type1Font object from a .pfb stream.
*
* @param pfbStream .pfb input stream, including headers
* @return a type1 font
*
* @throws IOException if something went wrong
*/ | Constructs a new Type1Font object from a .pfb stream | createWithPFB | {
"repo_name": "apache/pdfbox",
"path": "fontbox/src/main/java/org/apache/fontbox/type1/Type1Font.java",
"license": "apache-2.0",
"size": 12855
} | [
"java.io.IOException",
"java.io.InputStream",
"org.apache.fontbox.pfb.PfbParser"
] | import java.io.IOException; import java.io.InputStream; import org.apache.fontbox.pfb.PfbParser; | import java.io.*; import org.apache.fontbox.pfb.*; | [
"java.io",
"org.apache.fontbox"
] | java.io; org.apache.fontbox; | 1,690,087 |
public void setReceiveBufferSize(int size) throws SocketException {
checkClosedAndCreate(true);
if (size < 1) {
throw new IllegalArgumentException(Msg.getString("K0035")); //$NON-NLS-1$
}
impl.setOption(SocketOptions.SO_RCVBUF, Integer.valueOf(size));
} | void function(int size) throws SocketException { checkClosedAndCreate(true); if (size < 1) { throw new IllegalArgumentException(Msg.getString("K0035")); } impl.setOption(SocketOptions.SO_RCVBUF, Integer.valueOf(size)); } | /**
* Set the socket receive buffer size.
*
* @param size
* the buffer size, in bytes
*
* @exception java.net.SocketException
* If an error occurs while setting the size or the size is
* invalid.
*/ | Set the socket receive buffer size | setReceiveBufferSize | {
"repo_name": "freeVM/freeVM",
"path": "enhanced/archive/classlib/java6/modules/luni/src/main/java/java/net/ServerSocket.java",
"license": "apache-2.0",
"size": 17225
} | [
"org.apache.harmony.luni.util.Msg"
] | import org.apache.harmony.luni.util.Msg; | import org.apache.harmony.luni.util.*; | [
"org.apache.harmony"
] | org.apache.harmony; | 1,392,965 |
public AbstractTestBase addPreCondition(final Condition newPreCondition) {
if (this.preConditions == null) {
this.preConditions = new ArrayDeque<Condition>();
}
assumeTrue(this.preConditions.add(newPreCondition));
return this;
}
| AbstractTestBase function(final Condition newPreCondition) { if (this.preConditions == null) { this.preConditions = new ArrayDeque<Condition>(); } assumeTrue(this.preConditions.add(newPreCondition)); return this; } | /**
* Adds the pre condition.
*
* @param newPreCondition as Condition
* @return success as boolean.
* @see java.util.Collection#add(java.lang.Object)
*/ | Adds the pre condition | addPreCondition | {
"repo_name": "atf4j/atf4j",
"path": "atf4j-fdd/src/main/java/net/atf4j/fdd/model/AbstractTestBase.java",
"license": "gpl-3.0",
"size": 9732
} | [
"java.util.ArrayDeque",
"org.junit.Assume"
] | import java.util.ArrayDeque; import org.junit.Assume; | import java.util.*; import org.junit.*; | [
"java.util",
"org.junit"
] | java.util; org.junit; | 1,228,286 |
@Test(expected = IllegalArgumentException.class)
public void getUniqueGroupIdsForUser_null() throws Exception {
reg.getUniqueGroupIdsForUser(null);
} | @Test(expected = IllegalArgumentException.class) void function() throws Exception { reg.getUniqueGroupIdsForUser(null); } | /**
* Test method for {@link com.ibm.ws.security.registry.UserRegistry#getUniqueGroupIdsForUser(java.lang.String)}.
*/ | Test method for <code>com.ibm.ws.security.registry.UserRegistry#getUniqueGroupIdsForUser(java.lang.String)</code> | getUniqueGroupIdsForUser_null | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.security.registry/test/com/ibm/ws/security/registry/UserRegistryIllegalArgumentTemplate.java",
"license": "epl-1.0",
"size": 9316
} | [
"org.junit.Test"
] | import org.junit.Test; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,274,853 |
public Iterator childEdges(Node n) {
return super.outEdges(n);
} | Iterator function(Node n) { return super.outEdges(n); } | /**
* Get an iterator over the edges connecting child nodes to a given parent
* @param n the parent node
* @return an iterator over the edges connecting child nodes to a given
* parent
*/ | Get an iterator over the edges connecting child nodes to a given parent | childEdges | {
"repo_name": "ezegarra/microbrowser",
"path": "src/prefuse/data/Tree.java",
"license": "bsd-3-clause",
"size": 22864
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 2,463,138 |
@NotNull
protected File retrieveCustomSqlModelXmlFile(@NotNull final QueryJCommand parameters)
{
@NotNull final File result;
@Nullable final File aux = parameters.getFileSetting(ParameterValidationHandler.SQL_XML_FILE);
if (aux == null)
{
throw new MissingCustomSqlFileAtRuntimeException();
}
else
{
result = aux;
}
return result;
} | File function(@NotNull final QueryJCommand parameters) { @NotNull final File result; @Nullable final File aux = parameters.getFileSetting(ParameterValidationHandler.SQL_XML_FILE); if (aux == null) { throw new MissingCustomSqlFileAtRuntimeException(); } else { result = aux; } return result; } | /**
* Retrieves the custom sql model XML file from the attribute map.
* @param parameters the parameters.
* @return such reference.
*/ | Retrieves the custom sql model XML file from the attribute map | retrieveCustomSqlModelXmlFile | {
"repo_name": "rydnr/queryj-rt",
"path": "queryj-core/src/main/java/org/acmsl/queryj/customsql/handlers/CustomSqlProviderRetrievalHandler.java",
"license": "gpl-2.0",
"size": 5867
} | [
"java.io.File",
"org.acmsl.queryj.QueryJCommand",
"org.acmsl.queryj.customsql.exceptions.MissingCustomSqlFileAtRuntimeException",
"org.acmsl.queryj.tools.handlers.ParameterValidationHandler",
"org.jetbrains.annotations.NotNull",
"org.jetbrains.annotations.Nullable"
] | import java.io.File; import org.acmsl.queryj.QueryJCommand; import org.acmsl.queryj.customsql.exceptions.MissingCustomSqlFileAtRuntimeException; import org.acmsl.queryj.tools.handlers.ParameterValidationHandler; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; | import java.io.*; import org.acmsl.queryj.*; import org.acmsl.queryj.customsql.exceptions.*; import org.acmsl.queryj.tools.handlers.*; import org.jetbrains.annotations.*; | [
"java.io",
"org.acmsl.queryj",
"org.jetbrains.annotations"
] | java.io; org.acmsl.queryj; org.jetbrains.annotations; | 2,077,166 |
public void setLabel(String v)
{
if (!ObjectUtils.equals(this.label, v))
{
this.label = v;
setModified(true);
}
} | void function(String v) { if (!ObjectUtils.equals(this.label, v)) { this.label = v; setModified(true); } } | /**
* Set the value of Label
*
* @param v new value
*/ | Set the value of Label | setLabel | {
"repo_name": "trackplus/Genji",
"path": "src/main/java/com/aurel/track/persist/BaseTScreenPanel.java",
"license": "gpl-3.0",
"size": 44335
} | [
"org.apache.commons.lang.ObjectUtils"
] | import org.apache.commons.lang.ObjectUtils; | import org.apache.commons.lang.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,198,638 |
@MBeanAttribute(name = " Delete All Messages In Queue ", description = "Delete all the " +
"messages in the queue without removing queue bindings.")
void deleteAllMessagesInQueue(@MBeanOperationParameter(name = "queueName",
description = "Name of the queue to delete messages from") String queueName,
@MBeanOperationParameter(name = "ownerName",
description = "Username of user that calls for " +
"purge")
String ownerName) throws MBeanException; | @MBeanAttribute(name = STR, description = STR + STR) void deleteAllMessagesInQueue(@MBeanOperationParameter(name = STR, description = STR) String queueName, @MBeanOperationParameter(name = STR, description = STR + "purge") String ownerName) throws MBeanException; | /**
* Purge the given queue both in terms of stored messages and in-memory messages.
* Ideally, all messages not awaiting acknowledgement at the time of purge should be cleared
* from the broker.
*
* @param queueName name of queue
*/ | Purge the given queue both in terms of stored messages and in-memory messages. Ideally, all messages not awaiting acknowledgement at the time of purge should be cleared from the broker | deleteAllMessagesInQueue | {
"repo_name": "AnujaLK/andes",
"path": "modules/andes-core/management/common/src/main/java/org/wso2/andes/management/common/mbeans/QueueManagementInformation.java",
"license": "apache-2.0",
"size": 8540
} | [
"javax.management.MBeanException",
"org.wso2.andes.management.common.mbeans.annotations.MBeanAttribute",
"org.wso2.andes.management.common.mbeans.annotations.MBeanOperationParameter"
] | import javax.management.MBeanException; import org.wso2.andes.management.common.mbeans.annotations.MBeanAttribute; import org.wso2.andes.management.common.mbeans.annotations.MBeanOperationParameter; | import javax.management.*; import org.wso2.andes.management.common.mbeans.annotations.*; | [
"javax.management",
"org.wso2.andes"
] | javax.management; org.wso2.andes; | 2,212,548 |
public FlowLogProperties withRetentionPolicy(RetentionPolicyParameters retentionPolicy) {
this.retentionPolicy = retentionPolicy;
return this;
} | FlowLogProperties function(RetentionPolicyParameters retentionPolicy) { this.retentionPolicy = retentionPolicy; return this; } | /**
* Set the retentionPolicy property: Parameters that define the retention policy for flow log.
*
* @param retentionPolicy the retentionPolicy value to set.
* @return the FlowLogProperties object itself.
*/ | Set the retentionPolicy property: Parameters that define the retention policy for flow log | withRetentionPolicy | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/models/FlowLogProperties.java",
"license": "mit",
"size": 4269
} | [
"com.azure.resourcemanager.network.models.RetentionPolicyParameters"
] | import com.azure.resourcemanager.network.models.RetentionPolicyParameters; | import com.azure.resourcemanager.network.models.*; | [
"com.azure.resourcemanager"
] | com.azure.resourcemanager; | 1,384,657 |
protected void fall(float p_70069_1_)
{
super.fall(p_70069_1_);
PotionEffect var2 = this.getActivePotionEffect(Potion.jump);
float var3 = var2 != null ? (float)(var2.getAmplifier() + 1) : 0.0F;
int var4 = MathHelper.ceiling_float_int(p_70069_1_ - 3.0F - var3);
if (var4 > 0)
{
this.playSound(this.func_146067_o(var4), 1.0F, 1.0F);
this.attackEntityFrom(DamageSource.fall, (float)var4);
int var5 = MathHelper.floor_double(this.posX);
int var6 = MathHelper.floor_double(this.posY - 0.20000000298023224D - (double)this.yOffset);
int var7 = MathHelper.floor_double(this.posZ);
Block var8 = this.worldObj.getBlock(var5, var6, var7);
if (var8.getMaterial() != Material.air)
{
Block.SoundType var9 = var8.stepSound;
this.playSound(var9.func_150498_e(), var9.func_150497_c() * 0.5F, var9.func_150494_d() * 0.75F);
}
}
} | void function(float p_70069_1_) { super.fall(p_70069_1_); PotionEffect var2 = this.getActivePotionEffect(Potion.jump); float var3 = var2 != null ? (float)(var2.getAmplifier() + 1) : 0.0F; int var4 = MathHelper.ceiling_float_int(p_70069_1_ - 3.0F - var3); if (var4 > 0) { this.playSound(this.func_146067_o(var4), 1.0F, 1.0F); this.attackEntityFrom(DamageSource.fall, (float)var4); int var5 = MathHelper.floor_double(this.posX); int var6 = MathHelper.floor_double(this.posY - 0.20000000298023224D - (double)this.yOffset); int var7 = MathHelper.floor_double(this.posZ); Block var8 = this.worldObj.getBlock(var5, var6, var7); if (var8.getMaterial() != Material.air) { Block.SoundType var9 = var8.stepSound; this.playSound(var9.func_150498_e(), var9.func_150497_c() * 0.5F, var9.func_150494_d() * 0.75F); } } } | /**
* Called when the mob is falling. Calculates and applies fall damage.
*/ | Called when the mob is falling. Calculates and applies fall damage | fall | {
"repo_name": "mviitanen/marsmod",
"path": "mcp/src/minecraft/net/minecraft/entity/EntityLivingBase.java",
"license": "gpl-2.0",
"size": 72968
} | [
"net.minecraft.block.Block",
"net.minecraft.block.material.Material",
"net.minecraft.potion.Potion",
"net.minecraft.potion.PotionEffect",
"net.minecraft.util.DamageSource",
"net.minecraft.util.MathHelper"
] | import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; | import net.minecraft.block.*; import net.minecraft.block.material.*; import net.minecraft.potion.*; import net.minecraft.util.*; | [
"net.minecraft.block",
"net.minecraft.potion",
"net.minecraft.util"
] | net.minecraft.block; net.minecraft.potion; net.minecraft.util; | 919,346 |
public void setDetailElement(final Element detailElement)
{
this.detailElement = detailElement;
} | void function(final Element detailElement) { this.detailElement = detailElement; } | /**
* Set the SOAP fault detailElement.
* @param detailElement The SOAP fault detailElement.
*/ | Set the SOAP fault detailElement | setDetailElement | {
"repo_name": "tfisher1226/ARIES",
"path": "aries/tx-manager/tx-manager-service/src/main/java/common/tx/model/SoapFault11.java",
"license": "apache-2.0",
"size": 5636
} | [
"org.w3c.dom.Element"
] | import org.w3c.dom.Element; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 930,952 |
public NamingEnumeration listBindings(String name)
throws NamingException
{
return listBindings (_parser.parse(name));
} | NamingEnumeration function(String name) throws NamingException { return listBindings (_parser.parse(name)); } | /**
* List all Bindings at Name
*
* @param name a <code>String</code> value
* @return a <code>NamingEnumeration</code> value
* @exception NamingException if an error occurs
*/ | List all Bindings at Name | listBindings | {
"repo_name": "mabrek/jetty",
"path": "jetty-jndi/src/main/java/org/eclipse/jetty/jndi/NamingContext.java",
"license": "apache-2.0",
"size": 41077
} | [
"javax.naming.NamingEnumeration",
"javax.naming.NamingException"
] | import javax.naming.NamingEnumeration; import javax.naming.NamingException; | import javax.naming.*; | [
"javax.naming"
] | javax.naming; | 282,550 |
private String detectScriptUrlPerDHCP() {
Logger.log(getClass(), LogLevel.DEBUG, "Searching per DHCP not supported yet.");
// TODO Rossi 28.04.2009 Not implemented yet.
return null;
} | String function() { Logger.log(getClass(), LogLevel.DEBUG, STR); return null; } | /*************************************************************************
* Uses DHCP to find the script URL.
* @return the URL, null if not found.
************************************************************************/ | Uses DHCP to find the script URL | detectScriptUrlPerDHCP | {
"repo_name": "lexml/proxy-vole-lexml",
"path": "src/main/java/com/btr/proxy/search/wpad/WpadProxySearchStrategy.java",
"license": "bsd-3-clause",
"size": 5136
} | [
"com.btr.proxy.util.Logger"
] | import com.btr.proxy.util.Logger; | import com.btr.proxy.util.*; | [
"com.btr.proxy"
] | com.btr.proxy; | 2,845,729 |
public static void forEach(IAST ast, Predicate<IExpr> predicate, Consumer<IExpr> consumer) {
int size = ast.size();
for (int i = 1; i < size; i++) {
IExpr t = ast.get(i);
if (predicate.test(t)) {
consumer.accept(t);
}
}
} | static void function(IAST ast, Predicate<IExpr> predicate, Consumer<IExpr> consumer) { int size = ast.size(); for (int i = 1; i < size; i++) { IExpr t = ast.get(i); if (predicate.test(t)) { consumer.accept(t); } } } | /**
* Consume each argument of <code>ast</code> which fulfills the <code>predicate</code>.
*
* @param ast
* @param predicate
* @param consumer
* @return
*/ | Consume each argument of <code>ast</code> which fulfills the <code>predicate</code> | forEach | {
"repo_name": "axkr/symja_android_library",
"path": "symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/eval/util/Lambda.java",
"license": "gpl-3.0",
"size": 5960
} | [
"java.util.function.Consumer",
"java.util.function.Predicate",
"org.matheclipse.core.interfaces.IExpr"
] | import java.util.function.Consumer; import java.util.function.Predicate; import org.matheclipse.core.interfaces.IExpr; | import java.util.function.*; import org.matheclipse.core.interfaces.*; | [
"java.util",
"org.matheclipse.core"
] | java.util; org.matheclipse.core; | 76,714 |
@POST
Call<Void> postAppActivity(@Url String url, @Header(NetworkConstant.YONA_PASSWORD) String password, @Header(NetworkConstant.ACCEPT_LANGUAGE) String acceptLanguage, @Body AppActivity activity); | Call<Void> postAppActivity(@Url String url, @Header(NetworkConstant.YONA_PASSWORD) String password, @Header(NetworkConstant.ACCEPT_LANGUAGE) String acceptLanguage, @Body AppActivity activity); | /********
* APP ACTIVITY
*
* @param url the url
* @param password the password
* @param activity the activity
* @return the call
*/ | APP ACTIVITY | postAppActivity | {
"repo_name": "yonadev/yona-app-android",
"path": "app/src/main/java/nu/yona/app/api/manager/network/RestApi.java",
"license": "mpl-2.0",
"size": 14182
} | [
"nu.yona.app.api.model.AppActivity"
] | import nu.yona.app.api.model.AppActivity; | import nu.yona.app.api.model.*; | [
"nu.yona.app"
] | nu.yona.app; | 701,976 |
Response<ServerVulnerabilityAssessment> getWithResponse(
String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context); | Response<ServerVulnerabilityAssessment> getWithResponse( String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context); | /**
* Gets a server vulnerability assessment onboarding statuses on a given resource.
*
* @param resourceGroupName The name of the resource group within the user's subscription. The name is case
* insensitive.
* @param resourceNamespace The Namespace of the resource.
* @param resourceType The type of the resource.
* @param resourceName Name of the resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a server vulnerability assessment onboarding statuses on a given resource.
*/ | Gets a server vulnerability assessment onboarding statuses on a given resource | getWithResponse | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServerVulnerabilityAssessments.java",
"license": "mit",
"size": 8296
} | [
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context"
] | import com.azure.core.http.rest.Response; import com.azure.core.util.Context; | import com.azure.core.http.rest.*; import com.azure.core.util.*; | [
"com.azure.core"
] | com.azure.core; | 2,844,459 |
private void populateCloudProviderTemplates() {
// AWS
final CloudProviderTemplate aws = new CloudProviderTemplate(
"Amazon Elastic Compute Cloud", "Amazon EC2",
"org.dasein.cloud.aws.AWSCloud", AccessMethod.KEY);
aws.addEndPoint("EU (Ireland)", "EU",
"http://ec2.eu-west-1.amazonaws.com");
aws.addEndPoint("Asia Pacific (Singapore)", "Asia",
"http://ec2.ap-southeast-1.amazonaws.com");
aws.addEndPoint("US-West (Northern California)", "US-West",
"http://ec2.us-west-1.amazonaws.com");
aws.addEndPoint("US-East (Northern Virginia)", "US-East",
"http://ec2.us-east-1.amazonaws.com");
providerTemplates.add(aws);
// Rackspace
// final CloudProviderTemplate rackspace = new CloudProviderTemplate(
// "Rackspace (not implemented)", "Rackspace",
// "org.dasein.cloud.aws.AWSCloud", AccessMethod.KEY);
// providerTemplates.add(rackspace);
final CloudProviderTemplate mock = new CloudProviderTemplate(
"Mock Cloud Provider", "Mock",
"be.ac.ua.comp.scarletnebula.misc.MockCloudProvider",
AccessMethod.EMAILPASSWD);
providerTemplates.add(mock);
final CloudProviderTemplate cloudSigma = new CloudProviderTemplate(
"CloudSigma", "CloudSigma",
"org.dasein.cloud.jclouds.cloudsigma.CloudSigma",
AccessMethod.EMAILPASSWD);
providerTemplates.add(cloudSigma);
}
private static class CloudManagerHolder {
public static final CloudManager INSTANCE = new CloudManager();
} | void function() { final CloudProviderTemplate aws = new CloudProviderTemplate( STR, STR, STR, AccessMethod.KEY); aws.addEndPoint(STR, "EU", STRAsia Pacific (Singapore)STRAsia", STRUS-West (Northern California)STRUS-West", STRUS-East (Northern Virginia)STRUS-EastSTRhttp: providerTemplates.add(aws); final CloudProviderTemplate mock = new CloudProviderTemplate( "Mock Cloud ProviderSTRMockSTRbe.ac.ua.comp.scarletnebula.misc.MockCloudProvider", AccessMethod.EMAILPASSWD); providerTemplates.add(mock); final CloudProviderTemplate cloudSigma = new CloudProviderTemplate( "CloudSigmaSTRCloudSigmaSTRorg.dasein.cloud.jclouds.cloudsigma.CloudSigma", AccessMethod.EMAILPASSWD); providerTemplates.add(cloudSigma); } private static class CloudManagerHolder { public static final CloudManager INSTANCE = new CloudManager(); } | /**
* Fills the available cloud provider templates.
*/ | Fills the available cloud provider templates | populateCloudProviderTemplates | {
"repo_name": "Ivesvdf/Scarlet-Nebula",
"path": "src/be/ac/ua/comp/scarletnebula/core/CloudManager.java",
"license": "gpl-3.0",
"size": 8138
} | [
"be.ac.ua.comp.scarletnebula.core.CloudProviderTemplate"
] | import be.ac.ua.comp.scarletnebula.core.CloudProviderTemplate; | import be.ac.ua.comp.scarletnebula.core.*; | [
"be.ac.ua"
] | be.ac.ua; | 478,233 |
@Test
public void evaluateInteger()
{
// Setup.
final AndFunction<Integer> function = createInteger();
final Context context = new DefaultContext();
// Run.
final Integer result = function.evaluate(context);
// Verify.
assertNotNull(result);
assertThat(result, is(3));
} | void function() { final AndFunction<Integer> function = createInteger(); final Context context = new DefaultContext(); final Integer result = function.evaluate(context); assertNotNull(result); assertThat(result, is(3)); } | /**
* Test the <code>evaluate()</code> method.
*/ | Test the <code>evaluate()</code> method | evaluateInteger | {
"repo_name": "jmthompson2015/vizzini",
"path": "ai/src/test/java/org/vizzini/ai/geneticalgorithm/geneticprogramming/AndFunctionTest.java",
"license": "mit",
"size": 17729
} | [
"org.hamcrest.CoreMatchers",
"org.junit.Assert"
] | import org.hamcrest.CoreMatchers; import org.junit.Assert; | import org.hamcrest.*; import org.junit.*; | [
"org.hamcrest",
"org.junit"
] | org.hamcrest; org.junit; | 1,256,483 |
public OpenSubmissionPage getOpenSubmissions(UserInfo userInfo, String nextPageToken); | OpenSubmissionPage function(UserInfo userInfo, String nextPageToken); | /**
* Retrieve information about submitted Submissions.
*
* @param userInfo
* @param nextPageToken
* @return
*/ | Retrieve information about submitted Submissions | getOpenSubmissions | {
"repo_name": "hhu94/Synapse-Repository-Services",
"path": "services/repository-managers/src/main/java/org/sagebionetworks/repo/manager/dataaccess/SubmissionManager.java",
"license": "apache-2.0",
"size": 1929
} | [
"org.sagebionetworks.repo.model.UserInfo",
"org.sagebionetworks.repo.model.dataaccess.OpenSubmissionPage"
] | import org.sagebionetworks.repo.model.UserInfo; import org.sagebionetworks.repo.model.dataaccess.OpenSubmissionPage; | import org.sagebionetworks.repo.model.*; import org.sagebionetworks.repo.model.dataaccess.*; | [
"org.sagebionetworks.repo"
] | org.sagebionetworks.repo; | 599,885 |
public Collection<ChangedEntryDetails<?>> getSuccesfullChanges()
{
if (changedEntries == null)
throw new UnsupportedOperationException(" no detailed information available: operation modifier not set to return detailed change result");
return changedEntries;
}
| Collection<ChangedEntryDetails<?>> function() { if (changedEntries == null) throw new UnsupportedOperationException(STR); return changedEntries; } | /**
* Returns the successfully done changes.
*/ | Returns the successfully done changes | getSuccesfullChanges | {
"repo_name": "Gigaspaces/xap-openspaces",
"path": "src/main/java/org/openspaces/core/ChangeException.java",
"license": "apache-2.0",
"size": 4313
} | [
"com.gigaspaces.client.ChangedEntryDetails",
"java.util.Collection"
] | import com.gigaspaces.client.ChangedEntryDetails; import java.util.Collection; | import com.gigaspaces.client.*; import java.util.*; | [
"com.gigaspaces.client",
"java.util"
] | com.gigaspaces.client; java.util; | 2,271,044 |
public static final void setLocale(Locale locale) {
if (locale == null)
throw new IllegalArgumentException("locale can not be null!");
SCStatics.locale = locale;
} | static final void function(Locale locale) { if (locale == null) throw new IllegalArgumentException(STR); SCStatics.locale = locale; } | /**
* Set the {@link Locale} that should be used when converting names and aliases to lowercase.
*/ | Set the <code>Locale</code> that should be used when converting names and aliases to lowercase | setLocale | {
"repo_name": "AnorZaken/aztb",
"path": "src/nu/mine/obsidian/aztb/bukkit/subcommand/v1_0/SCStatics.java",
"license": "lgpl-3.0",
"size": 8995
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 1,374,654 |
public List<ExtendedLocationTrace> selectContainingKeyword(List<ExtendedLocationTrace> traces, String keyword){
List<ExtendedLocationTrace> newTraces = new ArrayList<ExtendedLocationTrace>();
Pattern regex = Pattern.compile("(?i)\\b" + keyword + "\\b");
Matcher regexMatcher;
for (ExtendedLocationTrace aTrace: traces){
regexMatcher = regex.matcher(aTrace.getNote());
if (regexMatcher.find() == true){
newTraces.add( new ExtendedLocationTrace(aTrace));
}
}
return newTraces;
}
| List<ExtendedLocationTrace> function(List<ExtendedLocationTrace> traces, String keyword){ List<ExtendedLocationTrace> newTraces = new ArrayList<ExtendedLocationTrace>(); Pattern regex = Pattern.compile(STR + keyword + "\\b"); Matcher regexMatcher; for (ExtendedLocationTrace aTrace: traces){ regexMatcher = regex.matcher(aTrace.getNote()); if (regexMatcher.find() == true){ newTraces.add( new ExtendedLocationTrace(aTrace)); } } return newTraces; } | /**
* Selects traces that contain given keyword
* @param traces
* @param keyword
* @return a list of selected location traces that contain given keyword.
*/ | Selects traces that contain given keyword | selectContainingKeyword | {
"repo_name": "hamdikavak/human-mobility-modeling-utilities",
"path": "src/main/java/com/hamdikavak/humanmobility/modeling/helpers/LocationTraceHelper.java",
"license": "mit",
"size": 12021
} | [
"com.hamdikavak.humanmobility.modeling.spatial.ExtendedLocationTrace",
"java.util.ArrayList",
"java.util.List",
"java.util.regex.Matcher",
"java.util.regex.Pattern"
] | import com.hamdikavak.humanmobility.modeling.spatial.ExtendedLocationTrace; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; | import com.hamdikavak.humanmobility.modeling.spatial.*; import java.util.*; import java.util.regex.*; | [
"com.hamdikavak.humanmobility",
"java.util"
] | com.hamdikavak.humanmobility; java.util; | 1,817,123 |
private void addBackground() {
BarNumber container = new BarNumber(StatsChart.FluidBar.WIDTH, StatsChart.FluidBar.HEIGHT, this.maxColor, (int) this.maxStat + "", Color.BLACK);
this.add(container, 0, 0);
} | void function() { BarNumber container = new BarNumber(StatsChart.FluidBar.WIDTH, StatsChart.FluidBar.HEIGHT, this.maxColor, (int) this.maxStat + "", Color.BLACK); this.add(container, 0, 0); } | /**
* Adds the background for the stat (e.g. max HP).
*/ | Adds the background for the stat (e.g. max HP) | addBackground | {
"repo_name": "chharvey/elemental",
"path": "src/menu/StatsChart.java",
"license": "mit",
"size": 11753
} | [
"java.awt.Color"
] | import java.awt.Color; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,378,781 |
int insert(MemberVerifyRelModel record); | int insert(MemberVerifyRelModel record); | /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table member_verification_rel
*
* @mbggenerated
*/ | This method was generated by MyBatis Generator. This method corresponds to the database table member_verification_rel | insert | {
"repo_name": "lankeren/taolijie",
"path": "src/main/java/com/fh/taolijie/dao/mapper/v2/MemberVerifyRelModelMapper.java",
"license": "gpl-3.0",
"size": 1582
} | [
"com.fh.taolijie.domain.MemberVerifyRelModel"
] | import com.fh.taolijie.domain.MemberVerifyRelModel; | import com.fh.taolijie.domain.*; | [
"com.fh.taolijie"
] | com.fh.taolijie; | 99,153 |
private void setServerSyncMarker(Account account, long marker) {
mAccountManager.setUserData(account, SYNC_MARKER_KEY, Long.toString(marker));
} | void function(Account account, long marker) { mAccountManager.setUserData(account, SYNC_MARKER_KEY, Long.toString(marker)); } | /**
* Save off the high-water-mark we receive back from the server.
* @param account The account we're syncing
* @param marker The high-water-mark we want to save.
*/ | Save off the high-water-mark we receive back from the server | setServerSyncMarker | {
"repo_name": "cozy/cordova-plugin-contacts",
"path": "src/android/syncadapter/SyncAdapter.java",
"license": "apache-2.0",
"size": 5128
} | [
"android.accounts.Account"
] | import android.accounts.Account; | import android.accounts.*; | [
"android.accounts"
] | android.accounts; | 858,032 |
@ServiceMethod(returns = ReturnType.SINGLE)
void delete(String resourceGroupName, String accountName, String poolName, String volumeName, Boolean forceDelete); | @ServiceMethod(returns = ReturnType.SINGLE) void delete(String resourceGroupName, String accountName, String poolName, String volumeName, Boolean forceDelete); | /**
* Delete the specified volume.
*
* @param resourceGroupName The name of the resource group.
* @param accountName The name of the NetApp account.
* @param poolName The name of the capacity pool.
* @param volumeName The name of the volume.
* @param forceDelete An option to force delete the volume. Will cleanup resources connected to the particular
* volume.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/ | Delete the specified volume | delete | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/VolumesClient.java",
"license": "mit",
"size": 47258
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; | import com.azure.core.annotation.*; | [
"com.azure.core"
] | com.azure.core; | 1,544,441 |
private String qName(String fileSuffix) {
return format("%s-%s", getClass().getSimpleName(), fileSuffix);
}
}
@Aspect("pertarget(execution(* *.getSpouse()))")
class PerTargetAspect implements Ordered {
public int count;
private int order = Ordered.LOWEST_PRECEDENCE; | String function(String fileSuffix) { return format("%s-%s", getClass().getSimpleName(), fileSuffix); } } @Aspect(STR) class PerTargetAspect implements Ordered { public int count; private int order = Ordered.LOWEST_PRECEDENCE; | /**
* Returns the relatively qualified name for <var>fileSuffix</var>.
* e.g. for a fileSuffix='foo.xml', this method will return
* 'AspectJAutoProxyCreatorTests-foo.xml'
*/ | Returns the relatively qualified name for fileSuffix. e.g. for a fileSuffix='foo.xml', this method will return 'AspectJAutoProxyCreatorTests-foo.xml' | qName | {
"repo_name": "deathspeeder/class-guard",
"path": "spring-framework-3.2.x/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java",
"license": "gpl-2.0",
"size": 17909
} | [
"java.lang.String",
"org.aspectj.lang.annotation.Aspect",
"org.springframework.core.Ordered"
] | import java.lang.String; import org.aspectj.lang.annotation.Aspect; import org.springframework.core.Ordered; | import java.lang.*; import org.aspectj.lang.annotation.*; import org.springframework.core.*; | [
"java.lang",
"org.aspectj.lang",
"org.springframework.core"
] | java.lang; org.aspectj.lang; org.springframework.core; | 1,357,117 |
final AbstractFreeMarkerRenderer renderer = new FreeMarkerRenderer();
context.setRenderer(renderer);
renderer.setTemplateName("page.ftl");
final Map<String, Object> dataModel = renderer.getDataModel();
final HttpServletRequest request = context.getRequest();
final HttpServletResponse response = context.getResponse();
try {
final JSONObject preference = preferenceQueryService.getPreference();
if (null == preference) {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
Skins.fillLangs(preference.getString(Option.ID_C_LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel);
final Map<String, String> langs = langPropsService.getAll(Latkes.getLocale());
// See PermalinkFilter#dispatchToArticleOrPageProcessor()
final JSONObject page = (JSONObject) request.getAttribute(Page.PAGE);
if (null == page) {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
final String pageId = page.getString(Keys.OBJECT_ID);
page.put(Common.COMMENTABLE, preference.getBoolean(Option.ID_C_COMMENTABLE) && page.getBoolean(Page.PAGE_COMMENTABLE));
page.put(Common.PERMALINK, page.getString(Page.PAGE_PERMALINK));
dataModel.put(Page.PAGE, page);
final List<JSONObject> comments = commentQueryService.getComments(pageId);
dataModel.put(Page.PAGE_COMMENTS_REF, comments);
// Markdown
if ("CodeMirror-Markdown".equals(page.optString(Page.PAGE_EDITOR_TYPE))) {
Stopwatchs.start("Markdown Page[id=" + page.optString(Keys.OBJECT_ID) + "]");
final String content = page.optString(Page.PAGE_CONTENT);
page.put(Page.PAGE_CONTENT, Markdowns.toHTML(content));
Stopwatchs.end();
}
filler.fillSide(request, dataModel, preference);
filler.fillBlogHeader(request, response, dataModel, preference);
filler.fillBlogFooter(request, dataModel, preference);
statisticMgmtService.incBlogViewCount(request, response);
} catch (final Exception e) {
LOGGER.log(Level.ERROR, e.getMessage(), e);
try {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
} catch (final IOException ex) {
LOGGER.error(ex.getMessage());
}
}
} | final AbstractFreeMarkerRenderer renderer = new FreeMarkerRenderer(); context.setRenderer(renderer); renderer.setTemplateName(STR); final Map<String, Object> dataModel = renderer.getDataModel(); final HttpServletRequest request = context.getRequest(); final HttpServletResponse response = context.getResponse(); try { final JSONObject preference = preferenceQueryService.getPreference(); if (null == preference) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } Skins.fillLangs(preference.getString(Option.ID_C_LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel); final Map<String, String> langs = langPropsService.getAll(Latkes.getLocale()); final JSONObject page = (JSONObject) request.getAttribute(Page.PAGE); if (null == page) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } final String pageId = page.getString(Keys.OBJECT_ID); page.put(Common.COMMENTABLE, preference.getBoolean(Option.ID_C_COMMENTABLE) && page.getBoolean(Page.PAGE_COMMENTABLE)); page.put(Common.PERMALINK, page.getString(Page.PAGE_PERMALINK)); dataModel.put(Page.PAGE, page); final List<JSONObject> comments = commentQueryService.getComments(pageId); dataModel.put(Page.PAGE_COMMENTS_REF, comments); if (STR.equals(page.optString(Page.PAGE_EDITOR_TYPE))) { Stopwatchs.start(STR + page.optString(Keys.OBJECT_ID) + "]"); final String content = page.optString(Page.PAGE_CONTENT); page.put(Page.PAGE_CONTENT, Markdowns.toHTML(content)); Stopwatchs.end(); } filler.fillSide(request, dataModel, preference); filler.fillBlogHeader(request, response, dataModel, preference); filler.fillBlogFooter(request, dataModel, preference); statisticMgmtService.incBlogViewCount(request, response); } catch (final Exception e) { LOGGER.log(Level.ERROR, e.getMessage(), e); try { response.sendError(HttpServletResponse.SC_NOT_FOUND); } catch (final IOException ex) { LOGGER.error(ex.getMessage()); } } } | /**
* Shows page with the specified context.
*
* @param context the specified context
*/ | Shows page with the specified context | showPage | {
"repo_name": "istarvip/solo",
"path": "src/main/java/org/b3log/solo/processor/PageProcessor.java",
"license": "apache-2.0",
"size": 5537
} | [
"java.io.IOException",
"java.util.List",
"java.util.Map",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.b3log.latke.Keys",
"org.b3log.latke.Latkes",
"org.b3log.latke.logging.Level",
"org.b3log.latke.servlet.renderer.freemarker.AbstractFreeMarkerRenderer",
... | import java.io.IOException; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.b3log.latke.Keys; import org.b3log.latke.Latkes; import org.b3log.latke.logging.Level; import org.b3log.latke.servlet.renderer.freemarker.AbstractFreeMarkerRenderer; import org.b3log.latke.servlet.renderer.freemarker.FreeMarkerRenderer; import org.b3log.latke.util.Stopwatchs; import org.b3log.solo.model.Common; import org.b3log.solo.model.Option; import org.b3log.solo.model.Page; import org.b3log.solo.util.Markdowns; import org.b3log.solo.util.Skins; import org.json.JSONObject; | import java.io.*; import java.util.*; import javax.servlet.http.*; import org.b3log.latke.*; import org.b3log.latke.logging.*; import org.b3log.latke.servlet.renderer.freemarker.*; import org.b3log.latke.util.*; import org.b3log.solo.model.*; import org.b3log.solo.util.*; import org.json.*; | [
"java.io",
"java.util",
"javax.servlet",
"org.b3log.latke",
"org.b3log.solo",
"org.json"
] | java.io; java.util; javax.servlet; org.b3log.latke; org.b3log.solo; org.json; | 1,988,385 |
public final boolean isCaseSensitive(int column) throws SQLException {
return DataTypeUtilities.isCaseSensitive(getColumnTypeDescriptor(column));
} | final boolean function(int column) throws SQLException { return DataTypeUtilities.isCaseSensitive(getColumnTypeDescriptor(column)); } | /**
* Does a column's case matter?
*
* @param column the first column is 1, the second is 2, ...
* @return true if so
* @exception SQLException thrown on failure
*/ | Does a column's case matter | isCaseSensitive | {
"repo_name": "papicella/snappy-store",
"path": "gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/impl/jdbc/EmbedResultSetMetaData.java",
"license": "apache-2.0",
"size": 18988
} | [
"com.pivotal.gemfirexd.internal.iapi.types.DataTypeUtilities",
"java.sql.SQLException"
] | import com.pivotal.gemfirexd.internal.iapi.types.DataTypeUtilities; import java.sql.SQLException; | import com.pivotal.gemfirexd.internal.iapi.types.*; import java.sql.*; | [
"com.pivotal.gemfirexd",
"java.sql"
] | com.pivotal.gemfirexd; java.sql; | 2,846,253 |
@Override public void enterIf(@NotNull IntlyParser.IfContext ctx) { } | @Override public void enterIf(@NotNull IntlyParser.IfContext ctx) { } | /**
* {@inheritDoc}
* <p/>
* The default implementation does nothing.
*/ | The default implementation does nothing | exitFparams | {
"repo_name": "johnbradley/Intly",
"path": "src/intly/parser/IntlyBaseListener.java",
"license": "bsd-2-clause",
"size": 8238
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 1,730,313 |
@Test
public void testCommittedFilesOfMerge() throws URISyntaxException, RepositoryException, ParseException {
new NonStrictExpectations() {{
setField(gitRepositoryService, indexPathManager);
indexPathManager.getPluginIndexRootPath(); result = new File(ClassLoader.getSystemResource("indexes").toURI()).getPath();
}};
GitRepository repository = getSourceRepository();
gitRepositoryService.cloneRepository(repository);
gitRepositoryService.fetch(repository);
LogEntryEnumerator<GitRepository, GitCommitKey> enumerator = gitRepositoryService.getLogEntries(repository, null);
LogEntry<GitRepository, GitCommitKey> logEntry = null;
while (enumerator.hasNext()) {
logEntry = enumerator.next();
if (logEntry.getCommitKey().getCommitHash().equals("970d660290bc24299fa8997f298bd02a310776d3")) {
break;
}
}
Assert.assertNotNull("No log entries", logEntry);
List<CommitFile> committedFiles = logEntry.getCommitFiles();
Assert.assertEquals(1, committedFiles.size());
Assert.assertEquals("GCV-1 Merge 'firstbranch' into 'secondbranch'", logEntry.getMessage().trim());
Assert.assertTrue(committedFiles.get(0) instanceof AddedCommitFile);
Assert.assertEquals("firstbranchfile.txt", ((AddedCommitFile)committedFiles.get(0)).getPath());
}
| void function() throws URISyntaxException, RepositoryException, ParseException { new NonStrictExpectations() {{ setField(gitRepositoryService, indexPathManager); indexPathManager.getPluginIndexRootPath(); result = new File(ClassLoader.getSystemResource(STR).toURI()).getPath(); }}; GitRepository repository = getSourceRepository(); gitRepositoryService.cloneRepository(repository); gitRepositoryService.fetch(repository); LogEntryEnumerator<GitRepository, GitCommitKey> enumerator = gitRepositoryService.getLogEntries(repository, null); LogEntry<GitRepository, GitCommitKey> logEntry = null; while (enumerator.hasNext()) { logEntry = enumerator.next(); if (logEntry.getCommitKey().getCommitHash().equals(STR)) { break; } } Assert.assertNotNull(STR, logEntry); List<CommitFile> committedFiles = logEntry.getCommitFiles(); Assert.assertEquals(1, committedFiles.size()); Assert.assertEquals(STR, logEntry.getMessage().trim()); Assert.assertTrue(committedFiles.get(0) instanceof AddedCommitFile); Assert.assertEquals(STR, ((AddedCommitFile)committedFiles.get(0)).getPath()); } | /**
* A merge has two parents and is more complex. Check that files from both lineages are included.
*
* @throws URISyntaxException
* @throws RepositoryException
* @throws ParseException
*/ | A merge has two parents and is more complex. Check that files from both lineages are included | testCommittedFilesOfMerge | {
"repo_name": "astralbat/gitcommitviewer",
"path": "src/test/java/jiracommitviewer/repository/service/GitRepositoryServiceTest.java",
"license": "bsd-2-clause",
"size": 22511
} | [
"java.io.File",
"java.net.URISyntaxException",
"java.text.ParseException",
"java.util.List",
"org.junit.Assert"
] | import java.io.File; import java.net.URISyntaxException; import java.text.ParseException; import java.util.List; import org.junit.Assert; | import java.io.*; import java.net.*; import java.text.*; import java.util.*; import org.junit.*; | [
"java.io",
"java.net",
"java.text",
"java.util",
"org.junit"
] | java.io; java.net; java.text; java.util; org.junit; | 1,564,852 |
private class RowColListener implements ChangeListener
{
public void stateChanged(ChangeEvent e)
{
submitRowColChanges();
}
}
| class RowColListener implements ChangeListener { public void function(ChangeEvent e) { submitRowColChanges(); } } | /**
* Listens for changes to the row and col spinners.
*
* @param e
*/ | Listens for changes to the row and col spinners | stateChanged | {
"repo_name": "KEOpenSource/CAExplorer",
"path": "cellularAutomata/analysis/SliceAnalysis.java",
"license": "apache-2.0",
"size": 29799
} | [
"javax.swing.event.ChangeEvent",
"javax.swing.event.ChangeListener"
] | import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; | import javax.swing.event.*; | [
"javax.swing"
] | javax.swing; | 275,803 |
private boolean termFilter(
Term term, String[] desiredFields, int minFreq, int maxFreq, int maxNonAlphabet, boolean filterNumbers) {
// number filter
if (filterNumbers) {
try {
// if the token can be parsed as a floating point number, no exception is thrown and false is returned
// if not, an exception is thrown and we continue with the other termFilter method.
// remark: this does not filter out e.g. Java or C++ formatted numbers like "1f" or "1.0d"
Double.parseDouble( term.text() );
return false;
} catch (Exception e) {}
}
return termFilter(term, desiredFields, minFreq, maxFreq, maxNonAlphabet);
} | boolean function( Term term, String[] desiredFields, int minFreq, int maxFreq, int maxNonAlphabet, boolean filterNumbers) { if (filterNumbers) { try { Double.parseDouble( term.text() ); return false; } catch (Exception e) {} } return termFilter(term, desiredFields, minFreq, maxFreq, maxNonAlphabet); } | /**
* Applies termFilter and additionally (if requested) filters out digit-only words.
*
* @param term Term to be filtered.
* @param desiredFields Terms in only these fields are filtered in
* @param minFreq minimum term frequency accepted
* @param maxFreq maximum term frequency accepted
* @param maxNonAlphabet reject terms with more than this number of non-alphabetic characters
* @param filterNumbers if true, filters out tokens that represent a number
*/ | Applies termFilter and additionally (if requested) filters out digit-only words | termFilter | {
"repo_name": "tuxdna/semanticvectors-googlecode",
"path": "src/main/java/pitt/search/semanticvectors/LuceneUtils.java",
"license": "bsd-3-clause",
"size": 15329
} | [
"org.apache.lucene.index.Term"
] | import org.apache.lucene.index.Term; | import org.apache.lucene.index.*; | [
"org.apache.lucene"
] | org.apache.lucene; | 267,022 |
public List<ConfigRevision> lookupFileInfo(User loggedInUser,
String channelLabel,
List<String> paths
) {
XmlRpcConfigChannelHelper configHelper = XmlRpcConfigChannelHelper.getInstance();
ConfigChannel channel = configHelper.lookupGlobal(loggedInUser,
channelLabel);
ConfigurationManager cm = ConfigurationManager.getInstance();
List <ConfigRevision> revisions = new LinkedList<ConfigRevision>();
for (String path : paths) {
ConfigFile cf = cm.lookupConfigFile(loggedInUser, channel.getId(), path);
if (cf == null) {
throw new NoSuchConfigFilePathException(path, channelLabel);
}
revisions.add(cf.getLatestConfigRevision());
}
return revisions;
} | List<ConfigRevision> function(User loggedInUser, String channelLabel, List<String> paths ) { XmlRpcConfigChannelHelper configHelper = XmlRpcConfigChannelHelper.getInstance(); ConfigChannel channel = configHelper.lookupGlobal(loggedInUser, channelLabel); ConfigurationManager cm = ConfigurationManager.getInstance(); List <ConfigRevision> revisions = new LinkedList<ConfigRevision>(); for (String path : paths) { ConfigFile cf = cm.lookupConfigFile(loggedInUser, channel.getId(), path); if (cf == null) { throw new NoSuchConfigFilePathException(path, channelLabel); } revisions.add(cf.getLatestConfigRevision()); } return revisions; } | /**
* Given a list of paths and a channel the method returns details about the latest
* revisions of the paths.
* @param loggedInUser The current user
* @param channelLabel the channel label
* @param paths a list of paths to examine.
* @return a list containing the latest config revisions of the requested paths.
* @since 10.2
*
* @xmlrpc.doc Given a list of paths and a channel, returns details about
* the latest revisions of the paths.
* @xmlrpc.param #session_key()
* @xmlrpc.param #param_desc("string", "channelLabel",
* "label of config channel to lookup on")
* @xmlrpc.param
* #array_single("string", "List of paths to examine.")
* @xmlrpc.returntype
* #array()
* $ConfigRevisionSerializer
* #array_end()
*/ | Given a list of paths and a channel the method returns details about the latest revisions of the paths | lookupFileInfo | {
"repo_name": "davidhrbac/spacewalk",
"path": "java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java",
"license": "gpl-2.0",
"size": 38853
} | [
"com.redhat.rhn.domain.config.ConfigChannel",
"com.redhat.rhn.domain.config.ConfigFile",
"com.redhat.rhn.domain.config.ConfigRevision",
"com.redhat.rhn.domain.user.User",
"com.redhat.rhn.frontend.xmlrpc.NoSuchConfigFilePathException",
"com.redhat.rhn.manager.configuration.ConfigurationManager",
"java.ut... | import com.redhat.rhn.domain.config.ConfigChannel; import com.redhat.rhn.domain.config.ConfigFile; import com.redhat.rhn.domain.config.ConfigRevision; import com.redhat.rhn.domain.user.User; import com.redhat.rhn.frontend.xmlrpc.NoSuchConfigFilePathException; import com.redhat.rhn.manager.configuration.ConfigurationManager; import java.util.LinkedList; import java.util.List; | import com.redhat.rhn.domain.config.*; import com.redhat.rhn.domain.user.*; import com.redhat.rhn.frontend.xmlrpc.*; import com.redhat.rhn.manager.configuration.*; import java.util.*; | [
"com.redhat.rhn",
"java.util"
] | com.redhat.rhn; java.util; | 776,087 |
Collection<String> getEntitiesClassNames(); | Collection<String> getEntitiesClassNames(); | /**
* Returns entities class names list.
*
* @return the list of class names
*/ | Returns entities class names list | getEntitiesClassNames | {
"repo_name": "sebbrudzinski/motech",
"path": "platform/mds/mds/src/main/java/org/motechproject/mds/entityinfo/EntityInfoReader.java",
"license": "bsd-3-clause",
"size": 904
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,895,103 |
public ReflectUtils field(final String name) {
try {
Field field = getField(name);
return new ReflectUtils(field.getType(), field.get(object));
} catch (IllegalAccessException e) {
throw new ReflectException(e);
}
} | ReflectUtils function(final String name) { try { Field field = getField(name); return new ReflectUtils(field.getType(), field.get(object)); } catch (IllegalAccessException e) { throw new ReflectException(e); } } | /**
* Get the field.
*
* @param name The name of field.
* @return the single {@link ReflectUtils} instance
*/ | Get the field | field | {
"repo_name": "didi/DoraemonKit",
"path": "Android/dokit-util/src/main/java/com/didichuxing/doraemonkit/util/ReflectUtils.java",
"license": "apache-2.0",
"size": 18317
} | [
"java.lang.reflect.Field"
] | import java.lang.reflect.Field; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 977,129 |
@ServiceMethod(returns = ReturnType.SINGLE)
Response<Boolean> checkExistenceWithResponse(
String resourceGroupName,
String resourceProviderNamespace,
String parentResourcePath,
String resourceType,
String resourceName,
String apiVersion,
Context context); | @ServiceMethod(returns = ReturnType.SINGLE) Response<Boolean> checkExistenceWithResponse( String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, Context context); | /**
* Checks whether a resource exists.
*
* @param resourceGroupName The name of the resource group containing the resource to check. The name is case
* insensitive.
* @param resourceProviderNamespace The resource provider of the resource to check.
* @param parentResourcePath The parent resource identity.
* @param resourceType The resource type.
* @param resourceName The name of the resource to check whether it exists.
* @param apiVersion The API version to use for the operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/ | Checks whether a resource exists | checkExistenceWithResponse | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluent/ResourcesClient.java",
"license": "mit",
"size": 91824
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; | [
"com.azure.core"
] | com.azure.core; | 2,296,241 |
protected double[] getPostPredictiveIntervalForPrediction(double[] record, double coverage, int num_cores_evaluate){
//get all gibbs samples sorted
double[] y_gibbs_samples_sorted = getGibbsSamplesForPrediction(record, num_cores_evaluate);
Arrays.sort(y_gibbs_samples_sorted);
//calculate index of the CI_a and CI_b
int n_bottom = (int)Math.round((1 - coverage) / 2 * y_gibbs_samples_sorted.length) - 1; //-1 because arrays start at zero
int n_top = (int)Math.round(((1 - coverage) / 2 + coverage) * y_gibbs_samples_sorted.length) - 1; //-1 because arrays start at zero
double[] conf_interval = {y_gibbs_samples_sorted[n_bottom], y_gibbs_samples_sorted[n_top]};
return conf_interval;
}
| double[] function(double[] record, double coverage, int num_cores_evaluate){ double[] y_gibbs_samples_sorted = getGibbsSamplesForPrediction(record, num_cores_evaluate); Arrays.sort(y_gibbs_samples_sorted); int n_bottom = (int)Math.round((1 - coverage) / 2 * y_gibbs_samples_sorted.length) - 1; int n_top = (int)Math.round(((1 - coverage) / 2 + coverage) * y_gibbs_samples_sorted.length) - 1; double[] conf_interval = {y_gibbs_samples_sorted[n_bottom], y_gibbs_samples_sorted[n_top]}; return conf_interval; } | /**
* For each sum-of-trees in each psoterior of the Gibbs samples, evaluate / predict these new records by summing over
* the prediction for each tree then order these by value and create an uncertainty interval
*
* @param record The observation for which to create an uncertainty interval
* @param coverage The percent coverage (between 0 and 1)
* @param num_cores_evaluate The number of CPU cores to use during evaluation
* @return A tuple which is the lower value in the interval followed by the higher value
*/ | For each sum-of-trees in each psoterior of the Gibbs samples, evaluate / predict these new records by summing over the prediction for each tree then order these by value and create an uncertainty interval | getPostPredictiveIntervalForPrediction | {
"repo_name": "kapelner/bartMachine",
"path": "src/bartMachine/bartMachine_h_eval.java",
"license": "mit",
"size": 4581
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 737,808 |
public void displayTrk(Vector trks) {
if (trks == null) {
//TODO:
} else {
try {
loadedTracksTile.dropTrk();
openTrackDatabase();
for (int j = 0; j< trks.size(); j++) {
PersistEntity track = (PersistEntity)trks.elementAt(j);
DataInputStream dis1 = new DataInputStream(new ByteArrayInputStream(trackDatabase.getRecord(track.id)));
trackName = dis1.readUTF();
mTrkRecorded = dis1.readInt();
mTrkSegments = 0;
int trackSize = dis1.readInt();
byte[] trackArray = new byte[trackSize];
dis1.read(trackArray);
DataInputStream trackIS = new DataInputStream(new ByteArrayInputStream(trackArray));
for (int i = 0; i < mTrkRecorded; i++) {
float lat = trackIS.readFloat();
float lon = trackIS.readFloat();
//center map on track start
if (i == 0 && j == 0) {
Trace tr = Trace.getInstance();
tr.receivePosition(lat * MoreMath.FAC_DECTORAD,
lon * MoreMath.FAC_DECTORAD, tr.scale);
}
trackIS.readShort(); //altitude
long time = trackIS.readLong(); //Time
trackIS.readByte(); //Speed
if (time > Long.MIN_VALUE + 10) { //We use some special markers in the Time to indicate
//Data other than trackpoints, so ignore these.
loadedTracksTile.addTrkPt(lat, lon, false);
}
}
dis1.close();
dis1 = null;
}
trackDatabase.closeRecordStore();
trackDatabase = null;
} catch (OutOfMemoryError oome) {
loadedTracksTile.dropTrk();
try {
trackDatabase.closeRecordStore();
} catch (RecordStoreException e) {
logger.exception(Locale.get("gpx.ExceptionClosingRecordstoreAfterOutOfMemoryErrorDisplayingTracks"), e);
}
trackDatabase = null;
System.gc();
} catch (IOException e) {
logger.exception(Locale.get("gpx.IOExceptionDisplayingTrack"), e);
} catch (RecordStoreNotOpenException e) {
logger.exception(Locale.get("gpx.ExceptionDisplayingTrackDBNotOpen"), e);
} catch (InvalidRecordIDException e) {
logger.exception(Locale.get("gpx.ExceptionDisplayingTrackIDInvalid"), e);
} catch (RecordStoreException e) {
logger.exception(Locale.get("gpx.ExceptionDisplayingTrack"), e);
}
}
}
| void function(Vector trks) { if (trks == null) { } else { try { loadedTracksTile.dropTrk(); openTrackDatabase(); for (int j = 0; j< trks.size(); j++) { PersistEntity track = (PersistEntity)trks.elementAt(j); DataInputStream dis1 = new DataInputStream(new ByteArrayInputStream(trackDatabase.getRecord(track.id))); trackName = dis1.readUTF(); mTrkRecorded = dis1.readInt(); mTrkSegments = 0; int trackSize = dis1.readInt(); byte[] trackArray = new byte[trackSize]; dis1.read(trackArray); DataInputStream trackIS = new DataInputStream(new ByteArrayInputStream(trackArray)); for (int i = 0; i < mTrkRecorded; i++) { float lat = trackIS.readFloat(); float lon = trackIS.readFloat(); if (i == 0 && j == 0) { Trace tr = Trace.getInstance(); tr.receivePosition(lat * MoreMath.FAC_DECTORAD, lon * MoreMath.FAC_DECTORAD, tr.scale); } trackIS.readShort(); long time = trackIS.readLong(); trackIS.readByte(); if (time > Long.MIN_VALUE + 10) { loadedTracksTile.addTrkPt(lat, lon, false); } } dis1.close(); dis1 = null; } trackDatabase.closeRecordStore(); trackDatabase = null; } catch (OutOfMemoryError oome) { loadedTracksTile.dropTrk(); try { trackDatabase.closeRecordStore(); } catch (RecordStoreException e) { logger.exception(Locale.get(STR), e); } trackDatabase = null; System.gc(); } catch (IOException e) { logger.exception(Locale.get(STR), e); } catch (RecordStoreNotOpenException e) { logger.exception(Locale.get(STR), e); } catch (InvalidRecordIDException e) { logger.exception(Locale.get(STR), e); } catch (RecordStoreException e) { logger.exception(Locale.get(STR), e); } } } | /**
* Loads the given tracks to display them on the map-screen
* @param trks Vector of tracks to be displayed
*/ | Loads the given tracks to display them on the map-screen | displayTrk | {
"repo_name": "martints/gpsmid",
"path": "src/de/ueller/gpsmid/data/Gpx.java",
"license": "gpl-2.0",
"size": 63591
} | [
"de.enough.polish.util.Locale",
"de.ueller.gpsmid.ui.Trace",
"de.ueller.util.MoreMath",
"java.io.ByteArrayInputStream",
"java.io.DataInputStream",
"java.io.IOException",
"java.util.Vector",
"javax.microedition.rms.InvalidRecordIDException",
"javax.microedition.rms.RecordStoreException",
"javax.mic... | import de.enough.polish.util.Locale; import de.ueller.gpsmid.ui.Trace; import de.ueller.util.MoreMath; import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.IOException; import java.util.Vector; import javax.microedition.rms.InvalidRecordIDException; import javax.microedition.rms.RecordStoreException; import javax.microedition.rms.RecordStoreNotOpenException; | import de.enough.polish.util.*; import de.ueller.gpsmid.ui.*; import de.ueller.util.*; import java.io.*; import java.util.*; import javax.microedition.rms.*; | [
"de.enough.polish",
"de.ueller.gpsmid",
"de.ueller.util",
"java.io",
"java.util",
"javax.microedition"
] | de.enough.polish; de.ueller.gpsmid; de.ueller.util; java.io; java.util; javax.microedition; | 2,031,547 |
public EdifactProtocolSettings withEdifactDelimiterOverrides(
List<EdifactDelimiterOverride> edifactDelimiterOverrides) {
this.edifactDelimiterOverrides = edifactDelimiterOverrides;
return this;
} | EdifactProtocolSettings function( List<EdifactDelimiterOverride> edifactDelimiterOverrides) { this.edifactDelimiterOverrides = edifactDelimiterOverrides; return this; } | /**
* Set the edifactDelimiterOverrides property: The EDIFACT delimiter override settings.
*
* @param edifactDelimiterOverrides the edifactDelimiterOverrides value to set.
* @return the EdifactProtocolSettings object itself.
*/ | Set the edifactDelimiterOverrides property: The EDIFACT delimiter override settings | withEdifactDelimiterOverrides | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/logic/azure-resourcemanager-logic/src/main/java/com/azure/resourcemanager/logic/models/EdifactProtocolSettings.java",
"license": "mit",
"size": 12966
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 229,745 |
public PublicKey generatePublic(KeySpec keySpec)
throws InvalidKeySpecException {
if (keySpec instanceof GMSSPublicKeySpec) {
GMSSPublicKeySpec gmssPublicKeySpec = (GMSSPublicKeySpec) keySpec;
return new GMSSPublicKey(gmssPublicKeySpec.getPublicKey(),
gmssPublicKeySpec.getGMSSParameterset());
} else if (keySpec instanceof X509EncodedKeySpec) {
// get the DER-encoded Key according to X.509 from the spec
byte[] enc = ((X509EncodedKeySpec) keySpec).getEncoded();
// decode the SubjectPublicKeyInfo data structure to the pki object
SubjectPublicKeyInfo pki = new SubjectPublicKeyInfo();
try {
ByteArrayInputStream bais = new ByteArrayInputStream(enc);
pki.decode(new DERDecoder(bais));
bais.close();
} catch (Exception ce) {
ce.printStackTrace();
throw new InvalidKeySpecException(
"Unable to decode X509EncodedKeySpec");
}
// get the inner type inside the BIT STRING
try {
ASN1Type innerType = pki.getDecodedRawKey();
GMSSPublicKeyASN1 gmssPublicKey = new GMSSPublicKeyASN1(
innerType);
return new GMSSPublicKey(gmssPublicKey.getKeySpec());
} catch (CorruptedCodeException cce) {
throw new InvalidKeySpecException(
"Unable to decode X509EncodedKeySpec");
}
}
throw new InvalidKeySpecException("Unknown KeySpec type");
}
| PublicKey function(KeySpec keySpec) throws InvalidKeySpecException { if (keySpec instanceof GMSSPublicKeySpec) { GMSSPublicKeySpec gmssPublicKeySpec = (GMSSPublicKeySpec) keySpec; return new GMSSPublicKey(gmssPublicKeySpec.getPublicKey(), gmssPublicKeySpec.getGMSSParameterset()); } else if (keySpec instanceof X509EncodedKeySpec) { byte[] enc = ((X509EncodedKeySpec) keySpec).getEncoded(); SubjectPublicKeyInfo pki = new SubjectPublicKeyInfo(); try { ByteArrayInputStream bais = new ByteArrayInputStream(enc); pki.decode(new DERDecoder(bais)); bais.close(); } catch (Exception ce) { ce.printStackTrace(); throw new InvalidKeySpecException( STR); } try { ASN1Type innerType = pki.getDecodedRawKey(); GMSSPublicKeyASN1 gmssPublicKey = new GMSSPublicKeyASN1( innerType); return new GMSSPublicKey(gmssPublicKey.getKeySpec()); } catch (CorruptedCodeException cce) { throw new InvalidKeySpecException( STR); } } throw new InvalidKeySpecException(STR); } | /**
* Converts, if possible, a key specification into a GMSSPublicKey.
* Currently the following key specs are supported: GMSSPublicKeySpec,
* X509EncodedKeySpec.
* <p>
*
* @param keySpec
* the key specification
* @return A GMSS public key
* @throws InvalidKeySpecException
* if the KeySpec is not supported
*/ | Converts, if possible, a key specification into a GMSSPublicKey. Currently the following key specs are supported: GMSSPublicKeySpec, X509EncodedKeySpec. | generatePublic | {
"repo_name": "besom/bbossgroups-mvn",
"path": "bboss_security/src/main/java/de/flexiprovider/pqc/hbc/gmss/GMSSKeyFactory.java",
"license": "apache-2.0",
"size": 9029
} | [
"de.flexiprovider.api.exceptions.InvalidKeySpecException",
"de.flexiprovider.api.keys.KeySpec",
"de.flexiprovider.api.keys.PublicKey",
"de.flexiprovider.pki.X509EncodedKeySpec",
"java.io.ByteArrayInputStream"
] | import de.flexiprovider.api.exceptions.InvalidKeySpecException; import de.flexiprovider.api.keys.KeySpec; import de.flexiprovider.api.keys.PublicKey; import de.flexiprovider.pki.X509EncodedKeySpec; import java.io.ByteArrayInputStream; | import de.flexiprovider.api.exceptions.*; import de.flexiprovider.api.keys.*; import de.flexiprovider.pki.*; import java.io.*; | [
"de.flexiprovider.api",
"de.flexiprovider.pki",
"java.io"
] | de.flexiprovider.api; de.flexiprovider.pki; java.io; | 358,123 |
public static String command(Command command) {
//check Service
if (!isBindService)
bindService();
if (iService == null) {
iLock.lock();
try {
iCondition.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
iLock.unlock();
}
//Get result
int count = 10;
while (count > 0) {
if (command.isCancel) {
if (command.listener != null)
command.listener.onCancel();
break;
}
try {
command.result = iService.command(command.id, command.parameter);
if (command.listener != null)
command.listener.onCompleted(command.result);
break;
} catch (Exception e) {
count--;
ToolUtils.sleepIgnoreInterrupt(3000);
}
}
//Check is Error
if (count <= 0) {
bindService();
if (command.listener != null)
command.listener.onError();
}
command.listener = null;
//Check is end
try {
if (iService.getTaskCount() <= 0)
dispose();
} catch (RemoteException e) {
e.printStackTrace();
}
//Return
return command.result;
} | static String function(Command command) { if (!isBindService) bindService(); if (iService == null) { iLock.lock(); try { iCondition.await(); } catch (InterruptedException e) { e.printStackTrace(); } iLock.unlock(); } int count = 10; while (count > 0) { if (command.isCancel) { if (command.listener != null) command.listener.onCancel(); break; } try { command.result = iService.command(command.id, command.parameter); if (command.listener != null) command.listener.onCompleted(command.result); break; } catch (Exception e) { count--; ToolUtils.sleepIgnoreInterrupt(3000); } } if (count <= 0) { bindService(); if (command.listener != null) command.listener.onError(); } command.listener = null; try { if (iService.getTaskCount() <= 0) dispose(); } catch (RemoteException e) { e.printStackTrace(); } return command.result; } | /**
* Command the test
*
* @param command Command
* @return Results
*/ | Command the test | command | {
"repo_name": "scudc/Genius-Android",
"path": "library/src/main/java/net/qiujuer/genius/command/Command.java",
"license": "apache-2.0",
"size": 6355
} | [
"android.os.RemoteException",
"net.qiujuer.genius.util.ToolUtils"
] | import android.os.RemoteException; import net.qiujuer.genius.util.ToolUtils; | import android.os.*; import net.qiujuer.genius.util.*; | [
"android.os",
"net.qiujuer.genius"
] | android.os; net.qiujuer.genius; | 2,110,759 |
public void calculateEuclideanDistance() {
euclideanDistance = Math.sqrt(
Math.pow((getX() - getCluster().getCentroid().getX()), 2.0) +
Math.pow((getY() - getCluster().getCentroid().getY()), 2.0));
} | void function() { euclideanDistance = Math.sqrt( Math.pow((getX() - getCluster().getCentroid().getX()), 2.0) + Math.pow((getY() - getCluster().getCentroid().getY()), 2.0)); } | /**
* Calculate the Euclidean distance.
* Called when a new DataPoint instance is added to a Cluster,
* or when the Centroid is recalculated.
*/ | Calculate the Euclidean distance. Called when a new DataPoint instance is added to a Cluster, or when the Centroid is recalculated | calculateEuclideanDistance | {
"repo_name": "youldash/NCCC",
"path": "Clustering/skeleton/DataPoint.java",
"license": "mit",
"size": 4236
} | [
"java.lang.Math"
] | import java.lang.Math; | import java.lang.*; | [
"java.lang"
] | java.lang; | 1,456,110 |
public void printCFDs() throws IOException{
ArrayList<CFD> cfds = new ArrayList<>(trader.userPortfolio());
int count=1;
Stock nrate;
printUserNotifications();
System.out.printf("\n%-20s %-20s %-20s %-20s %-20s %-20s\n","ID","COMPANY","OPEN RATE","ATUAL RATE","TYPE","UNITS");
for(CFD c: cfds){
nrate = YahooFinance.get(c.getCompany());
if(c.getType() == CFDtype.Buy){
System.out.printf("%-20s %-20s %-20s %-20s %-20s %-20s\n",count++,c.getCompany(),c.getRate(),nrate.getQuote().getBid(),c.getType(),c.getUnits());
}
else{
System.out.printf("%-20s %-20s %-20s %-20s %-20s %-20s\n",count++,c.getCompany(),c.getRate(),nrate.getQuote().getAsk(),c.getType(),c.getUnits());
}
}
System.out.println("\n");
} | void function() throws IOException{ ArrayList<CFD> cfds = new ArrayList<>(trader.userPortfolio()); int count=1; Stock nrate; printUserNotifications(); System.out.printf(STR,"ID",STR,STR,STR,"TYPE","UNITS"); for(CFD c: cfds){ nrate = YahooFinance.get(c.getCompany()); if(c.getType() == CFDtype.Buy){ System.out.printf(STR,count++,c.getCompany(),c.getRate(),nrate.getQuote().getBid(),c.getType(),c.getUnits()); } else{ System.out.printf(STR,count++,c.getCompany(),c.getRate(),nrate.getQuote().getAsk(),c.getType(),c.getUnits()); } } System.out.println("\n"); } | /**
* Imprime os CFD do utilizador atual.
*/ | Imprime os CFD do utilizador atual | printCFDs | {
"repo_name": "rgllm/uminho",
"path": "04/AS/TP3/src/tp2/after_refactoring/src/TraderApp.java",
"license": "mit",
"size": 11889
} | [
"java.io.IOException",
"java.util.ArrayList"
] | import java.io.IOException; import java.util.ArrayList; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,700,847 |
EClass getClass2();
| EClass getClass2(); | /**
* Returns the meta object for class '{@link org.dresdenocl.modelinstancetype.test.testmodel.Class2 <em>Class2</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Class2</em>'.
* @see org.dresdenocl.modelinstancetype.test.testmodel.Class2
* @generated
*/ | Returns the meta object for class '<code>org.dresdenocl.modelinstancetype.test.testmodel.Class2 Class2</code>'. | getClass2 | {
"repo_name": "dresden-ocl/dresdenocl",
"path": "tests/org.dresdenocl.modelinstancetype.ecore.testmodel/src/org/dresdenocl/modelinstancetype/test/testmodel/TestmodelPackage.java",
"license": "lgpl-3.0",
"size": 89535
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,920,842 |
private void initMap() {
try {
final Geometry geom = (Geometry)cidsBean.getProperty("geom.geo_field");
final Geometry geom31466 = CrsTransformer.transformToGivenCrs(geom.getEnvelope(), SMSUtils.EPSG_WUPP)
.buffer(60);
// geom31466 = geom31466.buffer(50);
final XBoundingBox bbox = new XBoundingBox(geom31466, SMSUtils.EPSG_WUPP, true);
final ActiveLayerModel mappingModel = new ActiveLayerModel();
mappingModel.setSrs(new Crs(SMSUtils.EPSG_WUPP, SMSUtils.EPSG_WUPP, SMSUtils.EPSG_WUPP, true, true));
mappingModel.addHome(bbox);
final SimpleWMS ortho = new SimpleWMS(new SimpleWmsGetMapUrl(
GeoCPMOptions.getInstance().getProperty("template.getmap.orthophoto").replace(
"<cismap:srs>",
"EPSG:31466")));
ortho.setName("Wuppertal Ortophoto"); // NOI18N
final RetrievalListener rl = new RetrievalListener() {
private final transient String text = lblMapHeader.getText(); | void function() { try { final Geometry geom = (Geometry)cidsBean.getProperty(STR); final Geometry geom31466 = CrsTransformer.transformToGivenCrs(geom.getEnvelope(), SMSUtils.EPSG_WUPP) .buffer(60); final XBoundingBox bbox = new XBoundingBox(geom31466, SMSUtils.EPSG_WUPP, true); final ActiveLayerModel mappingModel = new ActiveLayerModel(); mappingModel.setSrs(new Crs(SMSUtils.EPSG_WUPP, SMSUtils.EPSG_WUPP, SMSUtils.EPSG_WUPP, true, true)); mappingModel.addHome(bbox); final SimpleWMS ortho = new SimpleWMS(new SimpleWmsGetMapUrl( GeoCPMOptions.getInstance().getProperty(STR).replace( STR, STR))); ortho.setName(STR); final RetrievalListener rl = new RetrievalListener() { private final transient String text = lblMapHeader.getText(); | /**
* DOCUMENT ME!
*/ | DOCUMENT ME | initMap | {
"repo_name": "cismet/cids-custom-sudplan-wupp",
"path": "src/main/java/de/cismet/cids/custom/sudplan/wupp/objectrenderer/DeltaSurfaceRenderer.java",
"license": "lgpl-3.0",
"size": 25018
} | [
"com.vividsolutions.jts.geom.Geometry",
"de.cismet.cids.custom.sudplan.SMSUtils",
"de.cismet.cids.custom.sudplan.wupp.GeoCPMOptions",
"de.cismet.cismap.commons.Crs",
"de.cismet.cismap.commons.CrsTransformer",
"de.cismet.cismap.commons.XBoundingBox",
"de.cismet.cismap.commons.gui.layerwidget.ActiveLayerM... | import com.vividsolutions.jts.geom.Geometry; import de.cismet.cids.custom.sudplan.SMSUtils; import de.cismet.cids.custom.sudplan.wupp.GeoCPMOptions; import de.cismet.cismap.commons.Crs; import de.cismet.cismap.commons.CrsTransformer; import de.cismet.cismap.commons.XBoundingBox; import de.cismet.cismap.commons.gui.layerwidget.ActiveLayerModel; import de.cismet.cismap.commons.raster.wms.simple.SimpleWMS; import de.cismet.cismap.commons.raster.wms.simple.SimpleWmsGetMapUrl; import de.cismet.cismap.commons.retrieval.RetrievalListener; | import com.vividsolutions.jts.geom.*; import de.cismet.cids.custom.sudplan.*; import de.cismet.cids.custom.sudplan.wupp.*; import de.cismet.cismap.commons.*; import de.cismet.cismap.commons.gui.layerwidget.*; import de.cismet.cismap.commons.raster.wms.simple.*; import de.cismet.cismap.commons.retrieval.*; | [
"com.vividsolutions.jts",
"de.cismet.cids",
"de.cismet.cismap"
] | com.vividsolutions.jts; de.cismet.cids; de.cismet.cismap; | 680,187 |
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (elasticPoolName == null) {
return Mono
.error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String apiVersion = "2017-10-01-preview";
return FluxUtil
.withContext(
context ->
service
.createOrUpdate(
this.client.getEndpoint(),
resourceGroupName,
serverName,
elasticPoolName,
this.client.getSubscriptionId(),
apiVersion,
parameters,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Flux<ByteBuffer>>> function( String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (serverName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (elasticPoolName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (parameters == null) { return Mono.error(new IllegalArgumentException(STR)); } else { parameters.validate(); } final String apiVersion = STR; return FluxUtil .withContext( context -> service .createOrUpdate( this.client.getEndpoint(), resourceGroupName, serverName, elasticPoolName, this.client.getSubscriptionId(), apiVersion, parameters, context)) .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); } | /**
* Creates or updates an elastic pool.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
* from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param elasticPoolName The name of the elastic pool.
* @param parameters An elastic pool.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an elastic pool.
*/ | Creates or updates an elastic pool | createOrUpdateWithResponseAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-sql/src/main/java/com/azure/resourcemanager/sql/implementation/ElasticPoolsClientImpl.java",
"license": "mit",
"size": 108421
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.FluxUtil",
"com.azure.resourcemanager.sql.fluent.models.ElasticPoolInner",
"java.nio.ByteBuffer"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.sql.fluent.models.ElasticPoolInner; import java.nio.ByteBuffer; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.sql.fluent.models.*; import java.nio.*; | [
"com.azure.core",
"com.azure.resourcemanager",
"java.nio"
] | com.azure.core; com.azure.resourcemanager; java.nio; | 330,985 |
public static byte[] resourceToBytes(String resourcePath){
ClassLoader loader = Thread.currentThread().getContextClassLoader();
InputStream is = loader.getResourceAsStream(resourcePath);
byte[] bytes = new byte[0];
try {
bytes = IOUtils.toByteArray(is);
} catch (IOException e) {
throw new DS4PException(e.toString(), e);
}
return bytes;
} | static byte[] function(String resourcePath){ ClassLoader loader = Thread.currentThread().getContextClassLoader(); InputStream is = loader.getResourceAsStream(resourcePath); byte[] bytes = new byte[0]; try { bytes = IOUtils.toByteArray(is); } catch (IOException e) { throw new DS4PException(e.toString(), e); } return bytes; } | /**
* Resource to bytes.
*
* @param resourcePath the resource path
* @return the byte[]
*/ | Resource to bytes | resourceToBytes | {
"repo_name": "OBHITA/Consent2Share",
"path": "DS4P/access-control-service/common-library/src/main/java/gov/samhsa/acs/common/util/ArrayHelper.java",
"license": "bsd-3-clause",
"size": 3498
} | [
"gov.samhsa.acs.common.exception.DS4PException",
"java.io.IOException",
"java.io.InputStream",
"org.apache.commons.io.IOUtils"
] | import gov.samhsa.acs.common.exception.DS4PException; import java.io.IOException; import java.io.InputStream; import org.apache.commons.io.IOUtils; | import gov.samhsa.acs.common.exception.*; import java.io.*; import org.apache.commons.io.*; | [
"gov.samhsa.acs",
"java.io",
"org.apache.commons"
] | gov.samhsa.acs; java.io; org.apache.commons; | 1,144,698 |
public void complete(ITupleReference tuple) throws HyracksDataException; | void function(ITupleReference tuple) throws HyracksDataException; | /**
* This method is only called on a tuple that was reconciled on, and found after
* retraversing. This method allows an opportunity to do some subsequent action that was
* taken in {@link #reconcile(ITupleReference))}.
* @param tuple
* the tuple that was previously reconciled
*/ | This method is only called on a tuple that was reconciled on, and found after retraversing. This method allows an opportunity to do some subsequent action that was taken in <code>#reconcile(ITupleReference))</code> | complete | {
"repo_name": "apache/incubator-asterixdb-hyracks",
"path": "hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/api/ISearchOperationCallback.java",
"license": "apache-2.0",
"size": 3646
} | [
"org.apache.hyracks.api.exceptions.HyracksDataException",
"org.apache.hyracks.dataflow.common.data.accessors.ITupleReference"
] | import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference; | import org.apache.hyracks.api.exceptions.*; import org.apache.hyracks.dataflow.common.data.accessors.*; | [
"org.apache.hyracks"
] | org.apache.hyracks; | 312,663 |
List<EntityHeader> filterUnauthorizedHeaders(UserInfo userInfo,
List<EntityHeader> toFilter);
| List<EntityHeader> filterUnauthorizedHeaders(UserInfo userInfo, List<EntityHeader> toFilter); | /**
* Given a list of EntityHeaders, return the sub-set of EntityHeaders that the user is authorized to read.
* @param userInfo
* @param toFilter
* @return
*/ | Given a list of EntityHeaders, return the sub-set of EntityHeaders that the user is authorized to read | filterUnauthorizedHeaders | {
"repo_name": "Sage-Bionetworks/Synapse-Repository-Services",
"path": "services/repository-managers/src/main/java/org/sagebionetworks/repo/manager/NodeManager.java",
"license": "apache-2.0",
"size": 15277
} | [
"java.util.List",
"org.sagebionetworks.repo.model.EntityHeader",
"org.sagebionetworks.repo.model.UserInfo"
] | import java.util.List; import org.sagebionetworks.repo.model.EntityHeader; import org.sagebionetworks.repo.model.UserInfo; | import java.util.*; import org.sagebionetworks.repo.model.*; | [
"java.util",
"org.sagebionetworks.repo"
] | java.util; org.sagebionetworks.repo; | 2,865,331 |
@Override
public void translate(final ITranslationEnvironment environment, final IInstruction instruction,
final List<ReilInstruction> instructions) throws InternalTranslationException {
TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "xor");
if (instruction.getOperands().size() != 2) {
throw new InternalTranslationException(
"Error: Argument instruction is not a xor instruction (invalid number of operands)");
}
final long baseOffset = instruction.getAddress().toLong() * 0x100;
long offset = baseOffset;
final List<? extends IOperandTree> operands = instruction.getOperands();
final IOperandTree targetOperand = operands.get(0);
final IOperandTree sourceOperand = operands.get(1);
// Load source operand.
final TranslationResult sourceResult =
Helpers.translateOperand(environment, offset, sourceOperand, true);
instructions.addAll(sourceResult.getInstructions());
// Adjust the offset of the next REIL instruction.
offset = baseOffset + instructions.size();
// Load destination operand.
final TranslationResult targetResult =
Helpers.translateOperand(environment, offset, targetOperand, true);
// Adjust the offset of the next REIL instruction.
instructions.addAll(targetResult.getInstructions());
offset = baseOffset + instructions.size();
final OperandSize size = targetResult.getSize();
final String sourceRegister = sourceResult.getRegister();
final String targetRegister = targetResult.getRegister();
final String xorResult = environment.getNextVariableString();
// Do the XOR operation
instructions.add(ReilHelpers.createXor(offset, size, sourceRegister, size, targetRegister,
size, xorResult));
// Set the flags according to the result of the XOR operation
Helpers.generateBinaryOperationFlags(environment, offset + 1, xorResult, size, instructions);
offset = baseOffset + instructions.size();
// Write the result of the XOR operation into the target register
Helpers.writeBack(environment, offset, targetOperand, xorResult, size,
targetResult.getAddress(), targetResult.getType(), instructions);
} | void function(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException { TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "xor"); if (instruction.getOperands().size() != 2) { throw new InternalTranslationException( STR); } final long baseOffset = instruction.getAddress().toLong() * 0x100; long offset = baseOffset; final List<? extends IOperandTree> operands = instruction.getOperands(); final IOperandTree targetOperand = operands.get(0); final IOperandTree sourceOperand = operands.get(1); final TranslationResult sourceResult = Helpers.translateOperand(environment, offset, sourceOperand, true); instructions.addAll(sourceResult.getInstructions()); offset = baseOffset + instructions.size(); final TranslationResult targetResult = Helpers.translateOperand(environment, offset, targetOperand, true); instructions.addAll(targetResult.getInstructions()); offset = baseOffset + instructions.size(); final OperandSize size = targetResult.getSize(); final String sourceRegister = sourceResult.getRegister(); final String targetRegister = targetResult.getRegister(); final String xorResult = environment.getNextVariableString(); instructions.add(ReilHelpers.createXor(offset, size, sourceRegister, size, targetRegister, size, xorResult)); Helpers.generateBinaryOperationFlags(environment, offset + 1, xorResult, size, instructions); offset = baseOffset + instructions.size(); Helpers.writeBack(environment, offset, targetOperand, xorResult, size, targetResult.getAddress(), targetResult.getType(), instructions); } | /**
* Translates a XOR instruction to REIL code.
*
* @param environment A valid translation environment.
* @param instruction The XOR instruction to translate.
* @param instructions The generated REIL code will be added to this list
*
* @throws InternalTranslationException if any of the arguments are null the passed instruction is
* not an XOR instruction
*/ | Translates a XOR instruction to REIL code | translate | {
"repo_name": "crowell/binnavi",
"path": "src/main/java/com/google/security/zynamics/reil/translators/x86/XorTranslator.java",
"license": "apache-2.0",
"size": 4107
} | [
"com.google.security.zynamics.reil.OperandSize",
"com.google.security.zynamics.reil.ReilHelpers",
"com.google.security.zynamics.reil.ReilInstruction",
"com.google.security.zynamics.reil.translators.ITranslationEnvironment",
"com.google.security.zynamics.reil.translators.InternalTranslationException",
"com... | import com.google.security.zynamics.reil.OperandSize; import com.google.security.zynamics.reil.ReilHelpers; import com.google.security.zynamics.reil.ReilInstruction; import com.google.security.zynamics.reil.translators.ITranslationEnvironment; import com.google.security.zynamics.reil.translators.InternalTranslationException; import com.google.security.zynamics.reil.translators.TranslationHelpers; import com.google.security.zynamics.reil.translators.TranslationResult; import com.google.security.zynamics.zylib.disassembly.IInstruction; import com.google.security.zynamics.zylib.disassembly.IOperandTree; import java.util.List; | import com.google.security.zynamics.reil.*; import com.google.security.zynamics.reil.translators.*; import com.google.security.zynamics.zylib.disassembly.*; import java.util.*; | [
"com.google.security",
"java.util"
] | com.google.security; java.util; | 2,482,310 |
public final void performAction(Context context, BackgroundMode backgroundMode) {
if( backgroundMode.inBackground || backgroundMode.activity==null || backgroundMode.activity.isDestroyed() || backgroundMode.activity.isFinishing() ) {
performInBackground(context);
} else {
try {
performInForeground( backgroundMode.activity );
} catch (IllegalStateException exc) {
L.d("No longer in foreground, performing action in background");
// happens when a fragment cannot be displayed "java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState"
// so as a fallback we perform the action in background
performInBackground(context);
}
}
} | final void function(Context context, BackgroundMode backgroundMode) { if( backgroundMode.inBackground backgroundMode.activity==null backgroundMode.activity.isDestroyed() backgroundMode.activity.isFinishing() ) { performInBackground(context); } else { try { performInForeground( backgroundMode.activity ); } catch (IllegalStateException exc) { L.d(STR); performInBackground(context); } } } | /**
* Performs action (either in foreground or background, @see {@link com.upnext.blekit.BLEKit#setBackgroundMode(boolean, android.app.Activity)}).
*
* If an attempt to perform action in foreground fails (eg. IllegalStateException is thrown), then it is performed in background.
*
* @param context context
* @param backgroundMode background mode
*/ | Performs action (either in foreground or background, @see <code>com.upnext.blekit.BLEKit#setBackgroundMode(boolean, android.app.Activity)</code>). If an attempt to perform action in foreground fails (eg. IllegalStateException is thrown), then it is performed in background | performAction | {
"repo_name": "upnext/blekit-android",
"path": "src/main/java/com/upnext/blekit/actions/BLEAction.java",
"license": "mit",
"size": 7949
} | [
"android.content.Context",
"com.upnext.blekit.BackgroundMode",
"com.upnext.blekit.util.L"
] | import android.content.Context; import com.upnext.blekit.BackgroundMode; import com.upnext.blekit.util.L; | import android.content.*; import com.upnext.blekit.*; import com.upnext.blekit.util.*; | [
"android.content",
"com.upnext.blekit"
] | android.content; com.upnext.blekit; | 345,055 |
public static boolean hasGroup(Matcher matcher) {
return matcher.groupCount() > 0;
} | static boolean function(Matcher matcher) { return matcher.groupCount() > 0; } | /**
* Check whether a Matcher contains a group or not.
*
* @param matcher a Matcher
* @return boolean <code>true</code> if matcher contains at least one group.
* @since 1.0
*/ | Check whether a Matcher contains a group or not | hasGroup | {
"repo_name": "OpenBEL/kam-nav",
"path": "tools/groovy/src/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java",
"license": "apache-2.0",
"size": 132600
} | [
"java.util.regex.Matcher"
] | import java.util.regex.Matcher; | import java.util.regex.*; | [
"java.util"
] | java.util; | 1,426,784 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.