method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public static MetadataField[] findAllInSchema(Context context, int schemaID)
throws SQLException
{
List<MetadataField> fields = new ArrayList<MetadataField>();
// Get all the metadatafieldregistry rows
TableRowIterator tri = DatabaseManager.queryTable(context,"MetadataFieldRegistry",
"SELECT * FROM MetadataFieldRegistry WHERE metadata_schema_id= ? " +
" ORDER BY element, qualifier", schemaID);
try
{
// Make into DC Type objects
while (tri.hasNext())
{
fields.add(new MetadataField(tri.next()));
}
}
finally
{
// close the TableRowIterator to free up resources
if (tri != null)
{
tri.close();
}
}
// Convert list into an array
MetadataField[] typeArray = new MetadataField[fields.size()];
return (MetadataField[]) fields.toArray(typeArray);
} | static MetadataField[] function(Context context, int schemaID) throws SQLException { List<MetadataField> fields = new ArrayList<MetadataField>(); TableRowIterator tri = DatabaseManager.queryTable(context,STR, STR + STR, schemaID); try { while (tri.hasNext()) { fields.add(new MetadataField(tri.next())); } } finally { if (tri != null) { tri.close(); } } MetadataField[] typeArray = new MetadataField[fields.size()]; return (MetadataField[]) fields.toArray(typeArray); } | /**
* Return all metadata fields that are found in a given schema.
*
* @param context dspace context
* @param schemaID schema by db ID
* @return array of metadata fields
* @throws SQLException
*/ | Return all metadata fields that are found in a given schema | findAllInSchema | {
"repo_name": "mdiggory/dryad-repo",
"path": "dspace-api/src/main/java/org/dspace/content/MetadataField.java",
"license": "bsd-3-clause",
"size": 19946
} | [
"java.sql.SQLException",
"java.util.ArrayList",
"java.util.List",
"org.dspace.core.Context",
"org.dspace.storage.rdbms.DatabaseManager",
"org.dspace.storage.rdbms.TableRowIterator"
] | import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import org.dspace.core.Context; import org.dspace.storage.rdbms.DatabaseManager; import org.dspace.storage.rdbms.TableRowIterator; | import java.sql.*; import java.util.*; import org.dspace.core.*; import org.dspace.storage.rdbms.*; | [
"java.sql",
"java.util",
"org.dspace.core",
"org.dspace.storage"
] | java.sql; java.util; org.dspace.core; org.dspace.storage; | 834,972 |
@Test(expected = InterruptedException.class)
public void whenClientTimeoutDetectedThenMainThreadIsInterrupted()
throws InterruptedException, IOException {
final long timeoutMillis = 100;
final long intervalMillis = timeoutMillis * 2; // Interval > timeout to trigger disconnection.
final ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(
this, "exclusive_execution", tmp);
workspace.setUp();
// Build an NGContext connected to an NGInputStream reading from a stream that will timeout.
Thread.currentThread().setName("Test");
try (TestContext context = new TestContext(
ImmutableMap.copyOf(System.getenv()),
TestContext.createHeartBeatStream(intervalMillis),
timeoutMillis)) {
context.addClientListener(Thread.currentThread()::interrupt);
Thread.sleep(1000);
fail("Should have been interrupted.");
}
} | @Test(expected = InterruptedException.class) void function() throws InterruptedException, IOException { final long timeoutMillis = 100; final long intervalMillis = timeoutMillis * 2; final ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario( this, STR, tmp); workspace.setUp(); Thread.currentThread().setName("Test"); try (TestContext context = new TestContext( ImmutableMap.copyOf(System.getenv()), TestContext.createHeartBeatStream(intervalMillis), timeoutMillis)) { context.addClientListener(Thread.currentThread()::interrupt); Thread.sleep(1000); fail(STR); } } | /**
* Verifies that a client timeout will be detected by a Nailgun
* NGInputStream reading from a blocking heartbeat stream.
*/ | Verifies that a client timeout will be detected by a Nailgun NGInputStream reading from a blocking heartbeat stream | whenClientTimeoutDetectedThenMainThreadIsInterrupted | {
"repo_name": "daedric/buck",
"path": "test/com/facebook/buck/cli/DaemonIntegrationTest.java",
"license": "apache-2.0",
"size": 34281
} | [
"com.facebook.buck.testutil.integration.ProjectWorkspace",
"com.facebook.buck.testutil.integration.TestContext",
"com.facebook.buck.testutil.integration.TestDataHelper",
"com.google.common.collect.ImmutableMap",
"java.io.IOException",
"org.junit.Assert",
"org.junit.Test"
] | import com.facebook.buck.testutil.integration.ProjectWorkspace; import com.facebook.buck.testutil.integration.TestContext; import com.facebook.buck.testutil.integration.TestDataHelper; import com.google.common.collect.ImmutableMap; import java.io.IOException; import org.junit.Assert; import org.junit.Test; | import com.facebook.buck.testutil.integration.*; import com.google.common.collect.*; import java.io.*; import org.junit.*; | [
"com.facebook.buck",
"com.google.common",
"java.io",
"org.junit"
] | com.facebook.buck; com.google.common; java.io; org.junit; | 2,190,416 |
protected void sequence_SPDiagram(EObject context, SPDiagram semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
| void function(EObject context, SPDiagram semanticObject) { genericSequencer.createSequence(context, semanticObject); } | /**
* Constraint:
* (
* name=ID
* label=STRING?
* title=STRING?
* metamodels+=MetamodelUsage+
* root=STRING
* elements+=DiagramElement+
* )
*/ | Constraint: ( name=ID label=STRING? title=STRING? metamodels+=MetamodelUsage+ root=STRING elements+=DiagramElement+ ) | sequence_SPDiagram | {
"repo_name": "glefur/s-prototyper",
"path": "plugins/fr.obeo.dsl.sprototyper/src-gen/fr/obeo/dsl/serializer/SPrototyperSemanticSequencer.java",
"license": "apache-2.0",
"size": 113304
} | [
"fr.obeo.dsl.sPrototyper.SPDiagram",
"org.eclipse.emf.ecore.EObject"
] | import fr.obeo.dsl.sPrototyper.SPDiagram; import org.eclipse.emf.ecore.EObject; | import fr.obeo.dsl.*; import org.eclipse.emf.ecore.*; | [
"fr.obeo.dsl",
"org.eclipse.emf"
] | fr.obeo.dsl; org.eclipse.emf; | 241,739 |
JCExpression makeUnquotedIdent(String ident) {
return naming.makeUnquotedIdent(ident);
} | JCExpression makeUnquotedIdent(String ident) { return naming.makeUnquotedIdent(ident); } | /**
* Makes an <strong>unquoted</strong> simple identifier
* @param ident The identifier
* @return The ident
*/ | Makes an unquoted simple identifier | makeUnquotedIdent | {
"repo_name": "ceylon/ceylon",
"path": "compiler-java/src/org/eclipse/ceylon/compiler/java/codegen/AbstractTransformer.java",
"license": "apache-2.0",
"size": 290110
} | [
"org.eclipse.ceylon.langtools.tools.javac.tree.JCTree"
] | import org.eclipse.ceylon.langtools.tools.javac.tree.JCTree; | import org.eclipse.ceylon.langtools.tools.javac.tree.*; | [
"org.eclipse.ceylon"
] | org.eclipse.ceylon; | 1,372,736 |
public int getUniqueNameIndex(String prefix, Class cls, int startingIndex) {
int len = prefix.length();
int uniqueIndex = startingIndex;
if (cls == PortProto.class) {
for (Iterator<PortProto> it = getPorts(); it.hasNext();) {
PortProto pp = it.next();
if (pp.getName().startsWith(prefix)) // if (TextUtils.startsWithIgnoreCase(pp.getName(), prefix))
{
String restOfName = pp.getName().substring(len);
if (TextUtils.isANumber(restOfName)) {
int indexVal = TextUtils.atoi(restOfName);
if (indexVal >= uniqueIndex) {
uniqueIndex = indexVal + 1;
}
}
}
}
} else if (cls == NodeInst.class) {
for (Iterator<NodeInst> it = getNodes(); it.hasNext();) {
NodeInst ni = it.next();
if (ni.getName().startsWith(prefix)) // if (TextUtils.startsWithIgnoreCase(ni.getName(), prefix))
{
String restOfName = ni.getName().substring(len);
if (TextUtils.isANumber(restOfName)) {
int indexVal = TextUtils.atoi(restOfName);
if (indexVal >= uniqueIndex) {
uniqueIndex = indexVal + 1;
}
}
}
}
} else if (cls == ArcInst.class) {
for (Iterator<ArcInst> it = getArcs(); it.hasNext();) {
ArcInst ai = it.next();
if (ai.getName().startsWith(prefix)) // if (TextUtils.startsWithIgnoreCase(ai.getName(), prefix))
{
String restOfName = ai.getName().substring(len);
if (TextUtils.isANumber(restOfName)) {
int indexVal = TextUtils.atoi(restOfName);
if (indexVal >= uniqueIndex) {
uniqueIndex = indexVal + 1;
}
}
}
}
}
return uniqueIndex;
} | int function(String prefix, Class cls, int startingIndex) { int len = prefix.length(); int uniqueIndex = startingIndex; if (cls == PortProto.class) { for (Iterator<PortProto> it = getPorts(); it.hasNext();) { PortProto pp = it.next(); if (pp.getName().startsWith(prefix)) { String restOfName = pp.getName().substring(len); if (TextUtils.isANumber(restOfName)) { int indexVal = TextUtils.atoi(restOfName); if (indexVal >= uniqueIndex) { uniqueIndex = indexVal + 1; } } } } } else if (cls == NodeInst.class) { for (Iterator<NodeInst> it = getNodes(); it.hasNext();) { NodeInst ni = it.next(); if (ni.getName().startsWith(prefix)) { String restOfName = ni.getName().substring(len); if (TextUtils.isANumber(restOfName)) { int indexVal = TextUtils.atoi(restOfName); if (indexVal >= uniqueIndex) { uniqueIndex = indexVal + 1; } } } } } else if (cls == ArcInst.class) { for (Iterator<ArcInst> it = getArcs(); it.hasNext();) { ArcInst ai = it.next(); if (ai.getName().startsWith(prefix)) { String restOfName = ai.getName().substring(len); if (TextUtils.isANumber(restOfName)) { int indexVal = TextUtils.atoi(restOfName); if (indexVal >= uniqueIndex) { uniqueIndex = indexVal + 1; } } } } } return uniqueIndex; } | /**
* Method to determine the index value which, when appended to a given string,
* will generate a unique name in this Cell.
* @param prefix the start of the string.
* @param cls the type of object being examined.
* @param startingIndex the starting value to append to the string.
* @return a value that, when appended to the prefix, forms a unique name in the cell.
*/ | Method to determine the index value which, when appended to a given string, will generate a unique name in this Cell | getUniqueNameIndex | {
"repo_name": "imr/Electric8",
"path": "com/sun/electric/database/hierarchy/Cell.java",
"license": "gpl-3.0",
"size": 185659
} | [
"com.sun.electric.database.prototype.PortProto",
"com.sun.electric.database.text.TextUtils",
"com.sun.electric.database.topology.ArcInst",
"com.sun.electric.database.topology.NodeInst",
"java.util.Iterator"
] | import com.sun.electric.database.prototype.PortProto; import com.sun.electric.database.text.TextUtils; import com.sun.electric.database.topology.ArcInst; import com.sun.electric.database.topology.NodeInst; import java.util.Iterator; | import com.sun.electric.database.prototype.*; import com.sun.electric.database.text.*; import com.sun.electric.database.topology.*; import java.util.*; | [
"com.sun.electric",
"java.util"
] | com.sun.electric; java.util; | 476,038 |
public ResponseDescriptorBuilder withStatus(int i) {
if (i < STATUS_CODE_MIN || i > STATUS_CODE_MAX) {
throw new StubConfigurationException("Given Response StatusCode (" + i + ") is invalid.");
}
code = String.valueOf(i);
return this;
}
| ResponseDescriptorBuilder function(int i) { if (i < STATUS_CODE_MIN i > STATUS_CODE_MAX) { throw new StubConfigurationException(STR + i + STR); } code = String.valueOf(i); return this; } | /**
* Sets the response status code. Must be between 100 and 600, otherwise, will throw exception.
* By default the response status code is 200.
*
* @param i is the expected status code
* @return with itself
* @throws StubConfigurationException if the given status code is not acceptable
*/ | Sets the response status code. Must be between 100 and 600, otherwise, will throw exception. By default the response status code is 200 | withStatus | {
"repo_name": "epam/Wilma",
"path": "wilma-service-api/src/main/java/com/epam/wilma/service/configuration/stub/ResponseDescriptorBuilder.java",
"license": "gpl-3.0",
"size": 11036
} | [
"com.epam.wilma.service.configuration.stub.helper.common.StubConfigurationException"
] | import com.epam.wilma.service.configuration.stub.helper.common.StubConfigurationException; | import com.epam.wilma.service.configuration.stub.helper.common.*; | [
"com.epam.wilma"
] | com.epam.wilma; | 2,323,219 |
@Override
protected T doSwitch(int classifierID, EObject theEObject)
{
switch (classifierID)
{
case LSGLPackage.MODEL:
{
Model model = (Model)theEObject;
T result = caseModel(model);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LSGLPackage.GENERATOR:
{
Generator generator = (Generator)theEObject;
T result = caseGenerator(generator);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LSGLPackage.CONFIG:
{
Config config = (Config)theEObject;
T result = caseConfig(config);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LSGLPackage.CONFIG_PROPERTY:
{
ConfigProperty configProperty = (ConfigProperty)theEObject;
T result = caseConfigProperty(configProperty);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LSGLPackage.TYPE:
{
Type type = (Type)theEObject;
T result = caseType(type);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LSGLPackage.ENUM:
{
schlingel.bplaced.net.lSGL.Enum enum_ = (schlingel.bplaced.net.lSGL.Enum)theEObject;
T result = caseEnum(enum_);
if (result == null) result = caseType(enum_);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LSGLPackage.ENUM_ITEM:
{
EnumItem enumItem = (EnumItem)theEObject;
T result = caseEnumItem(enumItem);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LSGLPackage.ENTITY:
{
Entity entity = (Entity)theEObject;
T result = caseEntity(entity);
if (result == null) result = caseType(entity);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LSGLPackage.ATTRIBUTE:
{
Attribute attribute = (Attribute)theEObject;
T result = caseAttribute(attribute);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LSGLPackage.ANNOTATION:
{
Annotation annotation = (Annotation)theEObject;
T result = caseAnnotation(annotation);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LSGLPackage.PROJECTION:
{
Projection projection = (Projection)theEObject;
T result = caseProjection(projection);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LSGLPackage.STRING:
{
STRING string = (STRING)theEObject;
T result = caseSTRING(string);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LSGLPackage.ID:
{
ID id = (ID)theEObject;
T result = caseID(id);
if (result == null) result = caseSTRING(id);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
} | T function(int classifierID, EObject theEObject) { switch (classifierID) { case LSGLPackage.MODEL: { Model model = (Model)theEObject; T result = caseModel(model); if (result == null) result = defaultCase(theEObject); return result; } case LSGLPackage.GENERATOR: { Generator generator = (Generator)theEObject; T result = caseGenerator(generator); if (result == null) result = defaultCase(theEObject); return result; } case LSGLPackage.CONFIG: { Config config = (Config)theEObject; T result = caseConfig(config); if (result == null) result = defaultCase(theEObject); return result; } case LSGLPackage.CONFIG_PROPERTY: { ConfigProperty configProperty = (ConfigProperty)theEObject; T result = caseConfigProperty(configProperty); if (result == null) result = defaultCase(theEObject); return result; } case LSGLPackage.TYPE: { Type type = (Type)theEObject; T result = caseType(type); if (result == null) result = defaultCase(theEObject); return result; } case LSGLPackage.ENUM: { schlingel.bplaced.net.lSGL.Enum enum_ = (schlingel.bplaced.net.lSGL.Enum)theEObject; T result = caseEnum(enum_); if (result == null) result = caseType(enum_); if (result == null) result = defaultCase(theEObject); return result; } case LSGLPackage.ENUM_ITEM: { EnumItem enumItem = (EnumItem)theEObject; T result = caseEnumItem(enumItem); if (result == null) result = defaultCase(theEObject); return result; } case LSGLPackage.ENTITY: { Entity entity = (Entity)theEObject; T result = caseEntity(entity); if (result == null) result = caseType(entity); if (result == null) result = defaultCase(theEObject); return result; } case LSGLPackage.ATTRIBUTE: { Attribute attribute = (Attribute)theEObject; T result = caseAttribute(attribute); if (result == null) result = defaultCase(theEObject); return result; } case LSGLPackage.ANNOTATION: { Annotation annotation = (Annotation)theEObject; T result = caseAnnotation(annotation); if (result == null) result = defaultCase(theEObject); return result; } case LSGLPackage.PROJECTION: { Projection projection = (Projection)theEObject; T result = caseProjection(projection); if (result == null) result = defaultCase(theEObject); return result; } case LSGLPackage.STRING: { STRING string = (STRING)theEObject; T result = caseSTRING(string); if (result == null) result = defaultCase(theEObject); return result; } case LSGLPackage.ID: { ID id = (ID)theEObject; T result = caseID(id); if (result == null) result = caseSTRING(id); if (result == null) result = defaultCase(theEObject); return result; } default: return defaultCase(theEObject); } } | /**
* Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the first non-null result returned by a <code>caseXXX</code> call.
* @generated
*/ | Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. | doSwitch | {
"repo_name": "schlingel/LazyShortcutGenerationLanguage",
"path": "schlingel.bplaced.net.LazyShortcutGenerationLanguage/src-gen/schlingel/bplaced/net/lSGL/util/LSGLSwitch.java",
"license": "gpl-3.0",
"size": 13246
} | [
"org.eclipse.emf.ecore.EObject"
] | import org.eclipse.emf.ecore.EObject; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,783,052 |
public boolean isModeNormal() {
int mode = mAudioManager.getMode();
Log.d(TAG, "isInCall mode:" + mode);
return mode == AudioManager.MODE_NORMAL;
} | boolean function() { int mode = mAudioManager.getMode(); Log.d(TAG, STR + mode); return mode == AudioManager.MODE_NORMAL; } | /**
* Check current is in call/ringtone or not
* @return true if is not call mode. false mean is in call or ringtone
*/ | Check current is in call/ringtone or not | isModeNormal | {
"repo_name": "darklord4822/android_device_smart_sprint4g",
"path": "mtk/FmRadio/src/com/mediatek/fmradio/FmRadioService.java",
"license": "gpl-2.0",
"size": 105643
} | [
"android.media.AudioManager",
"android.util.Log"
] | import android.media.AudioManager; import android.util.Log; | import android.media.*; import android.util.*; | [
"android.media",
"android.util"
] | android.media; android.util; | 222,033 |
@Override public void visitTerminal(@NotNull TerminalNode node) { } | @Override public void visitTerminal(@NotNull TerminalNode node) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | exitEveryRule | {
"repo_name": "andra49/CSSGenerator",
"path": "CSSGenerator/src/CSSBaseListener.java",
"license": "mit",
"size": 4957
} | [
"org.antlr.v4.runtime.misc.NotNull",
"org.antlr.v4.runtime.tree.TerminalNode"
] | import org.antlr.v4.runtime.misc.NotNull; import org.antlr.v4.runtime.tree.TerminalNode; | import org.antlr.v4.runtime.misc.*; import org.antlr.v4.runtime.tree.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 385,999 |
@Command(shortDescription = "Reloads a ui screen")
public String reloadScreen(@CommandParam("ui") String ui) {
Set<ResourceUrn> urns = assetManager.resolve(ui, UIElement.class);
if (urns.size() == 1) {
ResourceUrn urn = urns.iterator().next();
boolean wasOpen = nuiManager.isOpen(urn);
if (wasOpen) {
nuiManager.closeScreen(urn);
}
if (wasOpen) {
nuiManager.pushScreen(urn);
}
return "Success";
} else {
return "No unique resource found";
}
} | @Command(shortDescription = STR) String function(@CommandParam("ui") String ui) { Set<ResourceUrn> urns = assetManager.resolve(ui, UIElement.class); if (urns.size() == 1) { ResourceUrn urn = urns.iterator().next(); boolean wasOpen = nuiManager.isOpen(urn); if (wasOpen) { nuiManager.closeScreen(urn); } if (wasOpen) { nuiManager.pushScreen(urn); } return STR; } else { return STR; } } | /**
* Reloads ui screen
* @param ui String containing ui screen name
* @return String containing Success if UI was reloaded or No unique resource found if more screens were found
*/ | Reloads ui screen | reloadScreen | {
"repo_name": "mertserezli/Terasology",
"path": "engine/src/main/java/org/terasology/logic/console/commands/CoreCommands.java",
"license": "apache-2.0",
"size": 28714
} | [
"java.util.Set",
"org.terasology.assets.ResourceUrn",
"org.terasology.logic.console.commandSystem.annotations.Command",
"org.terasology.logic.console.commandSystem.annotations.CommandParam",
"org.terasology.rendering.nui.asset.UIElement"
] | import java.util.Set; import org.terasology.assets.ResourceUrn; import org.terasology.logic.console.commandSystem.annotations.Command; import org.terasology.logic.console.commandSystem.annotations.CommandParam; import org.terasology.rendering.nui.asset.UIElement; | import java.util.*; import org.terasology.assets.*; import org.terasology.logic.console.*; import org.terasology.rendering.nui.asset.*; | [
"java.util",
"org.terasology.assets",
"org.terasology.logic",
"org.terasology.rendering"
] | java.util; org.terasology.assets; org.terasology.logic; org.terasology.rendering; | 1,309,531 |
public void setGpelProcess(GpelProcess gpelProcess) {
this.gpelProcess = gpelProcess;
} | void function(GpelProcess gpelProcess) { this.gpelProcess = gpelProcess; } | /**
* Sets gpelProcess.
*
* @param gpelProcess
* The gpelProcess to set.
*/ | Sets gpelProcess | setGpelProcess | {
"repo_name": "glahiru/airavata",
"path": "modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java",
"license": "apache-2.0",
"size": 30968
} | [
"org.gpel.model.GpelProcess"
] | import org.gpel.model.GpelProcess; | import org.gpel.model.*; | [
"org.gpel.model"
] | org.gpel.model; | 1,056,504 |
public void testAdd() {
TreeSet q = new TreeSet();
assertTrue(q.add(zero));
assertTrue(q.add(one));
} | void function() { TreeSet q = new TreeSet(); assertTrue(q.add(zero)); assertTrue(q.add(one)); } | /**
* Add of comparable element succeeds
*/ | Add of comparable element succeeds | testAdd | {
"repo_name": "AdmireTheDistance/android_libcore",
"path": "jsr166-tests/src/test/java/jsr166/TreeSetTest.java",
"license": "gpl-2.0",
"size": 29478
} | [
"java.util.TreeSet"
] | import java.util.TreeSet; | import java.util.*; | [
"java.util"
] | java.util; | 1,212,611 |
public static List<String> getCrlUrls(final CertificateToken certificateToken, boolean checkInTrustAnchors) {
final List<String> urls = new ArrayList<String>();
final byte[] crlDistributionPointsBytes = certificateToken.getCertificate().getExtensionValue(Extension.cRLDistributionPoints.getId());
if (crlDistributionPointsBytes != null) {
try {
final ASN1Sequence asn1Sequence = DSSASN1Utils.getAsn1SequenceFromDerOctetString(crlDistributionPointsBytes);
final CRLDistPoint distPoint = CRLDistPoint.getInstance(asn1Sequence);
final DistributionPoint[] distributionPoints = distPoint.getDistributionPoints();
for (final DistributionPoint distributionPoint : distributionPoints) {
final DistributionPointName distributionPointName = distributionPoint.getDistributionPoint();
if (DistributionPointName.FULL_NAME != distributionPointName.getType()) {
continue;
}
final GeneralNames generalNames = (GeneralNames) distributionPointName.getName();
final GeneralName[] names = generalNames.getNames();
for (final GeneralName name : names) {
String location = parseGn(name);
if (location != null) {
urls.add(location);
}
}
}
} catch (Exception e) {
LOG.error("Unable to parse cRLDistributionPoints", e);
}
}
if (Utils.isCollectionEmpty(urls) && checkInTrustAnchors) {
return getServiceSupplyPoints(certificateToken, "crl", "certificateRevocationList");
}
return urls;
} | static List<String> function(final CertificateToken certificateToken, boolean checkInTrustAnchors) { final List<String> urls = new ArrayList<String>(); final byte[] crlDistributionPointsBytes = certificateToken.getCertificate().getExtensionValue(Extension.cRLDistributionPoints.getId()); if (crlDistributionPointsBytes != null) { try { final ASN1Sequence asn1Sequence = DSSASN1Utils.getAsn1SequenceFromDerOctetString(crlDistributionPointsBytes); final CRLDistPoint distPoint = CRLDistPoint.getInstance(asn1Sequence); final DistributionPoint[] distributionPoints = distPoint.getDistributionPoints(); for (final DistributionPoint distributionPoint : distributionPoints) { final DistributionPointName distributionPointName = distributionPoint.getDistributionPoint(); if (DistributionPointName.FULL_NAME != distributionPointName.getType()) { continue; } final GeneralNames generalNames = (GeneralNames) distributionPointName.getName(); final GeneralName[] names = generalNames.getNames(); for (final GeneralName name : names) { String location = parseGn(name); if (location != null) { urls.add(location); } } } } catch (Exception e) { LOG.error(STR, e); } } if (Utils.isCollectionEmpty(urls) && checkInTrustAnchors) { return getServiceSupplyPoints(certificateToken, "crl", STR); } return urls; } | /**
* Gives back the {@code List} of CRL URI meta-data found within the given X509 certificate.
*
* @param certificateToken
* the cert token certificate
* @param checkInTrustAnchors
* if true, the method will search in the ServiceSupplyPoint urls
* @return the {@code List} of CRL URI, or empty list if the extension is not present
*/ | Gives back the List of CRL URI meta-data found within the given X509 certificate | getCrlUrls | {
"repo_name": "alisdev/dss",
"path": "dss-spi/src/main/java/eu/europa/esig/dss/DSSASN1Utils.java",
"license": "lgpl-2.1",
"size": 35801
} | [
"eu.europa.esig.dss.utils.Utils",
"eu.europa.esig.dss.x509.CertificateToken",
"java.util.ArrayList",
"java.util.List",
"org.bouncycastle.asn1.ASN1Sequence",
"org.bouncycastle.asn1.x509.CRLDistPoint",
"org.bouncycastle.asn1.x509.DistributionPoint",
"org.bouncycastle.asn1.x509.DistributionPointName",
... | import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.x509.CertificateToken; import java.util.ArrayList; import java.util.List; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.x509.CRLDistPoint; import org.bouncycastle.asn1.x509.DistributionPoint; import org.bouncycastle.asn1.x509.DistributionPointName; import org.bouncycastle.asn1.x509.Extension; import org.bouncycastle.asn1.x509.GeneralName; import org.bouncycastle.asn1.x509.GeneralNames; | import eu.europa.esig.dss.utils.*; import eu.europa.esig.dss.x509.*; import java.util.*; import org.bouncycastle.asn1.*; import org.bouncycastle.asn1.x509.*; | [
"eu.europa.esig",
"java.util",
"org.bouncycastle.asn1"
] | eu.europa.esig; java.util; org.bouncycastle.asn1; | 958,243 |
public DateTime getBeginDateTime();
| DateTime function(); | /**
* The beginDateTime associated with the TkCalendar
*
* <p>
* beginDateTime of a TkCalendar
* <p>
*
* @return beginDateTime for TkCalendar
*/ | The beginDateTime associated with the TkCalendar beginDateTime of a TkCalendar | getBeginDateTime | {
"repo_name": "kuali/kpme",
"path": "tk-lm/api/src/main/java/org/kuali/kpme/tklm/api/time/calendar/TkCalendarContract.java",
"license": "apache-2.0",
"size": 2940
} | [
"org.joda.time.DateTime"
] | import org.joda.time.DateTime; | import org.joda.time.*; | [
"org.joda.time"
] | org.joda.time; | 426,701 |
public void addCmsEventListener(I_CmsEventListener listener, int[] eventTypes) {
synchronized (m_eventListeners) {
if (eventTypes == null) {
// no event types given - register the listener for all event types
eventTypes = new int[] {I_CmsEventListener.LISTENERS_FOR_ALL_EVENTS.intValue()};
}
for (int i = 0; i < eventTypes.length; i++) {
// register the listener for all configured event types
Integer eventType = new Integer(eventTypes[i]);
List<I_CmsEventListener> listeners = m_eventListeners.get(eventType);
if (listeners == null) {
listeners = new ArrayList<I_CmsEventListener>();
m_eventListeners.put(eventType, listeners);
}
if (!listeners.contains(listener)) {
// add listerner only if it is not already registered
listeners.add(listener);
}
}
}
} | void function(I_CmsEventListener listener, int[] eventTypes) { synchronized (m_eventListeners) { if (eventTypes == null) { eventTypes = new int[] {I_CmsEventListener.LISTENERS_FOR_ALL_EVENTS.intValue()}; } for (int i = 0; i < eventTypes.length; i++) { Integer eventType = new Integer(eventTypes[i]); List<I_CmsEventListener> listeners = m_eventListeners.get(eventType); if (listeners == null) { listeners = new ArrayList<I_CmsEventListener>(); m_eventListeners.put(eventType, listeners); } if (!listeners.contains(listener)) { listeners.add(listener); } } } } | /**
* Add an OpenCms event listener.<p>
*
* @param listener the listener to add
* @param eventTypes the events to listen for
*/ | Add an OpenCms event listener | addCmsEventListener | {
"repo_name": "it-tavis/opencms-core",
"path": "src/org/opencms/main/CmsEventManager.java",
"license": "lgpl-2.1",
"size": 9395
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 244,646 |
public static <TSource> Long max(Enumerable<TSource> source,
NullableLongFunction1<TSource> selector) {
return aggregate(source.select(selector), null, Extensions.LONG_MAX);
} | static <TSource> Long function(Enumerable<TSource> source, NullableLongFunction1<TSource> selector) { return aggregate(source.select(selector), null, Extensions.LONG_MAX); } | /**
* Invokes a transform function on each element of a
* sequence and returns the maximum nullable long value. (Defined
* by Enumerable.)
*/ | Invokes a transform function on each element of a sequence and returns the maximum nullable long value. (Defined by Enumerable.) | max | {
"repo_name": "vlsi/calcite",
"path": "linq4j/src/main/java/org/apache/calcite/linq4j/EnumerableDefaults.java",
"license": "apache-2.0",
"size": 156877
} | [
"org.apache.calcite.linq4j.function.NullableLongFunction1"
] | import org.apache.calcite.linq4j.function.NullableLongFunction1; | import org.apache.calcite.linq4j.function.*; | [
"org.apache.calcite"
] | org.apache.calcite; | 2,853,259 |
private void filterForMine(List<Offer> offers, Player player) {
Iterator<Offer> it = offers.iterator();
while (it.hasNext()) {
if (!it.next().getOfferer().equals(player.getName())) {
it.remove();
}
}
}
| void function(List<Offer> offers, Player player) { Iterator<Offer> it = offers.iterator(); while (it.hasNext()) { if (!it.next().getOfferer().equals(player.getName())) { it.remove(); } } } | /**
* Filter out offers that do not belong to a given player.
*
* @param offers list of offers to be filtered
* @param player player whose offers should be retained on the list
*/ | Filter out offers that do not belong to a given player | filterForMine | {
"repo_name": "acsid/stendhal",
"path": "src/games/stendhal/server/maps/semos/tavern/market/ShowOffersChatAction.java",
"license": "gpl-2.0",
"size": 7280
} | [
"games.stendhal.server.entity.player.Player",
"games.stendhal.server.entity.trade.Offer",
"java.util.Iterator",
"java.util.List"
] | import games.stendhal.server.entity.player.Player; import games.stendhal.server.entity.trade.Offer; import java.util.Iterator; import java.util.List; | import games.stendhal.server.entity.player.*; import games.stendhal.server.entity.trade.*; import java.util.*; | [
"games.stendhal.server",
"java.util"
] | games.stendhal.server; java.util; | 444,735 |
private boolean saveAnswers(boolean evaluateConstraints) {
FormController formController = Collect.getInstance().getFormController();
int childCount = mQuestionHolder.getChildCount();
LinkedHashMap<FormIndex, IAnswerData> answers = getAnswers();
try {
FailedConstraint constraint = formController.saveAnswers(answers, evaluateConstraints);
if (constraint != null) {
createConstraintToast(constraint.index, constraint.status);
return false;
}
} catch (JavaRosaException e) {
Log.e(TAG, e.getMessage(), e);
createErrorDialog(e.getCause().getMessage(), DO_NOT_EXIT);
return false;
}
return true;
} | boolean function(boolean evaluateConstraints) { FormController formController = Collect.getInstance().getFormController(); int childCount = mQuestionHolder.getChildCount(); LinkedHashMap<FormIndex, IAnswerData> answers = getAnswers(); try { FailedConstraint constraint = formController.saveAnswers(answers, evaluateConstraints); if (constraint != null) { createConstraintToast(constraint.index, constraint.status); return false; } } catch (JavaRosaException e) { Log.e(TAG, e.getMessage(), e); createErrorDialog(e.getCause().getMessage(), DO_NOT_EXIT); return false; } return true; } | /**
* Saves all answers in the form.
*
* @return false if any error occurs while saving (constraint violated,
* etc...), true otherwise
*/ | Saves all answers in the form | saveAnswers | {
"repo_name": "projectbuendia/client",
"path": "third_party/odkcollect/src/main/java/org/odk/collect/android/activities/FormEntryActivity.java",
"license": "apache-2.0",
"size": 111672
} | [
"android.util.Log",
"java.util.LinkedHashMap",
"org.javarosa.core.model.FormIndex",
"org.javarosa.core.model.data.IAnswerData",
"org.odk.collect.android.application.Collect",
"org.odk.collect.android.exception.JavaRosaException",
"org.odk.collect.android.logic.FormController"
] | import android.util.Log; import java.util.LinkedHashMap; import org.javarosa.core.model.FormIndex; import org.javarosa.core.model.data.IAnswerData; import org.odk.collect.android.application.Collect; import org.odk.collect.android.exception.JavaRosaException; import org.odk.collect.android.logic.FormController; | import android.util.*; import java.util.*; import org.javarosa.core.model.*; import org.javarosa.core.model.data.*; import org.odk.collect.android.application.*; import org.odk.collect.android.exception.*; import org.odk.collect.android.logic.*; | [
"android.util",
"java.util",
"org.javarosa.core",
"org.odk.collect"
] | android.util; java.util; org.javarosa.core; org.odk.collect; | 1,291,224 |
public CommittedBallot getCommittedBallot(String serialNo) {
logger.debug("Getting committed ballot cipher: {}", serialNo);
CommittedBallot ballot = null;
if (this.committedBallots.containsKey(serialNo)) {
ballot = this.committedBallots.get(serialNo);
if (ballot == null) {
logger.debug("Loading committed ballot cipher from file: {}", serialNo);
try {
this.loadBallot(serialNo);
} catch (JSONException | BallotGenCommitException | FileNotFoundException e) {
logger.error("There was a problem reading the ballot generation data and getting the requested serial number: {}", serialNo);
return null;
}
}
return this.committedBallots.get(serialNo);
}
return null;
} | CommittedBallot function(String serialNo) { logger.debug(STR, serialNo); CommittedBallot ballot = null; if (this.committedBallots.containsKey(serialNo)) { ballot = this.committedBallots.get(serialNo); if (ballot == null) { logger.debug(STR, serialNo); try { this.loadBallot(serialNo); } catch (JSONException BallotGenCommitException FileNotFoundException e) { logger.error(STR, serialNo); return null; } } return this.committedBallots.get(serialNo); } return null; } | /**
* Gets a specific generic ballot and loads it if has not already been
* loaded
*
* @param serialNo
* @return a specific generic ballot
*/ | Gets a specific generic ballot and loads it if has not already been loaded | getCommittedBallot | {
"repo_name": "jerumble/vVoteVerifier",
"path": "src/com/vvote/datafiles/commits/gencommit/BallotGenCommit.java",
"license": "gpl-3.0",
"size": 10078
} | [
"com.vvote.datafiles.exceptions.BallotGenCommitException",
"com.vvote.thirdparty.json.orgjson.JSONException",
"java.io.FileNotFoundException"
] | import com.vvote.datafiles.exceptions.BallotGenCommitException; import com.vvote.thirdparty.json.orgjson.JSONException; import java.io.FileNotFoundException; | import com.vvote.datafiles.exceptions.*; import com.vvote.thirdparty.json.orgjson.*; import java.io.*; | [
"com.vvote.datafiles",
"com.vvote.thirdparty",
"java.io"
] | com.vvote.datafiles; com.vvote.thirdparty; java.io; | 1,275,785 |
public static boolean hasEquippedUsable(EntityPlayer player) {
ItemStack itemStack = player.getCurrentEquippedItem();
if (itemStack == null) {
return false;
}
return itemStack.getItemUseAction() != EnumAction.NONE;
} | static boolean function(EntityPlayer player) { ItemStack itemStack = player.getCurrentEquippedItem(); if (itemStack == null) { return false; } return itemStack.getItemUseAction() != EnumAction.NONE; } | /**
* Checks if a player has items equipped that can be used with a right-click.
* Typically applies for weapons, food and tools.
*
* @param player player to check
* @return true if the player has an usable item equipped
*/ | Checks if a player has items equipped that can be used with a right-click. Typically applies for weapons, food and tools | hasEquippedUsable | {
"repo_name": "TheGreyGhost/dragon-mounts",
"path": "src/main/java/info/ata4/minecraft/dragon/server/util/ItemUtils.java",
"license": "unlicense",
"size": 3720
} | [
"net.minecraft.entity.player.EntityPlayer",
"net.minecraft.item.EnumAction",
"net.minecraft.item.ItemStack"
] | import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.ItemStack; | import net.minecraft.entity.player.*; import net.minecraft.item.*; | [
"net.minecraft.entity",
"net.minecraft.item"
] | net.minecraft.entity; net.minecraft.item; | 2,880,016 |
public N1qlQueryResult query(final String usernameAttribute, final String usernameValue) throws GeneralSecurityException {
val theBucket = getBucket();
val statement = Select.select("*")
.from(Expression.i(theBucket.name()))
.where(Expression.x(usernameAttribute).eq('\'' + usernameValue + '\''));
LOGGER.debug("Running query [{}] on bucket [{}]", statement.toString(), theBucket.name());
val query = N1qlQuery.simple(statement);
val result = theBucket.query(query, timeout, TimeUnit.MILLISECONDS);
if (!result.finalSuccess()) {
LOGGER.error("Couchbase query failed with [{}]", result.errors()
.stream()
.map(JsonObject::toString)
.collect(Collectors.joining(",")));
throw new GeneralSecurityException("Could not locate account for user " + usernameValue);
}
return result;
} | N1qlQueryResult function(final String usernameAttribute, final String usernameValue) throws GeneralSecurityException { val theBucket = getBucket(); val statement = Select.select("*") .from(Expression.i(theBucket.name())) .where(Expression.x(usernameAttribute).eq('\'' + usernameValue + '\'')); LOGGER.debug(STR, statement.toString(), theBucket.name()); val query = N1qlQuery.simple(statement); val result = theBucket.query(query, timeout, TimeUnit.MILLISECONDS); if (!result.finalSuccess()) { LOGGER.error(STR, result.errors() .stream() .map(JsonObject::toString) .collect(Collectors.joining(","))); throw new GeneralSecurityException(STR + usernameValue); } return result; } | /**
* Query and get a result by username.
*
* @param usernameAttribute the username attribute
* @param usernameValue the username value
* @return the n1ql query result
* @throws GeneralSecurityException the general security exception
*/ | Query and get a result by username | query | {
"repo_name": "GIP-RECIA/cas",
"path": "support/cas-server-support-couchbase-core/src/main/java/org/apereo/cas/couchbase/core/CouchbaseClientFactory.java",
"license": "apache-2.0",
"size": 8344
} | [
"com.couchbase.client.java.document.json.JsonObject",
"com.couchbase.client.java.query.N1qlQuery",
"com.couchbase.client.java.query.N1qlQueryResult",
"com.couchbase.client.java.query.Select",
"com.couchbase.client.java.query.dsl.Expression",
"java.security.GeneralSecurityException",
"java.util.concurren... | import com.couchbase.client.java.document.json.JsonObject; import com.couchbase.client.java.query.N1qlQuery; import com.couchbase.client.java.query.N1qlQueryResult; import com.couchbase.client.java.query.Select; import com.couchbase.client.java.query.dsl.Expression; import java.security.GeneralSecurityException; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; | import com.couchbase.client.java.document.json.*; import com.couchbase.client.java.query.*; import com.couchbase.client.java.query.dsl.*; import java.security.*; import java.util.concurrent.*; import java.util.stream.*; | [
"com.couchbase.client",
"java.security",
"java.util"
] | com.couchbase.client; java.security; java.util; | 641,404 |
@Input
@Optional
public RegularFileProperty getJar() {
return this.jar;
} | RegularFileProperty function() { return this.jar; } | /**
* Returns the property for the jar file from which the image will be built.
* @return the jar property
*/ | Returns the property for the jar file from which the image will be built | getJar | {
"repo_name": "jxblum/spring-boot",
"path": "spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootBuildImage.java",
"license": "apache-2.0",
"size": 15010
} | [
"org.gradle.api.file.RegularFileProperty"
] | import org.gradle.api.file.RegularFileProperty; | import org.gradle.api.file.*; | [
"org.gradle.api"
] | org.gradle.api; | 2,496,838 |
@Deprecated
public void load() {
try {
load2();
} catch (IOException e) {
throw new RuntimeException(e);
}
} | void function() { try { load2(); } catch (IOException e) { throw new RuntimeException(e); } } | /**
* Loads the configuration from the configuration file.
* <p>
* This method is equivalent to {@link #load2()}, except that any
* {@link java.io.IOException} that occurs is wrapped as a
* {@link java.lang.RuntimeException}.
* <p>
* This method exists for source compatibility. Users should call
* {@link #load2()} instead.
* @deprecated use {@link #load2()} instead.
*/ | Loads the configuration from the configuration file. This method is equivalent to <code>#load2()</code>, except that any <code>java.io.IOException</code> that occurs is wrapped as a <code>java.lang.RuntimeException</code>. This method exists for source compatibility. Users should call <code>#load2()</code> instead | load | {
"repo_name": "rsandell/jenkins",
"path": "core/src/main/java/jenkins/security/s2m/ConfigFile.java",
"license": "mit",
"size": 3200
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,908,328 |
public CreateIndexRequestBuilder prepareCreate(String index, Settings.Builder settingsBuilder) {
return prepareCreate(index, -1, settingsBuilder);
} | CreateIndexRequestBuilder function(String index, Settings.Builder settingsBuilder) { return prepareCreate(index, -1, settingsBuilder); } | /**
* Creates a new {@link CreateIndexRequestBuilder} with the settings obtained from {@link #indexSettings()}, augmented
* by the given builder
*/ | Creates a new <code>CreateIndexRequestBuilder</code> with the settings obtained from <code>#indexSettings()</code>, augmented by the given builder | prepareCreate | {
"repo_name": "shreejay/elasticsearch",
"path": "test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java",
"license": "apache-2.0",
"size": 105253
} | [
"org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder",
"org.elasticsearch.common.settings.Settings"
] | import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder; import org.elasticsearch.common.settings.Settings; | import org.elasticsearch.action.admin.indices.create.*; import org.elasticsearch.common.settings.*; | [
"org.elasticsearch.action",
"org.elasticsearch.common"
] | org.elasticsearch.action; org.elasticsearch.common; | 396,430 |
public void showUI()
{
screenController = new PMScreenController();
}
| void function() { screenController = new PMScreenController(); } | /**
* This single method can be called by the implementer to use the baked in
* UI.
*/ | This single method can be called by the implementer to use the baked in UI | showUI | {
"repo_name": "PanaceaMobile/panacea-mobile-blackberry-sdk",
"path": "PanaceaSDK/src/com/panaceamobile/panacea/sdk/PanaceaSDK.java",
"license": "mit",
"size": 13884
} | [
"com.panaceamobile.panacea.ui.controllers.PMScreenController"
] | import com.panaceamobile.panacea.ui.controllers.PMScreenController; | import com.panaceamobile.panacea.ui.controllers.*; | [
"com.panaceamobile.panacea"
] | com.panaceamobile.panacea; | 109,498 |
private static ArrayList<String> getUniqueBSSIDs(ArrayList<? extends FingerPrintItem> _items)
{
ArrayList<String> uniqueBSSIDs = new ArrayList<String>();
for(FingerPrintItem fpi:_items)
{
ArrayList<FingerPrint> fingerPrints = fpi.getFingerPrints();
for(FingerPrint fp:fingerPrints)
{
String bssid = fp.getBSSID();
if(!uniqueBSSIDs.contains(bssid))
{
uniqueBSSIDs.add(bssid);
}
}
}
sort(uniqueBSSIDs);
return uniqueBSSIDs;
} | static ArrayList<String> function(ArrayList<? extends FingerPrintItem> _items) { ArrayList<String> uniqueBSSIDs = new ArrayList<String>(); for(FingerPrintItem fpi:_items) { ArrayList<FingerPrint> fingerPrints = fpi.getFingerPrints(); for(FingerPrint fp:fingerPrints) { String bssid = fp.getBSSID(); if(!uniqueBSSIDs.contains(bssid)) { uniqueBSSIDs.add(bssid); } } } sort(uniqueBSSIDs); return uniqueBSSIDs; } | /**
* extracts a list of unique BSSIDs from the passed list of FingerPrintItems and sorts it
* @param _items the FingerPrintItems to extract the information from
* @return a sorted list of unique BSSIDs
*/ | extracts a list of unique BSSIDs from the passed list of FingerPrintItems and sorts it | getUniqueBSSIDs | {
"repo_name": "mobilesec/sesames",
"path": "SurveyTool/src/at/fhooe/mc/extern/util/ARFFGenerator.java",
"license": "lgpl-3.0",
"size": 14629
} | [
"at.fhooe.mc.extern.fingerprintInformation.FingerPrint",
"at.fhooe.mc.extern.fingerprintInformation.FingerPrintItem",
"java.util.ArrayList"
] | import at.fhooe.mc.extern.fingerprintInformation.FingerPrint; import at.fhooe.mc.extern.fingerprintInformation.FingerPrintItem; import java.util.ArrayList; | import at.fhooe.mc.extern.*; import java.util.*; | [
"at.fhooe.mc",
"java.util"
] | at.fhooe.mc; java.util; | 1,724,584 |
public void commandAction(Command cmd, Displayable arg1) {
super.commandAction(cmd, arg1);
if (cmd.equals(ServidorBT.iniciarJogoCommand)) {
// Bloqueia novas conexões
setModoSetup(false);
// Cria um novo jogo e adiciona o jogador que está no servidor
Jogo jogo = new JogoLocal(regras.charAt(0) == 'T',
regras.charAt(1) == 'T');
midlet.jogadorHumano = new JogadorHumano(display, midlet.mesa);
jogo.adiciona(midlet.jogadorHumano);
// Adiciona jogadores para os outros slots
for (int i = 0; i <= 2; i++) {
if (connClientes[i] != null) {
// Se há alguém neste slot, cria um JogadorBT para
// representá-lo
jogo.adiciona(new JogadorBT(this));
} else {
// Se não há, preenche com um JogadorCPU
jogo.adiciona(new JogadorCPU()); //$NON-NLS-1$
}
}
midlet.iniciaJogo(jogo);
} else if (cmd.equals(ServidorBT.trocaParceiroCommand)) {
// Enquanto rola essa dança da cadeira, não queremos ninguém
// se conectando, daí o synchornized.
synchronized (this) {
Object temp;
temp = connClientes[2];
connClientes[2] = connClientes[1];
connClientes[1] = connClientes[0];
connClientes[0] = (StreamConnection) temp;
temp = outClientes[2];
outClientes[2] = outClientes[1];
outClientes[1] = outClientes[0];
outClientes[0] = (OutputStream) temp;
temp = apelidos[3];
apelidos[3] = apelidos[2];
apelidos[2] = apelidos[1];
apelidos[1] = (String) temp;
atualizaClientes();
atualizaServidor();
}
} else if (cmd.equals(ServidorBT.inverteAdversariosCommand)) {
// Idem acima
synchronized (this) {
Object temp;
temp = connClientes[0];
connClientes[0] = connClientes[2];
connClientes[2] = (StreamConnection) temp;
temp = outClientes[0];
outClientes[0] = outClientes[2];
outClientes[2] = (OutputStream) temp;
temp = apelidos[1];
apelidos[1] = apelidos[3];
apelidos[3] = (String) temp;
atualizaClientes();
atualizaServidor();
}
}
} | void function(Command cmd, Displayable arg1) { super.commandAction(cmd, arg1); if (cmd.equals(ServidorBT.iniciarJogoCommand)) { setModoSetup(false); Jogo jogo = new JogoLocal(regras.charAt(0) == 'T', regras.charAt(1) == 'T'); midlet.jogadorHumano = new JogadorHumano(display, midlet.mesa); jogo.adiciona(midlet.jogadorHumano); for (int i = 0; i <= 2; i++) { if (connClientes[i] != null) { jogo.adiciona(new JogadorBT(this)); } else { jogo.adiciona(new JogadorCPU()); } } midlet.iniciaJogo(jogo); } else if (cmd.equals(ServidorBT.trocaParceiroCommand)) { synchronized (this) { Object temp; temp = connClientes[2]; connClientes[2] = connClientes[1]; connClientes[1] = connClientes[0]; connClientes[0] = (StreamConnection) temp; temp = outClientes[2]; outClientes[2] = outClientes[1]; outClientes[1] = outClientes[0]; outClientes[0] = (OutputStream) temp; temp = apelidos[3]; apelidos[3] = apelidos[2]; apelidos[2] = apelidos[1]; apelidos[1] = (String) temp; atualizaClientes(); atualizaServidor(); } } else if (cmd.equals(ServidorBT.inverteAdversariosCommand)) { synchronized (this) { Object temp; temp = connClientes[0]; connClientes[0] = connClientes[2]; connClientes[2] = (StreamConnection) temp; temp = outClientes[0]; outClientes[0] = outClientes[2]; outClientes[2] = (OutputStream) temp; temp = apelidos[1]; apelidos[1] = apelidos[3]; apelidos[3] = (String) temp; atualizaClientes(); atualizaServidor(); } } } | /**
* Processa comandos de menu exclusivos do servidor
*/ | Processa comandos de menu exclusivos do servidor | commandAction | {
"repo_name": "chesterbr/minitruco-j2me",
"path": "miniTruco/src/mt/ServidorBT.java",
"license": "bsd-3-clause",
"size": 13888
} | [
"java.io.OutputStream",
"javax.microedition.io.StreamConnection",
"javax.microedition.lcdui.Command",
"javax.microedition.lcdui.Displayable"
] | import java.io.OutputStream; import javax.microedition.io.StreamConnection; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.Displayable; | import java.io.*; import javax.microedition.io.*; import javax.microedition.lcdui.*; | [
"java.io",
"javax.microedition"
] | java.io; javax.microedition; | 503,372 |
synchronized (sInstances) {
StorageMeasurement value = sInstances.get(volume);
if (value == null) {
value = new StorageMeasurement(context.getApplicationContext(), volume);
sInstances.put(volume, value);
}
return value;
}
}
public static class MeasurementDetails {
public long totalSize;
public long availSize;
public long appsSize;
public long cacheSize;
public HashMap<String, Long> mediaSize = Maps.newHashMap();
public long miscSize;
public SparseLongArray usersSize = new SparseLongArray();
} | synchronized (sInstances) { StorageMeasurement value = sInstances.get(volume); if (value == null) { value = new StorageMeasurement(context.getApplicationContext(), volume); sInstances.put(volume, value); } return value; } } public static class MeasurementDetails { public long totalSize; public long availSize; public long appsSize; public long cacheSize; public HashMap<String, Long> mediaSize = Maps.newHashMap(); public long miscSize; public SparseLongArray usersSize = new SparseLongArray(); } | /**
* Obtain shared instance of {@link StorageMeasurement} for given physical
* {@link StorageVolume}, or internal storage if {@code null}.
*/ | Obtain shared instance of <code>StorageMeasurement</code> for given physical <code>StorageVolume</code>, or internal storage if null | getInstance | {
"repo_name": "louis20150702/mytestgit",
"path": "Settings/src/com/android/settings/deviceinfo/StorageMeasurement.java",
"license": "gpl-2.0",
"size": 32172
} | [
"android.util.SparseLongArray",
"com.google.android.collect.Maps",
"java.util.HashMap"
] | import android.util.SparseLongArray; import com.google.android.collect.Maps; import java.util.HashMap; | import android.util.*; import com.google.android.collect.*; import java.util.*; | [
"android.util",
"com.google.android",
"java.util"
] | android.util; com.google.android; java.util; | 2,508,429 |
public void widgetDisposed( DisposeEvent evt ) {
deleteTimer( );
}
// ----------------------------------------------------------
// Methods defined by AlarmListener
// ---------------------------------------------------------- | void function( DisposeEvent evt ) { deleteTimer( ); } | /**
* We're being disposed of - clean up
*/ | We're being disposed of - clean up | widgetDisposed | {
"repo_name": "Norkart/NK-VirtualGlobe",
"path": "Xj3D/src/java/org/xj3d/ui/swt/view/FrameRateContributionItem.java",
"license": "gpl-2.0",
"size": 7818
} | [
"org.eclipse.swt.events.DisposeEvent"
] | import org.eclipse.swt.events.DisposeEvent; | import org.eclipse.swt.events.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 2,555,089 |
EClass getServiceRef(); | EClass getServiceRef(); | /**
* Returns the meta object for class '{@link fr.obeo.dsl.sPrototyper.ServiceRef <em>Service Ref</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Service Ref</em>'.
* @see fr.obeo.dsl.sPrototyper.ServiceRef
* @generated
*/ | Returns the meta object for class '<code>fr.obeo.dsl.sPrototyper.ServiceRef Service Ref</code>'. | getServiceRef | {
"repo_name": "glefur/s-prototyper",
"path": "plugins/fr.obeo.dsl.sprototyper/src-gen/fr/obeo/dsl/sPrototyper/SPrototyperPackage.java",
"license": "apache-2.0",
"size": 98928
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,402,590 |
public static String getThirdPartyCookie(HttpServletRequest req, HttpServletResponse resp,
boolean generate, String seed) {
if (! ProcessingQueue.getInstance().isThirdPartyCookies()) {
return null;
}
// Look for existing cookies
String globalVisitorId = null;
String optoutCookieVal = null;
if (req.getCookies() != null) {
for (Cookie cookie : req.getCookies()) {
if (cookie.getName().equals(VISITOR_ID_THIRD_PARTY_COOKIE)) {
globalVisitorId = cookie.getValue();
} else if (cookie.getName().equals(VISITOR_ID_OPTOUT_COOKIE)) {
optoutCookieVal = cookie.getValue();
}
}
}
// Send P3P header if configured
String p3pHeader = ProcessingQueue.getInstance().getP3PHeader();
if (p3pHeader != null) {
resp.setHeader("P3P", p3pHeader);
}
// Parse and echo DNT header if present
if (! ProcessingQueue.getInstance().isIgnoreDNT()) {
String doNotTrackVal = req.getHeader(DO_NOT_TRACK_HEADER);
if (doNotTrackVal != null) {
resp.addHeader(DO_NOT_TRACK_HEADER, doNotTrackVal);
if (doNotTrackVal.equals("1")) {
// Remove any third-party cookie
if (globalVisitorId != null) {
setCookie(resp, VISITOR_ID_THIRD_PARTY_COOKIE, "0", 0);
}
if (optoutCookieVal != null) {
setCookie(resp, VISITOR_ID_OPTOUT_COOKIE, "0", 0);
}
return "";
}
}
}
if (optoutCookieVal != null && optoutCookieVal.equals("1")) {
setCookie(resp, VISITOR_ID_OPTOUT_COOKIE, "1", VISITOR_ID_OPTOUT_COOKIE_LIFETIME);
return "";
}
if (globalVisitorId == null || globalVisitorId.equals("0")) {
if (generate) {
globalVisitorId = (seed == null) ? UUIDGenerator.generate() : UUIDGenerator.fromSeed(seed);
} else {
globalVisitorId = null;
}
}
if (globalVisitorId != null) {
setCookie(resp, VISITOR_ID_THIRD_PARTY_COOKIE, globalVisitorId, VISITOR_ID_THIRD_PARTY_COOKIE_LIFETIME);
}
return globalVisitorId;
}
| static String function(HttpServletRequest req, HttpServletResponse resp, boolean generate, String seed) { if (! ProcessingQueue.getInstance().isThirdPartyCookies()) { return null; } String globalVisitorId = null; String optoutCookieVal = null; if (req.getCookies() != null) { for (Cookie cookie : req.getCookies()) { if (cookie.getName().equals(VISITOR_ID_THIRD_PARTY_COOKIE)) { globalVisitorId = cookie.getValue(); } else if (cookie.getName().equals(VISITOR_ID_OPTOUT_COOKIE)) { optoutCookieVal = cookie.getValue(); } } } String p3pHeader = ProcessingQueue.getInstance().getP3PHeader(); if (p3pHeader != null) { resp.setHeader("P3P", p3pHeader); } if (! ProcessingQueue.getInstance().isIgnoreDNT()) { String doNotTrackVal = req.getHeader(DO_NOT_TRACK_HEADER); if (doNotTrackVal != null) { resp.addHeader(DO_NOT_TRACK_HEADER, doNotTrackVal); if (doNotTrackVal.equals("1")) { if (globalVisitorId != null) { setCookie(resp, VISITOR_ID_THIRD_PARTY_COOKIE, "0", 0); } if (optoutCookieVal != null) { setCookie(resp, VISITOR_ID_OPTOUT_COOKIE, "0", 0); } return STR1STR1STRSTR0")) { if (generate) { globalVisitorId = (seed == null) ? UUIDGenerator.generate() : UUIDGenerator.fromSeed(seed); } else { globalVisitorId = null; } } if (globalVisitorId != null) { setCookie(resp, VISITOR_ID_THIRD_PARTY_COOKIE, globalVisitorId, VISITOR_ID_THIRD_PARTY_COOKIE_LIFETIME); } return globalVisitorId; } | /**
* Sets or refreshes the third-party cookie, and returns its value.
* @param generate Generate a global id if none
* @param seed Seed to be used to generate the global id, or null if none
* @return The global visitor id, or null if none, or the empty string if the user has opted out third-party tracking.
*/ | Sets or refreshes the third-party cookie, and returns its value | getThirdPartyCookie | {
"repo_name": "dataiku/wt1",
"path": "src/main/java/com/dataiku/wt1/controllers/PixelServlet.java",
"license": "apache-2.0",
"size": 10411
} | [
"com.dataiku.wt1.ProcessingQueue",
"com.dataiku.wt1.UUIDGenerator",
"javax.servlet.http.Cookie",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import com.dataiku.wt1.ProcessingQueue; import com.dataiku.wt1.UUIDGenerator; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; | import com.dataiku.wt1.*; import javax.servlet.http.*; | [
"com.dataiku.wt1",
"javax.servlet"
] | com.dataiku.wt1; javax.servlet; | 2,313,832 |
public List getPropertyEditorPaths() {
return propertyEditorPaths;
} | List function() { return propertyEditorPaths; } | /**
* Gets the paths that are appended to the system property editors search path.
* @return the paths that are appended to the system property editors search path
*/ | Gets the paths that are appended to the system property editors search path | getPropertyEditorPaths | {
"repo_name": "codehaus/xbean",
"path": "xbean-server/src/main/java/org/apache/xbean/server/spring/main/SpringBootstrap.java",
"license": "apache-2.0",
"size": 11272
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,644,250 |
@Override
public void normalize() {
if (isNormalized()) {
return;
}
// System.err.println("spliting tree with order " + this.depth + " having "
// + this.myEntries.size() + " entries....");
if (myEntries.size() <= NORMALIZED_SIZE_LIMIT && mySubTrees.size() == 0) {
mutableSize = BigInteger.valueOf(myEntries.size());
return;
}
final int childOrder = this.depth + 1;
try {
// sort entries by the bucket they fall on
Map<Integer, Set<String>> entriesByBucket = new TreeMap<Integer, Set<String>>();
for (Object key : myEntries.keySet()) {
Integer bucket = computeBucket((String) key);
if (!entriesByBucket.containsKey(bucket)) {
entriesByBucket.put(bucket, new HashSet<String>());
}
entriesByBucket.get(bucket).add((String) key);
}
BigInteger size = BigInteger.ZERO;
// ignore this subtrees for computing the size later as by that time their size has been
// already added
Set<Ref> ignoreForSizeComputation = new HashSet<Ref>();
// for each bucket retrieve/create the bucket's subtree and set its entries
Iterator<Map.Entry<Integer, Set<String>>> it = entriesByBucket.entrySet().iterator();
Ref subtreeRef;
ObjectId subtreeId;
MutableTree subtree;
while (it.hasNext()) {
Entry<Integer, Set<String>> e = it.next();
Integer bucket = e.getKey();
Set<String> keys = e.getValue();
it.remove();
subtreeRef = mySubTrees.get(bucket);
if (subtreeRef == null) {
subtree = new MutableRevSHA1Tree(db, childOrder);
} else {
subtreeId = subtreeRef.getObjectId();
subtree = db.get(subtreeId, WrappedSerialisingFactory.getInstance().createRevTreeReader(db, childOrder)).mutable();
// subtree = db.get(subtreeId, new BxmlRevTreeReader(db, childOrder)).mutable();
}
for (String key : keys) {
Ref value = myEntries.remove(key);
if (value == null) {
subtree.remove(key);
} else {
subtree.put(value);
}
}
size = size.add(subtree.size());
subtreeId = this.db.put(WrappedSerialisingFactory.getInstance().createRevTreeWriter(subtree));
// subtreeId = this.db.put(new BxmlRevTreeWriter(subtree));
subtreeRef = new Ref("", subtreeId, TYPE.TREE);
ignoreForSizeComputation.add(subtreeRef);
mySubTrees.put(bucket, subtreeRef);
}
// compute the overall size
this.mutableSize = computeSize(size, ignoreForSizeComputation);
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
// System.err.println("spliting complete.");
} | void function() { if (isNormalized()) { return; } if (myEntries.size() <= NORMALIZED_SIZE_LIMIT && mySubTrees.size() == 0) { mutableSize = BigInteger.valueOf(myEntries.size()); return; } final int childOrder = this.depth + 1; try { Map<Integer, Set<String>> entriesByBucket = new TreeMap<Integer, Set<String>>(); for (Object key : myEntries.keySet()) { Integer bucket = computeBucket((String) key); if (!entriesByBucket.containsKey(bucket)) { entriesByBucket.put(bucket, new HashSet<String>()); } entriesByBucket.get(bucket).add((String) key); } BigInteger size = BigInteger.ZERO; Set<Ref> ignoreForSizeComputation = new HashSet<Ref>(); Iterator<Map.Entry<Integer, Set<String>>> it = entriesByBucket.entrySet().iterator(); Ref subtreeRef; ObjectId subtreeId; MutableTree subtree; while (it.hasNext()) { Entry<Integer, Set<String>> e = it.next(); Integer bucket = e.getKey(); Set<String> keys = e.getValue(); it.remove(); subtreeRef = mySubTrees.get(bucket); if (subtreeRef == null) { subtree = new MutableRevSHA1Tree(db, childOrder); } else { subtreeId = subtreeRef.getObjectId(); subtree = db.get(subtreeId, WrappedSerialisingFactory.getInstance().createRevTreeReader(db, childOrder)).mutable(); } for (String key : keys) { Ref value = myEntries.remove(key); if (value == null) { subtree.remove(key); } else { subtree.put(value); } } size = size.add(subtree.size()); subtreeId = this.db.put(WrappedSerialisingFactory.getInstance().createRevTreeWriter(subtree)); subtreeRef = new Ref("", subtreeId, TYPE.TREE); ignoreForSizeComputation.add(subtreeRef); mySubTrees.put(bucket, subtreeRef); } this.mutableSize = computeSize(size, ignoreForSizeComputation); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } } | /**
* Splits the cached entries into subtrees and saves them, making sure the tree contains either
* only entries or subtrees
*/ | Splits the cached entries into subtrees and saves them, making sure the tree contains either only entries or subtrees | normalize | {
"repo_name": "jodygarnett/GeoGit",
"path": "src/main/java/org/geogit/storage/MutableRevSHA1Tree.java",
"license": "lgpl-2.1",
"size": 8693
} | [
"java.math.BigInteger",
"java.util.HashSet",
"java.util.Iterator",
"java.util.Map",
"java.util.Set",
"java.util.TreeMap",
"org.geogit.api.MutableTree",
"org.geogit.api.ObjectId",
"org.geogit.api.Ref"
] | import java.math.BigInteger; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.TreeMap; import org.geogit.api.MutableTree; import org.geogit.api.ObjectId; import org.geogit.api.Ref; | import java.math.*; import java.util.*; import org.geogit.api.*; | [
"java.math",
"java.util",
"org.geogit.api"
] | java.math; java.util; org.geogit.api; | 2,598,522 |
SocketAddress getSocketAddress(); | SocketAddress getSocketAddress(); | /**
* Return the InetSocketAddress of the remote endpoint
*/ | Return the InetSocketAddress of the remote endpoint | getSocketAddress | {
"repo_name": "HATB0T/RuneCraftery",
"path": "forge/mcp/src/minecraft/net/minecraft/network/INetworkManager.java",
"license": "lgpl-3.0",
"size": 1329
} | [
"java.net.SocketAddress"
] | import java.net.SocketAddress; | import java.net.*; | [
"java.net"
] | java.net; | 801,550 |
@Override
public void setAnnotationSpanEnd(int spanEnd) {
sortSpanList();
int currentSpanEnd = this.getAnnotationSpanEnd();
try {
this.spanList.get(spanList.size() - 1).setSpanEnd(spanEnd);
} catch (InvalidSpanException ise) {
logger.error("Invalid span. [" + this.spanList.get(spanList.size() - 1).getSpanStart() + ".." + spanEnd
+ "] --- Annotation span reverted to last known safe state.");
ise.printStackTrace();
try {
this.spanList.get(spanList.size() - 1).setSpanEnd(currentSpanEnd);
} catch (InvalidSpanException ise2) {
ise2.printStackTrace();
}
}
} | void function(int spanEnd) { sortSpanList(); int currentSpanEnd = this.getAnnotationSpanEnd(); try { this.spanList.get(spanList.size() - 1).setSpanEnd(spanEnd); } catch (InvalidSpanException ise) { logger.error(STR + this.spanList.get(spanList.size() - 1).getSpanStart() + ".." + spanEnd + STR); ise.printStackTrace(); try { this.spanList.get(spanList.size() - 1).setSpanEnd(currentSpanEnd); } catch (InvalidSpanException ise2) { ise2.printStackTrace(); } } } | /**
* Set the end index for the last annotation span
*
* @param spanEnd
*/ | Set the end index for the last annotation span | setAnnotationSpanEnd | {
"repo_name": "UCDenver-ccp/ccp-nlp",
"path": "ccp-nlp-core/src/main/java/edu/ucdenver/ccp/nlp/core/annotation/impl/DefaultTextAnnotation.java",
"license": "bsd-3-clause",
"size": 13688
} | [
"edu.ucdenver.ccp.nlp.core.annotation.InvalidSpanException"
] | import edu.ucdenver.ccp.nlp.core.annotation.InvalidSpanException; | import edu.ucdenver.ccp.nlp.core.annotation.*; | [
"edu.ucdenver.ccp"
] | edu.ucdenver.ccp; | 1,170,677 |
public AnalysisEngineDescription getPreprocessing()
throws ResourceInitializationException
{
List<AnalysisEngineDescription> preprocessing = new ArrayList<>();
if (userPreprocessing != null) {
preprocessing.addAll(Arrays.asList(userPreprocessing));
}
preprocessing.add(AnalysisEngineFactory.createEngineDescription(TcPosTaggingWrapper.class,
TcPosTaggingWrapper.PARAM_USE_COARSE_GRAINED, useCoarse));
return AnalysisEngineFactory
.createEngineDescription(preprocessing.toArray(new AnalysisEngineDescription[0]));
} | AnalysisEngineDescription function() throws ResourceInitializationException { List<AnalysisEngineDescription> preprocessing = new ArrayList<>(); if (userPreprocessing != null) { preprocessing.addAll(Arrays.asList(userPreprocessing)); } preprocessing.add(AnalysisEngineFactory.createEngineDescription(TcPosTaggingWrapper.class, TcPosTaggingWrapper.PARAM_USE_COARSE_GRAINED, useCoarse)); return AnalysisEngineFactory .createEngineDescription(preprocessing.toArray(new AnalysisEngineDescription[0])); } | /**
* Gets the current pre-processing set up
* @return Pre-processing pipeline
* @throws ResourceInitializationException
* for erroneous configurations
*/ | Gets the current pre-processing set up | getPreprocessing | {
"repo_name": "Horsmann/FlexTag",
"path": "flextag-core/src/main/java/de/unidue/ltl/flextag/core/FlexTagSetUp.java",
"license": "apache-2.0",
"size": 7727
} | [
"de.unidue.ltl.flextag.core.uima.TcPosTaggingWrapper",
"java.util.ArrayList",
"java.util.Arrays",
"java.util.List",
"org.apache.uima.analysis_engine.AnalysisEngineDescription",
"org.apache.uima.fit.factory.AnalysisEngineFactory",
"org.apache.uima.resource.ResourceInitializationException"
] | import de.unidue.ltl.flextag.core.uima.TcPosTaggingWrapper; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.uima.analysis_engine.AnalysisEngineDescription; import org.apache.uima.fit.factory.AnalysisEngineFactory; import org.apache.uima.resource.ResourceInitializationException; | import de.unidue.ltl.flextag.core.uima.*; import java.util.*; import org.apache.uima.analysis_engine.*; import org.apache.uima.fit.factory.*; import org.apache.uima.resource.*; | [
"de.unidue.ltl",
"java.util",
"org.apache.uima"
] | de.unidue.ltl; java.util; org.apache.uima; | 986,611 |
public String readPolicyCombiningAlgorithm() throws EntitlementException {
try {
Collection policyCollection = null;
if(registry.resourceExists(policyStorePath)){
policyCollection = (Collection) registry.get(policyStorePath);
}
if(policyCollection != null){
return policyCollection.getProperty("globalPolicyCombiningAlgorithm");
}
return null;
} catch (RegistryException e) {
log.error("Error while reading policy combining algorithm", e);
throw new EntitlementException("Error while reading policy combining algorithm", e);
}
} | String function() throws EntitlementException { try { Collection policyCollection = null; if(registry.resourceExists(policyStorePath)){ policyCollection = (Collection) registry.get(policyStorePath); } if(policyCollection != null){ return policyCollection.getProperty(STR); } return null; } catch (RegistryException e) { log.error(STR, e); throw new EntitlementException(STR, e); } } | /**
* This reads the policy combining algorithm from registry resource property
* @return policy combining algorithm as String
* @throws EntitlementException throws
*/ | This reads the policy combining algorithm from registry resource property | readPolicyCombiningAlgorithm | {
"repo_name": "SupunS/carbon-identity",
"path": "components/identity/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/policy/finder/registry/RegistryPolicyReader.java",
"license": "apache-2.0",
"size": 10495
} | [
"org.wso2.carbon.identity.entitlement.EntitlementException",
"org.wso2.carbon.registry.core.Collection",
"org.wso2.carbon.registry.core.exceptions.RegistryException"
] | import org.wso2.carbon.identity.entitlement.EntitlementException; import org.wso2.carbon.registry.core.Collection; import org.wso2.carbon.registry.core.exceptions.RegistryException; | import org.wso2.carbon.identity.entitlement.*; import org.wso2.carbon.registry.core.*; import org.wso2.carbon.registry.core.exceptions.*; | [
"org.wso2.carbon"
] | org.wso2.carbon; | 527,033 |
public void deleteByConceptIdAndFilename(String conceptId, String filename) {
Query fileQuery = new Query(GridFsCriteria.whereFilename().is(
ConceptAttachmentFilenameBuilder.buildFileName(conceptId, filename)));
GridFSFile file = this.operations.findOne(fileQuery);
if (file == null) {
return;
}
ConceptAttachmentMetadata metadata = mongoTemplate.getConverter().read(
ConceptAttachmentMetadata.class, file.getMetadata());
String currentUser = SecurityUtils.getCurrentUserLogin();
this.operations.delete(fileQuery);
javers.commitShallowDelete(currentUser, metadata);
} | void function(String conceptId, String filename) { Query fileQuery = new Query(GridFsCriteria.whereFilename().is( ConceptAttachmentFilenameBuilder.buildFileName(conceptId, filename))); GridFSFile file = this.operations.findOne(fileQuery); if (file == null) { return; } ConceptAttachmentMetadata metadata = mongoTemplate.getConverter().read( ConceptAttachmentMetadata.class, file.getMetadata()); String currentUser = SecurityUtils.getCurrentUserLogin(); this.operations.delete(fileQuery); javers.commitShallowDelete(currentUser, metadata); } | /**
* Delete the attachment and its metadata from gridfs.
* @param conceptId The id of the {@link Concept}.
* @param filename The filename of the attachment.
*/ | Delete the attachment and its metadata from gridfs | deleteByConceptIdAndFilename | {
"repo_name": "dzhw/metadatamanagement",
"path": "src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptAttachmentService.java",
"license": "agpl-3.0",
"size": 5511
} | [
"com.mongodb.client.gridfs.model.GridFSFile",
"eu.dzhw.fdz.metadatamanagement.conceptmanagement.domain.ConceptAttachmentMetadata",
"eu.dzhw.fdz.metadatamanagement.usermanagement.security.SecurityUtils",
"org.springframework.data.mongodb.core.query.Query",
"org.springframework.data.mongodb.gridfs.GridFsCrite... | import com.mongodb.client.gridfs.model.GridFSFile; import eu.dzhw.fdz.metadatamanagement.conceptmanagement.domain.ConceptAttachmentMetadata; import eu.dzhw.fdz.metadatamanagement.usermanagement.security.SecurityUtils; import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.gridfs.GridFsCriteria; | import com.mongodb.client.gridfs.model.*; import eu.dzhw.fdz.metadatamanagement.conceptmanagement.domain.*; import eu.dzhw.fdz.metadatamanagement.usermanagement.security.*; import org.springframework.data.mongodb.core.query.*; import org.springframework.data.mongodb.gridfs.*; | [
"com.mongodb.client",
"eu.dzhw.fdz",
"org.springframework.data"
] | com.mongodb.client; eu.dzhw.fdz; org.springframework.data; | 1,178,914 |
public void invoke(
String methodName, Object argument, OutputStream ops)
throws IOException {
invoke(methodName, argument, ops, random.nextLong()+"");
} | void function( String methodName, Object argument, OutputStream ops) throws IOException { invoke(methodName, argument, ops, random.nextLong()+""); } | /**
* Invokes the given method on the remote service passing
* the given argument. An id is generated automatically. To read
* the response {@link #readResponse(Type, InputStream)} must be
* subsequently called.
*
* @see #writeRequest(String, Object, OutputStream, String)
* @param methodName the method to invoke
* @param argument the arguments to pass to the method
* @param ops the {@link OutputStream} to write to
* @throws IOException on error
*/ | Invokes the given method on the remote service passing the given argument. An id is generated automatically. To read the response <code>#readResponse(Type, InputStream)</code> must be subsequently called | invoke | {
"repo_name": "lokinell/jsonrpc4j",
"path": "src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java",
"license": "mit",
"size": 19825
} | [
"java.io.IOException",
"java.io.OutputStream"
] | import java.io.IOException; import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,015,857 |
public Adapter createEObjectAdapter() {
return null;
} | Adapter function() { return null; } | /**
* Creates a new adapter for the default case.
* <!-- begin-user-doc --> This
* default implementation returns null. <!-- end-user-doc -->
*
* @return the new adapter.
* @generated
*/ | Creates a new adapter for the default case. This default implementation returns null. | createEObjectAdapter | {
"repo_name": "edgarmueller/emfstore-rest",
"path": "bundles/org.eclipse.emf.emfstore.common.model/src/org/eclipse/emf/emfstore/internal/common/model/util/ModelAdapterFactory.java",
"license": "epl-1.0",
"size": 10752
} | [
"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,637,906 |
protected final void configureWebAppContext(WebAppContext context,
ServletContextInitializer... initializers) {
Assert.notNull(context, "Context must not be null");
context.setTempDirectory(getTempDirectory());
if (this.resourceLoader != null) {
context.setClassLoader(this.resourceLoader.getClassLoader());
}
String contextPath = getContextPath();
context.setContextPath(StringUtils.hasLength(contextPath) ? contextPath : "/");
configureDocumentRoot(context);
if (isRegisterDefaultServlet()) {
addDefaultServlet(context);
}
if (isRegisterJspServlet()
&& ClassUtils.isPresent(getJspServletClassName(), getClass()
.getClassLoader())) {
addJspServlet(context);
}
ServletContextInitializer[] initializersToUse = mergeInitializers(initializers);
Configuration[] configurations = getWebAppContextConfigurations(context,
initializersToUse);
context.setConfigurations(configurations);
int sessionTimeout = (getSessionTimeout() > 0 ? getSessionTimeout() : -1);
SessionManager sessionManager = context.getSessionHandler().getSessionManager();
sessionManager.setMaxInactiveInterval(sessionTimeout);
postProcessWebAppContext(context);
} | final void function(WebAppContext context, ServletContextInitializer... initializers) { Assert.notNull(context, STR); context.setTempDirectory(getTempDirectory()); if (this.resourceLoader != null) { context.setClassLoader(this.resourceLoader.getClassLoader()); } String contextPath = getContextPath(); context.setContextPath(StringUtils.hasLength(contextPath) ? contextPath : "/"); configureDocumentRoot(context); if (isRegisterDefaultServlet()) { addDefaultServlet(context); } if (isRegisterJspServlet() && ClassUtils.isPresent(getJspServletClassName(), getClass() .getClassLoader())) { addJspServlet(context); } ServletContextInitializer[] initializersToUse = mergeInitializers(initializers); Configuration[] configurations = getWebAppContextConfigurations(context, initializersToUse); context.setConfigurations(configurations); int sessionTimeout = (getSessionTimeout() > 0 ? getSessionTimeout() : -1); SessionManager sessionManager = context.getSessionHandler().getSessionManager(); sessionManager.setMaxInactiveInterval(sessionTimeout); postProcessWebAppContext(context); } | /**
* Configure the given Jetty {@link WebAppContext} for use.
* @param context the context to configure
* @param initializers the set of initializers to apply
*/ | Configure the given Jetty <code>WebAppContext</code> for use | configureWebAppContext | {
"repo_name": "10045125/spring-boot",
"path": "spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java",
"license": "apache-2.0",
"size": 19409
} | [
"org.eclipse.jetty.server.SessionManager",
"org.eclipse.jetty.webapp.Configuration",
"org.eclipse.jetty.webapp.WebAppContext",
"org.springframework.boot.context.embedded.ServletContextInitializer",
"org.springframework.util.Assert",
"org.springframework.util.ClassUtils",
"org.springframework.util.String... | import org.eclipse.jetty.server.SessionManager; import org.eclipse.jetty.webapp.Configuration; import org.eclipse.jetty.webapp.WebAppContext; import org.springframework.boot.context.embedded.ServletContextInitializer; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; | import org.eclipse.jetty.server.*; import org.eclipse.jetty.webapp.*; import org.springframework.boot.context.embedded.*; import org.springframework.util.*; | [
"org.eclipse.jetty",
"org.springframework.boot",
"org.springframework.util"
] | org.eclipse.jetty; org.springframework.boot; org.springframework.util; | 116,940 |
void setPrimaryMember(InternalDistributedMember id) {
if (!getDistributionManager().getId().equals(id)) {
// volunteerForPrimary handles primary state change if its our id
if (isHosting()) {
requestPrimaryState(OTHER_PRIMARY_HOSTING);
}
else {
requestPrimaryState(OTHER_PRIMARY_NOT_HOSTING);
}
}
this.primaryMember.set(id);
this.everHadPrimary = true;
if(id != null && id.equals(primaryElector)) {
primaryElector = null;
}
this.notifyAll(); // wake up any threads in waitForPrimaryMember
} | void setPrimaryMember(InternalDistributedMember id) { if (!getDistributionManager().getId().equals(id)) { if (isHosting()) { requestPrimaryState(OTHER_PRIMARY_HOSTING); } else { requestPrimaryState(OTHER_PRIMARY_NOT_HOSTING); } } this.primaryMember.set(id); this.everHadPrimary = true; if(id != null && id.equals(primaryElector)) { primaryElector = null; } this.notifyAll(); } | /**
* Sets primaryMember and notifies all. Caller must be synced on this.
*
* @param id the member to use as primary for this bucket
*/ | Sets primaryMember and notifies all. Caller must be synced on this | setPrimaryMember | {
"repo_name": "robertgeiger/incubator-geode",
"path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BucketAdvisor.java",
"license": "apache-2.0",
"size": 104869
} | [
"com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember"
] | import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; | import com.gemstone.gemfire.distributed.internal.membership.*; | [
"com.gemstone.gemfire"
] | com.gemstone.gemfire; | 1,503,888 |
List<SurveySection> getSurveySectionList(); | List<SurveySection> getSurveySectionList(); | /**
* Retrieves all the SurveySections in the system.
* @return
*/ | Retrieves all the SurveySections in the system | getSurveySectionList | {
"repo_name": "VHAINNOVATIONS/Mental-Health-eScreening",
"path": "escreening/src/main/java/gov/va/escreening/repository/SurveySectionRepository.java",
"license": "apache-2.0",
"size": 584
} | [
"gov.va.escreening.entity.SurveySection",
"java.util.List"
] | import gov.va.escreening.entity.SurveySection; import java.util.List; | import gov.va.escreening.entity.*; import java.util.*; | [
"gov.va.escreening",
"java.util"
] | gov.va.escreening; java.util; | 2,350,610 |
Table resolveCalciteTable(Schema calciteSchema, List<String> tablePath); | Table resolveCalciteTable(Schema calciteSchema, List<String> tablePath); | /**
* Returns a resolved table given a table path.
*
* <p>Returns null if table is not found.
*/ | Returns a resolved table given a table path. Returns null if table is not found | resolveCalciteTable | {
"repo_name": "axbaretto/beam",
"path": "sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/TableResolver.java",
"license": "apache-2.0",
"size": 1485
} | [
"java.util.List",
"org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.schema.Schema",
"org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.schema.Table"
] | import java.util.List; import org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.schema.Schema; import org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.schema.Table; | import java.util.*; import org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.schema.*; | [
"java.util",
"org.apache.beam"
] | java.util; org.apache.beam; | 1,324,294 |
Set<DeviceId> getNetconfDevices(); | Set<DeviceId> getNetconfDevices(); | /**
* Gets all Netconf Devices.
*
* @return List of all the NetconfDevices Ids
*/ | Gets all Netconf Devices | getNetconfDevices | {
"repo_name": "sdnwiselab/onos",
"path": "protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfController.java",
"license": "apache-2.0",
"size": 2874
} | [
"java.util.Set",
"org.onosproject.net.DeviceId"
] | import java.util.Set; import org.onosproject.net.DeviceId; | import java.util.*; import org.onosproject.net.*; | [
"java.util",
"org.onosproject.net"
] | java.util; org.onosproject.net; | 1,177,882 |
public static String getFormattedMonthDay(Context context, long dateInMillis) {
Time time = new Time();
time.setToNow();
SimpleDateFormat dbDateFormat = new SimpleDateFormat(Utility.DATE_FORMAT);
SimpleDateFormat monthDayFormat = new SimpleDateFormat("MMMM dd");
String monthDayString = monthDayFormat.format(dateInMillis);
return monthDayString;
} | static String function(Context context, long dateInMillis) { Time time = new Time(); time.setToNow(); SimpleDateFormat dbDateFormat = new SimpleDateFormat(Utility.DATE_FORMAT); SimpleDateFormat monthDayFormat = new SimpleDateFormat(STR); String monthDayString = monthDayFormat.format(dateInMillis); return monthDayString; } | /**
* Converts db date format to the format "Month day", e.g "June 24".
*
* @param context Context to use for resource localization
* @param dateInMillis The db formatted date string, expected to be of the form specified
* in Utility.DATE_FORMAT
* @return The day in the form of a string formatted "December 6"
*/ | Converts db date format to the format "Month day", e.g "June 24" | getFormattedMonthDay | {
"repo_name": "ivamluz/iluz-udacity-android-nanodegree-p6-go-ubiquitous",
"path": "app/src/main/java/com/example/android/sunshine/app/Utility.java",
"license": "apache-2.0",
"size": 24827
} | [
"android.content.Context",
"android.text.format.Time",
"java.text.SimpleDateFormat"
] | import android.content.Context; import android.text.format.Time; import java.text.SimpleDateFormat; | import android.content.*; import android.text.format.*; import java.text.*; | [
"android.content",
"android.text",
"java.text"
] | android.content; android.text; java.text; | 787,008 |
private void setInitiatedParameter() {
// first see if we can find an existing Parameter object with this key
ParameterService parameterService = SpringContext.getBean(ParameterService.class);
Parameter runIndicatorParameter = parameterService.getParameter(GenesisBatchStep.class, Job.STEP_RUN_PARM_NM);
if (runIndicatorParameter == null) {
Parameter.Builder newParameter = Builder.create(RUN_INDICATOR_PARAMETER_APPLICATION_NAMESPACE_CODE, RUN_INDICATOR_PARAMETER_NAMESPACE_CODE, RUN_INDICATOR_PARAMETER_NAMESPACE_STEP, Job.STEP_RUN_PARM_NM, ParameterType.Builder.create(RUN_INDICATOR_PARAMETER_TYPE));
newParameter.setValue(RUN_INDICATOR_PARAMETER_VALUE);
newParameter.setEvaluationOperator( EvaluationOperator.ALLOW );
newParameter.setDescription(RUN_INDICATOR_PARAMETER_DESCRIPTION);
parameterService.createParameter(newParameter.build());
} else {
Parameter.Builder updatedParameter = Parameter.Builder.create(runIndicatorParameter);
updatedParameter.setValue(GenesisBatchStep.RUN_INDICATOR_PARAMETER_VALUE);
parameterService.updateParameter(updatedParameter.build());
}
} | void function() { ParameterService parameterService = SpringContext.getBean(ParameterService.class); Parameter runIndicatorParameter = parameterService.getParameter(GenesisBatchStep.class, Job.STEP_RUN_PARM_NM); if (runIndicatorParameter == null) { Parameter.Builder newParameter = Builder.create(RUN_INDICATOR_PARAMETER_APPLICATION_NAMESPACE_CODE, RUN_INDICATOR_PARAMETER_NAMESPACE_CODE, RUN_INDICATOR_PARAMETER_NAMESPACE_STEP, Job.STEP_RUN_PARM_NM, ParameterType.Builder.create(RUN_INDICATOR_PARAMETER_TYPE)); newParameter.setValue(RUN_INDICATOR_PARAMETER_VALUE); newParameter.setEvaluationOperator( EvaluationOperator.ALLOW ); newParameter.setDescription(RUN_INDICATOR_PARAMETER_DESCRIPTION); parameterService.createParameter(newParameter.build()); } else { Parameter.Builder updatedParameter = Parameter.Builder.create(runIndicatorParameter); updatedParameter.setValue(GenesisBatchStep.RUN_INDICATOR_PARAMETER_VALUE); parameterService.updateParameter(updatedParameter.build()); } } | /**
* This method sets a parameter that tells the step that it has already run and it does not need to run again.
*/ | This method sets a parameter that tells the step that it has already run and it does not need to run again | setInitiatedParameter | {
"repo_name": "Ariah-Group/Finance",
"path": "af_webapp/src/main/java/org/kuali/kfs/module/bc/batch/GenesisBatchStep.java",
"license": "apache-2.0",
"size": 4287
} | [
"org.kuali.kfs.sys.batch.Job",
"org.kuali.kfs.sys.context.SpringContext",
"org.kuali.rice.coreservice.api.parameter.EvaluationOperator",
"org.kuali.rice.coreservice.api.parameter.Parameter",
"org.kuali.rice.coreservice.api.parameter.ParameterType",
"org.kuali.rice.coreservice.framework.parameter.Parameter... | import org.kuali.kfs.sys.batch.Job; import org.kuali.kfs.sys.context.SpringContext; import org.kuali.rice.coreservice.api.parameter.EvaluationOperator; import org.kuali.rice.coreservice.api.parameter.Parameter; import org.kuali.rice.coreservice.api.parameter.ParameterType; import org.kuali.rice.coreservice.framework.parameter.ParameterService; | import org.kuali.kfs.sys.batch.*; import org.kuali.kfs.sys.context.*; import org.kuali.rice.coreservice.api.parameter.*; import org.kuali.rice.coreservice.framework.parameter.*; | [
"org.kuali.kfs",
"org.kuali.rice"
] | org.kuali.kfs; org.kuali.rice; | 664,340 |
protected void readAttributeBlock(DataInputStream in) throws IOException {
ADC2Utils.readBlockHeader(in, "Attribute Symbol");
int nAttributes = ADC2Utils.readBase250Word(in);
for (int i = 0; i < nAttributes; ++i) {
int index = ADC2Utils.readBase250Word(in);
SymbolSet.SymbolData symbol = set.getMapBoardSymbol(ADC2Utils.readBase250Word(in));
if (isOnMapBoard(index) && symbol != null)
attributes.add(new HexData(index, symbol));
}
} | void function(DataInputStream in) throws IOException { ADC2Utils.readBlockHeader(in, STR); int nAttributes = ADC2Utils.readBase250Word(in); for (int i = 0; i < nAttributes; ++i) { int index = ADC2Utils.readBase250Word(in); SymbolSet.SymbolData symbol = set.getMapBoardSymbol(ADC2Utils.readBase250Word(in)); if (isOnMapBoard(index) && symbol != null) attributes.add(new HexData(index, symbol)); } } | /**
* Attributes are tertiary symbols, any number of which can be attached to a specific hex. Otherwise, they
* function the same as primary or secondary hex symbols.
*/ | Attributes are tertiary symbols, any number of which can be attached to a specific hex. Otherwise, they function the same as primary or secondary hex symbols | readAttributeBlock | {
"repo_name": "rzymek/vassal-src",
"path": "src/VASSAL/tools/imports/adc2/MapBoard.java",
"license": "lgpl-2.1",
"size": 95356
} | [
"java.io.DataInputStream",
"java.io.IOException"
] | import java.io.DataInputStream; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,015,152 |
protected String getJavaExecutable() {
Toolchain toolchain = this.toolchainManager.getToolchainFromBuildContext("jdk", this.session);
String javaExecutable = (toolchain != null) ? toolchain.findTool("java") : null;
return (javaExecutable != null) ? javaExecutable : new JavaExecutable().toString();
} | String function() { Toolchain toolchain = this.toolchainManager.getToolchainFromBuildContext("jdk", this.session); String javaExecutable = (toolchain != null) ? toolchain.findTool("java") : null; return (javaExecutable != null) ? javaExecutable : new JavaExecutable().toString(); } | /**
* Provides access to the java binary executable, regardless of OS.
* @return the java executable
*/ | Provides access to the java binary executable, regardless of OS | getJavaExecutable | {
"repo_name": "joshiste/spring-boot",
"path": "spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java",
"license": "apache-2.0",
"size": 18575
} | [
"org.apache.maven.toolchain.Toolchain",
"org.springframework.boot.loader.tools.JavaExecutable"
] | import org.apache.maven.toolchain.Toolchain; import org.springframework.boot.loader.tools.JavaExecutable; | import org.apache.maven.toolchain.*; import org.springframework.boot.loader.tools.*; | [
"org.apache.maven",
"org.springframework.boot"
] | org.apache.maven; org.springframework.boot; | 1,027,983 |
public static int queryPendingCount(Connection db, int userId) throws SQLException {
int toReturn = 0;
String sql =
"SELECT count(*) as taskcount " +
"FROM task " +
"WHERE owner = ? AND complete = ? ";
int i = 0;
PreparedStatement pst = db.prepareStatement(sql);
pst.setInt(++i, userId);
pst.setBoolean(++i, false);
ResultSet rs = pst.executeQuery();
if (rs.next()) {
toReturn = rs.getInt("taskcount");
}
rs.close();
pst.close();
return toReturn;
} | static int function(Connection db, int userId) throws SQLException { int toReturn = 0; String sql = STR + STR + STR; int i = 0; PreparedStatement pst = db.prepareStatement(sql); pst.setInt(++i, userId); pst.setBoolean(++i, false); ResultSet rs = pst.executeQuery(); if (rs.next()) { toReturn = rs.getInt(STR); } rs.close(); pst.close(); return toReturn; } | /**
* Description of the Method
*
* @param db Description of the Parameter
* @param userId Description of the Parameter
* @return Description of the Return Value
* @throws SQLException Description of the Exception
*/ | Description of the Method | queryPendingCount | {
"repo_name": "yukoff/concourse-connect",
"path": "src/main/java/com/concursive/connect/web/modules/lists/dao/TaskList.java",
"license": "agpl-3.0",
"size": 23736
} | [
"java.sql.Connection",
"java.sql.PreparedStatement",
"java.sql.ResultSet",
"java.sql.SQLException"
] | import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,106,839 |
@Override
public void removeNotify() {
// we only do the following hack if we are dealing with scoped variables
// when we delete a variable from scope, the variables parent will
// be null, so we need to filter this
EObject eObj = ((EObject) getParent().getModel()).eContainer();
if (eObj != null && !(eObj instanceof Scope)) {
super.removeNotify();
return;
}
if (getSelected() != SELECTED_NONE) {
// getViewer().deselect(this);
// instead of deselecting this entry (which would cause the process to be selected)
// we should ask the parent edit part to select some other child
((BPELTrayCategoryEditPart)getParent()).selectAnotherEntry();
}
if (hasFocus())
getViewer().setFocus(null);
List<EditPart> children = getChildren();
for (int i = 0; i < children.size(); i++)
children.get(i).removeNotify();
unregister();
} | void function() { EObject eObj = ((EObject) getParent().getModel()).eContainer(); if (eObj != null && !(eObj instanceof Scope)) { super.removeNotify(); return; } if (getSelected() != SELECTED_NONE) { ((BPELTrayCategoryEditPart)getParent()).selectAnotherEntry(); } if (hasFocus()) getViewer().setFocus(null); List<EditPart> children = getChildren(); for (int i = 0; i < children.size(); i++) children.get(i).removeNotify(); unregister(); } | /**
* HACK
* See comments in org.eclipse.bpel.ui.editparts.BPELTrayCategoryEditPart.selectAnotherEntry()
*/ | HACK See comments in org.eclipse.bpel.ui.editparts.BPELTrayCategoryEditPart.selectAnotherEntry() | removeNotify | {
"repo_name": "Drifftr/devstudio-tooling-bps",
"path": "plugins/org.eclipse.bpel.ui.noEmbeddedEditors/src/org/eclipse/bpel/ui/editparts/BPELTrayCategoryEntryEditPart.java",
"license": "apache-2.0",
"size": 5849
} | [
"java.util.List",
"org.eclipse.bpel.model.Scope",
"org.eclipse.emf.ecore.EObject",
"org.eclipse.gef.EditPart"
] | import java.util.List; import org.eclipse.bpel.model.Scope; import org.eclipse.emf.ecore.EObject; import org.eclipse.gef.EditPart; | import java.util.*; import org.eclipse.bpel.model.*; import org.eclipse.emf.ecore.*; import org.eclipse.gef.*; | [
"java.util",
"org.eclipse.bpel",
"org.eclipse.emf",
"org.eclipse.gef"
] | java.util; org.eclipse.bpel; org.eclipse.emf; org.eclipse.gef; | 1,522,145 |
void update (JSONObject updates, Class<?> receiver) {
mergeJSONObjects(updates);
persist(null);
if (getType() != Type.TRIGGERED)
return;
Intent intent = new Intent(context, receiver)
.setAction(PREF_KEY_ID + options.getId())
.putExtra(Notification.EXTRA_ID, options.getId())
.putExtra(Notification.EXTRA_UPDATE, true);
trigger(intent, receiver);
} | void update (JSONObject updates, Class<?> receiver) { mergeJSONObjects(updates); persist(null); if (getType() != Type.TRIGGERED) return; Intent intent = new Intent(context, receiver) .setAction(PREF_KEY_ID + options.getId()) .putExtra(Notification.EXTRA_ID, options.getId()) .putExtra(Notification.EXTRA_UPDATE, true); trigger(intent, receiver); } | /**
* Update the notification properties.
*
* @param updates The properties to update.
* @param receiver Receiver to handle the trigger event.
*/ | Update the notification properties | update | {
"repo_name": "sabrinathai/ExperienceSampler",
"path": "Example ExperienceSampler/exampleExperienceSampleriOS/plugins/cordova-plugin-local-notification/src/android/notification/Notification.java",
"license": "mit",
"size": 14605
} | [
"android.content.Intent",
"org.json.JSONObject"
] | import android.content.Intent; import org.json.JSONObject; | import android.content.*; import org.json.*; | [
"android.content",
"org.json"
] | android.content; org.json; | 440,201 |
void onVideoEnabled(DecoderCounters counters); | void onVideoEnabled(DecoderCounters counters); | /**
* Called when the renderer is enabled.
*
* @param counters {@link DecoderCounters} that will be updated by the renderer for as long as it
* remains enabled.
*/ | Called when the renderer is enabled | onVideoEnabled | {
"repo_name": "gysgogo/levetube",
"path": "lib/src/main/java/com/google/android/exoplayer2/video/VideoRendererEventListener.java",
"license": "gpl-3.0",
"size": 8216
} | [
"com.google.android.exoplayer2.decoder.DecoderCounters"
] | import com.google.android.exoplayer2.decoder.DecoderCounters; | import com.google.android.exoplayer2.decoder.*; | [
"com.google.android"
] | com.google.android; | 1,442,896 |
private void bindAuthenticationProviders(Collection<Class<AuthenticationProvider>> authProviders) {
// Bind each authentication provider within extension
for (Class<AuthenticationProvider> authenticationProvider : authProviders)
bindAuthenticationProvider(authenticationProvider);
} | void function(Collection<Class<AuthenticationProvider>> authProviders) { for (Class<AuthenticationProvider> authenticationProvider : authProviders) bindAuthenticationProvider(authenticationProvider); } | /**
* Binds each of the the given AuthenticationProvider classes such that any
* service requiring access to the AuthenticationProvider can obtain it via
* injection.
*
* @param authProviders
* The AuthenticationProvider classes to bind.
*/ | Binds each of the the given AuthenticationProvider classes such that any service requiring access to the AuthenticationProvider can obtain it via injection | bindAuthenticationProviders | {
"repo_name": "softpymesJeffer/incubator-guacamole-client",
"path": "guacamole/src/main/java/org/apache/guacamole/extension/ExtensionModule.java",
"license": "apache-2.0",
"size": 15572
} | [
"java.util.Collection",
"org.apache.guacamole.net.auth.AuthenticationProvider"
] | import java.util.Collection; import org.apache.guacamole.net.auth.AuthenticationProvider; | import java.util.*; import org.apache.guacamole.net.auth.*; | [
"java.util",
"org.apache.guacamole"
] | java.util; org.apache.guacamole; | 2,868,006 |
static public Graph getMoleculeGraph(
IAtomContainer molecule,
boolean respectBondOrder,
boolean respectRing,
boolean atomType) {
Map<Integer, StringBuilder> vertices = new HashMap<>();
Graph graph = new Multigraph<>(StringBuilder.class);
for (int i = 0; i < molecule.getAtomCount(); i++) {
IAtom atom = molecule.getAtom(i);
int id = molecule.indexOf(atom);
String label;
if (atomType) {
label = atom.getSymbol() + ":" + atom.getAtomTypeName();
} else {
label = atom.getSymbol();
}
StringBuilder node = new StringBuilder(label);
// StringLabeledObject node = new StringLabeledObject(label + ":" + id);
graph.addVertex(node);
vertices.put(id, node);
}
for (int i = 0; i < molecule.getBondCount(); i++) {
IBond bond = molecule.getBond(i);
int begin = molecule.indexOf(bond.getBegin());
int end = molecule.indexOf(bond.getEnd());
// String label = molecule.indexOf(bond) + "";
String label;
if (respectBondOrder) {
label = bond.getOrder().numeric() + "";
} else {
label = IBond.Order.UNSET.numeric() + "";
}
// System.out.println("Bond Label: " + label);
StringBuilder node = new StringBuilder(label);
graph.addEdge(vertices.get(begin), vertices.get(end), node);
}
return graph;
} | static Graph function( IAtomContainer molecule, boolean respectBondOrder, boolean respectRing, boolean atomType) { Map<Integer, StringBuilder> vertices = new HashMap<>(); Graph graph = new Multigraph<>(StringBuilder.class); for (int i = 0; i < molecule.getAtomCount(); i++) { IAtom atom = molecule.getAtom(i); int id = molecule.indexOf(atom); String label; if (atomType) { label = atom.getSymbol() + ":" + atom.getAtomTypeName(); } else { label = atom.getSymbol(); } StringBuilder node = new StringBuilder(label); graph.addVertex(node); vertices.put(id, node); } for (int i = 0; i < molecule.getBondCount(); i++) { IBond bond = molecule.getBond(i); int begin = molecule.indexOf(bond.getBegin()); int end = molecule.indexOf(bond.getEnd()); String label; if (respectBondOrder) { label = bond.getOrder().numeric() + STR"; } StringBuilder node = new StringBuilder(label); graph.addEdge(vertices.get(begin), vertices.get(end), node); } return graph; } | /**
* Creates a molecule graph for use with jgrapht.Bond - orders can be chosen
*
* @param molecule the specified molecule
* @param respectBondOrder include bond order
* @param respectRing
* @param atomType
* @return a graph representing the molecule
*/ | Creates a molecule graph for use with jgrapht.Bond - orders can be chosen | getMoleculeGraph | {
"repo_name": "asad/ReactionDecoder",
"path": "src/main/java/org/openscience/smsd/graph/MoleculeAsGraph.java",
"license": "lgpl-3.0",
"size": 2631
} | [
"java.util.HashMap",
"java.util.Map",
"org.jgrapht.Graph",
"org.jgrapht.graph.Multigraph",
"org.openscience.cdk.interfaces.IAtom",
"org.openscience.cdk.interfaces.IAtomContainer",
"org.openscience.cdk.interfaces.IBond"
] | import java.util.HashMap; import java.util.Map; import org.jgrapht.Graph; import org.jgrapht.graph.Multigraph; import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.interfaces.IBond; | import java.util.*; import org.jgrapht.*; import org.jgrapht.graph.*; import org.openscience.cdk.interfaces.*; | [
"java.util",
"org.jgrapht",
"org.jgrapht.graph",
"org.openscience.cdk"
] | java.util; org.jgrapht; org.jgrapht.graph; org.openscience.cdk; | 1,924,649 |
public int getFireSpread(IBlockAccess iba, int x, int y, int z, ForgeDirection side, Block b, int meta); | int function(IBlockAccess iba, int x, int y, int z, ForgeDirection side, Block b, int meta); | /**
* Effectively overrides Block.getFireSpreadSpeed
*/ | Effectively overrides Block.getFireSpreadSpeed | getFireSpread | {
"repo_name": "Techern/carpentersblocks",
"path": "src/main/java/com/carpentersblocks/api/IWrappableBlock.java",
"license": "lgpl-2.1",
"size": 2502
} | [
"net.minecraft.block.Block",
"net.minecraft.world.IBlockAccess",
"net.minecraftforge.common.util.ForgeDirection"
] | import net.minecraft.block.Block; import net.minecraft.world.IBlockAccess; import net.minecraftforge.common.util.ForgeDirection; | import net.minecraft.block.*; import net.minecraft.world.*; import net.minecraftforge.common.util.*; | [
"net.minecraft.block",
"net.minecraft.world",
"net.minecraftforge.common"
] | net.minecraft.block; net.minecraft.world; net.minecraftforge.common; | 1,546,149 |
private void initialize(final Item1Button _i1b, final String _text,
final int _plusXLocation, final int _plusYLocation) {
_i1b.setOpaque(true);
_i1b.setBackground(Color.white);
_i1b.setBorder(BorderFactory.createCompoundBorder(
new LineBorder(Color.black),
new LineBorder(Color.lightGray)));
_i1b.setText(_text);
_i1b.enableText();
_i1b.setSize((ViewSettings.getView_size_new().width - (2 + 1)
* distanceBetweenItems) / 2,
heightImageButton);
_i1b.setActivable(true);
_i1b.addActionListener(c_new);
_i1b.setLocation(distanceBetweenItems + _plusXLocation,
_plusYLocation);
_i1b.setIconLabelY((_i1b.getHeight()
- _i1b.getImageHeight()) / 2);
_i1b.setIconLabelX(2 + 1);
_i1b.setBorder(true);
jpnl_stuff.add(_i1b);
}
| void function(final Item1Button _i1b, final String _text, final int _plusXLocation, final int _plusYLocation) { _i1b.setOpaque(true); _i1b.setBackground(Color.white); _i1b.setBorder(BorderFactory.createCompoundBorder( new LineBorder(Color.black), new LineBorder(Color.lightGray))); _i1b.setText(_text); _i1b.enableText(); _i1b.setSize((ViewSettings.getView_size_new().width - (2 + 1) * distanceBetweenItems) / 2, heightImageButton); _i1b.setActivable(true); _i1b.addActionListener(c_new); _i1b.setLocation(distanceBetweenItems + _plusXLocation, _plusYLocation); _i1b.setIconLabelY((_i1b.getHeight() - _i1b.getImageHeight()) / 2); _i1b.setIconLabelX(2 + 1); _i1b.setBorder(true); jpnl_stuff.add(_i1b); } | /**
* Initialize one page - item.
* @param _i1b the page item
* @param _text the text
* @param _plusXLocation the amount of pixel which is added to the
* x coordinate of the component
* @param _plusYLocation the amount of pixel which is added to the
* x coordinate of the component
*/ | Initialize one page - item | initialize | {
"repo_name": "juliusHuelsmann/paint",
"path": "PaintNotes/src/main/java/view/forms/New.java",
"license": "apache-2.0",
"size": 23115
} | [
"java.awt.Color",
"javax.swing.BorderFactory",
"javax.swing.border.LineBorder"
] | import java.awt.Color; import javax.swing.BorderFactory; import javax.swing.border.LineBorder; | import java.awt.*; import javax.swing.*; import javax.swing.border.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 129,415 |
@SuppressWarnings("unchecked")
public final void run() {
while (true) {
try {
WeakReference<Remote> remove = (WeakReference<Remote>) stubsQueue
.remove();
do {
Pair<Endpoint, ObjID> data = referenceDataTable.get(remove);
if (dgc.isLiveReference(data)) {
dgc.cancelDirtyCall(data.getFirst(), data.getSecond());
enqueueCleanCall(data.getFirst(), data.getSecond());
}
referenceDataTable.remove(remove);
} while ((remove = (WeakReference<Remote>) stubsQueue.poll())
!= null);
sendQueuedCalls();
} catch (InterruptedException e) {
}
}
} | @SuppressWarnings(STR) final void function() { while (true) { try { WeakReference<Remote> remove = (WeakReference<Remote>) stubsQueue .remove(); do { Pair<Endpoint, ObjID> data = referenceDataTable.get(remove); if (dgc.isLiveReference(data)) { dgc.cancelDirtyCall(data.getFirst(), data.getSecond()); enqueueCleanCall(data.getFirst(), data.getSecond()); } referenceDataTable.remove(remove); } while ((remove = (WeakReference<Remote>) stubsQueue.poll()) != null); sendQueuedCalls(); } catch (InterruptedException e) { } } } | /**
* Waits for the local garbage collector to collect a stub, and then removes
* the reference corresponding to that stub from the Client DGC's "live"
* references table, stops sending dirty calls for that reference, and sends
* a clean call for that reference to te remote server's garbage collector.
*
*/ | Waits for the local garbage collector to collect a stub, and then removes the reference corresponding to that stub from the Client DGC's "live" references table, stops sending dirty calls for that reference, and sends a clean call for that reference to te remote server's garbage collector | run | {
"repo_name": "freeVM/freeVM",
"path": "enhanced/archive/classlib/modules/rmi2/src/ar/org/fitc/rmi/dgc/client/DGCQueuePoll.java",
"license": "apache-2.0",
"size": 5308
} | [
"ar.org.fitc.rmi.transport.Endpoint",
"ar.org.fitc.rmi.utils.Pair",
"java.lang.ref.WeakReference",
"java.rmi.Remote",
"java.rmi.server.ObjID"
] | import ar.org.fitc.rmi.transport.Endpoint; import ar.org.fitc.rmi.utils.Pair; import java.lang.ref.WeakReference; import java.rmi.Remote; import java.rmi.server.ObjID; | import ar.org.fitc.rmi.transport.*; import ar.org.fitc.rmi.utils.*; import java.lang.ref.*; import java.rmi.*; import java.rmi.server.*; | [
"ar.org.fitc",
"java.lang",
"java.rmi"
] | ar.org.fitc; java.lang; java.rmi; | 1,505,409 |
private void compareRecords(String expectedLine, String receivedLine)
throws IOException {
// handle null case
if (expectedLine == null || receivedLine == null) {
return;
}
// check if lines are equal
if (expectedLine.equals(receivedLine)) {
return;
}
// check if size is the same
String [] expectedValues = expectedLine.split(",");
String [] receivedValues = receivedLine.split(",");
if (expectedValues.length != 7 || receivedValues.length != 7) {
LOG.error("Number of expected fields did not match "
+ "number of received fields");
throw new IOException("Number of expected fields did not match "
+ "number of received fields");
}
// check first 5 values
boolean mismatch = false;
for (int i = 0; !mismatch && i < 5; i++) {
mismatch = !expectedValues[i].equals(receivedValues[i]);
}
if (mismatch) {
throw new IOException("Expected:<" + expectedLine + "> but was:<"
+ receivedLine + ">");
}
Date expectedDate = null;
Date receivedDate = null;
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
int offset = TimeZone.getDefault().getOffset(System.currentTimeMillis())
/ 3600000;
for (int i = 5; i < 7; i++) {
// parse expected timestamp.
try {
expectedDate = df.parse(expectedValues[i]);
} catch (ParseException ex) {
LOG.error("Could not parse expected timestamp: " + expectedValues[i]);
throw new IOException("Could not parse expected timestamp: "
+ expectedValues[i]);
}
// parse received timestamp
try {
receivedDate = df.parse(receivedValues[i]);
} catch (ParseException ex) {
LOG.error("Could not parse received timestamp: " + receivedValues[i]);
throw new IOException("Could not parse received timestamp: "
+ receivedValues[i]);
}
// compare two timestamps considering timezone offset
Calendar expectedCal = Calendar.getInstance();
expectedCal.setTime(expectedDate);
expectedCal.add(Calendar.HOUR, offset);
Calendar receivedCal = Calendar.getInstance();
receivedCal.setTime(receivedDate);
if (!expectedCal.equals(receivedCal)) {
throw new IOException("Expected:<" + expectedLine + "> but was:<"
+ receivedLine + ">, while timezone offset is: " + offset);
}
}
} | void function(String expectedLine, String receivedLine) throws IOException { if (expectedLine == null receivedLine == null) { return; } if (expectedLine.equals(receivedLine)) { return; } String [] expectedValues = expectedLine.split(","); String [] receivedValues = receivedLine.split(","); if (expectedValues.length != 7 receivedValues.length != 7) { LOG.error(STR + STR); throw new IOException(STR + STR); } boolean mismatch = false; for (int i = 0; !mismatch && i < 5; i++) { mismatch = !expectedValues[i].equals(receivedValues[i]); } if (mismatch) { throw new IOException(STR + expectedLine + STR + receivedLine + ">"); } Date expectedDate = null; Date receivedDate = null; DateFormat df = new SimpleDateFormat(STR); int offset = TimeZone.getDefault().getOffset(System.currentTimeMillis()) / 3600000; for (int i = 5; i < 7; i++) { try { expectedDate = df.parse(expectedValues[i]); } catch (ParseException ex) { LOG.error(STR + expectedValues[i]); throw new IOException(STR + expectedValues[i]); } try { receivedDate = df.parse(receivedValues[i]); } catch (ParseException ex) { LOG.error(STR + receivedValues[i]); throw new IOException(STR + receivedValues[i]); } Calendar expectedCal = Calendar.getInstance(); expectedCal.setTime(expectedDate); expectedCal.add(Calendar.HOUR, offset); Calendar receivedCal = Calendar.getInstance(); receivedCal.setTime(receivedDate); if (!expectedCal.equals(receivedCal)) { throw new IOException(STR + expectedLine + STR + receivedLine + STR + offset); } } } | /**
* Compare two lines. Normalize the dates we receive based on the expected
* time zone.
* @param expectedLine expected line
* @param receivedLine received line
* @throws IOException exception during lines comparison
*/ | Compare two lines. Normalize the dates we receive based on the expected time zone | compareRecords | {
"repo_name": "bonnetb/sqoop",
"path": "src/test/com/cloudera/sqoop/manager/OracleManagerTest.java",
"license": "apache-2.0",
"size": 18819
} | [
"java.io.IOException",
"java.text.DateFormat",
"java.text.ParseException",
"java.text.SimpleDateFormat",
"java.util.Calendar",
"java.util.Date",
"java.util.TimeZone"
] | import java.io.IOException; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; | import java.io.*; import java.text.*; import java.util.*; | [
"java.io",
"java.text",
"java.util"
] | java.io; java.text; java.util; | 1,447,503 |
public NatGatewayInner withPublicIpAddresses(List<SubResource> publicIpAddresses) {
this.publicIpAddresses = publicIpAddresses;
return this;
} | NatGatewayInner function(List<SubResource> publicIpAddresses) { this.publicIpAddresses = publicIpAddresses; return this; } | /**
* Set an array of public ip addresses associated with the nat gateway resource.
*
* @param publicIpAddresses the publicIpAddresses value to set
* @return the NatGatewayInner object itself.
*/ | Set an array of public ip addresses associated with the nat gateway resource | withPublicIpAddresses | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_04_01/src/main/java/com/microsoft/azure/management/network/v2019_04_01/implementation/NatGatewayInner.java",
"license": "mit",
"size": 7602
} | [
"com.microsoft.azure.SubResource",
"java.util.List"
] | import com.microsoft.azure.SubResource; import java.util.List; | import com.microsoft.azure.*; import java.util.*; | [
"com.microsoft.azure",
"java.util"
] | com.microsoft.azure; java.util; | 1,966,418 |
public Map<String, KrakenLedger> getKrakenLedgerInfo() throws IOException {
return getKrakenLedgerInfo(null, null, null, null);
} | Map<String, KrakenLedger> function() throws IOException { return getKrakenLedgerInfo(null, null, null, null); } | /**
* Retrieves the full account Ledger which represents all account asset activity.
*
* @return
* @throws IOException
*/ | Retrieves the full account Ledger which represents all account asset activity | getKrakenLedgerInfo | {
"repo_name": "jennieolsson/XChange",
"path": "xchange-kraken/src/main/java/com/xeiam/xchange/kraken/service/polling/KrakenAccountServiceRaw.java",
"license": "mit",
"size": 6667
} | [
"com.xeiam.xchange.kraken.dto.account.KrakenLedger",
"java.io.IOException",
"java.util.Map"
] | import com.xeiam.xchange.kraken.dto.account.KrakenLedger; import java.io.IOException; import java.util.Map; | import com.xeiam.xchange.kraken.dto.account.*; import java.io.*; import java.util.*; | [
"com.xeiam.xchange",
"java.io",
"java.util"
] | com.xeiam.xchange; java.io; java.util; | 2,618,177 |
public static void writeLines(Iterable<? extends CharSequence> lines, Charset cs, OutputStream out) throws IOException {
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, cs));
for (CharSequence line : lines) {
writer.write(line.toString());
writer.newLine();
}
writer.flush();
} | static void function(Iterable<? extends CharSequence> lines, Charset cs, OutputStream out) throws IOException { BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, cs)); for (CharSequence line : lines) { writer.write(line.toString()); writer.newLine(); } writer.flush(); } | /**
* Write lines of text to a file.
*
* @param lines
* the lines of text to write.
* @param cs
* the Charset to use.
* @param out
* the output stream to write to
* @throws IOException
* if an I/O error was produced while writing the stream.
*/ | Write lines of text to a file | writeLines | {
"repo_name": "benvanwerkhoven/Xenon",
"path": "src/main/java/nl/esciencecenter/xenon/util/Utils.java",
"license": "apache-2.0",
"size": 43661
} | [
"java.io.BufferedWriter",
"java.io.IOException",
"java.io.OutputStream",
"java.io.OutputStreamWriter",
"java.nio.charset.Charset"
] | import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.nio.charset.Charset; | import java.io.*; import java.nio.charset.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 1,925,063 |
default Function<T, R> toFunction() {
return this::transform;
} | default Function<T, R> toFunction() { return this::transform; } | /**
* Transform the function interface.
*/ | Transform the function interface | toFunction | {
"repo_name": "simonpatrick/stepbystep-java",
"path": "spring-demo/docs/learningMVC/common/src/main/java/com/common/util/Assembler.java",
"license": "gpl-3.0",
"size": 3934
} | [
"java.util.function.Function"
] | import java.util.function.Function; | import java.util.function.*; | [
"java.util"
] | java.util; | 673,201 |
public void validateSectionsAndTeams(List<StudentAttributes> studentList, String courseId) throws EnrollException {
List<StudentAttributes> mergedList = getMergedList(studentList, courseId);
if (mergedList.size() < 2) { // no conflicts
return;
}
String errorMessage = getSectionInvalidityInfo(mergedList) + getTeamInvalidityInfo(mergedList);
if (!errorMessage.isEmpty()) {
throw new EnrollException(errorMessage);
}
} | void function(List<StudentAttributes> studentList, String courseId) throws EnrollException { List<StudentAttributes> mergedList = getMergedList(studentList, courseId); if (mergedList.size() < 2) { return; } String errorMessage = getSectionInvalidityInfo(mergedList) + getTeamInvalidityInfo(mergedList); if (!errorMessage.isEmpty()) { throw new EnrollException(errorMessage); } } | /**
* Validates sections for any limit violations and teams for any team name violations.
*/ | Validates sections for any limit violations and teams for any team name violations | validateSectionsAndTeams | {
"repo_name": "guzman890/EpisMates",
"path": "src/main/java/teammates/logic/core/StudentsLogic.java",
"license": "gpl-2.0",
"size": 29572
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 675,401 |
@ServiceMethod(returns = ReturnType.SINGLE)
ArmDisasterRecoveryInner createOrUpdate(
String resourceGroupName, String namespaceName, String alias, ArmDisasterRecoveryInner parameters); | @ServiceMethod(returns = ReturnType.SINGLE) ArmDisasterRecoveryInner createOrUpdate( String resourceGroupName, String namespaceName, String alias, ArmDisasterRecoveryInner parameters); | /**
* Creates or updates a new Alias(Disaster Recovery configuration).
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param alias The Disaster Recovery configuration name.
* @param parameters Parameters required to create an Alias(Disaster Recovery configuration).
* @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 single item in List or Get Alias(Disaster Recovery configuration) operation.
*/ | Creates or updates a new Alias(Disaster Recovery configuration) | createOrUpdate | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-servicebus/src/main/java/com/azure/resourcemanager/servicebus/fluent/DisasterRecoveryConfigsClient.java",
"license": "mit",
"size": 35020
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.servicebus.fluent.models.ArmDisasterRecoveryInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.servicebus.fluent.models.ArmDisasterRecoveryInner; | import com.azure.core.annotation.*; import com.azure.resourcemanager.servicebus.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 2,117,516 |
public synchronized void
dumpConnectionInfo(PrintWriter pwriter, boolean brief)
{
Channel channel = sk.channel();
if (channel instanceof SocketChannel) {
pwriter.print(" ");
pwriter.print(((SocketChannel)channel).socket()
.getRemoteSocketAddress());
pwriter.print("[");
pwriter.print(sk.isValid() ? Integer.toHexString(sk.interestOps())
: "0");
pwriter.print("](queued=");
pwriter.print(getOutstandingRequests());
pwriter.print(",recved=");
pwriter.print(getPacketsReceived());
pwriter.print(",sent=");
pwriter.print(getPacketsSent());
if (!brief) {
long sessionId = getSessionId();
if (sessionId != 0) {
pwriter.print(",sid=0x");
pwriter.print(Long.toHexString(sessionId));
pwriter.print(",lop=");
pwriter.print(getLastOperation());
pwriter.print(",est=");
pwriter.print(getEstablished().getTime());
pwriter.print(",to=");
pwriter.print(getSessionTimeout());
long lastCxid = getLastCxid();
if (lastCxid >= 0) {
pwriter.print(",lcxid=0x");
pwriter.print(Long.toHexString(lastCxid));
}
pwriter.print(",lzxid=0x");
pwriter.print(Long.toHexString(getLastZxid()));
pwriter.print(",lresp=");
pwriter.print(getLastResponseTime());
pwriter.print(",llat=");
pwriter.print(getLastLatency());
pwriter.print(",minlat=");
pwriter.print(getMinLatency());
pwriter.print(",avglat=");
pwriter.print(getAvgLatency());
pwriter.print(",maxlat=");
pwriter.print(getMaxLatency());
}
}
pwriter.println(")");
}
}
} | synchronized void function(PrintWriter pwriter, boolean brief) { Channel channel = sk.channel(); if (channel instanceof SocketChannel) { pwriter.print(" "); pwriter.print(((SocketChannel)channel).socket() .getRemoteSocketAddress()); pwriter.print("["); pwriter.print(sk.isValid() ? Integer.toHexString(sk.interestOps()) : "0"); pwriter.print(STR); pwriter.print(getOutstandingRequests()); pwriter.print(STR); pwriter.print(getPacketsReceived()); pwriter.print(STR); pwriter.print(getPacketsSent()); if (!brief) { long sessionId = getSessionId(); if (sessionId != 0) { pwriter.print(STR); pwriter.print(Long.toHexString(sessionId)); pwriter.print(",lop="); pwriter.print(getLastOperation()); pwriter.print(",est="); pwriter.print(getEstablished().getTime()); pwriter.print(",to="); pwriter.print(getSessionTimeout()); long lastCxid = getLastCxid(); if (lastCxid >= 0) { pwriter.print(STR); pwriter.print(Long.toHexString(lastCxid)); } pwriter.print(STR); pwriter.print(Long.toHexString(getLastZxid())); pwriter.print(STR); pwriter.print(getLastResponseTime()); pwriter.print(STR); pwriter.print(getLastLatency()); pwriter.print(STR); pwriter.print(getMinLatency()); pwriter.print(STR); pwriter.print(getAvgLatency()); pwriter.print(STR); pwriter.print(getMaxLatency()); } } pwriter.println(")"); } } } | /**
* Print information about the connection.
* @param brief iff true prints brief details, otw full detail
* @return information about this connection
*/ | Print information about the connection | dumpConnectionInfo | {
"repo_name": "zhushuchen/Ocean",
"path": "组件/zookeeper-3.3.6/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java",
"license": "agpl-3.0",
"size": 65026
} | [
"java.io.PrintWriter",
"java.nio.channels.Channel",
"java.nio.channels.SocketChannel"
] | import java.io.PrintWriter; import java.nio.channels.Channel; import java.nio.channels.SocketChannel; | import java.io.*; import java.nio.channels.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 2,565,351 |
private JMeterTreeNode findFirstNodeOfType(Class<?> type, JMeterTreeModel treeModel) {
return treeModel.getNodesOfType(type).stream()
.filter(JMeterTreeNode::isEnabled)
.findFirst()
.orElse(null);
} | JMeterTreeNode function(Class<?> type, JMeterTreeModel treeModel) { return treeModel.getNodesOfType(type).stream() .filter(JMeterTreeNode::isEnabled) .findFirst() .orElse(null); } | /**
* Finds the first enabled node of a given type in the tree.
*
* @param type class of the node to be found
* @param treeModel the tree to search in
* @return the first node of the given type in the test component tree, or
* <code>null</code> if none was found.
*/ | Finds the first enabled node of a given type in the tree | findFirstNodeOfType | {
"repo_name": "vherilier/jmeter",
"path": "test/src/org/apache/jmeter/visualizers/GenerateTreeGui.java",
"license": "apache-2.0",
"size": 8887
} | [
"org.apache.jmeter.gui.tree.JMeterTreeModel",
"org.apache.jmeter.gui.tree.JMeterTreeNode"
] | import org.apache.jmeter.gui.tree.JMeterTreeModel; import org.apache.jmeter.gui.tree.JMeterTreeNode; | import org.apache.jmeter.gui.tree.*; | [
"org.apache.jmeter"
] | org.apache.jmeter; | 2,906,374 |
public static void dumpSpans(CharSequence cs, Printer printer, String prefix) {
if (cs instanceof Spanned) {
Spanned sp = (Spanned) cs;
Object[] os = sp.getSpans(0, cs.length(), Object.class);
for (int i = 0; i < os.length; i++) {
Object o = os[i];
printer.println(prefix + cs.subSequence(sp.getSpanStart(o),
sp.getSpanEnd(o)) + ": "
+ Integer.toHexString(System.identityHashCode(o))
+ " " + o.getClass().getCanonicalName()
+ " (" + sp.getSpanStart(o) + "-" + sp.getSpanEnd(o)
+ ") fl=#" + sp.getSpanFlags(o));
}
} else {
printer.println(prefix + cs + ": (no spans)");
}
} | static void function(CharSequence cs, Printer printer, String prefix) { if (cs instanceof Spanned) { Spanned sp = (Spanned) cs; Object[] os = sp.getSpans(0, cs.length(), Object.class); for (int i = 0; i < os.length; i++) { Object o = os[i]; printer.println(prefix + cs.subSequence(sp.getSpanStart(o), sp.getSpanEnd(o)) + STR + Integer.toHexString(System.identityHashCode(o)) + " " + o.getClass().getCanonicalName() + STR + sp.getSpanStart(o) + "-" + sp.getSpanEnd(o) + STR + sp.getSpanFlags(o)); } } else { printer.println(prefix + cs + STR); } } | /**
* Debugging tool to print the spans in a CharSequence. The output will
* be printed one span per line. If the CharSequence is not a Spanned,
* then the entire string will be printed on a single line.
*/ | Debugging tool to print the spans in a CharSequence. The output will be printed one span per line. If the CharSequence is not a Spanned, then the entire string will be printed on a single line | dumpSpans | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "frameworks/base/core/java/android/text/TextUtils.java",
"license": "gpl-3.0",
"size": 60007
} | [
"android.util.Printer"
] | import android.util.Printer; | import android.util.*; | [
"android.util"
] | android.util; | 1,063,447 |
public SaaSposeResponse PutCalendarException (String name, Integer calendarUid, Integer index, String fileName, String storage, String folder, CalendarException body) {
Object postBody = body;
// verify required params are set
if(name == null || calendarUid == null || index == null || body == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/tasks/{name}/calendars/{calendarUid}/calendarExceptions/{index}/?appSid={appSid}&fileName={fileName}&storage={storage}&folder={folder}";
resourcePath = resourcePath.replaceAll("\\*", "").replace("&", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(name!=null)
resourcePath = resourcePath.replace("{" + "name" + "}" , apiInvoker.toPathValue(name));
else
resourcePath = resourcePath.replaceAll("[&?]name.*?(?=&|\\?|$)", "");
if(calendarUid!=null)
resourcePath = resourcePath.replace("{" + "calendarUid" + "}" , apiInvoker.toPathValue(calendarUid));
else
resourcePath = resourcePath.replaceAll("[&?]calendarUid.*?(?=&|\\?|$)", "");
if(index!=null)
resourcePath = resourcePath.replace("{" + "index" + "}" , apiInvoker.toPathValue(index));
else
resourcePath = resourcePath.replaceAll("[&?]index.*?(?=&|\\?|$)", "");
if(fileName!=null)
resourcePath = resourcePath.replace("{" + "fileName" + "}" , apiInvoker.toPathValue(fileName));
else
resourcePath = resourcePath.replaceAll("[&?]fileName.*?(?=&|\\?|$)", "");
if(storage!=null)
resourcePath = resourcePath.replace("{" + "storage" + "}" , apiInvoker.toPathValue(storage));
else
resourcePath = resourcePath.replaceAll("[&?]storage.*?(?=&|\\?|$)", "");
if(folder!=null)
resourcePath = resourcePath.replace("{" + "folder" + "}" , apiInvoker.toPathValue(folder));
else
resourcePath = resourcePath.replaceAll("[&?]folder.*?(?=&|\\?|$)", "");
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
response = apiInvoker.invokeAPI(basePath, resourcePath, "PUT", queryParams, postBody, headerParams, formParams, contentType);
return (SaaSposeResponse) ApiInvoker.deserialize(response, "", SaaSposeResponse.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
} | SaaSposeResponse function (String name, Integer calendarUid, Integer index, String fileName, String storage, String folder, CalendarException body) { Object postBody = body; if(name == null calendarUid == null index == null body == null ) { throw new ApiException(400, STR); } String resourcePath = STR; resourcePath = resourcePath.replaceAll("\\*", STR&STR&STR/?STR?STRtoFormat={toFormat}STRformat={format}STR{STRnameSTR}STR[&?]name.*?(?=& \\? $)STRSTR{STRcalendarUidSTR}STR[&?]calendarUid.*?(?=& \\? $)STRSTR{STRindexSTR}STR[&?]index.*?(?=& \\? $)STRSTR{STRfileNameSTR}STR[&?]fileName.*?(?=& \\? $)STRSTR{STRstorageSTR}STR[&?]storage.*?(?=& \\? $)STRSTR{STRfolderSTR}STR[&?]folder.*?(?=& \\? $)STRSTRapplication/jsonSTRapplication/jsonSTRPUTSTRSTR"); } else { throw ex; } } } | /**
* PutCalendarException
* Updates calendar exception.
* @param name String The name of the file.
* @param calendarUid Integer Calendar Uid
* @param index Integer Calendar exception index
* @param fileName String The name of the project document to save changes to. If this parameter is omitted then the changes will be saved to the source project document.
* @param storage String The document storage.
* @param folder String The document folder.
* @param body CalendarException CalendarException DTO
* @return SaaSposeResponse
*/ | PutCalendarException Updates calendar exception | PutCalendarException | {
"repo_name": "asposetasks/Aspose_Tasks_Cloud",
"path": "SDKs/Aspose.Tasks-Cloud-SDK-for-Android/Aspose-Tasks-Cloud-SDK-for-Android/src/main/java/com/aspose/tasks/api/TasksApi.java",
"license": "mit",
"size": 107105
} | [
"com.aspose.tasks.client.ApiException",
"com.aspose.tasks.model.CalendarException",
"com.aspose.tasks.model.SaaSposeResponse"
] | import com.aspose.tasks.client.ApiException; import com.aspose.tasks.model.CalendarException; import com.aspose.tasks.model.SaaSposeResponse; | import com.aspose.tasks.client.*; import com.aspose.tasks.model.*; | [
"com.aspose.tasks"
] | com.aspose.tasks; | 992,920 |
public static String unescapeJava(String str) {
if (str == null) {
return null;
}
try {
StringWriter writer = new StringWriter(str.length());
unescapeJava(writer, str);
return writer.toString();
} catch (IOException ioe) {
// this should never ever happen while writing to a StringWriter
throw new RuntimeException(ioe);
}
} | static String function(String str) { if (str == null) { return null; } try { StringWriter writer = new StringWriter(str.length()); unescapeJava(writer, str); return writer.toString(); } catch (IOException ioe) { throw new RuntimeException(ioe); } } | /**
* Unescapes any Java literals found in the <code>String</code>.
* For example, it will turn a sequence of <code>'\'</code> and
* <code>'n'</code> into a newline character, unless the <code>'\'</code>
* is preceded by another <code>'\'</code>.
*
* @param str the <code>String</code> to unescape, may be null
* @return a new unescaped <code>String</code>, <code>null</code> if null string input
*/ | Unescapes any Java literals found in the <code>String</code>. For example, it will turn a sequence of <code>'\'</code> and <code>'n'</code> into a newline character, unless the <code>'\'</code> is preceded by another <code>'\'</code> | unescapeJava | {
"repo_name": "Selventa/model-builder",
"path": "tools/groovy/src/subprojects/groovy-json/src/main/java/groovy/json/StringEscapeUtils.java",
"license": "apache-2.0",
"size": 15515
} | [
"java.io.IOException",
"java.io.StringWriter"
] | import java.io.IOException; import java.io.StringWriter; | import java.io.*; | [
"java.io"
] | java.io; | 996,832 |
@ManagedOperation(description = "Gets the value of a Camel global option")
String getGlobalOption(String key) throws Exception; | @ManagedOperation(description = STR) String getGlobalOption(String key) throws Exception; | /**
* Gets the value of a CamelContext global option
*
* @param key the global option key
* @return the global option value
* @throws Exception when an error occurred
*/ | Gets the value of a CamelContext global option | getGlobalOption | {
"repo_name": "davidkarlsen/camel",
"path": "core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedCamelContextMBean.java",
"license": "apache-2.0",
"size": 11115
} | [
"org.apache.camel.api.management.ManagedOperation"
] | import org.apache.camel.api.management.ManagedOperation; | import org.apache.camel.api.management.*; | [
"org.apache.camel"
] | org.apache.camel; | 2,317,685 |
public double getWidth( final List<GridColumn<?>> columns ) {
double width = 0;
for ( GridColumn<?> column : columns ) {
if ( column.isVisible() ) {
width = width + column.getWidth();
}
}
return width;
} | double function( final List<GridColumn<?>> columns ) { double width = 0; for ( GridColumn<?> column : columns ) { if ( column.isVisible() ) { width = width + column.getWidth(); } } return width; } | /**
* Get the width of a set of columns, ignoring hidden columns.
* @param columns The columns.
* @return
*/ | Get the width of a set of columns, ignoring hidden columns | getWidth | {
"repo_name": "paulovmr/uberfire",
"path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/grids/impl/BaseGridRendererHelper.java",
"license": "apache-2.0",
"size": 20133
} | [
"java.util.List",
"org.uberfire.ext.wires.core.grids.client.model.GridColumn"
] | import java.util.List; import org.uberfire.ext.wires.core.grids.client.model.GridColumn; | import java.util.*; import org.uberfire.ext.wires.core.grids.client.model.*; | [
"java.util",
"org.uberfire.ext"
] | java.util; org.uberfire.ext; | 2,127,956 |
public AccessRights getDeclaredAccessRightsForPrincipal(Node node, String principalId) throws RepositoryException {
return getDeclaredAccessRightsForPrincipal(node.getSession(), node.getPath(), principalId);
} | AccessRights function(Node node, String principalId) throws RepositoryException { return getDeclaredAccessRightsForPrincipal(node.getSession(), node.getPath(), principalId); } | /**
* Returns the declared access rights for the specified Node for the given
* principalId.
*
* @param node the JCR node to retrieve the access rights for
* @param principalId the principalId to get the access rights for
* @return access rights for the specified principal
* @throws RepositoryException
*/ | Returns the declared access rights for the specified Node for the given principalId | getDeclaredAccessRightsForPrincipal | {
"repo_name": "codders/k2-sling-fork",
"path": "bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/PrivilegesInfo.java",
"license": "apache-2.0",
"size": 22963
} | [
"javax.jcr.Node",
"javax.jcr.RepositoryException"
] | import javax.jcr.Node; import javax.jcr.RepositoryException; | import javax.jcr.*; | [
"javax.jcr"
] | javax.jcr; | 938,422 |
private static boolean strEquals(String str1, String str2) {
return org.apache.commons.lang.StringUtils.equals(str1, str2);
} | static boolean function(String str1, String str2) { return org.apache.commons.lang.StringUtils.equals(str1, str2); } | /**
* Little abbreviation for StringUtils.
*/ | Little abbreviation for StringUtils | strEquals | {
"repo_name": "WANdisco/amplab-hive",
"path": "ql/src/java/org/apache/hadoop/hive/ql/Context.java",
"license": "apache-2.0",
"size": 21307
} | [
"org.apache.hadoop.util.StringUtils"
] | import org.apache.hadoop.util.StringUtils; | import org.apache.hadoop.util.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,049,622 |
public Action getAddAttributeAction() {
return addAttributeAction;
} | Action function() { return addAttributeAction; } | /**
* Get the Action class for creating and adding a new attribute
* to the single selected target (or its owner).
* @return the action
*/ | Get the Action class for creating and adding a new attribute to the single selected target (or its owner) | getAddAttributeAction | {
"repo_name": "carvalhomb/tsmells",
"path": "sample/argouml/argouml/org/argouml/ui/targetmanager/TargetManager.java",
"license": "gpl-2.0",
"size": 34904
} | [
"javax.swing.Action"
] | import javax.swing.Action; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 2,388,203 |
public List<RegionalReplicationStatus> summary() {
return this.summary;
} | List<RegionalReplicationStatus> function() { return this.summary; } | /**
* Get the summary property: This is a summary of replication status for each region.
*
* @return the summary value.
*/ | Get the summary property: This is a summary of replication status for each region | summary | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/models/ReplicationStatus.java",
"license": "mit",
"size": 1733
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,914,322 |
public static MeasurementRange<Float> create(
float minimum,
boolean isMinIncluded,
float maximum,
boolean isMaxIncluded,
Unit<?> units) {
return new MeasurementRange<>(
Float.class,
Float.valueOf(minimum),
isMinIncluded,
Float.valueOf(maximum),
isMaxIncluded,
units);
} | static MeasurementRange<Float> function( float minimum, boolean isMinIncluded, float maximum, boolean isMaxIncluded, Unit<?> units) { return new MeasurementRange<>( Float.class, Float.valueOf(minimum), isMinIncluded, Float.valueOf(maximum), isMaxIncluded, units); } | /**
* Constructs a range of {@code float} values.
*
* @param minimum The minimum value.
* @param isMinIncluded Defines whether the minimum value is included in the Range.
* @param maximum The maximum value.
* @param isMaxIncluded Defines whether the maximum value is included in the Range.
* @param units The units of measurement, or {@code null} if unknown.
* @return The measurement range.
* @since 2.5
*/ | Constructs a range of float values | create | {
"repo_name": "geotools/geotools",
"path": "modules/library/metadata/src/main/java/org/geotools/util/MeasurementRange.java",
"license": "lgpl-2.1",
"size": 13156
} | [
"javax.measure.Unit"
] | import javax.measure.Unit; | import javax.measure.*; | [
"javax.measure"
] | javax.measure; | 2,432,680 |
@Test
public void channelEnumerator() {
File tempPath = new File(System.getProperty("java.io.tmpdir"));
Channel.Enumerator enumerator = ioManager.createChannelEnumerator();
for (int i = 0; i < 10; i++) {
Channel.ID id = enumerator.next();
File path = new File(id.getPath());
Assert.assertTrue("Channel IDs must name an absolute path.", path.isAbsolute());
Assert.assertFalse("Channel IDs must name a file, not a directory.", path.isDirectory());
Assert.assertTrue("Path is not in the temp directory.", tempPath.equals(path.getParentFile()));
}
}
// ------------------------------------------------------------------------
| void function() { File tempPath = new File(System.getProperty(STR)); Channel.Enumerator enumerator = ioManager.createChannelEnumerator(); for (int i = 0; i < 10; i++) { Channel.ID id = enumerator.next(); File path = new File(id.getPath()); Assert.assertTrue(STR, path.isAbsolute()); Assert.assertFalse(STR, path.isDirectory()); Assert.assertTrue(STR, tempPath.equals(path.getParentFile())); } } | /**
* Tests that the channel enumerator creates channels in the temporary files directory.
*/ | Tests that the channel enumerator creates channels in the temporary files directory | channelEnumerator | {
"repo_name": "citlab/vs.msc.ws14",
"path": "flink-0-7-custom/flink-runtime/src/test/java/org/apache/flink/runtime/io/disk/iomanager/IOManagerTest.java",
"license": "apache-2.0",
"size": 8112
} | [
"java.io.File",
"org.apache.flink.runtime.io.disk.iomanager.Channel",
"org.junit.Assert"
] | import java.io.File; import org.apache.flink.runtime.io.disk.iomanager.Channel; import org.junit.Assert; | import java.io.*; import org.apache.flink.runtime.io.disk.iomanager.*; import org.junit.*; | [
"java.io",
"org.apache.flink",
"org.junit"
] | java.io; org.apache.flink; org.junit; | 478,880 |
public void setSourceProperty(SourceProperty property) throws SourceException {
if (m_delegate instanceof InspectableSource) {
((InspectableSource) m_delegate).setSourceProperty(property);
} else if (m_descriptor != null) {
m_descriptor.setSourceProperty(m_delegate, property);
}
}
// ---------------------------------------------------- Source implementation | void function(SourceProperty property) throws SourceException { if (m_delegate instanceof InspectableSource) { ((InspectableSource) m_delegate).setSourceProperty(property); } else if (m_descriptor != null) { m_descriptor.setSourceProperty(m_delegate, property); } } | /**
* Set the source property on the wrapped source. If the wrapped source implements
* InspectableSource set the property directly on the wrapped source. Otherwise
* set it on the SourceDescriptor.
*/ | Set the source property on the wrapped source. If the wrapped source implements InspectableSource set the property directly on the wrapped source. Otherwise set it on the SourceDescriptor | setSourceProperty | {
"repo_name": "apache/cocoon",
"path": "blocks/cocoon-repository/cocoon-repository-impl/src/main/java/org/apache/cocoon/components/source/impl/RepositorySource.java",
"license": "apache-2.0",
"size": 9110
} | [
"org.apache.cocoon.components.source.InspectableSource",
"org.apache.cocoon.components.source.helpers.SourceProperty",
"org.apache.excalibur.source.SourceException"
] | import org.apache.cocoon.components.source.InspectableSource; import org.apache.cocoon.components.source.helpers.SourceProperty; import org.apache.excalibur.source.SourceException; | import org.apache.cocoon.components.source.*; import org.apache.cocoon.components.source.helpers.*; import org.apache.excalibur.source.*; | [
"org.apache.cocoon",
"org.apache.excalibur"
] | org.apache.cocoon; org.apache.excalibur; | 360,938 |
public static void addToGallery(Context ctx, String path) {
if (!isIntentAvailable(ctx, Intent.ACTION_MEDIA_SCANNER_SCAN_FILE)) {
LOGW(ctx.getClass().getSimpleName(), "Gallery application not installed.");
return;
}
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
intent.setData(Uri.fromFile(new File(path)));
ctx.sendBroadcast(intent);
} | static void function(Context ctx, String path) { if (!isIntentAvailable(ctx, Intent.ACTION_MEDIA_SCANNER_SCAN_FILE)) { LOGW(ctx.getClass().getSimpleName(), STR); return; } Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); intent.setData(Uri.fromFile(new File(path))); ctx.sendBroadcast(intent); } | /**
* Loads a picture from a path and adds it to the gallery application. If the
* gallery application is not available, then calling this method does
* nothing.
*/ | Loads a picture from a path and adds it to the gallery application. If the gallery application is not available, then calling this method does nothing | addToGallery | {
"repo_name": "alexjlockwood/scouting-manager-2013",
"path": "ScoutingManager/src/edu/cmu/girlsofsteel/scouting/util/CameraUtil.java",
"license": "mit",
"size": 5697
} | [
"android.content.Context",
"android.content.Intent",
"android.net.Uri",
"java.io.File"
] | import android.content.Context; import android.content.Intent; import android.net.Uri; import java.io.File; | import android.content.*; import android.net.*; import java.io.*; | [
"android.content",
"android.net",
"java.io"
] | android.content; android.net; java.io; | 1,336,297 |
void onLatestEventDisplay(boolean isDisplayed);
/**
* See {@link AbsListView.OnScrollListener#onScrollStateChanged(AbsListView, int)} | void onLatestEventDisplay(boolean isDisplayed); /** * See {@link AbsListView.OnScrollListener#onScrollStateChanged(AbsListView, int)} | /**
* Tell if the latest event is fully displayed
*
* @param isDisplayed true if the latest event is fully displayed
*/ | Tell if the latest event is fully displayed | onLatestEventDisplay | {
"repo_name": "matrix-org/matrix-android-sdk",
"path": "matrix-sdk/src/main/java/org/matrix/androidsdk/fragments/MatrixMessageListFragment.java",
"license": "apache-2.0",
"size": 91833
} | [
"android.widget.AbsListView"
] | import android.widget.AbsListView; | import android.widget.*; | [
"android.widget"
] | android.widget; | 1,205,046 |
public YangString getRefSubentityInfoValue() throws JNCException {
return (YangString)getValue("ref-subentity-info");
} | YangString function() throws JNCException { return (YangString)getValue(STR); } | /**
* Gets the value for child leaf "ref-subentity-info".
* @return The value of the leaf.
*/ | Gets the value for child leaf "ref-subentity-info" | getRefSubentityInfoValue | {
"repo_name": "jnpr-shinma/yangfile",
"path": "hitel/src/hctaEpc/mmeSgsn/statistics/gprsSm/PriActGgsnFail.java",
"license": "apache-2.0",
"size": 11425
} | [
"com.tailf.jnc.YangString"
] | import com.tailf.jnc.YangString; | import com.tailf.jnc.*; | [
"com.tailf.jnc"
] | com.tailf.jnc; | 58,378 |
public String getKadminPrincipal() {
return KrbUtil.makeKadminPrincipal(kdcSetting.getKdcRealm()).getName();
} | String function() { return KrbUtil.makeKadminPrincipal(kdcSetting.getKdcRealm()).getName(); } | /**
* Get the kadmin principal name.
*
* @return The kadmin principal name.
*/ | Get the kadmin principal name | getKadminPrincipal | {
"repo_name": "YaningX/directory-kerby",
"path": "kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/Kadmin.java",
"license": "apache-2.0",
"size": 19003
} | [
"org.apache.kerby.kerberos.kerb.common.KrbUtil"
] | import org.apache.kerby.kerberos.kerb.common.KrbUtil; | import org.apache.kerby.kerberos.kerb.common.*; | [
"org.apache.kerby"
] | org.apache.kerby; | 2,537,079 |
public Shell getShell() {
return mShell;
} | Shell function() { return mShell; } | /**
* Share instances with root access instance with all other Classes
*/ | Share instances with root access instance with all other Classes | getShell | {
"repo_name": "WtfJoke/Rashr",
"path": "RashrApp/src/main/java/de/mkrtchyan/recoverytools/RashrActivity.java",
"license": "gpl-3.0",
"size": 22987
} | [
"org.sufficientlysecure.rootcommands.Shell"
] | import org.sufficientlysecure.rootcommands.Shell; | import org.sufficientlysecure.rootcommands.*; | [
"org.sufficientlysecure.rootcommands"
] | org.sufficientlysecure.rootcommands; | 2,606,271 |
protected void updateNodeRemoveMeasuresIncomingDirectedUnweighted(
DirectedNode nodeToRemove) {
for (Node directed1 : this
.getNeighborsOutDirectedUnweighted(nodeToRemove))
for (Node directed2 : this
.getNeighborsInDirectedUnweighted(directed1))
if (!directed2.equals(nodeToRemove))
for (Node directed3 : this
.getNeighborsOutDirectedUnweighted(directed2))
if (!directed3.equals(directed1)
&& !directed3.equals(nodeToRemove)) {
update(directed1, directed3);
}
} | void function( DirectedNode nodeToRemove) { for (Node directed1 : this .getNeighborsOutDirectedUnweighted(nodeToRemove)) for (Node directed2 : this .getNeighborsInDirectedUnweighted(directed1)) if (!directed2.equals(nodeToRemove)) for (Node directed3 : this .getNeighborsOutDirectedUnweighted(directed2)) if (!directed3.equals(directed1) && !directed3.equals(nodeToRemove)) { update(directed1, directed3); } } | /**
* Update the similarity measure incoming if a node is to be removed
*
* @param nodeToRemove
*/ | Update the similarity measure incoming if a node is to be removed | updateNodeRemoveMeasuresIncomingDirectedUnweighted | {
"repo_name": "timgrube/DNA",
"path": "src/dna/metrics/similarityMeasures/Measures.java",
"license": "gpl-3.0",
"size": 25489
} | [
"dna.graph.nodes.DirectedNode",
"dna.graph.nodes.Node"
] | import dna.graph.nodes.DirectedNode; import dna.graph.nodes.Node; | import dna.graph.nodes.*; | [
"dna.graph.nodes"
] | dna.graph.nodes; | 1,887,619 |
public static boolean ensureDefaultConfiguration( IProject project ) throws CoreException, IOException
{
IFile configurationFile = project.getFile( "creel.properties" );
if( configurationFile.exists() )
return false;
Properties configuration = new SortedProperties( new DotSeparatedStringComparator<Object>() );
configuration.setProperty( "repository.1.id", "central" );
configuration.setProperty( "repository.1.url", "https://repo1.maven.org/maven2/" );
configuration.setProperty( "#module.1.id", "org.jsoup:jsoup" );
Writer writer = new StringWriter();
configuration.store( writer, "Originally created by Creel " + Engine.getVersion() + " Eclipse plugin" );
EclipseUtil.write( writer.toString(), configurationFile );
return true;
} | static boolean function( IProject project ) throws CoreException, IOException { IFile configurationFile = project.getFile( STR ); if( configurationFile.exists() ) return false; Properties configuration = new SortedProperties( new DotSeparatedStringComparator<Object>() ); configuration.setProperty( STR, STR ); configuration.setProperty( STR, STR#module.1.idSTRorg.jsoup:jsoupSTROriginally created by Creel STR Eclipse plugin" ); EclipseUtil.write( writer.toString(), configurationFile ); return true; } | /**
* Makes sure a "creel.properties" file exists in the default location. If
* it's not there, creates an example file.
*
* @param project
* The project
* @return True if an example file was created, false if file already exists
* @throws CoreException
* In case of an Eclipse error
* @throws IOException
* In case of an I/O error
*/ | Makes sure a "creel.properties" file exists in the default location. If it's not there, creates an example file | ensureDefaultConfiguration | {
"repo_name": "tliron/creel",
"path": "components/creel-eclipse/source/com/threecrickets/creel/eclipse/Builder.java",
"license": "lgpl-3.0",
"size": 16468
} | [
"com.threecrickets.creel.eclipse.internal.EclipseUtil",
"com.threecrickets.creel.util.DotSeparatedStringComparator",
"com.threecrickets.creel.util.SortedProperties",
"java.io.IOException",
"java.util.Properties",
"org.eclipse.core.resources.IFile",
"org.eclipse.core.resources.IProject",
"org.eclipse.c... | import com.threecrickets.creel.eclipse.internal.EclipseUtil; import com.threecrickets.creel.util.DotSeparatedStringComparator; import com.threecrickets.creel.util.SortedProperties; import java.io.IOException; import java.util.Properties; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; | import com.threecrickets.creel.eclipse.internal.*; import com.threecrickets.creel.util.*; import java.io.*; import java.util.*; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; | [
"com.threecrickets.creel",
"java.io",
"java.util",
"org.eclipse.core"
] | com.threecrickets.creel; java.io; java.util; org.eclipse.core; | 590,062 |
private List<Object[]> populateEventListFromResultSet(List<Object[]> selectedEventList, ResultSet results) {
int columnCount = tableDefinition.getAttributeList().size();
try {
while (results.next()) {
Object[] eventArray = new Object[columnCount];
for (int i = 0; i < columnCount; i++) {
switch (tableDefinition.getAttributeList().get(i).getType()) {
case INT:
eventArray[i] = results.getInt(i + 1);
break;
case LONG:
eventArray[i] = results.getLong(i + 1);
break;
case FLOAT:
eventArray[i] = results.getFloat(i + 1);
break;
case DOUBLE:
eventArray[i] = results.getDouble(i + 1);
break;
case STRING:
eventArray[i] = results.getString(i + 1);
break;
case BOOL:
eventArray[i] = results.getBoolean(i + 1);
break;
}
}
selectedEventList.add(eventArray);
}
results.close();
} catch (SQLException e) {
throw new ExecutionPlanRuntimeException("Error while populating event list from db result set," + e
.getMessage(), e);
}
return selectedEventList;
} | List<Object[]> function(List<Object[]> selectedEventList, ResultSet results) { int columnCount = tableDefinition.getAttributeList().size(); try { while (results.next()) { Object[] eventArray = new Object[columnCount]; for (int i = 0; i < columnCount; i++) { switch (tableDefinition.getAttributeList().get(i).getType()) { case INT: eventArray[i] = results.getInt(i + 1); break; case LONG: eventArray[i] = results.getLong(i + 1); break; case FLOAT: eventArray[i] = results.getFloat(i + 1); break; case DOUBLE: eventArray[i] = results.getDouble(i + 1); break; case STRING: eventArray[i] = results.getString(i + 1); break; case BOOL: eventArray[i] = results.getBoolean(i + 1); break; } } selectedEventList.add(eventArray); } results.close(); } catch (SQLException e) { throw new ExecutionPlanRuntimeException(STR + e .getMessage(), e); } return selectedEventList; } | /**
* Generates an event list from db resultSet
*/ | Generates an event list from db resultSet | populateEventListFromResultSet | {
"repo_name": "lgobinath/siddhi",
"path": "modules/siddhi-extensions/event-table/src/main/java/org/wso2/siddhi/extension/table/rdbms/DBHandler.java",
"license": "apache-2.0",
"size": 32298
} | [
"java.sql.ResultSet",
"java.sql.SQLException",
"java.util.List",
"org.wso2.siddhi.core.exception.ExecutionPlanRuntimeException"
] | import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import org.wso2.siddhi.core.exception.ExecutionPlanRuntimeException; | import java.sql.*; import java.util.*; import org.wso2.siddhi.core.exception.*; | [
"java.sql",
"java.util",
"org.wso2.siddhi"
] | java.sql; java.util; org.wso2.siddhi; | 949,402 |
@Override
void read(TrueTypeFont ttf, TTFDataStream data) throws IOException
{
version = data.read32Fixed();
defaultVertOriginY = data.readSignedShort();
int numVertOriginYMetrics = data.readUnsignedShort();
origins = new ConcurrentHashMap<>(numVertOriginYMetrics);
for (int i = 0; i < numVertOriginYMetrics; ++i)
{
int g = data.readUnsignedShort();
int y = data.readSignedShort();
origins.put(g, y);
}
initialized = true;
} | void read(TrueTypeFont ttf, TTFDataStream data) throws IOException { version = data.read32Fixed(); defaultVertOriginY = data.readSignedShort(); int numVertOriginYMetrics = data.readUnsignedShort(); origins = new ConcurrentHashMap<>(numVertOriginYMetrics); for (int i = 0; i < numVertOriginYMetrics; ++i) { int g = data.readUnsignedShort(); int y = data.readSignedShort(); origins.put(g, y); } initialized = true; } | /**
* This will read the required data from the stream.
*
* @param ttf The font that is being read.
* @param data The stream to read the data from.
* @throws IOException If there is an error reading the data.
*/ | This will read the required data from the stream | read | {
"repo_name": "kalaspuffar/pdfbox",
"path": "fontbox/src/main/java/org/apache/fontbox/ttf/VerticalOriginTable.java",
"license": "apache-2.0",
"size": 3201
} | [
"java.io.IOException",
"java.util.concurrent.ConcurrentHashMap"
] | import java.io.IOException; import java.util.concurrent.ConcurrentHashMap; | import java.io.*; import java.util.concurrent.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,791,153 |
public DataFieldType getIMMSwapNodeDataFieldType(final Tenor tenor) {
if (_immSwapNodeIds == null) {
throw new OpenGammaRuntimeException("Cannot get IMM swap node id provider for curve node id mapper called " + _name);
}
return getDataFieldType(_immSwapNodeIds, tenor);
} | DataFieldType function(final Tenor tenor) { if (_immSwapNodeIds == null) { throw new OpenGammaRuntimeException(STR + _name); } return getDataFieldType(_immSwapNodeIds, tenor); } | /**
* Gets the data field type of the IMM swap node at a particular tenor.
* @param tenor The tenor
* @return The data field type
* @throws OpenGammaRuntimeException if the data field type for this tenor could not be found.
*/ | Gets the data field type of the IMM swap node at a particular tenor | getIMMSwapNodeDataFieldType | {
"repo_name": "ChinaQuants/OG-Platform",
"path": "projects/OG-Financial/src/main/java/com/opengamma/financial/analytics/curve/CurveNodeIdMapper.java",
"license": "apache-2.0",
"size": 64618
} | [
"com.opengamma.OpenGammaRuntimeException",
"com.opengamma.financial.analytics.ircurve.strips.DataFieldType",
"com.opengamma.util.time.Tenor"
] | import com.opengamma.OpenGammaRuntimeException; import com.opengamma.financial.analytics.ircurve.strips.DataFieldType; import com.opengamma.util.time.Tenor; | import com.opengamma.*; import com.opengamma.financial.analytics.ircurve.strips.*; import com.opengamma.util.time.*; | [
"com.opengamma",
"com.opengamma.financial",
"com.opengamma.util"
] | com.opengamma; com.opengamma.financial; com.opengamma.util; | 2,499,913 |
final double x1 = 3;
final double x2 = -1;
final double y1 = 6;
final double y2 = 3;
final double ab = 5;
final double q = 1;
Point a = new Point(x1, x2);
Point b = new Point(y1, y2);
double s = a.distanceTo(b);
assertThat(s, closeTo(ab, q));
} | final double x1 = 3; final double x2 = -1; final double y1 = 6; final double y2 = 3; final double ab = 5; final double q = 1; Point a = new Point(x1, x2); Point b = new Point(y1, y2); double s = a.distanceTo(b); assertThat(s, closeTo(ab, q)); } | /**
* Point test.
*/ | Point test | whenADistanceToBThenAB | {
"repo_name": "EgorStogov/estogov",
"path": "Chapter_001/src/test/java/ru/estogov/PointTest.java",
"license": "apache-2.0",
"size": 585
} | [
"org.hamcrest.number.IsCloseTo",
"org.junit.Assert"
] | import org.hamcrest.number.IsCloseTo; import org.junit.Assert; | import org.hamcrest.number.*; import org.junit.*; | [
"org.hamcrest.number",
"org.junit"
] | org.hamcrest.number; org.junit; | 2,605,055 |
Boolean instantiateTriggerCallback() {
if (_sessionCallbackClassName != null
&& !_sessionCallbackClassName.isEmpty())
try {
Class<?> c = Class.forName(_sessionCallbackClassName);
_callback = (SessionCallback) c.newInstance();
} catch (ClassNotFoundException e) {
_log.error("A ClassNotFoundException occured when trying to instantiate:"
+ this._sessionCallbackClassName);
e.printStackTrace();
return Boolean.FALSE;
} catch (InstantiationException e) {
_log.error("A InstantiationException occured when trying to instantiate:"
+ this._sessionCallbackClassName);
e.printStackTrace();
return Boolean.FALSE;
} catch (IllegalAccessException e) {
_log.error("A IllegalAccessException occured when trying to instantiate:"
+ this._sessionCallbackClassName);
e.printStackTrace();
return Boolean.FALSE;
}
return Boolean.TRUE;
} | Boolean instantiateTriggerCallback() { if (_sessionCallbackClassName != null && !_sessionCallbackClassName.isEmpty()) try { Class<?> c = Class.forName(_sessionCallbackClassName); _callback = (SessionCallback) c.newInstance(); } catch (ClassNotFoundException e) { _log.error(STR + this._sessionCallbackClassName); e.printStackTrace(); return Boolean.FALSE; } catch (InstantiationException e) { _log.error(STR + this._sessionCallbackClassName); e.printStackTrace(); return Boolean.FALSE; } catch (IllegalAccessException e) { _log.error(STR + this._sessionCallbackClassName); e.printStackTrace(); return Boolean.FALSE; } return Boolean.TRUE; } | /**
* Instantiates the trigger callback handler class
*
* @return
*/ | Instantiates the trigger callback handler class | instantiateTriggerCallback | {
"repo_name": "yauritux/venice-legacy",
"path": "Venice/Venice-Service/src/main/java/com/gdn/venice/facade/FrdRelatedFraudCaseSessionEJBBean.java",
"license": "apache-2.0",
"size": 19028
} | [
"com.gdn.venice.facade.callback.SessionCallback"
] | import com.gdn.venice.facade.callback.SessionCallback; | import com.gdn.venice.facade.callback.*; | [
"com.gdn.venice"
] | com.gdn.venice; | 1,267,343 |
public void shutdown()
{
// TODO revisit this.
// the name here doesn't matter.
try
{
lateralService.dispose( "ALL" );
}
catch ( IOException e )
{
log.error( "Problem disposing of service", e );
}
// shut down monitor
if (monitor != null)
{
monitor.notifyShutdown();
}
} | void function() { try { lateralService.dispose( "ALL" ); } catch ( IOException e ) { log.error( STR, e ); } if (monitor != null) { monitor.notifyShutdown(); } } | /**
* Shuts down the lateral sender. This does not shutdown the listener. This can be called if the
* end point is taken out of service.
*/ | Shuts down the lateral sender. This does not shutdown the listener. This can be called if the end point is taken out of service | shutdown | {
"repo_name": "tikue/jcs2-snapshot",
"path": "src/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java",
"license": "apache-2.0",
"size": 12804
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,456,218 |
@Test
public void testNestedArrayQuery2()
throws Exception {
final Query q = twq(1)
.with(ntq("aaa"))
.with(twq(2)
.with(ntq("b")))
.getLuceneProxyQuery();
this._assertSirenQuery(q, "* : [ aaa, [ b ] ]");
} | void function() throws Exception { final Query q = twq(1) .with(ntq("aaa")) .with(twq(2) .with(ntq("b"))) .getLuceneProxyQuery(); this._assertSirenQuery(q, STR); } | /**
* Tests for a nested array with a single child
*/ | Tests for a nested array with a single child | testNestedArrayQuery2 | {
"repo_name": "rdelbru/SIREn",
"path": "siren-qparser/src/test/java/org/sindice/siren/qparser/keyword/KeywordQueryParserTest.java",
"license": "apache-2.0",
"size": 64273
} | [
"org.apache.lucene.search.Query",
"org.sindice.siren.search.AbstractTestSirenScorer"
] | import org.apache.lucene.search.Query; import org.sindice.siren.search.AbstractTestSirenScorer; | import org.apache.lucene.search.*; import org.sindice.siren.search.*; | [
"org.apache.lucene",
"org.sindice.siren"
] | org.apache.lucene; org.sindice.siren; | 1,695,021 |
Future<WebSiteCreateResponse> createAsync(String webSpaceName, WebSiteCreateParameters parameters); | Future<WebSiteCreateResponse> createAsync(String webSpaceName, WebSiteCreateParameters parameters); | /**
* You can create a web site by using a POST request that includes the name
* of the web site and other information in the request body. (see
* http://msdn.microsoft.com/en-us/library/windowsazure/dn166986.aspx for
* more information)
*
* @param webSpaceName Required. The name of the web space.
* @param parameters Required. Parameters supplied to the Create Web Site
* operation.
* @return The Create Web Site operation response.
*/ | You can create a web site by using a POST request that includes the name of the web site and other information in the request body. (see HREF for more information) | createAsync | {
"repo_name": "manikandan-palaniappan/azure-sdk-for-java",
"path": "management-websites/src/main/java/com/microsoft/windowsazure/management/websites/WebSiteOperations.java",
"license": "apache-2.0",
"size": 51140
} | [
"com.microsoft.windowsazure.management.websites.models.WebSiteCreateParameters",
"com.microsoft.windowsazure.management.websites.models.WebSiteCreateResponse",
"java.util.concurrent.Future"
] | import com.microsoft.windowsazure.management.websites.models.WebSiteCreateParameters; import com.microsoft.windowsazure.management.websites.models.WebSiteCreateResponse; import java.util.concurrent.Future; | import com.microsoft.windowsazure.management.websites.models.*; import java.util.concurrent.*; | [
"com.microsoft.windowsazure",
"java.util"
] | com.microsoft.windowsazure; java.util; | 795,014 |
public void testRemoveNodePropertyParent() throws Exception {
testNode.setProperty(propertyName1, n1);
testRootNode.getSession().save();
testNode.setProperty(propertyName1, (Node) null);
testRootNode.getSession().save();
assertFalse("Removing property with Node.setProperty(String, (Node)null) and parentNode.save() not working",
testNode.hasProperty(propertyName1));
} | void function() throws Exception { testNode.setProperty(propertyName1, n1); testRootNode.getSession().save(); testNode.setProperty(propertyName1, (Node) null); testRootNode.getSession().save(); assertFalse(STR, testNode.hasProperty(propertyName1)); } | /**
* Tests if removing a <code>Node</code> property with
* <code>Node.setProperty(String, null)</code> works with
* <code>parentNode.save()</code>
*/ | Tests if removing a <code>Node</code> property with <code>Node.setProperty(String, null)</code> works with <code>parentNode.save()</code> | testRemoveNodePropertyParent | {
"repo_name": "sdmcraft/jackrabbit",
"path": "jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SetPropertyNodeTest.java",
"license": "apache-2.0",
"size": 6127
} | [
"javax.jcr.Node"
] | import javax.jcr.Node; | import javax.jcr.*; | [
"javax.jcr"
] | javax.jcr; | 978,120 |
public ExpressRouteCircuitPeeringConfig microsoftPeeringConfig() {
return this.microsoftPeeringConfig;
} | ExpressRouteCircuitPeeringConfig function() { return this.microsoftPeeringConfig; } | /**
* Get the Microsoft peering configuration.
*
* @return the microsoftPeeringConfig value
*/ | Get the Microsoft peering configuration | microsoftPeeringConfig | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/network/v2019_08_01/implementation/ExpressRouteCrossConnectionPeeringInner.java",
"license": "mit",
"size": 12184
} | [
"com.microsoft.azure.management.network.v2019_08_01.ExpressRouteCircuitPeeringConfig"
] | import com.microsoft.azure.management.network.v2019_08_01.ExpressRouteCircuitPeeringConfig; | import com.microsoft.azure.management.network.v2019_08_01.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 1,333,297 |
LinkedList<Node> newList = new LinkedList<Node>();
for (int i = 0; i < list.getLength(); i++) {
if (!list.item(i).getNodeName().equals("#text")) {
newList.add(list.item(i));
}
}
return newList;
} | LinkedList<Node> newList = new LinkedList<Node>(); for (int i = 0; i < list.getLength(); i++) { if (!list.item(i).getNodeName().equals("#text")) { newList.add(list.item(i)); } } return newList; } | /**
* filter all #text nodes out
*/ | filter all #text nodes out | filterTextNode | {
"repo_name": "wangzk/uml-relationship-detection-in-xmi-file",
"path": "src/RelationshipParser/src/cn/edu/nju/cs/Utils.java",
"license": "gpl-3.0",
"size": 2127
} | [
"java.util.LinkedList",
"org.w3c.dom.Node"
] | import java.util.LinkedList; import org.w3c.dom.Node; | import java.util.*; import org.w3c.dom.*; | [
"java.util",
"org.w3c.dom"
] | java.util; org.w3c.dom; | 1,105,393 |
public String getName(final SessionContext ctx)
{
return (String)getProperty( ctx, NAME);
}
| String function(final SessionContext ctx) { return (String)getProperty( ctx, NAME); } | /**
* <i>Generated method</i> - Getter of the <code>BusinessPartner.name</code> attribute.
* @return the name
*/ | Generated method - Getter of the <code>BusinessPartner.name</code> attribute | getName | {
"repo_name": "kungfu-software/fujitsu-hybris-training",
"path": "trainingcore/gensrc/au/com/fujitsu/trainingcore/jalo/GeneratedBusinessPartner.java",
"license": "mit",
"size": 5267
} | [
"de.hybris.platform.jalo.SessionContext"
] | import de.hybris.platform.jalo.SessionContext; | import de.hybris.platform.jalo.*; | [
"de.hybris.platform"
] | de.hybris.platform; | 823,841 |
protected void normalize( Map<Node,Double> vector )
{
// Compute vector length
double sum = 0;
for ( Node node : vector.keySet() )
{
double d = vector.get( node );
sum += d * d;
}
sum = Math.sqrt( sum );
// Divide all components
if ( sum > 0.0 )
{
for ( Node node : vector.keySet() )
{
vector.put( node, vector.get( node ) / sum );
}
}
} | void function( Map<Node,Double> vector ) { double sum = 0; for ( Node node : vector.keySet() ) { double d = vector.get( node ); sum += d * d; } sum = Math.sqrt( sum ); if ( sum > 0.0 ) { for ( Node node : vector.keySet() ) { vector.put( node, vector.get( node ) / sum ); } } } | /**
* Normalizes a vector represented as a Map.
* @param vector
*/ | Normalizes a vector represented as a Map | normalize | {
"repo_name": "eldersantos/community",
"path": "graph-algo/src/main/java/org/neo4j/graphalgo/impl/centrality/EigenvectorCentralityPower.java",
"license": "gpl-3.0",
"size": 9993
} | [
"java.util.Map",
"org.neo4j.graphdb.Node"
] | import java.util.Map; import org.neo4j.graphdb.Node; | import java.util.*; import org.neo4j.graphdb.*; | [
"java.util",
"org.neo4j.graphdb"
] | java.util; org.neo4j.graphdb; | 1,937,446 |
private DelegationTokenSecretManager createDelegationTokenSecretManager(
Configuration conf) {
return new DelegationTokenSecretManager(conf.getLong(
DFS_NAMENODE_DELEGATION_KEY_UPDATE_INTERVAL_KEY,
DFS_NAMENODE_DELEGATION_KEY_UPDATE_INTERVAL_DEFAULT),
conf.getLong(DFS_NAMENODE_DELEGATION_TOKEN_MAX_LIFETIME_KEY,
DFS_NAMENODE_DELEGATION_TOKEN_MAX_LIFETIME_DEFAULT),
conf.getLong(DFS_NAMENODE_DELEGATION_TOKEN_RENEW_INTERVAL_KEY,
DFS_NAMENODE_DELEGATION_TOKEN_RENEW_INTERVAL_DEFAULT),
DELEGATION_TOKEN_REMOVER_SCAN_INTERVAL,
conf.getBoolean(DFS_NAMENODE_AUDIT_LOG_TOKEN_TRACKING_ID_KEY,
DFS_NAMENODE_AUDIT_LOG_TOKEN_TRACKING_ID_DEFAULT),
this);
} | DelegationTokenSecretManager function( Configuration conf) { return new DelegationTokenSecretManager(conf.getLong( DFS_NAMENODE_DELEGATION_KEY_UPDATE_INTERVAL_KEY, DFS_NAMENODE_DELEGATION_KEY_UPDATE_INTERVAL_DEFAULT), conf.getLong(DFS_NAMENODE_DELEGATION_TOKEN_MAX_LIFETIME_KEY, DFS_NAMENODE_DELEGATION_TOKEN_MAX_LIFETIME_DEFAULT), conf.getLong(DFS_NAMENODE_DELEGATION_TOKEN_RENEW_INTERVAL_KEY, DFS_NAMENODE_DELEGATION_TOKEN_RENEW_INTERVAL_DEFAULT), DELEGATION_TOKEN_REMOVER_SCAN_INTERVAL, conf.getBoolean(DFS_NAMENODE_AUDIT_LOG_TOKEN_TRACKING_ID_KEY, DFS_NAMENODE_AUDIT_LOG_TOKEN_TRACKING_ID_DEFAULT), this); } | /**
* Create delegation token secret manager
*/ | Create delegation token secret manager | createDelegationTokenSecretManager | {
"repo_name": "yncxcw/Yarn-SBlock",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java",
"license": "apache-2.0",
"size": 338725
} | [
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenSecretManager"
] | import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenSecretManager; | import org.apache.hadoop.conf.*; import org.apache.hadoop.hdfs.security.token.delegation.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,318,693 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.