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 VertexLabel getOrCreateVertexLabel(String name);
|
VertexLabel function(String name);
|
/**
* Returns the vertex label with the given name. If a vertex label with this name does not exist, the label is
* automatically created through the registered {@link com.thinkaurelius.titan.core.schema.DefaultSchemaMaker}.
* <p />
* Attempting to automatically create a vertex label might cause an exception depending on the configuration.
*
* @param name
* @return
*/
|
Returns the vertex label with the given name. If a vertex label with this name does not exist, the label is automatically created through the registered <code>com.thinkaurelius.titan.core.schema.DefaultSchemaMaker</code>. Attempting to automatically create a vertex label might cause an exception depending on the configuration
|
getOrCreateVertexLabel
|
{
"repo_name": "CYPP/titan",
"path": "titan-core/src/main/java/com/thinkaurelius/titan/core/schema/SchemaInspector.java",
"license": "apache-2.0",
"size": 4073
}
|
[
"com.thinkaurelius.titan.core.VertexLabel"
] |
import com.thinkaurelius.titan.core.VertexLabel;
|
import com.thinkaurelius.titan.core.*;
|
[
"com.thinkaurelius.titan"
] |
com.thinkaurelius.titan;
| 1,909,827
|
@Deprecated
ServiceResponse<String> executeCommands(String id, String payload);
|
ServiceResponse<String> executeCommands(String id, String payload);
|
/**
* This method is deprecated on KieServicesClient as it was moved to RuleServicesClient
* @see RuleServicesClient#executeCommands(String, String)
* @deprecated
*/
|
This method is deprecated on KieServicesClient as it was moved to RuleServicesClient
|
executeCommands
|
{
"repo_name": "markcoble/droolsjbpm-integration",
"path": "kie-server-parent/kie-server-remote/kie-server-client/src/main/java/org/kie/server/client/KieServicesClient.java",
"license": "apache-2.0",
"size": 3216
}
|
[
"org.kie.server.api.model.ServiceResponse"
] |
import org.kie.server.api.model.ServiceResponse;
|
import org.kie.server.api.model.*;
|
[
"org.kie.server"
] |
org.kie.server;
| 1,563,160
|
void removeVariables(Collection<String> variableNames);
|
void removeVariables(Collection<String> variableNames);
|
/**
* Removes the variables and creates a new {@link HistoricVariableUpdate} for each of them.
*/
|
Removes the variables and creates a new <code>HistoricVariableUpdate</code> for each of them
|
removeVariables
|
{
"repo_name": "robsoncardosoti/flowable-engine",
"path": "modules/flowable-engine/src/main/java/org/flowable/engine/delegate/VariableScope.java",
"license": "apache-2.0",
"size": 16165
}
|
[
"java.util.Collection"
] |
import java.util.Collection;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 857,470
|
public static void createDiff(final PrintWriter writer,
final PgDiffArguments arguments, final InputStream oldInputStream,
final InputStream newInputStream) {
final PgDatabase oldDatabase = PgDumpLoader.loadDatabaseSchema(
oldInputStream, arguments.getInCharsetName(),
arguments.isOutputIgnoredStatements(),
arguments.isIgnoreSlonyTriggers());
final PgDatabase newDatabase = PgDumpLoader.loadDatabaseSchema(
newInputStream, arguments.getInCharsetName(),
arguments.isOutputIgnoredStatements(),
arguments.isIgnoreSlonyTriggers());
diffDatabaseSchemas(writer, arguments, oldDatabase, newDatabase);
}
|
static void function(final PrintWriter writer, final PgDiffArguments arguments, final InputStream oldInputStream, final InputStream newInputStream) { final PgDatabase oldDatabase = PgDumpLoader.loadDatabaseSchema( oldInputStream, arguments.getInCharsetName(), arguments.isOutputIgnoredStatements(), arguments.isIgnoreSlonyTriggers()); final PgDatabase newDatabase = PgDumpLoader.loadDatabaseSchema( newInputStream, arguments.getInCharsetName(), arguments.isOutputIgnoredStatements(), arguments.isIgnoreSlonyTriggers()); diffDatabaseSchemas(writer, arguments, oldDatabase, newDatabase); }
|
/**
* Creates diff on the two database schemas.
*
* @param writer writer the output should be written to
* @param arguments object containing arguments settings
* @param oldInputStream input stream of file containing dump of the
* original schema
* @param newInputStream input stream of file containing dump of the new
* schema
*/
|
Creates diff on the two database schemas
|
createDiff
|
{
"repo_name": "divinebovine/apgdiff",
"path": "src/main/java/cz/startnet/utils/pgdiff/PgDiff.java",
"license": "mit",
"size": 11983
}
|
[
"cz.startnet.utils.pgdiff.loader.PgDumpLoader",
"cz.startnet.utils.pgdiff.schema.PgDatabase",
"java.io.InputStream",
"java.io.PrintWriter"
] |
import cz.startnet.utils.pgdiff.loader.PgDumpLoader; import cz.startnet.utils.pgdiff.schema.PgDatabase; import java.io.InputStream; import java.io.PrintWriter;
|
import cz.startnet.utils.pgdiff.loader.*; import cz.startnet.utils.pgdiff.schema.*; import java.io.*;
|
[
"cz.startnet.utils",
"java.io"
] |
cz.startnet.utils; java.io;
| 2,082,132
|
public static BroadcastReceiver registerPebbleConnectedReceiver( final Context context,
final BroadcastReceiver receiver )
{
return registerBroadcastReceiverInternal( context, INTENT_PEBBLE_CONNECTED, receiver );
}
|
static BroadcastReceiver function( final Context context, final BroadcastReceiver receiver ) { return registerBroadcastReceiverInternal( context, INTENT_PEBBLE_CONNECTED, receiver ); }
|
/**
* A convenience function to assist in programatically registering a broadcast receiver for the 'CONNECTED' intent.
* <p/>
* To avoid leaking memory, activities registering BroadcastReceivers <em>must</em> unregister them in the
* Activity's {@link android.app.Activity#onPause()} method.
*
* @param context The context in which to register the BroadcastReceiver.
* @param receiver The receiver to be registered.
* @return The registered receiver.
* @see Constants#INTENT_PEBBLE_CONNECTED
*/
|
A convenience function to assist in programatically registering a broadcast receiver for the 'CONNECTED' intent. To avoid leaking memory, activities registering BroadcastReceivers must unregister them in the Activity's <code>android.app.Activity#onPause()</code> method
|
registerPebbleConnectedReceiver
|
{
"repo_name": "zaxebo1/RingMyPhoneAndroid",
"path": "RingMyPhone/src/main/java/com/getpebble/android/kit/PebbleKit.java",
"license": "mit",
"size": 35095
}
|
[
"android.content.BroadcastReceiver",
"android.content.Context"
] |
import android.content.BroadcastReceiver; import android.content.Context;
|
import android.content.*;
|
[
"android.content"
] |
android.content;
| 1,926,521
|
// First the triple
StringJoiner tripleJoiner = new StringJoiner(";", "(", ")");
String subject = proposition.getSubject().toString();
if (!subject.isEmpty()) tripleJoiner.add(subject);
String relation = proposition.getRelation().toString();
if (!relation.isEmpty()) tripleJoiner.add(relation);
String object = proposition.getObject().toString();
if (!object.isEmpty()) tripleJoiner.add(object);
// Factuality
String factualityString = "";
String factuality = formatFactuality(proposition.getPolarity().getType().toString(), proposition.getModality().getModalityType().toString());
if (!factuality.isEmpty()) factualityString = String.format("[factuality=%s]", factuality);
// Attribution
Attribution attribution = proposition.getAttribution();
String attributionString = "";
// Only process the attribution if there is a attribution phrase TODO is this suitable?
if (attribution != null && attribution.getAttributionPhrase() != null) {
StringJoiner attributionAttributesJoiner = new StringJoiner(";");
String attributionPhrase = attribution.getAttributionPhrase().toString();
if (!attributionPhrase.isEmpty()) attributionAttributesJoiner.add("phrase:" + attributionPhrase);
String attributionPredicate = attribution.getPredicateVerb().toString();
if (!attributionPredicate.isEmpty()) attributionAttributesJoiner.add("predicate:" + attributionPredicate);
String attributionFactuality = formatFactuality(attribution.getPolarityType().toString(), attribution.getModalityType().toString());
if (!attributionFactuality.isEmpty()) attributionAttributesJoiner.add("factuality:" + attributionFactuality);
attributionString = String.format("[attribution=%s]", attributionAttributesJoiner.toString());
}
// Quantities
StringJoiner quantityJoiner = new StringJoiner(";");
String quantitiesString = "";
ObjectArrayList<Quantity> quantities = new ObjectArrayList<Quantity>();
// Add all quantities
quantities.addAll(proposition.getSubject().getQuantities());
quantities.addAll(proposition.getRelation().getQuantities());
quantities.addAll(proposition.getObject().getQuantities());
if (quantities.size() > 0) {
for (Quantity q : quantities) {
StringJoiner quantityPhrase = new StringJoiner(" ");
for (IndexedWord w : q.getQuantityWords()) {
quantityPhrase.add(w.originalText());
}
quantityJoiner.add(String.format("QUANT_%s:%s", q.getId(),quantityPhrase.toString()));
}
quantitiesString = String.format("[quantities=%s]", quantityJoiner.toString());
}
String output = tripleJoiner.toString() + factualityString + attributionString + quantitiesString;
return output;
}
|
StringJoiner tripleJoiner = new StringJoiner(";", "(", ")"); String subject = proposition.getSubject().toString(); if (!subject.isEmpty()) tripleJoiner.add(subject); String relation = proposition.getRelation().toString(); if (!relation.isEmpty()) tripleJoiner.add(relation); String object = proposition.getObject().toString(); if (!object.isEmpty()) tripleJoiner.add(object); String factualityString = STR[factuality=%s]STRSTR;STRphrase:STRpredicate:STRfactuality:STR[attribution=%s]STR;STRSTR STRQUANT_%s:%sSTR[quantities=%s]", quantityJoiner.toString()); } String output = tripleJoiner.toString() + factualityString + attributionString + quantitiesString; return output; }
|
/**
* formats an annotated proposition in Ollie style
* @param proposition: annotated proposition to format
* @return formatted proposition
*/
|
formats an annotated proposition in Ollie style
|
formatProposition
|
{
"repo_name": "gkiril/minie",
"path": "src/main/java/de/uni_mannheim/utils/minie/Utils.java",
"license": "gpl-3.0",
"size": 6829
}
|
[
"java.util.StringJoiner"
] |
import java.util.StringJoiner;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,093,578
|
EAttribute getCreateExpression_Alias();
|
EAttribute getCreateExpression_Alias();
|
/**
* Returns the meta object for the attribute '{@link org.eclipse.xtext.testlanguages.backtracking.beeLangTestLanguage.CreateExpression#getAlias <em>Alias</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Alias</em>'.
* @see org.eclipse.xtext.testlanguages.backtracking.beeLangTestLanguage.CreateExpression#getAlias()
* @see #getCreateExpression()
* @generated
*/
|
Returns the meta object for the attribute '<code>org.eclipse.xtext.testlanguages.backtracking.beeLangTestLanguage.CreateExpression#getAlias Alias</code>'.
|
getCreateExpression_Alias
|
{
"repo_name": "miklossy/xtext-core",
"path": "org.eclipse.xtext.testlanguages/src-gen/org/eclipse/xtext/testlanguages/backtracking/beeLangTestLanguage/BeeLangTestLanguagePackage.java",
"license": "epl-1.0",
"size": 161651
}
|
[
"org.eclipse.emf.ecore.EAttribute"
] |
import org.eclipse.emf.ecore.EAttribute;
|
import org.eclipse.emf.ecore.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 682,312
|
public void setHttpBindPorts(int unsecurePort, int securePort) throws Exception {
changeHttpBindPorts(unsecurePort, securePort);
bindPort = unsecurePort;
bindSecurePort = securePort;
if (unsecurePort != HTTP_BIND_PORT_DEFAULT) {
JiveGlobals.setProperty(HTTP_BIND_PORT, String.valueOf(unsecurePort));
}
else {
JiveGlobals.deleteProperty(HTTP_BIND_PORT);
}
if (securePort != HTTP_BIND_SECURE_PORT_DEFAULT) {
JiveGlobals.setProperty(HTTP_BIND_SECURE_PORT, String.valueOf(securePort));
}
else {
JiveGlobals.deleteProperty(HTTP_BIND_SECURE_PORT);
}
}
|
void function(int unsecurePort, int securePort) throws Exception { changeHttpBindPorts(unsecurePort, securePort); bindPort = unsecurePort; bindSecurePort = securePort; if (unsecurePort != HTTP_BIND_PORT_DEFAULT) { JiveGlobals.setProperty(HTTP_BIND_PORT, String.valueOf(unsecurePort)); } else { JiveGlobals.deleteProperty(HTTP_BIND_PORT); } if (securePort != HTTP_BIND_SECURE_PORT_DEFAULT) { JiveGlobals.setProperty(HTTP_BIND_SECURE_PORT, String.valueOf(securePort)); } else { JiveGlobals.deleteProperty(HTTP_BIND_SECURE_PORT); } }
|
/**
* Set the ports on which the HTTP binding service will be running.
*
* @param unsecurePort the unsecured connection port which clients can connect to.
* @param securePort the secured connection port which clients can connect to.
* @throws Exception when there is an error configuring the HTTP binding ports.
*/
|
Set the ports on which the HTTP binding service will be running
|
setHttpBindPorts
|
{
"repo_name": "eraserx99/OF",
"path": "src/java/org/jivesoftware/openfire/http/HttpBindManager.java",
"license": "apache-2.0",
"size": 21081
}
|
[
"org.jivesoftware.util.JiveGlobals"
] |
import org.jivesoftware.util.JiveGlobals;
|
import org.jivesoftware.util.*;
|
[
"org.jivesoftware.util"
] |
org.jivesoftware.util;
| 180,427
|
@JsonProperty(value = "Target")
public String getTarget() {
return this.Target;
}
|
@JsonProperty(value = STR) String function() { return this.Target; }
|
/**
* Get the target
* @return The target
*/
|
Get the target
|
getTarget
|
{
"repo_name": "baidubce/bce-sdk-java",
"path": "src/main/java/com/baidubce/services/cfc/model/UpdateTriggerRequest.java",
"license": "apache-2.0",
"size": 3724
}
|
[
"com.fasterxml.jackson.annotation.JsonProperty"
] |
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.*;
|
[
"com.fasterxml.jackson"
] |
com.fasterxml.jackson;
| 1,291,418
|
public Map<String, CourseDetailsBundle> getCourseSummariesForInstructors(List<InstructorAttributes> instructorList) {
Assumption.assertNotNull(instructorList);
return coursesLogic.getCourseSummariesForInstructor(instructorList);
}
|
Map<String, CourseDetailsBundle> function(List<InstructorAttributes> instructorList) { Assumption.assertNotNull(instructorList); return coursesLogic.getCourseSummariesForInstructor(instructorList); }
|
/**
* Preconditions: <br>
* * All parameters are non-null.
* @return A less detailed version of courses for the specified instructor attributes.
* Returns an empty list if none found.
*/
|
Preconditions: All parameters are non-null
|
getCourseSummariesForInstructors
|
{
"repo_name": "Mynk96/teammates",
"path": "src/main/java/teammates/logic/api/Logic.java",
"license": "gpl-2.0",
"size": 86976
}
|
[
"java.util.List",
"java.util.Map"
] |
import java.util.List; import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,721,126
|
private boolean isShadowed(Method method, List<Method> previousMethods) {
for (Method each : previousMethods) {
if (isShadowed(method, each)) {
return true;
}
}
return false;
}
|
boolean function(Method method, List<Method> previousMethods) { for (Method each : previousMethods) { if (isShadowed(method, each)) { return true; } } return false; }
|
/**
* Determines if the supplied {@link Method method} is <em>shadowed</em> by
* a method in supplied {@link List list} of previous methods.
* <p>
* Note: This code has been borrowed from
* {@link org.junit.internal.runners.TestClass#isShadowed(Method,List)}.
*
* @param method
* the method to check for shadowing
* @param previousMethods
* the list of methods which have previously been processed
* @return <code>true</code> if the supplied method is shadowed by a method
* in the <code>previousMethods</code> list
*/
|
Determines if the supplied <code>Method method</code> is shadowed by a method in supplied <code>List list</code> of previous methods. Note: This code has been borrowed from <code>org.junit.internal.runners.TestClass#isShadowed(Method,List)</code>
|
isShadowed
|
{
"repo_name": "fpuna-cia/karaku",
"path": "src/test/java/py/una/pol/karaku/test/cucumber/TransactionalTestCucumberExecutionListener.java",
"license": "lgpl-2.1",
"size": 20393
}
|
[
"java.lang.reflect.Method",
"java.util.List"
] |
import java.lang.reflect.Method; import java.util.List;
|
import java.lang.reflect.*; import java.util.*;
|
[
"java.lang",
"java.util"
] |
java.lang; java.util;
| 2,387,290
|
protected void appendObjectProps(SortedMap<String, Object> props) {
props.put("ID", Integer.valueOf(mId));
putProp(props, "Name", mName);
putProp(props, "Object type", getType());
putProp(props, "X", mX);
putProp(props, "Y", mY);
putProp(props, "Z", mZ);
putProp(props, "Race", mRace);
putProp(props, "Class", mArtemisClass);
putProp(props, "Level 1 intel", mIntelLevel1);
putProp(props, "Level 2 intel", mIntelLevel2);
if (unknownProps != null) {
props.putAll(unknownProps);
}
}
|
void function(SortedMap<String, Object> props) { props.put("ID", Integer.valueOf(mId)); putProp(props, "Name", mName); putProp(props, STR, getType()); putProp(props, "X", mX); putProp(props, "Y", mY); putProp(props, "Z", mZ); putProp(props, "Race", mRace); putProp(props, "Class", mArtemisClass); putProp(props, STR, mIntelLevel1); putProp(props, STR, mIntelLevel2); if (unknownProps != null) { props.putAll(unknownProps); } }
|
/**
* Appends this object's properties to the given map. Unspecified values
* should be omitted. Subclasses must always call the superclass's
* implementation of this method.
*/
|
Appends this object's properties to the given map. Unspecified values should be omitted. Subclasses must always call the superclass's implementation of this method
|
appendObjectProps
|
{
"repo_name": "rjwut/ian",
"path": "src/main/java/com/walkertribe/ian/world/BaseArtemisObject.java",
"license": "mit",
"size": 10487
}
|
[
"java.util.SortedMap"
] |
import java.util.SortedMap;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,941,837
|
public static void visitSinglePath(BlockNode startBlock, Consumer<BlockNode> visitor) {
if (startBlock == null) {
return;
}
visitor.accept(startBlock);
BlockNode next = getNextSinglePathBlock(startBlock);
while (next != null) {
visitor.accept(next);
next = getNextSinglePathBlock(next);
}
}
|
static void function(BlockNode startBlock, Consumer<BlockNode> visitor) { if (startBlock == null) { return; } visitor.accept(startBlock); BlockNode next = getNextSinglePathBlock(startBlock); while (next != null) { visitor.accept(next); next = getNextSinglePathBlock(next); } }
|
/**
* Visit blocks on path without branching or merging paths.
*/
|
Visit blocks on path without branching or merging paths
|
visitSinglePath
|
{
"repo_name": "skylot/jadx",
"path": "jadx-core/src/main/java/jadx/core/utils/BlockUtils.java",
"license": "apache-2.0",
"size": 33022
}
|
[
"java.util.function.Consumer"
] |
import java.util.function.Consumer;
|
import java.util.function.*;
|
[
"java.util"
] |
java.util;
| 1,753,567
|
public void testMinimalCompletionStage_toCompletableFuture_exceptionalCompletion() {
for (boolean createIncomplete : new boolean[] { true, false })
{
CFException ex = new CFException();
CompletableFuture<Integer> f = new CompletableFuture<>();
CompletionStage<Integer> minimal = f.minimalCompletionStage();
if (!createIncomplete) f.completeExceptionally(ex);
CompletableFuture<Integer> g = minimal.toCompletableFuture();
if (createIncomplete) {
checkIncomplete(f);
checkIncomplete(g);
f.completeExceptionally(ex);
}
checkCompletedExceptionally(f, ex);
checkCompletedWithWrappedException(g, ex);
}}
|
void function() { for (boolean createIncomplete : new boolean[] { true, false }) { CFException ex = new CFException(); CompletableFuture<Integer> f = new CompletableFuture<>(); CompletionStage<Integer> minimal = f.minimalCompletionStage(); if (!createIncomplete) f.completeExceptionally(ex); CompletableFuture<Integer> g = minimal.toCompletableFuture(); if (createIncomplete) { checkIncomplete(f); checkIncomplete(g); f.completeExceptionally(ex); } checkCompletedExceptionally(f, ex); checkCompletedWithWrappedException(g, ex); }}
|
/**
* minimalStage.toCompletableFuture() returns a CompletableFuture that
* is completed exceptionally when source is.
*/
|
minimalStage.toCompletableFuture() returns a CompletableFuture that is completed exceptionally when source is
|
testMinimalCompletionStage_toCompletableFuture_exceptionalCompletion
|
{
"repo_name": "google/desugar_jdk_libs",
"path": "jdk11/src/libcore/ojluni/src/test/java/util/concurrent/tck/CompletableFutureTest.java",
"license": "gpl-2.0",
"size": 182910
}
|
[
"java.util.concurrent.CompletableFuture",
"java.util.concurrent.CompletionStage"
] |
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage;
|
import java.util.concurrent.*;
|
[
"java.util"
] |
java.util;
| 114,332
|
public static void setLabel(Model model,
org.ontoware.rdf2go.model.node.Resource instanceResource,
org.ontoware.rdf2go.model.node.Node value) {
Base.set(model, instanceResource, LABEL, value);
}
|
static void function(Model model, org.ontoware.rdf2go.model.node.Resource instanceResource, org.ontoware.rdf2go.model.node.Node value) { Base.set(model, instanceResource, LABEL, value); }
|
/**
* Sets a value of property Label from an RDF2Go node. First, all existing
* values are removed, then this value is added. Cardinality constraints are
* not checked, but this method exists only for properties with no
* minCardinality or minCardinality == 1.
*
* @param model an RDF2Go model
* @param instanceResource an RDF2Go resource
* @param value the value to be set
*
* [Generated from RDFReactor template rule #set1static]
*/
|
Sets a value of property Label from an RDF2Go node. First, all existing values are removed, then this value is added. Cardinality constraints are not checked, but this method exists only for properties with no minCardinality or minCardinality == 1
|
setLabel
|
{
"repo_name": "semweb4j/semweb4j",
"path": "org.semweb4j.rdfreactor.generator/src/main/java/org/ontoware/rdfreactor/schema/bootstrap/Resource.java",
"license": "bsd-2-clause",
"size": 83665
}
|
[
"org.ontoware.rdf2go.model.Model",
"org.ontoware.rdfreactor.runtime.Base"
] |
import org.ontoware.rdf2go.model.Model; import org.ontoware.rdfreactor.runtime.Base;
|
import org.ontoware.rdf2go.model.*; import org.ontoware.rdfreactor.runtime.*;
|
[
"org.ontoware.rdf2go",
"org.ontoware.rdfreactor"
] |
org.ontoware.rdf2go; org.ontoware.rdfreactor;
| 1,541,672
|
List<Long> evaluate(long dataSourceId) throws ExportRulesException {
try {
SleuthkitCase db = Case.getCurrentCaseThrows().getSleuthkitCase();
try (SleuthkitCase.CaseDbQuery queryResult = db.executeQuery(getQuery(dataSourceId));
ResultSet resultSet = queryResult.getResultSet();) {
List<Long> fileIds = new ArrayList<>();
while (resultSet.next()) {
fileIds.add(resultSet.getLong("obj_id"));
}
return fileIds;
}
} catch (NoCurrentCaseException ex) {
throw new ExportRulesException("No current case", ex);
} catch (TskCoreException ex) {
throw new ExportRulesException("Error querying case database", ex);
} catch (SQLException ex) {
throw new ExportRulesException("Error processing result set", ex);
}
}
|
List<Long> evaluate(long dataSourceId) throws ExportRulesException { try { SleuthkitCase db = Case.getCurrentCaseThrows().getSleuthkitCase(); try (SleuthkitCase.CaseDbQuery queryResult = db.executeQuery(getQuery(dataSourceId)); ResultSet resultSet = queryResult.getResultSet();) { List<Long> fileIds = new ArrayList<>(); while (resultSet.next()) { fileIds.add(resultSet.getLong(STR)); } return fileIds; } } catch (NoCurrentCaseException ex) { throw new ExportRulesException(STR, ex); } catch (TskCoreException ex) { throw new ExportRulesException(STR, ex); } catch (SQLException ex) { throw new ExportRulesException(STR, ex); } }
|
/**
* Evaluates a rule to determine if there are any files that satisfy the
* rule.
*
* @param dataSourceId The data source id of the files.
*
* @return A list of file ids, possibly empty.
*
* @throws
* org.sleuthkit.autopsy.autoingest.fileexporter.ExportRuleSet.ExportRulesException
*/
|
Evaluates a rule to determine if there are any files that satisfy the rule
|
evaluate
|
{
"repo_name": "esaunders/autopsy",
"path": "Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/FileExportRuleSet.java",
"license": "apache-2.0",
"size": 41669
}
|
[
"java.sql.ResultSet",
"java.sql.SQLException",
"java.util.ArrayList",
"java.util.List",
"org.sleuthkit.autopsy.casemodule.Case",
"org.sleuthkit.autopsy.casemodule.NoCurrentCaseException",
"org.sleuthkit.datamodel.SleuthkitCase",
"org.sleuthkit.datamodel.TskCoreException"
] |
import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException;
|
import java.sql.*; import java.util.*; import org.sleuthkit.autopsy.casemodule.*; import org.sleuthkit.datamodel.*;
|
[
"java.sql",
"java.util",
"org.sleuthkit.autopsy",
"org.sleuthkit.datamodel"
] |
java.sql; java.util; org.sleuthkit.autopsy; org.sleuthkit.datamodel;
| 1,430,936
|
void processAMDAndCommonJSModules() {
Map<String, JSModule> modulesByName = Maps.newLinkedHashMap();
Map<CompilerInput, JSModule> modulesByInput = Maps.newLinkedHashMap();
// TODO(nicksantos): Refactor module dependency resolution to work nicely
// with multiple ways to express dependencies. Directly support JSModules
// that are equivalent to a signal file and which express their deps
// directly in the source.
for (CompilerInput input : inputs) {
input.setCompiler(this);
Node root = input.getAstRoot(this);
if (root == null) {
continue;
}
if (options.transformAMDToCJSModules) {
new TransformAMDToCJSModule(this).process(null, root);
}
if (options.processCommonJSModules) {
ProcessCommonJSModules cjs = new ProcessCommonJSModules(this,
options.commonJSModulePathPrefix);
cjs.process(null, root);
JSModule m = cjs.getModule();
if (m != null) {
modulesByName.put(m.getName(), m);
modulesByInput.put(input, m);
}
}
}
if (options.processCommonJSModules) {
List<JSModule> modules = Lists.newArrayList(modulesByName.values());
if (!modules.isEmpty()) {
this.modules = modules;
this.moduleGraph = new JSModuleGraph(this.modules);
}
for (JSModule module : modules) {
for (CompilerInput input : module.getInputs()) {
for (String require : input.getRequires()) {
JSModule dependency = modulesByName.get(require);
if (dependency == null) {
report(JSError.make(MISSING_ENTRY_ERROR, require));
} else {
module.addDependency(dependency);
}
}
}
}
try {
modules = Lists.newArrayList();
for (CompilerInput input : this.moduleGraph.manageDependencies(
options.dependencyOptions, inputs)) {
modules.add(modulesByInput.get(input));
}
JSModule root = new JSModule("root");
for (JSModule m : modules) {
m.addDependency(root);
}
modules.add(0, root);
SortedDependencies<JSModule> sorter =
new SortedDependencies<JSModule>(modules);
modules = sorter.getDependenciesOf(modules, true);
this.modules = modules;
this.moduleGraph = new JSModuleGraph(modules);
} catch (Exception e) {
Throwables.propagate(e);
}
}
}
|
void processAMDAndCommonJSModules() { Map<String, JSModule> modulesByName = Maps.newLinkedHashMap(); Map<CompilerInput, JSModule> modulesByInput = Maps.newLinkedHashMap(); for (CompilerInput input : inputs) { input.setCompiler(this); Node root = input.getAstRoot(this); if (root == null) { continue; } if (options.transformAMDToCJSModules) { new TransformAMDToCJSModule(this).process(null, root); } if (options.processCommonJSModules) { ProcessCommonJSModules cjs = new ProcessCommonJSModules(this, options.commonJSModulePathPrefix); cjs.process(null, root); JSModule m = cjs.getModule(); if (m != null) { modulesByName.put(m.getName(), m); modulesByInput.put(input, m); } } } if (options.processCommonJSModules) { List<JSModule> modules = Lists.newArrayList(modulesByName.values()); if (!modules.isEmpty()) { this.modules = modules; this.moduleGraph = new JSModuleGraph(this.modules); } for (JSModule module : modules) { for (CompilerInput input : module.getInputs()) { for (String require : input.getRequires()) { JSModule dependency = modulesByName.get(require); if (dependency == null) { report(JSError.make(MISSING_ENTRY_ERROR, require)); } else { module.addDependency(dependency); } } } } try { modules = Lists.newArrayList(); for (CompilerInput input : this.moduleGraph.manageDependencies( options.dependencyOptions, inputs)) { modules.add(modulesByInput.get(input)); } JSModule root = new JSModule("root"); for (JSModule m : modules) { m.addDependency(root); } modules.add(0, root); SortedDependencies<JSModule> sorter = new SortedDependencies<JSModule>(modules); modules = sorter.getDependenciesOf(modules, true); this.modules = modules; this.moduleGraph = new JSModuleGraph(modules); } catch (Exception e) { Throwables.propagate(e); } } }
|
/**
* Transforms AMD and CJS modules to something closure compiler can
* process and creates JSModules and the corresponding dependency tree
* on the way.
*/
|
Transforms AMD and CJS modules to something closure compiler can process and creates JSModules and the corresponding dependency tree on the way
|
processAMDAndCommonJSModules
|
{
"repo_name": "abdullah38rcc/closure-compiler",
"path": "src/com/google/javascript/jscomp/Compiler.java",
"license": "apache-2.0",
"size": 76660
}
|
[
"com.google.common.base.Throwables",
"com.google.common.collect.Lists",
"com.google.common.collect.Maps",
"com.google.javascript.jscomp.deps.SortedDependencies",
"com.google.javascript.rhino.Node",
"java.util.List",
"java.util.Map"
] |
import com.google.common.base.Throwables; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.javascript.jscomp.deps.SortedDependencies; import com.google.javascript.rhino.Node; import java.util.List; import java.util.Map;
|
import com.google.common.base.*; import com.google.common.collect.*; import com.google.javascript.jscomp.deps.*; import com.google.javascript.rhino.*; import java.util.*;
|
[
"com.google.common",
"com.google.javascript",
"java.util"
] |
com.google.common; com.google.javascript; java.util;
| 1,023,563
|
public static boolean isPasswordCorrect(byte[] password, File passwordFile) throws IOException, GeneralSecurityException {
if (!passwordFile.exists())
return true;
EncryptedInputStream inputStream = null;
try {
inputStream = new EncryptedInputStream(new FileInputStream(passwordFile), password);
byte[] decryptedText = Util.readBytes(inputStream);
return Arrays.equals(PASSWORD_FILE_PLAIN_TEXT, decryptedText);
}
catch (PasswordException e) {
return false;
}
finally {
if (inputStream != null)
inputStream.close();
}
}
|
static boolean function(byte[] password, File passwordFile) throws IOException, GeneralSecurityException { if (!passwordFile.exists()) return true; EncryptedInputStream inputStream = null; try { inputStream = new EncryptedInputStream(new FileInputStream(passwordFile), password); byte[] decryptedText = Util.readBytes(inputStream); return Arrays.equals(PASSWORD_FILE_PLAIN_TEXT, decryptedText); } catch (PasswordException e) { return false; } finally { if (inputStream != null) inputStream.close(); } }
|
/**
* Decrypts a file with a given password and returns <code>true</code> if the decrypted
* text is {@link FileEncryptionConstants#PASSWORD_FILE_PLAIN_TEXT}; <code>false</code>
* otherwise.
* @param password
* @param passwordFile
* @throws IOException
* @throws GeneralSecurityException
*/
|
Decrypts a file with a given password and returns <code>true</code> if the decrypted text is <code>FileEncryptionConstants#PASSWORD_FILE_PLAIN_TEXT</code>; <code>false</code> otherwise
|
isPasswordCorrect
|
{
"repo_name": "NoYouShutup/CryptMeme",
"path": "CryptMeme/src/java/i2p/bote/fileencryption/FileEncryptionUtil.java",
"license": "mit",
"size": 6494
}
|
[
"java.io.File",
"java.io.FileInputStream",
"java.io.IOException",
"java.security.GeneralSecurityException",
"java.util.Arrays"
] |
import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.security.GeneralSecurityException; import java.util.Arrays;
|
import java.io.*; import java.security.*; import java.util.*;
|
[
"java.io",
"java.security",
"java.util"
] |
java.io; java.security; java.util;
| 1,015,491
|
protected String createAttributes(){
String tableModel = "";
Iterator i = columns.iterator();
while(i.hasNext()){
TableColumn col = (TableColumn)i.next();
String datatype = getDataType(col.getDataType());
String identifier = col.getColumnName();
tableModel += buildAttribute(datatype, identifier) + nl;
}
return tableModel;
}
|
String function(){ String tableModel = ""; Iterator i = columns.iterator(); while(i.hasNext()){ TableColumn col = (TableColumn)i.next(); String datatype = getDataType(col.getDataType()); String identifier = col.getColumnName(); tableModel += buildAttribute(datatype, identifier) + nl; } return tableModel; }
|
/***
* Creates private attributes
* @return
*/
|
Creates private attributes
|
createAttributes
|
{
"repo_name": "daveaaaa/modelbuilder",
"path": "ModelBuilder/src/modelbuilder/tables/Table.java",
"license": "gpl-2.0",
"size": 4155
}
|
[
"java.util.Iterator"
] |
import java.util.Iterator;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,586,430
|
public Map<String, String> getParameters() {
if (p != null) {
return p.getParameters();
} else {
return t.getParameters();
}
}
|
Map<String, String> function() { if (p != null) { return p.getParameters(); } else { return t.getParameters(); } }
|
/**
* Get the parameter map of the Entity.
*/
|
Get the parameter map of the Entity
|
getParameters
|
{
"repo_name": "WANdisco/amplab-hive",
"path": "ql/src/java/org/apache/hadoop/hive/ql/hooks/Entity.java",
"license": "apache-2.0",
"size": 8325
}
|
[
"java.util.Map"
] |
import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,865,858
|
//-------------------------------------------------------------------------
public SecurityType getSecurityType(final String bbgSecurityType) {
ArgumentChecker.notNull(bbgSecurityType, "bloomberg security type");
for (final Entry<SecurityType, String> entry : _securityTypes.entries()) {
if (entry.getValue().equals(bbgSecurityType)) {
return entry.getKey();
}
}
return null;
}
|
SecurityType function(final String bbgSecurityType) { ArgumentChecker.notNull(bbgSecurityType, STR); for (final Entry<SecurityType, String> entry : _securityTypes.entries()) { if (entry.getValue().equals(bbgSecurityType)) { return entry.getKey(); } } return null; }
|
/**
* Looks up a security type.
*
* @param bbgSecurityType the security type, not null
* @return the security type enum, null if no match
*/
|
Looks up a security type
|
getSecurityType
|
{
"repo_name": "McLeodMoores/starling",
"path": "projects/bloomberg/src/main/java/com/opengamma/bbg/config/BloombergSecurityTypeDefinition.java",
"license": "apache-2.0",
"size": 11253
}
|
[
"com.opengamma.bbg.loader.SecurityType",
"com.opengamma.util.ArgumentChecker",
"java.util.Map"
] |
import com.opengamma.bbg.loader.SecurityType; import com.opengamma.util.ArgumentChecker; import java.util.Map;
|
import com.opengamma.bbg.loader.*; import com.opengamma.util.*; import java.util.*;
|
[
"com.opengamma.bbg",
"com.opengamma.util",
"java.util"
] |
com.opengamma.bbg; com.opengamma.util; java.util;
| 595,112
|
public void dissociateIds(final Set<Integer> ids) {
for (Integer id : ids) {
dissociateId(id);
}
}
|
void function(final Set<Integer> ids) { for (Integer id : ids) { dissociateId(id); } }
|
/**
* Dissociate {@code ids} from assinged id set. <br>
*
* @param ids Id set to be dissociated
*/
|
Dissociate ids from assinged id set.
|
dissociateIds
|
{
"repo_name": "aratakokubun/new_words",
"path": "src/com/kkbnart/wordis/game/object/BlockIdFactory.java",
"license": "mit",
"size": 2409
}
|
[
"java.util.Set"
] |
import java.util.Set;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,112,732
|
@Override
@ApiOperation(value = "update class with given id ", notes = "Returns an updated Clasz object.")
@ApiResponses(value = { @ApiResponse(code = 200, message = "class was successfully updated"),
@ApiResponse(code = 201, message = "class was successfully persisted"),
@ApiResponse(code = 500, message = "internal processing error (see body for details)") })
@PUT
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response updateObject(@ApiParam(value = "class (as JSON)", required = true) final String jsonObjectString,
@ApiParam(value = "class identifier", required = true) @PathParam("id") final String uuid) throws DMPControllerException {
return super.updateObject(jsonObjectString, uuid);
}
|
@ApiOperation(value = STR, notes = STR) @ApiResponses(value = { @ApiResponse(code = 200, message = STR), @ApiResponse(code = 201, message = STR), @ApiResponse(code = 500, message = STR) }) @Path("/{id}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response function(@ApiParam(value = STR, required = true) final String jsonObjectString, @ApiParam(value = STR, required = true) @PathParam("id") final String uuid) throws DMPControllerException { return super.updateObject(jsonObjectString, uuid); }
|
/**
* This endpoint consumes a class as JSON representation and updates this class in the database.
*
* @param jsonObjectString a JSON representation of one class
* @param uuid a class identifier
* @return the updated class as JSON representation
* @throws DMPControllerException
*/
|
This endpoint consumes a class as JSON representation and updates this class in the database
|
updateObject
|
{
"repo_name": "dswarm/dswarm",
"path": "controller/src/main/java/org/dswarm/controller/resources/schema/ClaszesResource.java",
"license": "apache-2.0",
"size": 7225
}
|
[
"com.wordnik.swagger.annotations.ApiOperation",
"com.wordnik.swagger.annotations.ApiParam",
"com.wordnik.swagger.annotations.ApiResponse",
"com.wordnik.swagger.annotations.ApiResponses",
"javax.ws.rs.Consumes",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"javax.ws.rs.Produces",
"javax.ws.rs.core.MediaType",
"javax.ws.rs.core.Response",
"org.dswarm.controller.DMPControllerException"
] |
import com.wordnik.swagger.annotations.ApiOperation; import com.wordnik.swagger.annotations.ApiParam; import com.wordnik.swagger.annotations.ApiResponse; import com.wordnik.swagger.annotations.ApiResponses; import javax.ws.rs.Consumes; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.dswarm.controller.DMPControllerException;
|
import com.wordnik.swagger.annotations.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.dswarm.controller.*;
|
[
"com.wordnik.swagger",
"javax.ws",
"org.dswarm.controller"
] |
com.wordnik.swagger; javax.ws; org.dswarm.controller;
| 1,043,347
|
protected Serializable performSave(
Object entity,
Serializable id,
EntityPersister persister,
boolean useIdentityColumn,
Object anything,
EventSource source,
boolean requiresImmediateIdAccess) {
if ( log.isTraceEnabled() ) {
log.trace(
"saving " +
MessageHelper.infoString( persister, id, source.getFactory() )
);
}
EntityKey key;
if ( !useIdentityColumn ) {
key = new EntityKey( id, persister, source.getEntityMode() );
Object old = source.getPersistenceContext().getEntity( key );
if ( old != null ) {
if ( source.getPersistenceContext().getEntry( old ).getStatus() == Status.DELETED ) {
source.forceFlush( source.getPersistenceContext().getEntry( old ) );
}
else {
throw new NonUniqueObjectException( id, persister.getEntityName() );
}
}
persister.setIdentifier( entity, id, source );
}
else {
key = null;
}
if ( invokeSaveLifecycle( entity, persister, source ) ) {
return id; //EARLY EXIT
}
return performSaveOrReplicate(
entity,
key,
persister,
useIdentityColumn,
anything,
source,
requiresImmediateIdAccess
);
}
|
Serializable function( Object entity, Serializable id, EntityPersister persister, boolean useIdentityColumn, Object anything, EventSource source, boolean requiresImmediateIdAccess) { if ( log.isTraceEnabled() ) { log.trace( STR + MessageHelper.infoString( persister, id, source.getFactory() ) ); } EntityKey key; if ( !useIdentityColumn ) { key = new EntityKey( id, persister, source.getEntityMode() ); Object old = source.getPersistenceContext().getEntity( key ); if ( old != null ) { if ( source.getPersistenceContext().getEntry( old ).getStatus() == Status.DELETED ) { source.forceFlush( source.getPersistenceContext().getEntry( old ) ); } else { throw new NonUniqueObjectException( id, persister.getEntityName() ); } } persister.setIdentifier( entity, id, source ); } else { key = null; } if ( invokeSaveLifecycle( entity, persister, source ) ) { return id; } return performSaveOrReplicate( entity, key, persister, useIdentityColumn, anything, source, requiresImmediateIdAccess ); }
|
/**
* Ppepares the save call by checking the session caches for a pre-existing
* entity and performing any lifecycle callbacks.
*
* @param entity The entity to be saved.
* @param id The id by which to save the entity.
* @param persister The entity's persister instance.
* @param useIdentityColumn Is an identity column being used?
* @param anything Generally cascade-specific information.
* @param source The session from which the event originated.
* @param requiresImmediateIdAccess does the event context require
* access to the identifier immediately after execution of this method (if
* not, post-insert style id generators may be postponed if we are outside
* a transaction).
*
* @return The id used to save the entity; may be null depending on the
* type of id generator used and the requiresImmediateIdAccess value
*/
|
Ppepares the save call by checking the session caches for a pre-existing entity and performing any lifecycle callbacks
|
performSave
|
{
"repo_name": "codeApeFromChina/resource",
"path": "frame_packages/java_libs/hibernate-distribution-3.6.10.Final/project/hibernate-core/src/main/java/org/hibernate/event/def/AbstractSaveEventListener.java",
"license": "unlicense",
"size": 17761
}
|
[
"java.io.Serializable",
"org.hibernate.NonUniqueObjectException",
"org.hibernate.engine.EntityKey",
"org.hibernate.engine.Status",
"org.hibernate.event.EventSource",
"org.hibernate.persister.entity.EntityPersister",
"org.hibernate.pretty.MessageHelper"
] |
import java.io.Serializable; import org.hibernate.NonUniqueObjectException; import org.hibernate.engine.EntityKey; import org.hibernate.engine.Status; import org.hibernate.event.EventSource; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.pretty.MessageHelper;
|
import java.io.*; import org.hibernate.*; import org.hibernate.engine.*; import org.hibernate.event.*; import org.hibernate.persister.entity.*; import org.hibernate.pretty.*;
|
[
"java.io",
"org.hibernate",
"org.hibernate.engine",
"org.hibernate.event",
"org.hibernate.persister",
"org.hibernate.pretty"
] |
java.io; org.hibernate; org.hibernate.engine; org.hibernate.event; org.hibernate.persister; org.hibernate.pretty;
| 388,589
|
@Override
public void onConnectionSuspended(int i) {
Log.w(TAG, "onConnectionSuspended:" + i);
}
|
void function(int i) { Log.w(TAG, STR + i); }
|
/**
* Code borrowed from Google's login sample
*/
|
Code borrowed from Google's login sample
|
onConnectionSuspended
|
{
"repo_name": "jokr/nfcoauth",
"path": "OAuthDemo/app/src/main/java/mobilesecurity/ini/cmu/edu/oauthdemo/SelectDomain.java",
"license": "unlicense",
"size": 9416
}
|
[
"android.util.Log"
] |
import android.util.Log;
|
import android.util.*;
|
[
"android.util"
] |
android.util;
| 2,108,363
|
protected void onMatch() {
final VolcanoRuleMatch match =
new VolcanoRuleMatch(
volcanoPlanner,
getOperand0(),
rels,
nodeInputs);
volcanoPlanner.ruleQueue.addMatch(match);
}
}
private abstract static class Provenance {
public static final Provenance EMPTY = new UnknownProvenance();
}
private static class UnknownProvenance extends Provenance {
}
static class DirectProvenance extends Provenance {
final RelNode source;
DirectProvenance(RelNode source) {
this.source = source;
}
}
static class RuleProvenance extends Provenance {
final RelOptRule rule;
final ImmutableList<RelNode> rels;
final int callId;
RuleProvenance(RelOptRule rule, ImmutableList<RelNode> rels, int callId) {
this.rule = rule;
this.rels = rels;
this.callId = callId;
}
}
}
|
void function() { final VolcanoRuleMatch match = new VolcanoRuleMatch( volcanoPlanner, getOperand0(), rels, nodeInputs); volcanoPlanner.ruleQueue.addMatch(match); } } private abstract static class Provenance { public static final Provenance EMPTY = new UnknownProvenance(); } private static class UnknownProvenance extends Provenance { } static class DirectProvenance extends Provenance { final RelNode source; DirectProvenance(RelNode source) { this.source = source; } } static class RuleProvenance extends Provenance { final RelOptRule rule; final ImmutableList<RelNode> rels; final int callId; RuleProvenance(RelOptRule rule, ImmutableList<RelNode> rels, int callId) { this.rule = rule; this.rels = rels; this.callId = callId; } } }
|
/**
* Rather than invoking the rule (as the base method does), creates a
* {@link VolcanoRuleMatch} which can be invoked later.
*/
|
Rather than invoking the rule (as the base method does), creates a <code>VolcanoRuleMatch</code> which can be invoked later
|
onMatch
|
{
"repo_name": "sreev/incubator-calcite",
"path": "core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java",
"license": "apache-2.0",
"size": 67108
}
|
[
"com.google.common.collect.ImmutableList",
"org.apache.calcite.plan.RelOptRule",
"org.apache.calcite.rel.RelNode"
] |
import com.google.common.collect.ImmutableList; import org.apache.calcite.plan.RelOptRule; import org.apache.calcite.rel.RelNode;
|
import com.google.common.collect.*; import org.apache.calcite.plan.*; import org.apache.calcite.rel.*;
|
[
"com.google.common",
"org.apache.calcite"
] |
com.google.common; org.apache.calcite;
| 412,648
|
public void addEntry(String Group, long RangeFrom, long RangeTo, long ValidityFrom, long ValidityTo, ArrayList<String> Results)
throws InitializationException
{
RangeItem tmpRangeItem;
RangeItem newRangeItem;
RangeItem tmpRangeNextNode;
// these hold the modified values
long tmpRF = RangeFrom;
long tmpRT = RangeTo;
long tmpVF = ValidityFrom;
long tmpVT = ValidityTo;
// check that the range is OK
if (RangeFrom > RangeTo)
{
message = "Range From <" + RangeFrom +
"> cannot be larger than Range To <" + RangeTo + "> in group <" +
Group + ">";
throw new InitializationException(message,getSymbolicName());
}
if ((ValidityFrom > ValidityTo) && (ValidityTo > 0))
{
message = "Validity From <" + ValidityFrom +
"> cannot be larger than Validity To <" + ValidityTo +
"> in group <" + Group + ">";
throw new InitializationException(message,getSymbolicName());
}
// make sure that we deal with the "don't care" cases
if (RangeFrom == 0)
{
tmpRF = Long.MIN_VALUE;
}
if (RangeTo == 0)
{
tmpRT = Long.MAX_VALUE;
}
if (ValidityFrom == 0)
{
tmpVF = CommonConfig.LOW_DATE;
}
if (ValidityTo == 0)
{
tmpVT = CommonConfig.HIGH_DATE;
}
// Get/Create the group cache
if (GroupCache.containsKey(Group))
{
tmpRangeItem = GroupCache.get(Group);
// now run down the ranges until we find the right position
while (tmpRangeItem != null)
{
tmpRangeNextNode = tmpRangeItem.nextRange;
if ((tmpRF > tmpRangeItem.RangeFrom) &
(tmpRangeNextNode == null))
{
// insert at the tail of the list if we are able
newRangeItem = new RangeItem();
newRangeItem.RangeFrom = tmpRF;
newRangeItem.RangeTo = tmpRT;
newRangeItem.ValidityFrom = tmpVF;
newRangeItem.ValidityTo = tmpVT;
newRangeItem.Results = Results;
// Link to the previous range
tmpRangeItem.nextRange = newRangeItem;
// done
return;
}
else if (tmpRF < tmpRangeItem.RangeFrom)
{
// insert at the head/middle of the list
newRangeItem = new RangeItem();
newRangeItem.RangeFrom = tmpRF;
newRangeItem.RangeTo = tmpRT;
newRangeItem.ValidityFrom = tmpVF;
newRangeItem.ValidityTo = tmpVT;
newRangeItem.Results = Results;
newRangeItem.nextRange = tmpRangeItem.nextRange;
tmpRangeItem.nextRange = newRangeItem;
// done
return;
}
// Move down the map
tmpRangeItem = tmpRangeItem.nextRange;
}
// If we get here, we could not insert the period
message = "Range From <" + RangeFrom +
"> to <" + RangeTo + "> overlaps with another range in group <" +
Group + ">";
throw new InitializationException(message,getSymbolicName());
}
else
{
// create the new group and initialise
tmpRangeItem = new RangeItem();
tmpRangeItem.RangeFrom = tmpRF;
tmpRangeItem.RangeTo = tmpRT;
tmpRangeItem.ValidityFrom = tmpVF;
tmpRangeItem.ValidityTo = tmpVT;
tmpRangeItem.Results = Results;
GroupCache.put(Group, tmpRangeItem);
}
}
|
void function(String Group, long RangeFrom, long RangeTo, long ValidityFrom, long ValidityTo, ArrayList<String> Results) throws InitializationException { RangeItem tmpRangeItem; RangeItem newRangeItem; RangeItem tmpRangeNextNode; long tmpRF = RangeFrom; long tmpRT = RangeTo; long tmpVF = ValidityFrom; long tmpVT = ValidityTo; if (RangeFrom > RangeTo) { message = STR + RangeFrom + STR + RangeTo + STR + Group + ">"; throw new InitializationException(message,getSymbolicName()); } if ((ValidityFrom > ValidityTo) && (ValidityTo > 0)) { message = STR + ValidityFrom + STR + ValidityTo + STR + Group + ">"; throw new InitializationException(message,getSymbolicName()); } if (RangeFrom == 0) { tmpRF = Long.MIN_VALUE; } if (RangeTo == 0) { tmpRT = Long.MAX_VALUE; } if (ValidityFrom == 0) { tmpVF = CommonConfig.LOW_DATE; } if (ValidityTo == 0) { tmpVT = CommonConfig.HIGH_DATE; } if (GroupCache.containsKey(Group)) { tmpRangeItem = GroupCache.get(Group); while (tmpRangeItem != null) { tmpRangeNextNode = tmpRangeItem.nextRange; if ((tmpRF > tmpRangeItem.RangeFrom) & (tmpRangeNextNode == null)) { newRangeItem = new RangeItem(); newRangeItem.RangeFrom = tmpRF; newRangeItem.RangeTo = tmpRT; newRangeItem.ValidityFrom = tmpVF; newRangeItem.ValidityTo = tmpVT; newRangeItem.Results = Results; tmpRangeItem.nextRange = newRangeItem; return; } else if (tmpRF < tmpRangeItem.RangeFrom) { newRangeItem = new RangeItem(); newRangeItem.RangeFrom = tmpRF; newRangeItem.RangeTo = tmpRT; newRangeItem.ValidityFrom = tmpVF; newRangeItem.ValidityTo = tmpVT; newRangeItem.Results = Results; newRangeItem.nextRange = tmpRangeItem.nextRange; tmpRangeItem.nextRange = newRangeItem; return; } tmpRangeItem = tmpRangeItem.nextRange; } message = STR + RangeFrom + STR + RangeTo + STR + Group + ">"; throw new InitializationException(message,getSymbolicName()); } else { tmpRangeItem = new RangeItem(); tmpRangeItem.RangeFrom = tmpRF; tmpRangeItem.RangeTo = tmpRT; tmpRangeItem.ValidityFrom = tmpVF; tmpRangeItem.ValidityTo = tmpVT; tmpRangeItem.Results = Results; GroupCache.put(Group, tmpRangeItem); } }
|
/**
* Add an object into the Object Cache, creating a chain of values to search,
* ordered by "RangeFrom".
* @param Group The group to add the entry to
* @param ValidityFrom The start of the validity of the range
* @param ValidityTo The end of the validity of the range
* @param RangeFrom The start of the range
* @param RangeTo The end of the range
* @param Results The results associated with this range
* @throws InitializationException
*/
|
Add an object into the Object Cache, creating a chain of values to search, ordered by "RangeFrom"
|
addEntry
|
{
"repo_name": "isparkes/OpenRate",
"path": "src/main/java/OpenRate/cache/NumberRangeCache.java",
"license": "apache-2.0",
"size": 19807
}
|
[
"java.util.ArrayList"
] |
import java.util.ArrayList;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,245,280
|
public PDFPaint getPaint(float[] components) {
float[] rgb = cs.toRGB(components);
return PDFPaint.getColorPaint(new Color(rgb[0], rgb[1], rgb[2]));
}
|
PDFPaint function(float[] components) { float[] rgb = cs.toRGB(components); return PDFPaint.getColorPaint(new Color(rgb[0], rgb[1], rgb[2])); }
|
/**
* get the PDFPaint representing the color described by the
* given color components
* @param components the color components corresponding to the given
* colorspace
* @return a PDFPaint object representing the closest Color to the
* given components.
*/
|
get the PDFPaint representing the color described by the given color components
|
getPaint
|
{
"repo_name": "manusa/mnPrintClient",
"path": "src/main/java/com/sun/pdfview/colorspace/PDFColorSpace.java",
"license": "apache-2.0",
"size": 7809
}
|
[
"com.sun.pdfview.PDFPaint",
"java.awt.Color"
] |
import com.sun.pdfview.PDFPaint; import java.awt.Color;
|
import com.sun.pdfview.*; import java.awt.*;
|
[
"com.sun.pdfview",
"java.awt"
] |
com.sun.pdfview; java.awt;
| 1,067,126
|
private void postParseStartEvent(Iterable<BuildTarget> buildTargets, BuckEventBus eventBus) {
if (parseStartEvent.isPresent()) {
eventBus.post(ParseEvent.started(buildTargets), parseStartEvent.get());
} else {
eventBus.post(ParseEvent.started(buildTargets));
}
}
private class CachedState {
private final ListMultimap<Path, Map<String, Object>> parsedBuildFiles;
private final Map<BuildTarget, TargetNode<?>> memoizedTargetNodes;
@Nullable
private ImmutableMap<String, String> cacheEnvironment;
@Nullable
private List<String> cacheDefaultIncludes;
private final Map<BuildTarget, Path> targetsToFile;
public CachedState() {
this.memoizedTargetNodes = Maps.newHashMap();
this.parsedBuildFiles = ArrayListMultimap.create();
this.targetsToFile = Maps.newHashMap();
}
|
void function(Iterable<BuildTarget> buildTargets, BuckEventBus eventBus) { if (parseStartEvent.isPresent()) { eventBus.post(ParseEvent.started(buildTargets), parseStartEvent.get()); } else { eventBus.post(ParseEvent.started(buildTargets)); } } private class CachedState { private final ListMultimap<Path, Map<String, Object>> parsedBuildFiles; private final Map<BuildTarget, TargetNode<?>> memoizedTargetNodes; private ImmutableMap<String, String> cacheEnvironment; private List<String> cacheDefaultIncludes; private final Map<BuildTarget, Path> targetsToFile; public CachedState() { this.memoizedTargetNodes = Maps.newHashMap(); this.parsedBuildFiles = ArrayListMultimap.create(); this.targetsToFile = Maps.newHashMap(); }
|
/**
* Post a ParseStart event to eventBus, using the start of WatchEvent processing as the start
* time if applicable.
*/
|
Post a ParseStart event to eventBus, using the start of WatchEvent processing as the start time if applicable
|
postParseStartEvent
|
{
"repo_name": "saleeh93/buck-cutom",
"path": "src/com/facebook/buck/parser/Parser.java",
"license": "apache-2.0",
"size": 43719
}
|
[
"com.facebook.buck.event.BuckEventBus",
"com.facebook.buck.model.BuildTarget",
"com.facebook.buck.rules.TargetNode",
"com.google.common.collect.ArrayListMultimap",
"com.google.common.collect.ImmutableMap",
"com.google.common.collect.ListMultimap",
"com.google.common.collect.Maps",
"java.nio.file.Path",
"java.util.List",
"java.util.Map"
] |
import com.facebook.buck.event.BuckEventBus; import com.facebook.buck.model.BuildTarget; import com.facebook.buck.rules.TargetNode; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ListMultimap; import com.google.common.collect.Maps; import java.nio.file.Path; import java.util.List; import java.util.Map;
|
import com.facebook.buck.event.*; import com.facebook.buck.model.*; import com.facebook.buck.rules.*; import com.google.common.collect.*; import java.nio.file.*; import java.util.*;
|
[
"com.facebook.buck",
"com.google.common",
"java.nio",
"java.util"
] |
com.facebook.buck; com.google.common; java.nio; java.util;
| 1,731,867
|
@VisibleForTesting
ExponentialBackoffScheduler createBackoffScheduler(String prefPackage, Context context,
long base, long max) {
return new ExponentialBackoffScheduler(prefPackage, context, base, max);
}
|
ExponentialBackoffScheduler createBackoffScheduler(String prefPackage, Context context, long base, long max) { return new ExponentialBackoffScheduler(prefPackage, context, base, max); }
|
/**
* Creates the scheduler used to space out POST attempts.
*/
|
Creates the scheduler used to space out POST attempts
|
createBackoffScheduler
|
{
"repo_name": "SaschaMester/delicium",
"path": "chrome/android/java/src/org/chromium/chrome/browser/omaha/OmahaClient.java",
"license": "bsd-3-clause",
"size": 33784
}
|
[
"android.content.Context"
] |
import android.content.Context;
|
import android.content.*;
|
[
"android.content"
] |
android.content;
| 194,364
|
PostingsFormat get();
/**
* Returns the name of this providers {@link PostingsFormat}
|
PostingsFormat get(); /** * Returns the name of this providers {@link PostingsFormat}
|
/**
* Returns this providers {@link PostingsFormat} instance.
*/
|
Returns this providers <code>PostingsFormat</code> instance
|
get
|
{
"repo_name": "andrewvc/elasticsearch",
"path": "src/main/java/org/elasticsearch/index/codec/postingsformat/PostingsFormatProvider.java",
"license": "apache-2.0",
"size": 5047
}
|
[
"org.apache.lucene.codecs.PostingsFormat"
] |
import org.apache.lucene.codecs.PostingsFormat;
|
import org.apache.lucene.codecs.*;
|
[
"org.apache.lucene"
] |
org.apache.lucene;
| 1,819,432
|
public static long getContainerUsableSpace(final Path path) {
return path.toFile().getUsableSpace();
}
|
static long function(final Path path) { return path.toFile().getUsableSpace(); }
|
/**
* Returns the free capacity for a given path
* @param path path
* @return usable space
*/
|
Returns the free capacity for a given path
|
getContainerUsableSpace
|
{
"repo_name": "MikeThomsen/nifi",
"path": "nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/FileUtils.java",
"license": "apache-2.0",
"size": 25512
}
|
[
"java.nio.file.Path"
] |
import java.nio.file.Path;
|
import java.nio.file.*;
|
[
"java.nio"
] |
java.nio;
| 235,701
|
public Optional<SubjectEntity> get(String identifier) {
Preconditions.checkNotNull(identifier);
Session session = this.sessionFactory.openSession();
session.beginTransaction();
Query query = session.createNamedQuery("getSubjectByIdentifier", SubjectEntity.class);
query.setParameter("identifier", identifier);
try {
SubjectEntity result = (SubjectEntity) query.getSingleResult();
session.close();
return Optional.of(result);
} catch (Exception e) {
session.close();
return Optional.empty();
}
}
|
Optional<SubjectEntity> function(String identifier) { Preconditions.checkNotNull(identifier); Session session = this.sessionFactory.openSession(); session.beginTransaction(); Query query = session.createNamedQuery(STR, SubjectEntity.class); query.setParameter(STR, identifier); try { SubjectEntity result = (SubjectEntity) query.getSingleResult(); session.close(); return Optional.of(result); } catch (Exception e) { session.close(); return Optional.empty(); } }
|
/**
* Get a SubjectEntity by identifier
*
* @param identifier String
* @return the SubjectEntity matching that identifier
*/
|
Get a SubjectEntity by identifier
|
get
|
{
"repo_name": "glowstone-io/Glowstone",
"path": "src/main/java/com/github/glowstone/io/core/persistence/repositories/SubjectRepository.java",
"license": "mit",
"size": 5513
}
|
[
"com.github.glowstone.io.core.entities.SubjectEntity",
"com.google.common.base.Preconditions",
"java.util.Optional",
"javax.persistence.Query",
"org.hibernate.Session"
] |
import com.github.glowstone.io.core.entities.SubjectEntity; import com.google.common.base.Preconditions; import java.util.Optional; import javax.persistence.Query; import org.hibernate.Session;
|
import com.github.glowstone.io.core.entities.*; import com.google.common.base.*; import java.util.*; import javax.persistence.*; import org.hibernate.*;
|
[
"com.github.glowstone",
"com.google.common",
"java.util",
"javax.persistence",
"org.hibernate"
] |
com.github.glowstone; com.google.common; java.util; javax.persistence; org.hibernate;
| 2,133,744
|
List<String> getSortedDependencyNames() {
List<String> names = new ArrayList<>();
for (JSModule module : getDependencies()) {
names.add(module.getName());
}
Collections.sort(names);
return names;
}
|
List<String> getSortedDependencyNames() { List<String> names = new ArrayList<>(); for (JSModule module : getDependencies()) { names.add(module.getName()); } Collections.sort(names); return names; }
|
/**
* Gets the names of the modules that this module depends on,
* sorted alphabetically.
*/
|
Gets the names of the modules that this module depends on, sorted alphabetically
|
getSortedDependencyNames
|
{
"repo_name": "anomaly/closure-compiler",
"path": "src/com/google/javascript/jscomp/JSModule.java",
"license": "apache-2.0",
"size": 8308
}
|
[
"java.util.ArrayList",
"java.util.Collections",
"java.util.List"
] |
import java.util.ArrayList; import java.util.Collections; import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 942,798
|
public static void main(String[] args) {
Module.start("org.transitclock.custom.vta.VtaAcsAvlModule");
}
|
static void function(String[] args) { Module.start(STR); }
|
/**
* Just for debugging
*/
|
Just for debugging
|
main
|
{
"repo_name": "TheTransitClock/transitime",
"path": "transitclock/src/main/java/org/transitclock/custom/vta/VtaAcsAvlModule.java",
"license": "gpl-3.0",
"size": 3225
}
|
[
"org.transitclock.modules.Module"
] |
import org.transitclock.modules.Module;
|
import org.transitclock.modules.*;
|
[
"org.transitclock.modules"
] |
org.transitclock.modules;
| 1,820,129
|
@XmlElement(name = "TimeInstant")
public TimeInstant getTimeInstant() {
final TemporalPrimitive metadata = this.metadata;
return (metadata instanceof Instant) ? new TimeInstant((Instant) metadata) : null;
}
|
@XmlElement(name = STR) TimeInstant function() { final TemporalPrimitive metadata = this.metadata; return (metadata instanceof Instant) ? new TimeInstant((Instant) metadata) : null; }
|
/**
* Returns the {@link TimeInstant} generated from the metadata value.
* This method is systematically called at marshalling-time by JAXB.
*
* @return The time instant, or {@code null}.
*/
|
Returns the <code>TimeInstant</code> generated from the metadata value. This method is systematically called at marshalling-time by JAXB
|
getTimeInstant
|
{
"repo_name": "desruisseaux/sis",
"path": "core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java",
"license": "apache-2.0",
"size": 6466
}
|
[
"javax.xml.bind.annotation.XmlElement",
"org.opengis.temporal.Instant",
"org.opengis.temporal.TemporalPrimitive"
] |
import javax.xml.bind.annotation.XmlElement; import org.opengis.temporal.Instant; import org.opengis.temporal.TemporalPrimitive;
|
import javax.xml.bind.annotation.*; import org.opengis.temporal.*;
|
[
"javax.xml",
"org.opengis.temporal"
] |
javax.xml; org.opengis.temporal;
| 877,491
|
VoidExtractor extractor = new VoidExtractor();
SpecialClassExtractor sExtractor = new SpecialClassExtractor();
VoidParsingExtractor vpExtractor = new VoidParsingExtractor();
for (int i = 0; i < dumps.length; ++i) {
if (!extractFromDump(dumps[i], extractor, sExtractor, vpExtractor)) {
LOGGER.error("Couldn't extract information from dump \"" + dumps[i] + "\". Returning null.");
return null;
}
}
addParsedVoidToCounts(extractor, vpExtractor);
return generateVoidModel(datsetUri, extractor, sExtractor);
}
|
VoidExtractor extractor = new VoidExtractor(); SpecialClassExtractor sExtractor = new SpecialClassExtractor(); VoidParsingExtractor vpExtractor = new VoidParsingExtractor(); for (int i = 0; i < dumps.length; ++i) { if (!extractFromDump(dumps[i], extractor, sExtractor, vpExtractor)) { LOGGER.error(STRSTR\STR); return null; } } addParsedVoidToCounts(extractor, vpExtractor); return generateVoidModel(datsetUri, extractor, sExtractor); }
|
/**
* Extracts the VoID information of an RDF dataset comprising the given dump files.
*
* @param datsetUri the URI of the dataset
* @param dumps the dump files of the dataset
* @return a Model containing the VoID information
*/
|
Extracts the VoID information of an RDF dataset comprising the given dump files
|
extractVoidInfo
|
{
"repo_name": "AKSW/Tapioca",
"path": "tapioca.analyzer/src/main/java/org/aksw/simba/tapioca/analyzer/dump/DumpFileAnalyzer.java",
"license": "lgpl-3.0",
"size": 6939
}
|
[
"org.aksw.simba.tapioca.extraction.voidex.SpecialClassExtractor",
"org.aksw.simba.tapioca.extraction.voidex.VoidExtractor",
"org.aksw.simba.tapioca.extraction.voidex.VoidParsingExtractor"
] |
import org.aksw.simba.tapioca.extraction.voidex.SpecialClassExtractor; import org.aksw.simba.tapioca.extraction.voidex.VoidExtractor; import org.aksw.simba.tapioca.extraction.voidex.VoidParsingExtractor;
|
import org.aksw.simba.tapioca.extraction.voidex.*;
|
[
"org.aksw.simba"
] |
org.aksw.simba;
| 1,084,783
|
public Baz findByUuid_First(
String uuid,
com.liferay.portal.kernel.util.OrderByComparator<Baz>
orderByComparator)
throws NoSuchBazException;
|
Baz function( String uuid, com.liferay.portal.kernel.util.OrderByComparator<Baz> orderByComparator) throws NoSuchBazException;
|
/**
* Returns the first baz in the ordered set where uuid = ?.
*
* @param uuid the uuid
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the first matching baz
* @throws NoSuchBazException if a matching baz could not be found
*/
|
Returns the first baz in the ordered set where uuid = ?
|
findByUuid_First
|
{
"repo_name": "gamerson/liferay-blade-samples",
"path": "maven/apps/workflow/basic/basic-api/src/main/java/com/liferay/blade/workflow/basic/service/persistence/BazPersistence.java",
"license": "apache-2.0",
"size": 24217
}
|
[
"com.liferay.blade.workflow.basic.exception.NoSuchBazException",
"com.liferay.blade.workflow.basic.model.Baz"
] |
import com.liferay.blade.workflow.basic.exception.NoSuchBazException; import com.liferay.blade.workflow.basic.model.Baz;
|
import com.liferay.blade.workflow.basic.exception.*; import com.liferay.blade.workflow.basic.model.*;
|
[
"com.liferay.blade"
] |
com.liferay.blade;
| 2,802,540
|
public CompletableFuture<Void> expireMessagesAsync(String topic, String subscriptionName,
long expireTimeInSeconds);
|
CompletableFuture<Void> function(String topic, String subscriptionName, long expireTimeInSeconds);
|
/**
* Expire all messages older than given N (expireTimeInSeconds) seconds for a given subscription asynchronously
*
* @param topic
* topic name
* @param subName
* Subscription name
* @param expireTimeInSeconds
* Expire messages older than time in seconds
* @return
*/
|
Expire all messages older than given N (expireTimeInSeconds) seconds for a given subscription asynchronously
|
expireMessagesAsync
|
{
"repo_name": "jai1/pulsar",
"path": "pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/Topics.java",
"license": "apache-2.0",
"size": 37663
}
|
[
"java.util.concurrent.CompletableFuture"
] |
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.*;
|
[
"java.util"
] |
java.util;
| 2,468,910
|
@Test
public void testReplaceValueEqualStoreEntryStoreAccessExceptionUnequalCacheLoaderWriterEntry() throws Exception {
final FakeStore fakeStore = new FakeStore(Collections.singletonMap("key", "oldValue"));
this.store = spy(fakeStore);
doThrow(new StoreAccessException("")).when(this.store).compute(eq("key"), getAnyBiFunction(), getBooleanNullaryFunction());
final FakeCacheLoaderWriter fakeWriter = new FakeCacheLoaderWriter(Collections.singletonMap("key", "unequalValue"));
this.cacheLoaderWriter = spy(fakeWriter);
final EhcacheWithLoaderWriter<String, String> ehcache = this.getEhcache(this.cacheLoaderWriter);
ehcache.replace("key", "oldValue", "newValue");
verify(this.store).compute(eq("key"), getAnyBiFunction(), getBooleanNullaryFunction());
verify(this.spiedResilienceStrategy)
.replaceFailure(eq("key"), eq("oldValue"), eq("newValue"), any(StoreAccessException.class), eq(false));
// Broken initial state: CacheLoaderWriter check omitted
validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.ReplaceOutcome.FAILURE));
}
|
void function() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.singletonMap("key", STR)); this.store = spy(fakeStore); doThrow(new StoreAccessException(STRkeySTRkeySTRunequalValueSTRkey", STR, "newValueSTRkeySTRkey"), eq(STR), eq("newValue"), any(StoreAccessException.class), eq(false)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.ReplaceOutcome.FAILURE)); }
|
/**
* Tests the effect of a {@link EhcacheWithLoaderWriter#replace(Object, Object, Object)} for
* <ul>
* <li>key with equal value present in {@code Store}</li>
* <li>>{@code Store.compute} throws</li>
* <li>key with unequal value present via {@code CacheLoaderWriter}</li>
* </ul>
*/
|
Tests the effect of a <code>EhcacheWithLoaderWriter#replace(Object, Object, Object)</code> for key with equal value present in Store >Store.compute throws key with unequal value present via CacheLoaderWriter
|
testReplaceValueEqualStoreEntryStoreAccessExceptionUnequalCacheLoaderWriterEntry
|
{
"repo_name": "akomakom/ehcache3",
"path": "core/src/test/java/org/ehcache/core/EhcacheWithLoaderWriterBasicReplaceValueTest.java",
"license": "apache-2.0",
"size": 43771
}
|
[
"java.util.Collections",
"java.util.EnumSet",
"org.ehcache.core.spi.store.StoreAccessException",
"org.ehcache.core.statistics.CacheOperationOutcomes",
"org.mockito.Matchers",
"org.mockito.Mockito"
] |
import java.util.Collections; import java.util.EnumSet; import org.ehcache.core.spi.store.StoreAccessException; import org.ehcache.core.statistics.CacheOperationOutcomes; import org.mockito.Matchers; import org.mockito.Mockito;
|
import java.util.*; import org.ehcache.core.spi.store.*; import org.ehcache.core.statistics.*; import org.mockito.*;
|
[
"java.util",
"org.ehcache.core",
"org.mockito"
] |
java.util; org.ehcache.core; org.mockito;
| 149,272
|
public FileChecksum getFileChecksum(Path f) throws IOException {
return null;
}
|
FileChecksum function(Path f) throws IOException { return null; }
|
/**
* Get the checksum of a file.
*
* @param f The file path
* @return The file checksum. The default return value is null,
* which indicates that no checksum algorithm is implemented
* in the corresponding FileSystem.
*/
|
Get the checksum of a file
|
getFileChecksum
|
{
"repo_name": "fyqls/hadoop-2.4.0",
"path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java",
"license": "apache-2.0",
"size": 102531
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 780,440
|
public BigDecimal getBase();
public static final String COLUMNNAME_C_InvoiceLine_ID = "C_InvoiceLine_ID";
|
BigDecimal function(); public static final String COLUMNNAME_C_InvoiceLine_ID = STR;
|
/** Get Base.
* Calculation Base
*/
|
Get Base. Calculation Base
|
getBase
|
{
"repo_name": "klst-com/metasfresh",
"path": "de.metas.adempiere.adempiere/base/src/main/java-gen/org/compiere/model/I_C_LandedCostAllocation.java",
"license": "gpl-2.0",
"size": 6001
}
|
[
"java.math.BigDecimal"
] |
import java.math.BigDecimal;
|
import java.math.*;
|
[
"java.math"
] |
java.math;
| 1,515,121
|
public static void write(String filename, String content, boolean append) throws IOException {
File file = new File(filename);
try {
file.getParentFile().mkdirs();
}
catch (Exception e) { }
FileWriter fileWriter = new FileWriter(file, append);
BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
bufferedWriter.write(content);
bufferedWriter.newLine();
bufferedWriter.close();
file = null;
bufferedWriter = null;
fileWriter = null;
}
|
static void function(String filename, String content, boolean append) throws IOException { File file = new File(filename); try { file.getParentFile().mkdirs(); } catch (Exception e) { } FileWriter fileWriter = new FileWriter(file, append); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); bufferedWriter.write(content); bufferedWriter.newLine(); bufferedWriter.close(); file = null; bufferedWriter = null; fileWriter = null; }
|
/**
* Writes data to a file in disk.
*
* @param filename Name of the file
* @param content Data to be written to the file
* @param append Boolean signalling if the data is to be appended to the file
* @throws IOException Error while writing data to the file
*/
|
Writes data to a file in disk
|
write
|
{
"repo_name": "rovemonteux/automation_engine",
"path": "src/main/java/cf/monteux/automation/engine/io/FileIO.java",
"license": "gpl-3.0",
"size": 12852
}
|
[
"java.io.BufferedWriter",
"java.io.File",
"java.io.FileWriter",
"java.io.IOException"
] |
import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 551,657
|
@ApiModelProperty(example = "null", value = "")
public DateTime getFinishDate() {
return finishDate;
}
|
@ApiModelProperty(example = "null", value = "") DateTime function() { return finishDate; }
|
/**
* Get finishDate
* @return finishDate
**/
|
Get finishDate
|
getFinishDate
|
{
"repo_name": "Avalara/avataxbr-clients",
"path": "java-client/src/main/java/io/swagger/client/model/Body4.java",
"license": "gpl-3.0",
"size": 2834
}
|
[
"io.swagger.annotations.ApiModelProperty",
"org.joda.time.DateTime"
] |
import io.swagger.annotations.ApiModelProperty; import org.joda.time.DateTime;
|
import io.swagger.annotations.*; import org.joda.time.*;
|
[
"io.swagger.annotations",
"org.joda.time"
] |
io.swagger.annotations; org.joda.time;
| 2,677,350
|
try {
return
journal.currentEventsByPersistenceId(persistenceId, 0, Integer.MAX_VALUE).runWith(toSeq(), materializer)
.toCompletableFuture().get(1, TimeUnit.SECONDS);
} catch (TimeoutException e) {
// should not occur, since getting "current" events should always return pretty much instantly.
throw new RuntimeException(e);
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
}
|
try { return journal.currentEventsByPersistenceId(persistenceId, 0, Integer.MAX_VALUE).runWith(toSeq(), materializer) .toCompletableFuture().get(1, TimeUnit.SECONDS); } catch (TimeoutException e) { throw new RuntimeException(e); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (ExecutionException e) { throw new RuntimeException(e); } }
|
/**
* Returns the current complete sequence of events known to the in-memory journal for the given [persistenceId].
*/
|
Returns the current complete sequence of events known to the in-memory journal for the given [persistenceId]
|
journalEventsFor
|
{
"repo_name": "Tradeshift/ts-reaktive",
"path": "ts-reaktive-testkit/src/main/java/com/tradeshift/reaktive/testkit/SharedActorSystemSpec.java",
"license": "mit",
"size": 3842
}
|
[
"java.util.concurrent.ExecutionException",
"java.util.concurrent.TimeUnit",
"java.util.concurrent.TimeoutException"
] |
import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.*;
|
[
"java.util"
] |
java.util;
| 2,858,318
|
public void setBackgroundColor(Color rColor)
{
if (rColor != null)
{
getWidget().getElement()
.getStyle()
.setBackgroundColor(rColor.toHtml());
}
}
|
void function(Color rColor) { if (rColor != null) { getWidget().getElement() .getStyle() .setBackgroundColor(rColor.toHtml()); } }
|
/***************************************
* Sets the background color of this component.
*
* @param rColor The new background color
*/
|
Sets the background color of this component
|
setBackgroundColor
|
{
"repo_name": "esoco/gewt",
"path": "src/main/java/de/esoco/ewt/component/Component.java",
"license": "apache-2.0",
"size": 47801
}
|
[
"de.esoco.lib.property.Color"
] |
import de.esoco.lib.property.Color;
|
import de.esoco.lib.property.*;
|
[
"de.esoco.lib"
] |
de.esoco.lib;
| 1,311,489
|
public static String getFolded(final String fileString,
final HashMap<Range<Integer>, Boolean> folds,
final TreeCreatorVisitor tcv) {
// Set up containers for removed chars, dots comments and javadocs
final ArrayList<Integer> rems = Lists.newArrayList();
final ArrayList<Integer> dots = Lists.newArrayList();
final HashMap<Integer, String> blockComments = Maps.newHashMap();
final HashMap<Integer, String> lineComments = Maps.newHashMap();
final HashMap<Integer, String> javadocs = Maps.newHashMap();
// Fill containers with char ranges
for (final Entry<Range<Integer>, Boolean> entry : folds.entrySet()) {
if (entry.getValue()) {
rems.addAll(range(entry.getKey().lowerEndpoint() + 1, entry
.getKey().upperEndpoint() + 2));
dots.add(entry.getKey().lowerEndpoint());
}
}
// Discern javadocs and block comments
if (tcv != null) {
for (final Entry<Range<Integer>, String> entry : tcv.blockCommentFolds
.entrySet())
blockComments.put(entry.getKey().lowerEndpoint(),
entry.getValue());
for (final Entry<Range<Integer>, String> entry : tcv.lineCommentFolds
.entrySet())
lineComments.put(entry.getKey().lowerEndpoint(),
entry.getValue());
for (final Entry<Range<Integer>, String> entry : tcv.javadocFolds
.entrySet())
javadocs.put(entry.getKey().lowerEndpoint(), entry.getValue());
}
// Print relevant folded markers in string
final StringBuffer stringBuffer = new StringBuffer();
for (int i = 0; i <= fileString.length(); i++) {
if (rems.contains(i))
continue;
if (dots.contains(i)) {
if (javadocs.containsKey(i))
stringBuffer.append(" ");
else if (blockComments.containsKey(i))
stringBuffer.append(" ");
else if (lineComments.containsKey(i))
stringBuffer.append(" //" + lineComments.get(i) + "...");
else
stringBuffer.append(" {...}");
continue;
}
if (i != 0)
stringBuffer.append(fileString.charAt(i - 1));
}
// Return folded string
return stringBuffer.toString();
}
|
static String function(final String fileString, final HashMap<Range<Integer>, Boolean> folds, final TreeCreatorVisitor tcv) { final ArrayList<Integer> rems = Lists.newArrayList(); final ArrayList<Integer> dots = Lists.newArrayList(); final HashMap<Integer, String> blockComments = Maps.newHashMap(); final HashMap<Integer, String> lineComments = Maps.newHashMap(); final HashMap<Integer, String> javadocs = Maps.newHashMap(); for (final Entry<Range<Integer>, Boolean> entry : folds.entrySet()) { if (entry.getValue()) { rems.addAll(range(entry.getKey().lowerEndpoint() + 1, entry .getKey().upperEndpoint() + 2)); dots.add(entry.getKey().lowerEndpoint()); } } if (tcv != null) { for (final Entry<Range<Integer>, String> entry : tcv.blockCommentFolds .entrySet()) blockComments.put(entry.getKey().lowerEndpoint(), entry.getValue()); for (final Entry<Range<Integer>, String> entry : tcv.lineCommentFolds .entrySet()) lineComments.put(entry.getKey().lowerEndpoint(), entry.getValue()); for (final Entry<Range<Integer>, String> entry : tcv.javadocFolds .entrySet()) javadocs.put(entry.getKey().lowerEndpoint(), entry.getValue()); } final StringBuffer stringBuffer = new StringBuffer(); for (int i = 0; i <= fileString.length(); i++) { if (rems.contains(i)) continue; if (dots.contains(i)) { if (javadocs.containsKey(i)) stringBuffer.append(" "); else if (blockComments.containsKey(i)) stringBuffer.append(" "); else if (lineComments.containsKey(i)) stringBuffer.append(STR {...}"); continue; } if (i != 0) stringBuffer.append(fileString.charAt(i - 1)); } return stringBuffer.toString(); }
|
/**
* Return folded file as String (there must be a nicer way to do this)
*
* @author Jaroslav Fowkes based on Razvan Ranca's Python code
*/
|
Return folded file as String (there must be a nicer way to do this)
|
getFolded
|
{
"repo_name": "sachintyagi22/tassal",
"path": "autofolding/src/main/java/codesum/lm/main/CodeUtils.java",
"license": "bsd-3-clause",
"size": 7280
}
|
[
"com.google.common.collect.Lists",
"com.google.common.collect.Maps",
"com.google.common.collect.Range",
"java.util.ArrayList",
"java.util.HashMap",
"java.util.Map"
] |
import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Range; import java.util.ArrayList; import java.util.HashMap; import java.util.Map;
|
import com.google.common.collect.*; import java.util.*;
|
[
"com.google.common",
"java.util"
] |
com.google.common; java.util;
| 2,253,338
|
public Executor getPublishExecutor() {
return publishExecutor;
}
|
Executor function() { return publishExecutor; }
|
/**
* Gets the {@link Executor} that this builder is currently configured to use for
* asynchronous publishing operations. If null, a default will be used instead.
*
* @return The {@link Executor} to use.
*/
|
Gets the <code>Executor</code> that this builder is currently configured to use for asynchronous publishing operations. If null, a default will be used instead
|
getPublishExecutor
|
{
"repo_name": "keenlabs/KeenClient-Java",
"path": "core/src/main/java/io/keen/client/java/KeenClient.java",
"license": "mit",
"size": 75396
}
|
[
"java.util.concurrent.Executor"
] |
import java.util.concurrent.Executor;
|
import java.util.concurrent.*;
|
[
"java.util"
] |
java.util;
| 1,544,557
|
@Test(expected = NullPointerException.class)
public void testJobUpdateNull() throws P4JavaException {
jobDelegator.updateJob(null);
}
|
@Test(expected = NullPointerException.class) void function() throws P4JavaException { jobDelegator.updateJob(null); }
|
/**
* Test job update null.
*
* @throws P4JavaException the p4 java exception
*/
|
Test job update null
|
testJobUpdateNull
|
{
"repo_name": "groboclown/p4ic4idea",
"path": "p4java/r17-2/src/test/java/com/perforce/p4java/impl/mapbased/server/cmd/JobDelegatorTest.java",
"license": "apache-2.0",
"size": 16856
}
|
[
"com.perforce.p4java.exception.P4JavaException",
"org.junit.Test"
] |
import com.perforce.p4java.exception.P4JavaException; import org.junit.Test;
|
import com.perforce.p4java.exception.*; import org.junit.*;
|
[
"com.perforce.p4java",
"org.junit"
] |
com.perforce.p4java; org.junit;
| 1,297,774
|
@Test
public void testBookKeeperAdmin() throws Exception {
BookKeeper bk = new BookKeeper(baseClientConf, zkc);
try (BookKeeperAdmin bkadmin = new BookKeeperAdmin(bk)) {
LOG.info("Create ledger and add entries to it");
LedgerHandle lh1 = createLedgerWithEntries(bk, 100);
LedgerHandle lh2 = createLedgerWithEntries(bk, 100);
LedgerHandle lh3 = createLedgerWithEntries(bk, 100);
lh3.close();
BookieSocketAddress bookieToKill = getBookie(0);
killBookie(bookieToKill);
startNewBookie();
CheckerCb checkercb = new CheckerCb();
LedgerChecker lc = new LedgerChecker(bk);
lc.checkLedger(lh3, checkercb);
assertEquals("Should have completed",
checkercb.getRc(30, TimeUnit.SECONDS), BKException.Code.OK);
assertEquals("Should have a missing fragment",
1, checkercb.getResult(30, TimeUnit.SECONDS).size());
// make sure a bookie in each quorum is slow
restartBookieSlow();
restartBookieSlow();
bk.close();
try {
bkadmin.openLedger(lh1.getId());
fail("Shouldn't be able to open with a closed client");
} catch (BKException.BKClientClosedException cce) {
// correct behaviour
}
try {
bkadmin.openLedgerNoRecovery(lh1.getId());
fail("Shouldn't be able to open with a closed client");
} catch (BKException.BKClientClosedException cce) {
// correct behaviour
}
try {
bkadmin.recoverBookieData(bookieToKill);
fail("Shouldn't be able to recover with a closed client");
} catch (BKException.BKClientClosedException cce) {
// correct behaviour
}
try {
bkadmin.replicateLedgerFragment(lh3,
checkercb.getResult(10, TimeUnit.SECONDS).iterator().next());
fail("Shouldn't be able to replicate with a closed client");
} catch (BKException.BKClientClosedException cce) {
// correct behaviour
}
}
}
/**
* Test that the bookkeeper client doesn't leave any threads hanging around.
* See {@link https://issues.apache.org/jira/browse/BOOKKEEPER-804}
|
void function() throws Exception { BookKeeper bk = new BookKeeper(baseClientConf, zkc); try (BookKeeperAdmin bkadmin = new BookKeeperAdmin(bk)) { LOG.info(STR); LedgerHandle lh1 = createLedgerWithEntries(bk, 100); LedgerHandle lh2 = createLedgerWithEntries(bk, 100); LedgerHandle lh3 = createLedgerWithEntries(bk, 100); lh3.close(); BookieSocketAddress bookieToKill = getBookie(0); killBookie(bookieToKill); startNewBookie(); CheckerCb checkercb = new CheckerCb(); LedgerChecker lc = new LedgerChecker(bk); lc.checkLedger(lh3, checkercb); assertEquals(STR, checkercb.getRc(30, TimeUnit.SECONDS), BKException.Code.OK); assertEquals(STR, 1, checkercb.getResult(30, TimeUnit.SECONDS).size()); restartBookieSlow(); restartBookieSlow(); bk.close(); try { bkadmin.openLedger(lh1.getId()); fail(STR); } catch (BKException.BKClientClosedException cce) { } try { bkadmin.openLedgerNoRecovery(lh1.getId()); fail(STR); } catch (BKException.BKClientClosedException cce) { } try { bkadmin.recoverBookieData(bookieToKill); fail(STR); } catch (BKException.BKClientClosedException cce) { } try { bkadmin.replicateLedgerFragment(lh3, checkercb.getResult(10, TimeUnit.SECONDS).iterator().next()); fail(STR); } catch (BKException.BKClientClosedException cce) { } } } /** * Test that the bookkeeper client doesn't leave any threads hanging around. * See {@link https:
|
/**
* Test that BookKeeperAdmin operationg using a closed BK client will
* throw a ClientClosedException.
*/
|
Test that BookKeeperAdmin operationg using a closed BK client will throw a ClientClosedException
|
testBookKeeperAdmin
|
{
"repo_name": "ivankelly/bookkeeper",
"path": "bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperCloseTest.java",
"license": "apache-2.0",
"size": 23901
}
|
[
"java.util.concurrent.TimeUnit",
"org.apache.bookkeeper.client.BKException",
"org.apache.bookkeeper.net.BookieSocketAddress",
"org.junit.Assert",
"org.junit.Test"
] |
import java.util.concurrent.TimeUnit; import org.apache.bookkeeper.client.BKException; import org.apache.bookkeeper.net.BookieSocketAddress; import org.junit.Assert; import org.junit.Test;
|
import java.util.concurrent.*; import org.apache.bookkeeper.client.*; import org.apache.bookkeeper.net.*; import org.junit.*;
|
[
"java.util",
"org.apache.bookkeeper",
"org.junit"
] |
java.util; org.apache.bookkeeper; org.junit;
| 1,160,911
|
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
super.notifyChanged(notification);
}
|
void function(Notification notification) { updateChildren(notification); super.notifyChanged(notification); }
|
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* @generated
*/
|
This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>
|
notifyChanged
|
{
"repo_name": "parraman/micobs",
"path": "mesp/es.uah.aut.srg.micobs.mesp/src/es/uah/aut/srg/micobs/mesp/library/mesplibrary/provider/MMESPItemPlatformSwPackageItemProvider.java",
"license": "epl-1.0",
"size": 4227
}
|
[
"org.eclipse.emf.common.notify.Notification"
] |
import org.eclipse.emf.common.notify.Notification;
|
import org.eclipse.emf.common.notify.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 340,471
|
public static List<Double> asList(double[] elements) {
//noinspection unchecked
return (List<Double>) asList((Object) elements);
}
|
static List<Double> function(double[] elements) { return (List<Double>) asList((Object) elements); }
|
/**
* Adapts an array of {@code double} into a {@link List} of
* {@link Double}.
*/
|
Adapts an array of double into a <code>List</code> of <code>Double</code>
|
asList
|
{
"repo_name": "mehant/incubator-calcite",
"path": "linq4j/src/main/java/org/apache/calcite/linq4j/tree/Primitive.java",
"license": "apache-2.0",
"size": 26877
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,439,948
|
public static ColorStrokeDialogFragment newInstance(ColorStrokeObject colorStrokeObject) {
ColorStrokeDialogFragment f = new ColorStrokeDialogFragment();
Bundle args = new Bundle();
args.putSerializable(PREFS_KEY_COLORPROPERTIES, colorStrokeObject);
f.setArguments(args);
return f;
}
|
static ColorStrokeDialogFragment function(ColorStrokeObject colorStrokeObject) { ColorStrokeDialogFragment f = new ColorStrokeDialogFragment(); Bundle args = new Bundle(); args.putSerializable(PREFS_KEY_COLORPROPERTIES, colorStrokeObject); f.setArguments(args); return f; }
|
/**
* Create a dialog instance.
*
* @param colorStrokeObject object holding color and stroke info.
* @return the instance.
*/
|
Create a dialog instance
|
newInstance
|
{
"repo_name": "tghoward/geopaparazzi",
"path": "geopaparazzilibrary/src/main/java/eu/geopaparazzi/library/core/dialogs/ColorStrokeDialogFragment.java",
"license": "gpl-3.0",
"size": 20795
}
|
[
"android.os.Bundle",
"eu.geopaparazzi.library.style.ColorStrokeObject"
] |
import android.os.Bundle; import eu.geopaparazzi.library.style.ColorStrokeObject;
|
import android.os.*; import eu.geopaparazzi.library.style.*;
|
[
"android.os",
"eu.geopaparazzi.library"
] |
android.os; eu.geopaparazzi.library;
| 1,862,294
|
@Test
public void testInsertReadUpdateWithUpsert() {
Properties props = new Properties();
props.setProperty("mongodb.upsert", "true");
DB client = getDB(props);
final String table = getClass().getSimpleName();
final String id = "updateWithUpsert";
HashMap<String, ByteIterator> inserted =
new HashMap<String, ByteIterator>();
inserted.put("a", new ByteArrayByteIterator(new byte[] { 1, 2, 3, 4 }));
Status result = client.insert(table, id, inserted);
assertThat("Insert did not return success (0).", result, is(Status.OK));
HashMap<String, ByteIterator> read = new HashMap<String, ByteIterator>();
Set<String> keys = Collections.singleton("a");
result = client.read(table, id, keys, read);
assertThat("Read did not return success (0).", result, is(Status.OK));
for (String key : keys) {
ByteIterator iter = read.get(key);
assertThat("Did not read the inserted field: " + key, iter,
notNullValue());
assertTrue(iter.hasNext());
assertThat(iter.nextByte(), is(Byte.valueOf((byte) 1)));
assertTrue(iter.hasNext());
assertThat(iter.nextByte(), is(Byte.valueOf((byte) 2)));
assertTrue(iter.hasNext());
assertThat(iter.nextByte(), is(Byte.valueOf((byte) 3)));
assertTrue(iter.hasNext());
assertThat(iter.nextByte(), is(Byte.valueOf((byte) 4)));
assertFalse(iter.hasNext());
}
HashMap<String, ByteIterator> updated = new HashMap<String, ByteIterator>();
updated.put("a", new ByteArrayByteIterator(new byte[] { 5, 6, 7, 8 }));
result = client.update(table, id, updated);
assertThat("Update did not return success (0).", result, is(Status.OK));
read.clear();
result = client.read(table, id, null, read);
assertThat("Read, after update, did not return success (0).", result, is(Status.OK));
for (String key : keys) {
ByteIterator iter = read.get(key);
assertThat("Did not read the inserted field: " + key, iter,
notNullValue());
assertTrue(iter.hasNext());
assertThat(iter.nextByte(), is(Byte.valueOf((byte) 5)));
assertTrue(iter.hasNext());
assertThat(iter.nextByte(), is(Byte.valueOf((byte) 6)));
assertTrue(iter.hasNext());
assertThat(iter.nextByte(), is(Byte.valueOf((byte) 7)));
assertTrue(iter.hasNext());
assertThat(iter.nextByte(), is(Byte.valueOf((byte) 8)));
assertFalse(iter.hasNext());
}
}
|
void function() { Properties props = new Properties(); props.setProperty(STR, "true"); DB client = getDB(props); final String table = getClass().getSimpleName(); final String id = STR; HashMap<String, ByteIterator> inserted = new HashMap<String, ByteIterator>(); inserted.put("a", new ByteArrayByteIterator(new byte[] { 1, 2, 3, 4 })); Status result = client.insert(table, id, inserted); assertThat(STR, result, is(Status.OK)); HashMap<String, ByteIterator> read = new HashMap<String, ByteIterator>(); Set<String> keys = Collections.singleton("a"); result = client.read(table, id, keys, read); assertThat(STR, result, is(Status.OK)); for (String key : keys) { ByteIterator iter = read.get(key); assertThat(STR + key, iter, notNullValue()); assertTrue(iter.hasNext()); assertThat(iter.nextByte(), is(Byte.valueOf((byte) 1))); assertTrue(iter.hasNext()); assertThat(iter.nextByte(), is(Byte.valueOf((byte) 2))); assertTrue(iter.hasNext()); assertThat(iter.nextByte(), is(Byte.valueOf((byte) 3))); assertTrue(iter.hasNext()); assertThat(iter.nextByte(), is(Byte.valueOf((byte) 4))); assertFalse(iter.hasNext()); } HashMap<String, ByteIterator> updated = new HashMap<String, ByteIterator>(); updated.put("a", new ByteArrayByteIterator(new byte[] { 5, 6, 7, 8 })); result = client.update(table, id, updated); assertThat(STR, result, is(Status.OK)); read.clear(); result = client.read(table, id, null, read); assertThat(STR, result, is(Status.OK)); for (String key : keys) { ByteIterator iter = read.get(key); assertThat(STR + key, iter, notNullValue()); assertTrue(iter.hasNext()); assertThat(iter.nextByte(), is(Byte.valueOf((byte) 5))); assertTrue(iter.hasNext()); assertThat(iter.nextByte(), is(Byte.valueOf((byte) 6))); assertTrue(iter.hasNext()); assertThat(iter.nextByte(), is(Byte.valueOf((byte) 7))); assertTrue(iter.hasNext()); assertThat(iter.nextByte(), is(Byte.valueOf((byte) 8))); assertFalse(iter.hasNext()); } }
|
/**
* Test method for {@link DB#insert}, {@link DB#read}, and {@link DB#update} .
*/
|
Test method for <code>DB#insert</code>, <code>DB#read</code>, and <code>DB#update</code>
|
testInsertReadUpdateWithUpsert
|
{
"repo_name": "ChristianNavolskyi/YCSB",
"path": "mongodb/src/test/java/com/yahoo/ycsb/db/AbstractDBTestCases.java",
"license": "apache-2.0",
"size": 11920
}
|
[
"com.yahoo.ycsb.ByteArrayByteIterator",
"com.yahoo.ycsb.ByteIterator",
"com.yahoo.ycsb.Status",
"java.util.Collections",
"java.util.HashMap",
"java.util.Properties",
"java.util.Set",
"org.hamcrest.CoreMatchers",
"org.junit.Assert"
] |
import com.yahoo.ycsb.ByteArrayByteIterator; import com.yahoo.ycsb.ByteIterator; import com.yahoo.ycsb.Status; import java.util.Collections; import java.util.HashMap; import java.util.Properties; import java.util.Set; import org.hamcrest.CoreMatchers; import org.junit.Assert;
|
import com.yahoo.ycsb.*; import java.util.*; import org.hamcrest.*; import org.junit.*;
|
[
"com.yahoo.ycsb",
"java.util",
"org.hamcrest",
"org.junit"
] |
com.yahoo.ycsb; java.util; org.hamcrest; org.junit;
| 217,191
|
public WeightClass getWeightClass()
{
return wClass;
}
|
WeightClass function() { return wClass; }
|
/**
* Gets the armor's weight class.
*
* @return wClass
* @see de.nebur97.git.gw2api.type.armor.WeightClass WeightClass
*/
|
Gets the armor's weight class
|
getWeightClass
|
{
"repo_name": "NeBuR97/GW2API",
"path": "GW2API/src/de/nebur97/git/gw2api/item/Armor.java",
"license": "mit",
"size": 2101
}
|
[
"de.nebur97.git.gw2api.type.armor.WeightClass"
] |
import de.nebur97.git.gw2api.type.armor.WeightClass;
|
import de.nebur97.git.gw2api.type.armor.*;
|
[
"de.nebur97.git"
] |
de.nebur97.git;
| 785,653
|
public final HsqlName getName() {
return tableName;
}
|
final HsqlName function() { return tableName; }
|
/**
* Returns the HsqlName object fo the table
*/
|
Returns the HsqlName object fo the table
|
getName
|
{
"repo_name": "anhnv-3991/VoltDB",
"path": "src/hsqldb19b3/org/hsqldb_voltpatches/Table.java",
"license": "agpl-3.0",
"size": 82842
}
|
[
"org.hsqldb_voltpatches.HsqlNameManager"
] |
import org.hsqldb_voltpatches.HsqlNameManager;
|
import org.hsqldb_voltpatches.*;
|
[
"org.hsqldb_voltpatches"
] |
org.hsqldb_voltpatches;
| 104,862
|
public static synchronized OMPlatform createPlatform()
{
try
{
if (systemContext != null)
{
return new OSGiPlatform(systemContext);
}
return new LegacyPlatform();
}
catch (Exception ex)
{
if (TRACER().isEnabled())
{
TRACER().trace(ex);
}
}
return null;
}
|
static synchronized OMPlatform function() { try { if (systemContext != null) { return new OSGiPlatform(systemContext); } return new LegacyPlatform(); } catch (Exception ex) { if (TRACER().isEnabled()) { TRACER().trace(ex); } } return null; }
|
/**
* TODO Make configurable via system property
*/
|
TODO Make configurable via system property
|
createPlatform
|
{
"repo_name": "IHTSDO/snow-owl",
"path": "dependencies/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractPlatform.java",
"license": "apache-2.0",
"size": 9179
}
|
[
"org.eclipse.net4j.internal.util.om.LegacyPlatform",
"org.eclipse.net4j.internal.util.om.OSGiPlatform",
"org.eclipse.net4j.util.om.OMPlatform"
] |
import org.eclipse.net4j.internal.util.om.LegacyPlatform; import org.eclipse.net4j.internal.util.om.OSGiPlatform; import org.eclipse.net4j.util.om.OMPlatform;
|
import org.eclipse.net4j.internal.util.om.*; import org.eclipse.net4j.util.om.*;
|
[
"org.eclipse.net4j"
] |
org.eclipse.net4j;
| 2,734,478
|
private void settingWidth() {
WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics displaymetrics = new DisplayMetrics(); //-------------------- Getting width of screen
wm.getDefaultDisplay().getMetrics(displaymetrics);
int width = displaymetrics.widthPixels;
width -= DisplayCalculations.dpToPx(16,this);
ViewGroup.LayoutParams lp1 = contentAboutLinear1.getLayoutParams();
ViewGroup.LayoutParams lp2 = contentAboutLinear2.getLayoutParams();
lp1.width = width / 2;
lp1.height = width / 2;
lp2.width = width / 2;
lp2.height = width / 2;
contentAboutLinear1.requestLayout();
contentAboutLinear2.requestLayout();
}
|
void function() { WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE); DisplayMetrics displaymetrics = new DisplayMetrics(); wm.getDefaultDisplay().getMetrics(displaymetrics); int width = displaymetrics.widthPixels; width -= DisplayCalculations.dpToPx(16,this); ViewGroup.LayoutParams lp1 = contentAboutLinear1.getLayoutParams(); ViewGroup.LayoutParams lp2 = contentAboutLinear2.getLayoutParams(); lp1.width = width / 2; lp1.height = width / 2; lp2.width = width / 2; lp2.height = width / 2; contentAboutLinear1.requestLayout(); contentAboutLinear2.requestLayout(); }
|
/**
* Setting the width of linear layouts in Card 1
*/
|
Setting the width of linear layouts in Card 1
|
settingWidth
|
{
"repo_name": "DawnImpulse/Wallup",
"path": "app/src/main/java/com/stonevire/wallup/activities/AboutActivity.java",
"license": "apache-2.0",
"size": 2927
}
|
[
"android.content.Context",
"android.util.DisplayMetrics",
"android.view.ViewGroup",
"android.view.WindowManager",
"com.stonevire.wallup.utils.DisplayCalculations"
] |
import android.content.Context; import android.util.DisplayMetrics; import android.view.ViewGroup; import android.view.WindowManager; import com.stonevire.wallup.utils.DisplayCalculations;
|
import android.content.*; import android.util.*; import android.view.*; import com.stonevire.wallup.utils.*;
|
[
"android.content",
"android.util",
"android.view",
"com.stonevire.wallup"
] |
android.content; android.util; android.view; com.stonevire.wallup;
| 2,371,575
|
public static Matcher<VariableTree> variableType(Matcher<Tree> treeMatcher) {
return (variableTree, state) -> treeMatcher.matches(variableTree.getType(), state);
}
|
static Matcher<VariableTree> function(Matcher<Tree> treeMatcher) { return (variableTree, state) -> treeMatcher.matches(variableTree.getType(), state); }
|
/**
* Matches on the type of a VariableTree AST node.
*
* @param treeMatcher A matcher on the type of the variable.
*/
|
Matches on the type of a VariableTree AST node
|
variableType
|
{
"repo_name": "google/error-prone",
"path": "check_api/src/main/java/com/google/errorprone/matchers/Matchers.java",
"license": "apache-2.0",
"size": 62161
}
|
[
"com.google.errorprone.util.ASTHelpers",
"com.sun.source.tree.Tree",
"com.sun.source.tree.VariableTree"
] |
import com.google.errorprone.util.ASTHelpers; import com.sun.source.tree.Tree; import com.sun.source.tree.VariableTree;
|
import com.google.errorprone.util.*; import com.sun.source.tree.*;
|
[
"com.google.errorprone",
"com.sun.source"
] |
com.google.errorprone; com.sun.source;
| 56,930
|
@javax.annotation.Nullable
@ApiModelProperty(
value =
"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds")
public String getKind() {
return kind;
}
|
@javax.annotation.Nullable @ApiModelProperty( value = "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https: String function() { return kind; }
|
/**
* Kind is a string value representing the REST resource this object represents. Servers may infer
* this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More
* info:
* https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
*
* @return kind
*/
|
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: HREF
|
getKind
|
{
"repo_name": "kubernetes-client/java",
"path": "kubernetes/src/main/java/io/kubernetes/client/openapi/models/V1beta1EventList.java",
"license": "apache-2.0",
"size": 5941
}
|
[
"io.swagger.annotations.ApiModelProperty"
] |
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.*;
|
[
"io.swagger.annotations"
] |
io.swagger.annotations;
| 983,935
|
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Void> startAsync(String resourceGroupName, String vmScaleSetName);
|
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Void> startAsync(String resourceGroupName, String vmScaleSetName);
|
/**
* Starts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @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 completion.
*/
|
Starts one or more virtual machines in a VM scale set
|
startAsync
|
{
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/VirtualMachineScaleSetsClient.java",
"license": "mit",
"size": 129320
}
|
[
"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;
| 445,814
|
private boolean isLocked(HttpServletRequest req) {
String path = getRelativePath(req);
String ifHeader = req.getHeader("If");
if (ifHeader == null)
ifHeader = "";
String lockTokenHeader = req.getHeader("Lock-Token");
if (lockTokenHeader == null)
lockTokenHeader = "";
return isLocked(path, ifHeader + lockTokenHeader);
}
|
boolean function(HttpServletRequest req) { String path = getRelativePath(req); String ifHeader = req.getHeader("If"); if (ifHeader == null) ifHeader = STRLock-TokenSTR"; return isLocked(path, ifHeader + lockTokenHeader); }
|
/**
* Check to see if a resource is currently write locked. The method
* will look at the "If" header to make sure the client
* has give the appropriate lock tokens.
*
* @param req Servlet request
* @return <code>true</code> if the resource is locked (and no appropriate
* lock token has been found for at least one of
* the non-shared locks which are present on the resource).
*/
|
Check to see if a resource is currently write locked. The method will look at the "If" header to make sure the client has give the appropriate lock tokens
|
isLocked
|
{
"repo_name": "IAMTJW/Tomcat-8.5.20",
"path": "tomcat-8.5.20/java/org/apache/catalina/servlets/WebdavServlet.java",
"license": "apache-2.0",
"size": 101838
}
|
[
"javax.servlet.http.HttpServletRequest"
] |
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.*;
|
[
"javax.servlet"
] |
javax.servlet;
| 1,952,335
|
public static MozuClient<com.mozu.api.contracts.commerceruntime.fulfillment.Pickup> updatePickupClient(com.mozu.api.contracts.commerceruntime.fulfillment.Pickup pickup, String orderId, String pickupId) throws Exception
{
return updatePickupClient( pickup, orderId, pickupId, null);
}
|
static MozuClient<com.mozu.api.contracts.commerceruntime.fulfillment.Pickup> function(com.mozu.api.contracts.commerceruntime.fulfillment.Pickup pickup, String orderId, String pickupId) throws Exception { return updatePickupClient( pickup, orderId, pickupId, null); }
|
/**
* Updates one or more details of a defined in-store pickup.
* <p><pre><code>
* MozuClient<com.mozu.api.contracts.commerceruntime.fulfillment.Pickup> mozuClient=UpdatePickupClient( pickup, orderId, pickupId);
* client.setBaseAddress(url);
* client.executeRequest();
* Pickup pickup = client.Result();
* </code></pre></p>
* @param orderId Unique identifier of the order.
* @param pickupId Unique identifier of the pickup to remove.
* @param pickup Properties of an in-store pickup defined to fulfill items in an order.
* @return Mozu.Api.MozuClient <com.mozu.api.contracts.commerceruntime.fulfillment.Pickup>
* @see com.mozu.api.contracts.commerceruntime.fulfillment.Pickup
* @see com.mozu.api.contracts.commerceruntime.fulfillment.Pickup
*/
|
Updates one or more details of a defined in-store pickup. <code><code> MozuClient mozuClient=UpdatePickupClient( pickup, orderId, pickupId); client.setBaseAddress(url); client.executeRequest(); Pickup pickup = client.Result(); </code></code>
|
updatePickupClient
|
{
"repo_name": "johngatti/mozu-java",
"path": "mozu-java-core/src/main/java/com/mozu/api/clients/commerce/orders/PickupClient.java",
"license": "mit",
"size": 10337
}
|
[
"com.mozu.api.MozuClient"
] |
import com.mozu.api.MozuClient;
|
import com.mozu.api.*;
|
[
"com.mozu.api"
] |
com.mozu.api;
| 1,868,208
|
Graphics gr;
Dimension size = getSize();
// Will hold the graphics context from the offScreenBuffer.
// We need to make sure we keep our offscreen buffer the same size
// as the graphics context we're working with.
if ((this.offScreenBuffer == null) ||
(!((this.offScreenBuffer.getWidth(this) == size.width) && (this.offScreenBuffer.getHeight(this) == size.height)))) {
this.offScreenBuffer = this.createImage(size.width, size.height);
}
// We need to use our buffer Image as a Graphics object:
gr = this.offScreenBuffer.getGraphics();
paint(gr); // Passes our off-screen buffer to our paint method, which,
// unsuspecting, paints on it just as it would on the Graphics
// passed by the browser or applet viewer.
g.drawImage(this.offScreenBuffer, 0, 0, this);
// And now we transfer the info in the buffer onto the
// graphics context we got from the browser in one smooth motion.
}
|
Graphics gr; Dimension size = getSize(); if ((this.offScreenBuffer == null) (!((this.offScreenBuffer.getWidth(this) == size.width) && (this.offScreenBuffer.getHeight(this) == size.height)))) { this.offScreenBuffer = this.createImage(size.width, size.height); } gr = this.offScreenBuffer.getGraphics(); paint(gr); g.drawImage(this.offScreenBuffer, 0, 0, this); }
|
/** Drawing the Component with a double-buffer.
* Thanks to "Graphics and Double-buffering Made Easy" , by Ian McFarland, July 1997
*/
|
Drawing the Component with a double-buffer. Thanks to "Graphics and Double-buffering Made Easy" , by Ian McFarland, July 1997
|
update
|
{
"repo_name": "moliva/proactive",
"path": "src/Examples/org/objectweb/proactive/examples/c3d/gui/ImageCanvas.java",
"license": "agpl-3.0",
"size": 5819
}
|
[
"java.awt.Dimension",
"java.awt.Graphics"
] |
import java.awt.Dimension; import java.awt.Graphics;
|
import java.awt.*;
|
[
"java.awt"
] |
java.awt;
| 229,541
|
private static void handleInvocationTargetException(
InvocationTargetException ex) {
rethrowRuntimeException(ex.getTargetException());
}
|
static void function( InvocationTargetException ex) { rethrowRuntimeException(ex.getTargetException()); }
|
/**
* Handles the reflection exceptions
*
* @param ex
*/
|
Handles the reflection exceptions
|
handleInvocationTargetException
|
{
"repo_name": "osanchezhuerta/employees-hr-ws-app",
"path": "employees-hr-ws-app/employees-hr-ws-soa/employees-hr-ws-soa-commons/src/main/java/org/osanchezhuerta/hr/employees/soa/commons/util/ReflectionHelper.java",
"license": "apache-2.0",
"size": 6868
}
|
[
"java.lang.reflect.InvocationTargetException"
] |
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.*;
|
[
"java.lang"
] |
java.lang;
| 2,604,948
|
public int getDayOfYear() {
int doy = this.iso.get(PlainDate.DAY_OF_YEAR);
if (this.iso.getYear() < 1941) {
if (this.iso.getMonth() >= 4) {
doy -= (this.iso.isLeapYear() ? 91 : 90);
} else {
doy += 275; // 91 + 92 + 92
}
}
return doy;
}
|
int function() { int doy = this.iso.get(PlainDate.DAY_OF_YEAR); if (this.iso.getYear() < 1941) { if (this.iso.getMonth() >= 4) { doy -= (this.iso.isLeapYear() ? 91 : 90); } else { doy += 275; } } return doy; }
|
/**
* <p>Yields the day of year. </p>
*
* @return int
* @since 3.19/4.15
*/
|
Yields the day of year.
|
getDayOfYear
|
{
"repo_name": "MenoData/Time4J",
"path": "base/src/main/java/net/time4j/calendar/ThaiSolarCalendar.java",
"license": "lgpl-2.1",
"size": 43423
}
|
[
"net.time4j.PlainDate"
] |
import net.time4j.PlainDate;
|
import net.time4j.*;
|
[
"net.time4j"
] |
net.time4j;
| 2,572,975
|
public int _offsetToX(int line, int offset) {
TokenMarker tokenMarker = getTokenMarker();
FontMetrics fm = painter.getFontMetrics();
getLineText(line, lineSegment);
int segmentOffset = lineSegment.offset;
int x = horizontalOffset;
if (tokenMarker == null) {
lineSegment.count = offset;
return x + Utilities.getTabbedTextWidth(lineSegment, fm, x, painter, 0);
}
else {
Token tokens;
if (painter.currentLineIndex == line && painter.currentLineTokens != null) {
tokens = painter.currentLineTokens;
} else {
painter.currentLineIndex = line;
tokens = painter.currentLineTokens = tokenMarker.markTokens(lineSegment, line);
}
Font defaultFont = painter.getFont();
SyntaxStyle[] styles = painter.getStyles();
for (;;) {
byte id = tokens.id;
if (id == Token.END) {
return x;
}
if (id == Token.NULL) {
fm = painter.getFontMetrics();
} else {
fm = styles[id].getFontMetrics(defaultFont);
}
int length = tokens.length;
if (offset + segmentOffset < lineSegment.offset + length) {
lineSegment.count = offset - (lineSegment.offset - segmentOffset);
return x + Utilities.getTabbedTextWidth(lineSegment, fm, x, painter, 0);
} else {
lineSegment.count = length;
x += Utilities.getTabbedTextWidth(lineSegment, fm, x, painter, 0);
lineSegment.offset += length;
}
tokens = tokens.next;
}
}
}
|
int function(int line, int offset) { TokenMarker tokenMarker = getTokenMarker(); FontMetrics fm = painter.getFontMetrics(); getLineText(line, lineSegment); int segmentOffset = lineSegment.offset; int x = horizontalOffset; if (tokenMarker == null) { lineSegment.count = offset; return x + Utilities.getTabbedTextWidth(lineSegment, fm, x, painter, 0); } else { Token tokens; if (painter.currentLineIndex == line && painter.currentLineTokens != null) { tokens = painter.currentLineTokens; } else { painter.currentLineIndex = line; tokens = painter.currentLineTokens = tokenMarker.markTokens(lineSegment, line); } Font defaultFont = painter.getFont(); SyntaxStyle[] styles = painter.getStyles(); for (;;) { byte id = tokens.id; if (id == Token.END) { return x; } if (id == Token.NULL) { fm = painter.getFontMetrics(); } else { fm = styles[id].getFontMetrics(defaultFont); } int length = tokens.length; if (offset + segmentOffset < lineSegment.offset + length) { lineSegment.count = offset - (lineSegment.offset - segmentOffset); return x + Utilities.getTabbedTextWidth(lineSegment, fm, x, painter, 0); } else { lineSegment.count = length; x += Utilities.getTabbedTextWidth(lineSegment, fm, x, painter, 0); lineSegment.offset += length; } tokens = tokens.next; } } }
|
/**
* Converts an offset in a line into an x co-ordinate. This is a fast version that should only
* be used if no changes were made to the text since the last repaint.
*
* @param line
* The line
* @param offset
* The offset, from the start of the line
*/
|
Converts an offset in a line into an x co-ordinate. This is a fast version that should only be used if no changes were made to the text since the last repaint
|
_offsetToX
|
{
"repo_name": "transwarpio/rapidminer",
"path": "rapidMiner/rapidminer-studio-core/src/main/java/com/rapidminer/gui/tools/syntax/JEditTextArea.java",
"license": "gpl-3.0",
"size": 55315
}
|
[
"java.awt.Font",
"java.awt.FontMetrics",
"javax.swing.text.Utilities"
] |
import java.awt.Font; import java.awt.FontMetrics; import javax.swing.text.Utilities;
|
import java.awt.*; import javax.swing.text.*;
|
[
"java.awt",
"javax.swing"
] |
java.awt; javax.swing;
| 2,805,559
|
void itemChangeNotification(RowItem changedItem) {
if (autoCommit) {
try {
queryDelegate.beginTransaction();
if (queryDelegate.storeRow(changedItem) == 0) {
queryDelegate.rollback();
refresh();
throw new ConcurrentModificationException(
"Item with the ID '" + changedItem.getId()
+ "' has been externally modified.");
}
queryDelegate.commit();
if (notificationsEnabled) {
CacheFlushNotifier.notifyOfCacheFlush(this);
}
getLogger().log(Level.FINER, "Row updated to DB...");
} catch (SQLException e) {
getLogger().log(Level.WARNING,
"itemChangeNotification failed, rolling back...", e);
try {
queryDelegate.rollback();
} catch (SQLException ee) {
getLogger().log(Level.SEVERE, "Rollback failed", e);
}
throw new RuntimeException(e);
}
} else {
if (!(changedItem.getId() instanceof TemporaryRowId)
&& !modifiedItems.contains(changedItem)) {
modifiedItems.add(changedItem);
}
}
}
|
void itemChangeNotification(RowItem changedItem) { if (autoCommit) { try { queryDelegate.beginTransaction(); if (queryDelegate.storeRow(changedItem) == 0) { queryDelegate.rollback(); refresh(); throw new ConcurrentModificationException( STR + changedItem.getId() + STR); } queryDelegate.commit(); if (notificationsEnabled) { CacheFlushNotifier.notifyOfCacheFlush(this); } getLogger().log(Level.FINER, STR); } catch (SQLException e) { getLogger().log(Level.WARNING, STR, e); try { queryDelegate.rollback(); } catch (SQLException ee) { getLogger().log(Level.SEVERE, STR, e); } throw new RuntimeException(e); } } else { if (!(changedItem.getId() instanceof TemporaryRowId) && !modifiedItems.contains(changedItem)) { modifiedItems.add(changedItem); } } }
|
/**
* Notifies this container that a property in the given item has been
* modified. The change will be buffered or made instantaneously depending
* on auto commit mode.
*
* @param changedItem
* item that has a modified property
*/
|
Notifies this container that a property in the given item has been modified. The change will be buffered or made instantaneously depending on auto commit mode
|
itemChangeNotification
|
{
"repo_name": "jdahlstrom/vaadin.react",
"path": "server/src/main/java/com/vaadin/data/util/sqlcontainer/SQLContainer.java",
"license": "apache-2.0",
"size": 62113
}
|
[
"java.sql.SQLException",
"java.util.ConcurrentModificationException",
"java.util.logging.Level"
] |
import java.sql.SQLException; import java.util.ConcurrentModificationException; import java.util.logging.Level;
|
import java.sql.*; import java.util.*; import java.util.logging.*;
|
[
"java.sql",
"java.util"
] |
java.sql; java.util;
| 2,473,935
|
return new OracleContainer(new OracleConfig(version, properties));
}
private static final Logger log = LoggerFactory.getLogger(Commands.class);
private final OracleConfig oracleConfig;
private boolean oracleScript;
public OracleContainer(OracleConfig config) {
super(config);
this.oracleConfig = config;
this.checkConnectivityUsingAdmin = true;
}
|
return new OracleContainer(new OracleConfig(version, properties)); } private static final Logger log = LoggerFactory.getLogger(Commands.class); private final OracleConfig oracleConfig; private boolean oracleScript; public OracleContainer(OracleConfig config) { super(config); this.oracleConfig = config; this.checkConnectivityUsingAdmin = true; }
|
/**
* Create Postgres container with configuration from properties.
*/
|
Create Postgres container with configuration from properties
|
create
|
{
"repo_name": "avaje/docker-commands",
"path": "src/main/java/io/ebean/docker/commands/OracleContainer.java",
"license": "apache-2.0",
"size": 2843
}
|
[
"org.slf4j.Logger",
"org.slf4j.LoggerFactory"
] |
import org.slf4j.Logger; import org.slf4j.LoggerFactory;
|
import org.slf4j.*;
|
[
"org.slf4j"
] |
org.slf4j;
| 1,950,540
|
public static boolean parseFullXMLDocument(String prefsXML, PropertyNamesProvider provider,
int version, boolean versionsMustMatch) {
Document doc = BaseXMLReader.getDocumentFromString(prefsXML);
if (doc == null) {
// not xml -- can't parse it
return false;
}
Element rootElement = doc.getRootElement();
String shortClassName = getShortClassName(provider.getClass());
Element classElement = rootElement.getChild(shortClassName);
if (classElement != null) {
String versionString = classElement.getChildText(VERSION);
int versionInXml = MesquiteInteger.fromString(versionString);
boolean acceptableVersion = (versionInXml == version || !versionsMustMatch);
if (isCorrectRootTag(classElement.getName(), provider.getClass()) && acceptableVersion) {
List prefsChildren = classElement.getChildren(PREFERENCE);
for (Iterator iter = prefsChildren.iterator(); iter.hasNext();) {
Element nextPreferenceElement = (Element) iter.next();
String key = nextPreferenceElement.getAttributeValue(KEY);
String value = nextPreferenceElement.getText();
try {
PropertyUtils.smartWrite(provider, key, value);
} catch (Exception e) {
MesquiteMessage.warnProgrammer("Could not write property value " + key + " for loading xml preferences on module: " + provider);
}
}
return true;
}
}
return false;
}
|
static boolean function(String prefsXML, PropertyNamesProvider provider, int version, boolean versionsMustMatch) { Document doc = BaseXMLReader.getDocumentFromString(prefsXML); if (doc == null) { return false; } Element rootElement = doc.getRootElement(); String shortClassName = getShortClassName(provider.getClass()); Element classElement = rootElement.getChild(shortClassName); if (classElement != null) { String versionString = classElement.getChildText(VERSION); int versionInXml = MesquiteInteger.fromString(versionString); boolean acceptableVersion = (versionInXml == version !versionsMustMatch); if (isCorrectRootTag(classElement.getName(), provider.getClass()) && acceptableVersion) { List prefsChildren = classElement.getChildren(PREFERENCE); for (Iterator iter = prefsChildren.iterator(); iter.hasNext();) { Element nextPreferenceElement = (Element) iter.next(); String key = nextPreferenceElement.getAttributeValue(KEY); String value = nextPreferenceElement.getText(); try { PropertyUtils.smartWrite(provider, key, value); } catch (Exception e) { MesquiteMessage.warnProgrammer(STR + key + STR + provider); } } return true; } } return false; }
|
/**
* Ideally this should not be static but since we don't always have control over the superclass,
* make it available for classes that might otherwise not be able to use it due to inheritance
* constraints
* @param prefsXML
* @param provider
* @param version
* @param versionsMustMatch
* @return
*/
|
Ideally this should not be static but since we don't always have control over the superclass, make it available for classes that might otherwise not be able to use it due to inheritance constraints
|
parseFullXMLDocument
|
{
"repo_name": "MesquiteProject/MesquiteArchive",
"path": "tags/release2.0/Mesquite Project/Source/mesquite/lib/MesquiteXMLPreferencesModule.java",
"license": "lgpl-3.0",
"size": 4524
}
|
[
"java.util.Iterator",
"java.util.List",
"org.apache.hivemind.util.PropertyUtils",
"org.jdom.Document",
"org.jdom.Element",
"org.tolweb.base.xml.BaseXMLReader"
] |
import java.util.Iterator; import java.util.List; import org.apache.hivemind.util.PropertyUtils; import org.jdom.Document; import org.jdom.Element; import org.tolweb.base.xml.BaseXMLReader;
|
import java.util.*; import org.apache.hivemind.util.*; import org.jdom.*; import org.tolweb.base.xml.*;
|
[
"java.util",
"org.apache.hivemind",
"org.jdom",
"org.tolweb.base"
] |
java.util; org.apache.hivemind; org.jdom; org.tolweb.base;
| 171,958
|
public void stopEventLooper() throws SerialComException {
try {
exitEventThread.set(true);
mEventLooperThread.interrupt();
} catch (Exception e) {
}
}
|
void function() throws SerialComException { try { exitEventThread.set(true); mEventLooperThread.interrupt(); } catch (Exception e) { } }
|
/**
* <p>Set the flag to indicate that the thread is supposed to run to completion and exit.
* Interrupt the thread so that take() method can come out of blocked sleep state.</p>
*/
|
Set the flag to indicate that the thread is supposed to run to completion and exit. Interrupt the thread so that take() method can come out of blocked sleep state
|
stopEventLooper
|
{
"repo_name": "Tecsisa/serial-communication-manager",
"path": "com.embeddedunveiled.serial/src/com/embeddedunveiled/serial/internal/SerialComLooper.java",
"license": "lgpl-3.0",
"size": 10991
}
|
[
"com.embeddedunveiled.serial.SerialComException"
] |
import com.embeddedunveiled.serial.SerialComException;
|
import com.embeddedunveiled.serial.*;
|
[
"com.embeddedunveiled.serial"
] |
com.embeddedunveiled.serial;
| 2,854,450
|
void deleteContainer(long containerId, Pipeline pipeline, boolean force) throws IOException;
|
void deleteContainer(long containerId, Pipeline pipeline, boolean force) throws IOException;
|
/**
* Deletes an existing container.
* @param containerId - ID of the container.
* @param pipeline - Pipeline that represents the container.
* @param force - true to forcibly delete the container.
* @throws IOException
*/
|
Deletes an existing container
|
deleteContainer
|
{
"repo_name": "szegedim/hadoop",
"path": "hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/client/ScmClient.java",
"license": "apache-2.0",
"size": 4943
}
|
[
"java.io.IOException",
"org.apache.hadoop.hdds.scm.container.common.helpers.Pipeline"
] |
import java.io.IOException; import org.apache.hadoop.hdds.scm.container.common.helpers.Pipeline;
|
import java.io.*; import org.apache.hadoop.hdds.scm.container.common.helpers.*;
|
[
"java.io",
"org.apache.hadoop"
] |
java.io; org.apache.hadoop;
| 590,643
|
public List<Tombstone> tombstones() {
return Collections.unmodifiableList(tombstones);
}
|
List<Tombstone> function() { return Collections.unmodifiableList(tombstones); }
|
/**
* A copy of the current tombstones in the builder.
*/
|
A copy of the current tombstones in the builder
|
tombstones
|
{
"repo_name": "fforbeck/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/cluster/metadata/IndexGraveyard.java",
"license": "apache-2.0",
"size": 18001
}
|
[
"java.util.Collections",
"java.util.List"
] |
import java.util.Collections; import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 558,182
|
public void updateAutoScalingGroup(String autoScalingGroupName, String launchConfigurationName, int minSize, int maxSize,
int defaultCooldown) throws AutoScalingException {
Map<String, String> params = new HashMap<String, String>();
params.put("AutoScalingGroupName", autoScalingGroupName);
params.put("LaunchConfigurationName", launchConfigurationName);
params.put("MinSize", ""+minSize);
params.put("MaxSize", ""+maxSize);
params.put("DefaultCooldown", ""+defaultCooldown);
HttpGet method = new HttpGet();
// UpdateAutoScalingGroupResponse response =
makeRequestInt(method, "UpdateAutoScalingGroup", params, UpdateAutoScalingGroupResponse.class);
}
|
void function(String autoScalingGroupName, String launchConfigurationName, int minSize, int maxSize, int defaultCooldown) throws AutoScalingException { Map<String, String> params = new HashMap<String, String>(); params.put(STR, autoScalingGroupName); params.put(STR, launchConfigurationName); params.put(STR, STRMaxSizeSTRSTRDefaultCooldownSTRSTRUpdateAutoScalingGroup", params, UpdateAutoScalingGroupResponse.class); }
|
/**
* Update a auto scaling group
*
* @param autoScalingGroupName a autoScaling group name
* @param launchConfigurationName name of launch configuration for this group
* @param minSize min number of servers in this group
* @param maxSize max number of servers in this group (must be < 1000)
* @param defaultCooldown number of seconds to wait before adjusting capacity
* @throws AutoScalingException wraps checked exceptions
*/
|
Update a auto scaling group
|
updateAutoScalingGroup
|
{
"repo_name": "jonnyzzz/maragogype",
"path": "tags/v1.7/java/com/xerox/amazonws/ec2/AutoScaling.java",
"license": "apache-2.0",
"size": 23797
}
|
[
"com.xerox.amazonws.typica.autoscale.jaxb.UpdateAutoScalingGroupResponse",
"java.util.HashMap",
"java.util.Map"
] |
import com.xerox.amazonws.typica.autoscale.jaxb.UpdateAutoScalingGroupResponse; import java.util.HashMap; import java.util.Map;
|
import com.xerox.amazonws.typica.autoscale.jaxb.*; import java.util.*;
|
[
"com.xerox.amazonws",
"java.util"
] |
com.xerox.amazonws; java.util;
| 1,492,092
|
private void setContentAreaAsTouchableSurface() {
if (!mPopupWindow.isShowing()) {
mContentContainer.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
}
int width = mContentContainer.getMeasuredWidth();
int height = mContentContainer.getMeasuredHeight();
mTouchableRegion.set(
(int) mContentContainer.getX(),
(int) mContentContainer.getY(),
(int) mContentContainer.getX() + width,
(int) mContentContainer.getY() + height);
}
|
void function() { if (!mPopupWindow.isShowing()) { mContentContainer.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); } int width = mContentContainer.getMeasuredWidth(); int height = mContentContainer.getMeasuredHeight(); mTouchableRegion.set( (int) mContentContainer.getX(), (int) mContentContainer.getY(), (int) mContentContainer.getX() + width, (int) mContentContainer.getY() + height); }
|
/**
* Sets the touchable region of this popup to be the area occupied by its content.
*/
|
Sets the touchable region of this popup to be the area occupied by its content
|
setContentAreaAsTouchableSurface
|
{
"repo_name": "OmniEvo/android_frameworks_base",
"path": "core/java/com/android/internal/widget/FloatingToolbar.java",
"license": "gpl-3.0",
"size": 65171
}
|
[
"android.view.View"
] |
import android.view.View;
|
import android.view.*;
|
[
"android.view"
] |
android.view;
| 238,882
|
public static String applyVCodeUrl() {
return TxnCodeConst.getVCodeUrl();
}
|
static String function() { return TxnCodeConst.getVCodeUrl(); }
|
/**
* get verify code from server to make sure it's the same source compared
* with apply.
*
* @return
*/
|
get verify code from server to make sure it's the same source compared with apply
|
applyVCodeUrl
|
{
"repo_name": "armstrongli/CaiddApp",
"path": "src/cn/caidd/core/ApplyData.java",
"license": "gpl-2.0",
"size": 4663
}
|
[
"cn.caidd.constele.TxnCodeConst"
] |
import cn.caidd.constele.TxnCodeConst;
|
import cn.caidd.constele.*;
|
[
"cn.caidd.constele"
] |
cn.caidd.constele;
| 338,415
|
EList<CustomerAgreement> getCustomerAgreements();
|
EList<CustomerAgreement> getCustomerAgreements();
|
/**
* Returns the value of the '<em><b>Customer Agreements</b></em>' reference list.
* The list contents are of type {@link CIM.IEC61968.Customers.CustomerAgreement}.
* It is bidirectional and its opposite is '{@link CIM.IEC61968.Customers.CustomerAgreement#getDemandResponseProgram <em>Demand Response Program</em>}'.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Customer Agreements</em>' reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Customer Agreements</em>' reference list.
* @see CIM.IEC61968.Metering.MeteringPackage#getDemandResponseProgram_CustomerAgreements()
* @see CIM.IEC61968.Customers.CustomerAgreement#getDemandResponseProgram
* @model opposite="DemandResponseProgram"
* annotation="http://iec.ch/TC57/2009/CIM-schema-cim14 Documentation='All customer agreements with this demand response program.'"
* annotation="http://www.eclipse.org/emf/2002/GenModel Documentation='All customer agreements with this demand response program.'"
* @generated
*/
|
Returns the value of the 'Customer Agreements' reference list. The list contents are of type <code>CIM.IEC61968.Customers.CustomerAgreement</code>. It is bidirectional and its opposite is '<code>CIM.IEC61968.Customers.CustomerAgreement#getDemandResponseProgram Demand Response Program</code>'. If the meaning of the 'Customer Agreements' reference list isn't clear, there really should be more of a description here...
|
getCustomerAgreements
|
{
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/ModelJoin/src/main/java/CIM/IEC61968/Metering/DemandResponseProgram.java",
"license": "mit",
"size": 7747
}
|
[
"org.eclipse.emf.common.util.EList"
] |
import org.eclipse.emf.common.util.EList;
|
import org.eclipse.emf.common.util.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 2,677,040
|
private Coordinate[] createCoordinates(final List<SweCoordinate<?>> coordinates) throws OwsExceptionReport {
if (coordinates != null) {
final ArrayList<Coordinate> xbCoordinates = new ArrayList<Coordinate>(coordinates.size());
for (final SweCoordinate<?> coordinate : coordinates) {
xbCoordinates.add(createCoordinate(coordinate));
}
return xbCoordinates.toArray(new Coordinate[xbCoordinates.size()]);
}
return null;
}
|
Coordinate[] function(final List<SweCoordinate<?>> coordinates) throws OwsExceptionReport { if (coordinates != null) { final ArrayList<Coordinate> xbCoordinates = new ArrayList<Coordinate>(coordinates.size()); for (final SweCoordinate<?> coordinate : coordinates) { xbCoordinates.add(createCoordinate(coordinate)); } return xbCoordinates.toArray(new Coordinate[xbCoordinates.size()]); } return null; }
|
/**
* Adds values to SWE coordinates
*
* @param coordinates
* SOS internal representation
* @throws OwsExceptionReport
*/
|
Adds values to SWE coordinates
|
createCoordinates
|
{
"repo_name": "impulze/SOS",
"path": "coding/sensorML-v101/src/main/java/org/n52/sos/encode/SweCommonEncoderv101.java",
"license": "gpl-2.0",
"size": 40103
}
|
[
"java.util.ArrayList",
"java.util.List",
"net.opengis.swe.x101.VectorType",
"org.n52.sos.ogc.ows.OwsExceptionReport",
"org.n52.sos.ogc.swe.SweCoordinate"
] |
import java.util.ArrayList; import java.util.List; import net.opengis.swe.x101.VectorType; import org.n52.sos.ogc.ows.OwsExceptionReport; import org.n52.sos.ogc.swe.SweCoordinate;
|
import java.util.*; import net.opengis.swe.x101.*; import org.n52.sos.ogc.ows.*; import org.n52.sos.ogc.swe.*;
|
[
"java.util",
"net.opengis.swe",
"org.n52.sos"
] |
java.util; net.opengis.swe; org.n52.sos;
| 127,898
|
private static boolean startSqsService(final ApiFunctions functions, String name) {
try {
// create the SQS interface
AmazonSQSControl sqs = new AmazonSQSControl(
name,
(cmd) -> SQSTarget.parseCommand(cmd, functions),
4);
sqs.start();
} catch (Exception ex) {
LOGGER.error("Unexpected exception starting SQS service.", ex);
return false;
}
return true;
}
|
static boolean function(final ApiFunctions functions, String name) { try { AmazonSQSControl sqs = new AmazonSQSControl( name, (cmd) -> SQSTarget.parseCommand(cmd, functions), 4); sqs.start(); } catch (Exception ex) { LOGGER.error(STR, ex); return false; } return true; }
|
/**
* Starts the amazon simple queue service.
* @param functions The control object for executing the api calls.
* @param name The name of the queue to attach to.
* @return A boolean value indicating whether the service stated
* successfully.
*/
|
Starts the amazon simple queue service
|
startSqsService
|
{
"repo_name": "KyleGrund/ViTeMBP-BEJava",
"path": "ViTeMBP Services/src/com/vitembp/services/interfaces/ServiceControl.java",
"license": "gpl-3.0",
"size": 3292
}
|
[
"com.vitembp.embedded.interfaces.AmazonSQSControl",
"com.vitembp.services.ApiFunctions"
] |
import com.vitembp.embedded.interfaces.AmazonSQSControl; import com.vitembp.services.ApiFunctions;
|
import com.vitembp.embedded.interfaces.*; import com.vitembp.services.*;
|
[
"com.vitembp.embedded",
"com.vitembp.services"
] |
com.vitembp.embedded; com.vitembp.services;
| 1,926,983
|
@SuppressWarnings("unchecked")
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> of(
E e1, E e2, E e3, E e4, E e5) {
return copyOf(Ordering.natural(), Arrays.asList(e1, e2, e3, e4, e5));
}
|
@SuppressWarnings(STR) static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> function( E e1, E e2, E e3, E e4, E e5) { return copyOf(Ordering.natural(), Arrays.asList(e1, e2, e3, e4, e5)); }
|
/**
* Returns an immutable sorted multiset containing the given elements sorted by their natural
* ordering.
*
* @throws NullPointerException if any element is null
*/
|
Returns an immutable sorted multiset containing the given elements sorted by their natural ordering
|
of
|
{
"repo_name": "jakubmalek/guava",
"path": "guava/src/com/google/common/collect/ImmutableSortedMultiset.java",
"license": "apache-2.0",
"size": 20714
}
|
[
"java.util.Arrays"
] |
import java.util.Arrays;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,646,388
|
public CallbackRegistration addRefreshHandler(DataViewRefreshHandler handler) {
return this.addWidgetListener(Event.REFRESH.getValue(), handler.getJsoPeer());
}
|
CallbackRegistration function(DataViewRefreshHandler handler) { return this.addWidgetListener(Event.REFRESH.getValue(), handler.getJsoPeer()); }
|
/**
* Fires whenever the DataView is refreshed. The Event is preventable.
*
* @param handler
*/
|
Fires whenever the DataView is refreshed. The Event is preventable
|
addRefreshHandler
|
{
"repo_name": "paulvi/touch4j",
"path": "src/com/emitrom/touch4j/client/ui/DataView.java",
"license": "apache-2.0",
"size": 16868
}
|
[
"com.emitrom.touch4j.client.core.config.Event",
"com.emitrom.touch4j.client.core.handlers.CallbackRegistration",
"com.emitrom.touch4j.client.core.handlers.dataview.DataViewRefreshHandler"
] |
import com.emitrom.touch4j.client.core.config.Event; import com.emitrom.touch4j.client.core.handlers.CallbackRegistration; import com.emitrom.touch4j.client.core.handlers.dataview.DataViewRefreshHandler;
|
import com.emitrom.touch4j.client.core.config.*; import com.emitrom.touch4j.client.core.handlers.*; import com.emitrom.touch4j.client.core.handlers.dataview.*;
|
[
"com.emitrom.touch4j"
] |
com.emitrom.touch4j;
| 906,417
|
public void graphs() throws Exception {
// checking existence of ip and start time.
if (!parameterMap
.containsKey(com.impetus.ankush2.constant.Constant.Keys.PATTERN)
&& !parameterMap
.containsKey(com.impetus.ankush2.constant.Constant.Keys.STARTTIME)) {
throw new Exception("Either pattern or start time is missing.");
}
// getting start time
StartTime startTime = StartTime.valueOf(((String) parameterMap
.get(com.impetus.ankush2.constant.Constant.Keys.STARTTIME))
.toLowerCase());
// pattern
String pattern = (String) parameterMap
.get(com.impetus.ankush2.constant.Constant.Keys.PATTERN);
// node ip.
String host = null;
if (parameterMap
.containsKey(com.impetus.ankush2.constant.Constant.Keys.IP)) {
host = (String) parameterMap
.get(com.impetus.ankush2.constant.Constant.Keys.IP);
}
try {
Graph graph = new Graph(clusterConf);
// putting the extracted data into the json.
result.putAll(graph.getGraph(startTime, pattern, host));
} catch (Exception e) {
addAndLogError(e.getMessage());
}
}
|
void function() throws Exception { if (!parameterMap .containsKey(com.impetus.ankush2.constant.Constant.Keys.PATTERN) && !parameterMap .containsKey(com.impetus.ankush2.constant.Constant.Keys.STARTTIME)) { throw new Exception(STR); } StartTime startTime = StartTime.valueOf(((String) parameterMap .get(com.impetus.ankush2.constant.Constant.Keys.STARTTIME)) .toLowerCase()); String pattern = (String) parameterMap .get(com.impetus.ankush2.constant.Constant.Keys.PATTERN); String host = null; if (parameterMap .containsKey(com.impetus.ankush2.constant.Constant.Keys.IP)) { host = (String) parameterMap .get(com.impetus.ankush2.constant.Constant.Keys.IP); } try { Graph graph = new Graph(clusterConf); result.putAll(graph.getGraph(startTime, pattern, host)); } catch (Exception e) { addAndLogError(e.getMessage()); } }
|
/**
* Return pattern based graphs.
*
* @throws Exception
*/
|
Return pattern based graphs
|
graphs
|
{
"repo_name": "zengzhaozheng/ankush",
"path": "ankush/src/main/java/com/impetus/ankush2/framework/monitor/AbstractMonitor.java",
"license": "lgpl-3.0",
"size": 63629
}
|
[
"com.impetus.ankush2.constant.Constant",
"com.impetus.ankush2.framework.monitor.Graph"
] |
import com.impetus.ankush2.constant.Constant; import com.impetus.ankush2.framework.monitor.Graph;
|
import com.impetus.ankush2.constant.*; import com.impetus.ankush2.framework.monitor.*;
|
[
"com.impetus.ankush2"
] |
com.impetus.ankush2;
| 1,111,756
|
public String getCountryName(String ip) throws IOException {
Country c = Countries.getCountry((int)ipToCountryCode(ip));
return (c != null ? c.name : null);
}
|
String function(String ip) throws IOException { Country c = Countries.getCountry((int)ipToCountryCode(ip)); return (c != null ? c.name : null); }
|
/** Get the name of the country for a given IP address.
* @param ip The IPV4 address as a string.
* @return The country name, or "--"
* @throws IOException if something goes wrong reading the database.
*/
|
Get the name of the country for a given IP address
|
getCountryName
|
{
"repo_name": "IanDarwin/jeoip",
"path": "src/main/java/jeoip/JeoIP.java",
"license": "bsd-2-clause",
"size": 7633
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 611,646
|
@Test
public void testBogusExp1() {
jee.setExpression("mzzzz.get(\"key\").equals(null)");
jee.setName("bogus");
jee.start();
assertFalse(jee.isStarted());
}
|
void function() { jee.setExpression(STRkey\STR); jee.setName("bogus"); jee.start(); assertFalse(jee.isStarted()); }
|
/**
* check that evaluator with bogus exp does not start
*
* @throws Exception
*/
|
check that evaluator with bogus exp does not start
|
testBogusExp1
|
{
"repo_name": "cscfa/bartleby",
"path": "library/logBack/logback-1.1.3/logback-classic/src/test/java/ch/qos/logback/classic/boolex/JaninoEventEvaluatorTest.java",
"license": "mit",
"size": 7709
}
|
[
"org.junit.Assert"
] |
import org.junit.Assert;
|
import org.junit.*;
|
[
"org.junit"
] |
org.junit;
| 2,745,604
|
@Transactional
public void unscheduleAllAlerts(Enrollment enrollment) {
LOGGER.info("Un-scheduling all jobs for enrollment {}", enrollment.getId());
schedulerService.safeUnscheduleAllJobs(String.format("%s-%s", EventSubjects.MILESTONE_ALERT, enrollment.getId()));
LOGGER.info("Un-scheduled all jobs for enrollment {}", enrollment.getId());
}
|
void function(Enrollment enrollment) { LOGGER.info(STR, enrollment.getId()); schedulerService.safeUnscheduleAllJobs(String.format("%s-%s", EventSubjects.MILESTONE_ALERT, enrollment.getId())); LOGGER.info(STR, enrollment.getId()); }
|
/**
* Unschedules the alerts jobs from for the given enrollment.
*
* @param enrollment the enrollment for which alerts jobs will be unscheduled
*/
|
Unschedules the alerts jobs from for the given enrollment
|
unscheduleAllAlerts
|
{
"repo_name": "wstrzelczyk/modules",
"path": "schedule-tracking/src/main/java/org/motechproject/scheduletracking/service/impl/EnrollmentAlertService.java",
"license": "bsd-3-clause",
"size": 9450
}
|
[
"org.motechproject.scheduletracking.domain.Enrollment",
"org.motechproject.scheduletracking.events.constants.EventSubjects"
] |
import org.motechproject.scheduletracking.domain.Enrollment; import org.motechproject.scheduletracking.events.constants.EventSubjects;
|
import org.motechproject.scheduletracking.domain.*; import org.motechproject.scheduletracking.events.constants.*;
|
[
"org.motechproject.scheduletracking"
] |
org.motechproject.scheduletracking;
| 299,140
|
public void send() throws Email451Exception, EmailException {
modifyRecipients();
try {
connection.sendMessage(msg, msg.getAllRecipients());
} catch (SMTPSendFailedException ex) {
if (ex.getReturnCode() == 451) {
throw new Email451Exception(String.format("Send Failure 451 - %s", ex.getMessage()));
} else {
throw new EmailException(String.format("Send Failure - failed command is %s; rc=%d3.0", ex.getCommand(), ex.getReturnCode()));
}
} catch (SMTPAddressFailedException ex) {
throw new EmailException(String.format("Sender Address Failure - failed command is %s; rc=%d3.0", ex.getCommand(), ex.getReturnCode()));
} catch (SMTPSenderFailedException ex) {
throw new EmailException(String.format("Recepient Address Failure - failed command is %s; rc=%d3.0", ex.getCommand(), ex.getReturnCode()));
} catch (MessagingException ex) {
throw new EmailException(String.format("Mail failure when sending message - %s", ex.getMessage()));
}
}
|
void function() throws Email451Exception, EmailException { modifyRecipients(); try { connection.sendMessage(msg, msg.getAllRecipients()); } catch (SMTPSendFailedException ex) { if (ex.getReturnCode() == 451) { throw new Email451Exception(String.format(STR, ex.getMessage())); } else { throw new EmailException(String.format(STR, ex.getCommand(), ex.getReturnCode())); } } catch (SMTPAddressFailedException ex) { throw new EmailException(String.format(STR, ex.getCommand(), ex.getReturnCode())); } catch (SMTPSenderFailedException ex) { throw new EmailException(String.format(STR, ex.getCommand(), ex.getReturnCode())); } catch (MessagingException ex) { throw new EmailException(String.format(STR, ex.getMessage())); } }
|
/**
* Send the message.
*
* @throws Email451Exception if 451 problem
* @throws EmailException if problems
*/
|
Send the message
|
send
|
{
"repo_name": "Richard-Linsdale/nbpcglibrary",
"path": "email/src/main/java/uk/theretiredprogrammer/nbpcglibrary/email/HtmlMessage.java",
"license": "apache-2.0",
"size": 15293
}
|
[
"com.sun.mail.smtp.SMTPAddressFailedException",
"com.sun.mail.smtp.SMTPSendFailedException",
"com.sun.mail.smtp.SMTPSenderFailedException",
"javax.mail.MessagingException"
] |
import com.sun.mail.smtp.SMTPAddressFailedException; import com.sun.mail.smtp.SMTPSendFailedException; import com.sun.mail.smtp.SMTPSenderFailedException; import javax.mail.MessagingException;
|
import com.sun.mail.smtp.*; import javax.mail.*;
|
[
"com.sun.mail",
"javax.mail"
] |
com.sun.mail; javax.mail;
| 1,844,590
|
//////////////////////////////////////////////////////////////////////////////
// get() methods for client use.
//////////////////////////////////////////////////////////////////////////////
Result getClosestRowBefore(final byte [] row)
throws IOException{
return getClosestRowBefore(row, HConstants.CATALOG_FAMILY);
}
|
Result getClosestRowBefore(final byte [] row) throws IOException{ return getClosestRowBefore(row, HConstants.CATALOG_FAMILY); }
|
/**
* Return all the data for the row that matches <i>row</i> exactly,
* or the one that immediately preceeds it, at or immediately before
* <i>ts</i>.
*
* @param row row key
* @return map of values
* @throws IOException
*/
|
Return all the data for the row that matches row exactly, or the one that immediately preceeds it, at or immediately before ts
|
getClosestRowBefore
|
{
"repo_name": "francisliu/hbase_namespace",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java",
"license": "apache-2.0",
"size": 208409
}
|
[
"java.io.IOException",
"org.apache.hadoop.hbase.HConstants",
"org.apache.hadoop.hbase.client.Result"
] |
import java.io.IOException; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.client.Result;
|
import java.io.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*;
|
[
"java.io",
"org.apache.hadoop"
] |
java.io; org.apache.hadoop;
| 320,113
|
public WorkflowConfig addWorkflowConfig(WorkflowConfig WorkflowConfig)
throws Exception;
|
WorkflowConfig function(WorkflowConfig WorkflowConfig) throws Exception;
|
/**
* Add project workflow config.
*
* @param WorkflowConfig the project workflow config
* @return the project workflow config
* @throws Exception the exception
*/
|
Add project workflow config
|
addWorkflowConfig
|
{
"repo_name": "WestCoastInformatics/UMLS-Terminology-Server",
"path": "services/src/main/java/com/wci/umls/server/services/WorkflowService.java",
"license": "apache-2.0",
"size": 13441
}
|
[
"com.wci.umls.server.model.workflow.WorkflowConfig"
] |
import com.wci.umls.server.model.workflow.WorkflowConfig;
|
import com.wci.umls.server.model.workflow.*;
|
[
"com.wci.umls"
] |
com.wci.umls;
| 442,071
|
public List<Flow> getAllFlows() {
Flow flow = new Flow();
flow.setServiceTicket(this.serviceTicket);
return new FlowListing(this.postJson(flow, WS.Path.Flow.Version1.getAllFlows())).getListing();
}
|
List<Flow> function() { Flow flow = new Flow(); flow.setServiceTicket(this.serviceTicket); return new FlowListing(this.postJson(flow, WS.Path.Flow.Version1.getAllFlows())).getListing(); }
|
/**
* Retrieves all the flows.
*
* @return The Flow listing.
* @see FlowListing
*/
|
Retrieves all the flows
|
getAllFlows
|
{
"repo_name": "Koekiebox-PTY-LTD/Fluid",
"path": "fluid-ws-java-client/src/main/java/com/fluidbpm/ws/client/v1/flow/FlowClient.java",
"license": "gpl-3.0",
"size": 4914
}
|
[
"com.fluidbpm.program.api.vo.flow.Flow",
"com.fluidbpm.program.api.vo.flow.FlowListing",
"java.util.List"
] |
import com.fluidbpm.program.api.vo.flow.Flow; import com.fluidbpm.program.api.vo.flow.FlowListing; import java.util.List;
|
import com.fluidbpm.program.api.vo.flow.*; import java.util.*;
|
[
"com.fluidbpm.program",
"java.util"
] |
com.fluidbpm.program; java.util;
| 535,028
|
public synchronized boolean stopRandomDataNode() throws IOException {
ensureOpen();
NodeAndClient nodeAndClient = getRandomNodeAndClient(new DataNodePredicate());
if (nodeAndClient != null) {
logger.info("Closing random node [{}] ", nodeAndClient.name);
removeDisruptionSchemeFromNode(nodeAndClient);
nodes.remove(nodeAndClient.name);
nodeAndClient.close();
return true;
}
return false;
}
|
synchronized boolean function() throws IOException { ensureOpen(); NodeAndClient nodeAndClient = getRandomNodeAndClient(new DataNodePredicate()); if (nodeAndClient != null) { logger.info(STR, nodeAndClient.name); removeDisruptionSchemeFromNode(nodeAndClient); nodes.remove(nodeAndClient.name); nodeAndClient.close(); return true; } return false; }
|
/**
* Stops a random data node in the cluster. Returns true if a node was found to stop, false otherwise.
*/
|
Stops a random data node in the cluster. Returns true if a node was found to stop, false otherwise
|
stopRandomDataNode
|
{
"repo_name": "mapr/elasticsearch",
"path": "test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java",
"license": "apache-2.0",
"size": 81328
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 673,854
|
private void restartMessageHandlerThreadPool() {
ExecutorService prevExecutor = messageHandlingExecutor;
messageHandlingExecutor = newFixedThreadPool(getMessageHandlerThreadPoolSize(),
groupedThreads("DistFlowStats", "messageHandling-%d", log));
prevExecutor.shutdown();
}
|
void function() { ExecutorService prevExecutor = messageHandlingExecutor; messageHandlingExecutor = newFixedThreadPool(getMessageHandlerThreadPoolSize(), groupedThreads(STR, STR, log)); prevExecutor.shutdown(); }
|
/**
* Restarts thread pool of message handler.
*/
|
Restarts thread pool of message handler
|
restartMessageHandlerThreadPool
|
{
"repo_name": "Shashikanth-Huawei/bmp",
"path": "core/store/dist/src/main/java/org/onosproject/store/statistic/impl/DistributedFlowStatisticStore.java",
"license": "apache-2.0",
"size": 13632
}
|
[
"java.util.concurrent.ExecutorService",
"java.util.concurrent.Executors",
"org.onlab.util.Tools"
] |
import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import org.onlab.util.Tools;
|
import java.util.concurrent.*; import org.onlab.util.*;
|
[
"java.util",
"org.onlab.util"
] |
java.util; org.onlab.util;
| 1,354,846
|
@Deprecated
public void onKeyDown(Widget sender, char keyCode, int modifiers) {
}
|
void function(Widget sender, char keyCode, int modifiers) { }
|
/**
* On key down.
*
* @param sender
* the sender
* @param keyCode
* the key code
* @param modifiers
* the modifiers
* @deprecated add a key down handler to the individual {@link Tab} objects
* instead.
*/
|
On key down
|
onKeyDown
|
{
"repo_name": "JaLandry/MeasureAuthoringTool_LatestSprint",
"path": "mat/src/mat/client/shared/ui/MATTabBar.java",
"license": "apache-2.0",
"size": 24416
}
|
[
"com.google.gwt.user.client.ui.Widget"
] |
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.*;
|
[
"com.google.gwt"
] |
com.google.gwt;
| 822,217
|
public final Transform getTransform() {
return m_xf;
}
|
final Transform function() { return m_xf; }
|
/**
* Get the body transform for the body's origin.
*
* @return the world transform of the body's origin.
*/
|
Get the body transform for the body's origin
|
getTransform
|
{
"repo_name": "dragome/dragome-examples",
"path": "dragome-jbox2d-examples/src/main/java/org/jbox2d/dynamics/Body.java",
"license": "gpl-3.0",
"size": 30517
}
|
[
"org.jbox2d.common.Transform"
] |
import org.jbox2d.common.Transform;
|
import org.jbox2d.common.*;
|
[
"org.jbox2d.common"
] |
org.jbox2d.common;
| 870,502
|
void setReferencedTableMap(JBitSet newRTM)
{
referencedTableMap = newRTM;
}
|
void setReferencedTableMap(JBitSet newRTM) { referencedTableMap = newRTM; }
|
/**
* Set the referencedTableMap in this ResultSetNode
*
* @param newRTM The new referencedTableMap for this ResultSetNode
*/
|
Set the referencedTableMap in this ResultSetNode
|
setReferencedTableMap
|
{
"repo_name": "trejkaz/derby",
"path": "java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java",
"license": "apache-2.0",
"size": 65254
}
|
[
"org.apache.derby.iapi.util.JBitSet"
] |
import org.apache.derby.iapi.util.JBitSet;
|
import org.apache.derby.iapi.util.*;
|
[
"org.apache.derby"
] |
org.apache.derby;
| 1,267,820
|
public Settings settings() {
return this.settings;
}
|
Settings function() { return this.settings; }
|
/**
* Returns repository-specific snapshot settings
*
* @return repository-specific snapshot settings
*/
|
Returns repository-specific snapshot settings
|
settings
|
{
"repo_name": "gfyoung/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotRequest.java",
"license": "apache-2.0",
"size": 16950
}
|
[
"org.elasticsearch.common.settings.Settings"
] |
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.*;
|
[
"org.elasticsearch.common"
] |
org.elasticsearch.common;
| 1,556,146
|
try {
deleteFileWithRetry0(path);
} catch (InterruptedException x) {
throw new IOException("Interrupted while deleting.", x);
}
}
|
try { deleteFileWithRetry0(path); } catch (InterruptedException x) { throw new IOException(STR, x); } }
|
/**
* Deletes a file, retrying if necessary.
*
* @param path the file to delete
*
* @throws NoSuchFileException
* if the file does not exist (optional specific exception)
* @throws DirectoryNotEmptyException
* if the file is a directory and could not otherwise be deleted
* because the directory is not empty (optional specific exception)
* @throws IOException
* if an I/O error occurs
*/
|
Deletes a file, retrying if necessary
|
deleteFileWithRetry
|
{
"repo_name": "md-5/jdk10",
"path": "test/lib/jdk/test/lib/util/FileUtils.java",
"license": "gpl-2.0",
"size": 14836
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 159,540
|
@Override
public Adapter createLinkAdapter() {
if (linkItemProvider == null) {
linkItemProvider = new LinkItemProvider(this);
}
return linkItemProvider;
}
|
Adapter function() { if (linkItemProvider == null) { linkItemProvider = new LinkItemProvider(this); } return linkItemProvider; }
|
/**
* This creates an adapter for a {@link eu.cloudscaleproject.env.method.common.method.Link}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
|
This creates an adapter for a <code>eu.cloudscaleproject.env.method.common.method.Link</code>.
|
createLinkAdapter
|
{
"repo_name": "CloudScale-Project/Environment",
"path": "plugins/eu.cloudscaleproject.env.method.editor/src/eu/cloudscaleproject/env/method/common/method/provider/MethodItemProviderAdapterFactory.java",
"license": "epl-1.0",
"size": 12037
}
|
[
"org.eclipse.emf.common.notify.Adapter"
] |
import org.eclipse.emf.common.notify.Adapter;
|
import org.eclipse.emf.common.notify.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 2,258,875
|
@Test
public void testDiscardingCheckpointsAtShutDown() throws Exception {
final SharedStateRegistry sharedStateRegistry = new SharedStateRegistryImpl();
final Configuration configuration = new Configuration();
configuration.setString(
HighAvailabilityOptions.HA_ZOOKEEPER_QUORUM, zooKeeperResource.getConnectString());
final CuratorFrameworkWithUnhandledErrorListener curatorFrameworkWrapper =
ZooKeeperUtils.startCuratorFramework(configuration, NoOpFatalErrorHandler.INSTANCE);
final CompletedCheckpointStore checkpointStore =
createZooKeeperCheckpointStore(curatorFrameworkWrapper.asCuratorFramework());
try {
final CompletedCheckpointStoreTest.TestCompletedCheckpoint checkpoint1 =
CompletedCheckpointStoreTest.createCheckpoint(0, sharedStateRegistry);
checkpointStore.addCheckpointAndSubsumeOldestOne(
checkpoint1, new CheckpointsCleaner(), () -> {});
assertThat(checkpointStore.getAllCheckpoints(), Matchers.contains(checkpoint1));
checkpointStore.shutdown(JobStatus.FINISHED, new CheckpointsCleaner());
// verify that the checkpoint is discarded
CompletedCheckpointStoreTest.verifyCheckpointDiscarded(checkpoint1);
} finally {
curatorFrameworkWrapper.close();
}
}
|
void function() throws Exception { final SharedStateRegistry sharedStateRegistry = new SharedStateRegistryImpl(); final Configuration configuration = new Configuration(); configuration.setString( HighAvailabilityOptions.HA_ZOOKEEPER_QUORUM, zooKeeperResource.getConnectString()); final CuratorFrameworkWithUnhandledErrorListener curatorFrameworkWrapper = ZooKeeperUtils.startCuratorFramework(configuration, NoOpFatalErrorHandler.INSTANCE); final CompletedCheckpointStore checkpointStore = createZooKeeperCheckpointStore(curatorFrameworkWrapper.asCuratorFramework()); try { final CompletedCheckpointStoreTest.TestCompletedCheckpoint checkpoint1 = CompletedCheckpointStoreTest.createCheckpoint(0, sharedStateRegistry); checkpointStore.addCheckpointAndSubsumeOldestOne( checkpoint1, new CheckpointsCleaner(), () -> {}); assertThat(checkpointStore.getAllCheckpoints(), Matchers.contains(checkpoint1)); checkpointStore.shutdown(JobStatus.FINISHED, new CheckpointsCleaner()); CompletedCheckpointStoreTest.verifyCheckpointDiscarded(checkpoint1); } finally { curatorFrameworkWrapper.close(); } }
|
/**
* Tests that checkpoints are discarded when the completed checkpoint store is shut down with a
* globally terminal state.
*/
|
Tests that checkpoints are discarded when the completed checkpoint store is shut down with a globally terminal state
|
testDiscardingCheckpointsAtShutDown
|
{
"repo_name": "lincoln-lil/flink",
"path": "flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/ZooKeeperCompletedCheckpointStoreTest.java",
"license": "apache-2.0",
"size": 12248
}
|
[
"org.apache.flink.api.common.JobStatus",
"org.apache.flink.configuration.Configuration",
"org.apache.flink.configuration.HighAvailabilityOptions",
"org.apache.flink.runtime.highavailability.zookeeper.CuratorFrameworkWithUnhandledErrorListener",
"org.apache.flink.runtime.rest.util.NoOpFatalErrorHandler",
"org.apache.flink.runtime.state.SharedStateRegistry",
"org.apache.flink.runtime.state.SharedStateRegistryImpl",
"org.apache.flink.runtime.util.ZooKeeperUtils",
"org.hamcrest.MatcherAssert",
"org.hamcrest.Matchers"
] |
import org.apache.flink.api.common.JobStatus; import org.apache.flink.configuration.Configuration; import org.apache.flink.configuration.HighAvailabilityOptions; import org.apache.flink.runtime.highavailability.zookeeper.CuratorFrameworkWithUnhandledErrorListener; import org.apache.flink.runtime.rest.util.NoOpFatalErrorHandler; import org.apache.flink.runtime.state.SharedStateRegistry; import org.apache.flink.runtime.state.SharedStateRegistryImpl; import org.apache.flink.runtime.util.ZooKeeperUtils; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers;
|
import org.apache.flink.api.common.*; import org.apache.flink.configuration.*; import org.apache.flink.runtime.highavailability.zookeeper.*; import org.apache.flink.runtime.rest.util.*; import org.apache.flink.runtime.state.*; import org.apache.flink.runtime.util.*; import org.hamcrest.*;
|
[
"org.apache.flink",
"org.hamcrest"
] |
org.apache.flink; org.hamcrest;
| 1,894,978
|
private void ordinalRecognizer(List<CoreLabel> tokenSequence) {
for (CoreLabel crt : tokenSequence) {
if ((crt.get(CoreAnnotations.AnswerAnnotation.class).equals(flags.backgroundSymbol) ||
crt.get(CoreAnnotations.AnswerAnnotation.class).equals("NUMBER")) &&
ORDINAL_PATTERN.matcher(crt.word()).matches()) {
crt.set(CoreAnnotations.AnswerAnnotation.class, "ORDINAL");
}
}
}
|
void function(List<CoreLabel> tokenSequence) { for (CoreLabel crt : tokenSequence) { if ((crt.get(CoreAnnotations.AnswerAnnotation.class).equals(flags.backgroundSymbol) crt.get(CoreAnnotations.AnswerAnnotation.class).equals(STR)) && ORDINAL_PATTERN.matcher(crt.word()).matches()) { crt.set(CoreAnnotations.AnswerAnnotation.class, STR); } } }
|
/**
* Recognizes ordinal numbers
* @param tokenSequence
*/
|
Recognizes ordinal numbers
|
ordinalRecognizer
|
{
"repo_name": "sanjithuom/Stanford-corenlp",
"path": "src/edu/stanford/nlp/ie/regexp/NumberSequenceClassifier.java",
"license": "gpl-2.0",
"size": 37803
}
|
[
"edu.stanford.nlp.ling.CoreAnnotations",
"edu.stanford.nlp.ling.CoreLabel",
"java.util.List"
] |
import edu.stanford.nlp.ling.CoreAnnotations; import edu.stanford.nlp.ling.CoreLabel; import java.util.List;
|
import edu.stanford.nlp.ling.*; import java.util.*;
|
[
"edu.stanford.nlp",
"java.util"
] |
edu.stanford.nlp; java.util;
| 2,437,697
|
public boolean unflagComment(int commentID)
{
try
{
conn=ConnectionBroker.getConnection();
cs = conn.prepareCall("call unflagComment(?)");
cs.setInt(1,commentID);
cs.execute();
cs.close();
conn.close();
return true;
}
catch (Exception ex)
{
Logger.getLogger(UserBroker.class.getName()).log(Level.SEVERE, null, ex);
return false;
}
}
|
boolean function(int commentID) { try { conn=ConnectionBroker.getConnection(); cs = conn.prepareCall(STR); cs.setInt(1,commentID); cs.execute(); cs.close(); conn.close(); return true; } catch (Exception ex) { Logger.getLogger(UserBroker.class.getName()).log(Level.SEVERE, null, ex); return false; } }
|
/**
* Unflag a specific Comment based on CommentID.
* @param commentID CommentID of Comment to find
* @return true if Comment was successfully flagged, false otherwise
*/
|
Unflag a specific Comment based on CommentID
|
unflagComment
|
{
"repo_name": "MadisonGelowitz/Accessibility",
"path": "AccessibilityWebsite2/AccessibilityWebsite2-ejb/src/java/brokers/CommentBroker.java",
"license": "mit",
"size": 11153
}
|
[
"java.util.logging.Level",
"java.util.logging.Logger"
] |
import java.util.logging.Level; import java.util.logging.Logger;
|
import java.util.logging.*;
|
[
"java.util"
] |
java.util;
| 2,059,011
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.