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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
private void printNeededDependencies(Collection<MissingSymbolEvent> missingSymbolEvents)
throws InterruptedException {
ImmutableSetMultimap<BuildTarget, BuildTarget> neededDependencies =
getNeededDependencies(missingSymbolEvents);
ImmutableSortedSet.Builder<String> samePackageDeps = ImmutableSortedSet.naturalOrder();
ImmutableSortedSet.Builder<String> otherPackageDeps = ImmutableSortedSet.naturalOrder();
for (BuildTarget target : neededDependencies.keySet()) {
print(formatTarget(target) + " is missing deps:");
Set<BuildTarget> sortedDeps = ImmutableSortedSet.copyOf(neededDependencies.get(target));
for (BuildTarget neededDep : sortedDeps) {
if (neededDep.getBaseName().equals(target.getBaseName())) {
samePackageDeps.add(":" + neededDep.getShortName());
} else {
otherPackageDeps.add(neededDep.toString());
}
}
}
String format = " '%s',";
for (String dep : samePackageDeps.build()) {
print(String.format(format, dep));
}
for (String dep : otherPackageDeps.build()) {
print(String.format(format, dep));
}
} | void function(Collection<MissingSymbolEvent> missingSymbolEvents) throws InterruptedException { ImmutableSetMultimap<BuildTarget, BuildTarget> neededDependencies = getNeededDependencies(missingSymbolEvents); ImmutableSortedSet.Builder<String> samePackageDeps = ImmutableSortedSet.naturalOrder(); ImmutableSortedSet.Builder<String> otherPackageDeps = ImmutableSortedSet.naturalOrder(); for (BuildTarget target : neededDependencies.keySet()) { print(formatTarget(target) + STR); Set<BuildTarget> sortedDeps = ImmutableSortedSet.copyOf(neededDependencies.get(target)); for (BuildTarget neededDep : sortedDeps) { if (neededDep.getBaseName().equals(target.getBaseName())) { samePackageDeps.add(":" + neededDep.getShortName()); } else { otherPackageDeps.add(neededDep.toString()); } } } String format = STR; for (String dep : samePackageDeps.build()) { print(String.format(format, dep)); } for (String dep : otherPackageDeps.build()) { print(String.format(format, dep)); } } | /**
* Get a list of missing dependencies from {@link #getNeededDependencies} and print it to the
* console in a list-of-Python-strings way that's easy to copy and paste.
*/ | Get a list of missing dependencies from <code>#getNeededDependencies</code> and print it to the console in a list-of-Python-strings way that's easy to copy and paste | printNeededDependencies | {
"repo_name": "MarkRunWu/buck",
"path": "src/com/facebook/buck/cli/MissingSymbolsHandler.java",
"license": "apache-2.0",
"size": 8665
} | [
"com.facebook.buck.event.MissingSymbolEvent",
"com.facebook.buck.model.BuildTarget",
"com.google.common.collect.ImmutableSetMultimap",
"com.google.common.collect.ImmutableSortedSet",
"java.util.Collection",
"java.util.Set"
] | import com.facebook.buck.event.MissingSymbolEvent; import com.facebook.buck.model.BuildTarget; import com.google.common.collect.ImmutableSetMultimap; import com.google.common.collect.ImmutableSortedSet; import java.util.Collection; import java.util.Set; | import com.facebook.buck.event.*; import com.facebook.buck.model.*; import com.google.common.collect.*; import java.util.*; | [
"com.facebook.buck",
"com.google.common",
"java.util"
] | com.facebook.buck; com.google.common; java.util; | 1,546,005 |
private static void reflectionAppend(
Object lhs,
Object rhs,
Class<?> clazz,
CompareToBuilder builder,
boolean useTransients,
String[] excludeFields) {
Field[] fields = clazz.getDeclaredFields();
AccessibleObject.setAccessible(fields, true);
for (int i = 0; i < fields.length && builder.comparison == 0; i++) {
Field f = fields[i];
if (!ArrayUtils.contains(excludeFields, f.getName())
&& (f.getName().indexOf('$') == -1)
&& (useTransients || !Modifier.isTransient(f.getModifiers()))
&& (!Modifier.isStatic(f.getModifiers()))) {
try {
builder.append(f.get(lhs), f.get(rhs));
} catch (IllegalAccessException e) {
// This can't happen. Would get a Security exception instead.
// Throw a runtime exception in case the impossible happens.
throw new InternalError("Unexpected IllegalAccessException");
}
}
}
} | static void function( Object lhs, Object rhs, Class<?> clazz, CompareToBuilder builder, boolean useTransients, String[] excludeFields) { Field[] fields = clazz.getDeclaredFields(); AccessibleObject.setAccessible(fields, true); for (int i = 0; i < fields.length && builder.comparison == 0; i++) { Field f = fields[i]; if (!ArrayUtils.contains(excludeFields, f.getName()) && (f.getName().indexOf('$') == -1) && (useTransients !Modifier.isTransient(f.getModifiers())) && (!Modifier.isStatic(f.getModifiers()))) { try { builder.append(f.get(lhs), f.get(rhs)); } catch (IllegalAccessException e) { throw new InternalError(STR); } } } } | /**
* <p>Appends to <code>builder</code> the comparison of <code>lhs</code>
* to <code>rhs</code> using the fields defined in <code>clazz</code>.</p>
*
* @param lhs left-hand object
* @param rhs right-hand object
* @param clazz <code>Class</code> that defines fields to be compared
* @param builder <code>CompareToBuilder</code> to append to
* @param useTransients whether to compare transient fields
* @param excludeFields fields to exclude
*/ | Appends to <code>builder</code> the comparison of <code>lhs</code> to <code>rhs</code> using the fields defined in <code>clazz</code> | reflectionAppend | {
"repo_name": "nkafei/xposed-art",
"path": "xposed_bridge/lib/apache-commons-lang/external/org/apache/commons/lang3/builder/CompareToBuilder.java",
"license": "apache-2.0",
"size": 37013
} | [
"external.org.apache.commons.lang3.ArrayUtils",
"java.lang.reflect.AccessibleObject",
"java.lang.reflect.Field",
"java.lang.reflect.Modifier"
] | import external.org.apache.commons.lang3.ArrayUtils; import java.lang.reflect.AccessibleObject; import java.lang.reflect.Field; import java.lang.reflect.Modifier; | import external.org.apache.commons.lang3.*; import java.lang.reflect.*; | [
"external.org.apache",
"java.lang"
] | external.org.apache; java.lang; | 300,632 |
public RectangleInsets getLabelInsets() {
return this.labelInsets;
}
/**
* Sets the insets for the axis label, and sends an {@link AxisChangeEvent} | RectangleInsets function() { return this.labelInsets; } /** * Sets the insets for the axis label, and sends an {@link AxisChangeEvent} | /**
* Returns the insets for the label (that is, the amount of blank space
* that should be left around the label).
*
* @return The label insets (never <code>null</code>).
*
* @see #setLabelInsets(RectangleInsets)
*/ | Returns the insets for the label (that is, the amount of blank space that should be left around the label) | getLabelInsets | {
"repo_name": "Epsilon2/Memetic-Algorithm-for-TSP",
"path": "jfreechart-1.0.16/source/org/jfree/chart/axis/Axis.java",
"license": "mit",
"size": 58723
} | [
"org.jfree.chart.event.AxisChangeEvent",
"org.jfree.ui.RectangleInsets"
] | import org.jfree.chart.event.AxisChangeEvent; import org.jfree.ui.RectangleInsets; | import org.jfree.chart.event.*; import org.jfree.ui.*; | [
"org.jfree.chart",
"org.jfree.ui"
] | org.jfree.chart; org.jfree.ui; | 2,080,267 |
@Test
public void testSendLargeRequest() throws Exception {
int node = 0;
blockingConnect(node);
String big = TestUtils.randomString(10 * BUFFER_SIZE);
assertEquals(big, blockingRequest(node, big));
} | void function() throws Exception { int node = 0; blockingConnect(node); String big = TestUtils.randomString(10 * BUFFER_SIZE); assertEquals(big, blockingRequest(node, big)); } | /**
* Validate that we can send and receive a message larger than the receive and send buffer size
*/ | Validate that we can send and receive a message larger than the receive and send buffer size | testSendLargeRequest | {
"repo_name": "unix1986/universe",
"path": "tool/kafka-0.8.1.1-src/clients/src/test/java/org/apache/kafka/common/network/SelectorTest.java",
"license": "bsd-2-clause",
"size": 11543
} | [
"org.apache.kafka.test.TestUtils",
"org.junit.Assert"
] | import org.apache.kafka.test.TestUtils; import org.junit.Assert; | import org.apache.kafka.test.*; import org.junit.*; | [
"org.apache.kafka",
"org.junit"
] | org.apache.kafka; org.junit; | 653,559 |
public void marshal(Object obj, OutputStream out, NamespaceContext inscopeNamespace) throws JAXBException {
write(obj, createWriter(out), new StAXPostInitAction(inscopeNamespace,serializer));
} | void function(Object obj, OutputStream out, NamespaceContext inscopeNamespace) throws JAXBException { write(obj, createWriter(out), new StAXPostInitAction(inscopeNamespace,serializer)); } | /**
* Marshals to {@link OutputStream} with the given in-scope namespaces
* taken into account.
*
* @since 2.1.5
*/ | Marshals to <code>OutputStream</code> with the given in-scope namespaces taken into account | marshal | {
"repo_name": "FauxFaux/jdk9-jaxws",
"path": "src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/MarshallerImpl.java",
"license": "gpl-2.0",
"size": 23052
} | [
"java.io.OutputStream",
"javax.xml.bind.JAXBException",
"javax.xml.namespace.NamespaceContext"
] | import java.io.OutputStream; import javax.xml.bind.JAXBException; import javax.xml.namespace.NamespaceContext; | import java.io.*; import javax.xml.bind.*; import javax.xml.namespace.*; | [
"java.io",
"javax.xml"
] | java.io; javax.xml; | 1,071,331 |
public NBTTagCompound getTag(ISatelliteUpgrade upgrade); | NBTTagCompound function(ISatelliteUpgrade upgrade); | /**
* Gets nbt tag for given upgrade
* @param upgrade The satellite upgrade
* @return The tag, or null if the upgrade doesn't exist
*/ | Gets nbt tag for given upgrade | getTag | {
"repo_name": "TheCodingMonster/PeripheralsPlusPlus",
"path": "src/main/java/com/austinv11/peripheralsplusplus/api/satellites/ISatellite.java",
"license": "gpl-2.0",
"size": 2915
} | [
"com.austinv11.peripheralsplusplus.api.satellites.upgrades.ISatelliteUpgrade",
"net.minecraft.nbt.NBTTagCompound"
] | import com.austinv11.peripheralsplusplus.api.satellites.upgrades.ISatelliteUpgrade; import net.minecraft.nbt.NBTTagCompound; | import com.austinv11.peripheralsplusplus.api.satellites.upgrades.*; import net.minecraft.nbt.*; | [
"com.austinv11.peripheralsplusplus",
"net.minecraft.nbt"
] | com.austinv11.peripheralsplusplus; net.minecraft.nbt; | 1,447,059 |
public void checkDoFirstInstall(){
if ( ! downloadAll ) {
return;
}
// this makes sure there is a file separator between every component,
// if path has a trailing file separator or not, it will work for both cases
File dir = new File(path, CHEM_COMP_CACHE_DIRECTORY);
File f = new File(dir, "components.cif.gz");
if ( ! f.exists()) {
downloadAllDefinitions();
} else {
// file exists.. did it get extracted?
FilenameFilter filter =new FilenameFilter() { | void function(){ if ( ! downloadAll ) { return; } File dir = new File(path, CHEM_COMP_CACHE_DIRECTORY); File f = new File(dir, STR); if ( ! f.exists()) { downloadAllDefinitions(); } else { FilenameFilter filter =new FilenameFilter() { | /** checks if the chemical components already have been installed into the PDB directory.
* If not, will download the chemical components definitions file and split it up into small
* subfiles.
*/ | checks if the chemical components already have been installed into the PDB directory. If not, will download the chemical components definitions file and split it up into small subfiles | checkDoFirstInstall | {
"repo_name": "JolantaWojcik/biojavaOwn",
"path": "biojava3-structure/src/main/java/org/biojava/bio/structure/io/mmcif/DownloadChemCompProvider.java",
"license": "lgpl-2.1",
"size": 10622
} | [
"java.io.File",
"java.io.FilenameFilter"
] | import java.io.File; import java.io.FilenameFilter; | import java.io.*; | [
"java.io"
] | java.io; | 1,016,169 |
public void writePacketData(PacketBuffer buf) throws IOException
{
byte b0 = 0;
if (this.isInvulnerable())
{
b0 = (byte)(b0 | 1);
}
if (this.isFlying())
{
b0 = (byte)(b0 | 2);
}
if (this.isAllowFlying())
{
b0 = (byte)(b0 | 4);
}
if (this.isCreativeMode())
{
b0 = (byte)(b0 | 8);
}
buf.writeByte(b0);
buf.writeFloat(this.flySpeed);
buf.writeFloat(this.walkSpeed);
} | void function(PacketBuffer buf) throws IOException { byte b0 = 0; if (this.isInvulnerable()) { b0 = (byte)(b0 1); } if (this.isFlying()) { b0 = (byte)(b0 2); } if (this.isAllowFlying()) { b0 = (byte)(b0 4); } if (this.isCreativeMode()) { b0 = (byte)(b0 8); } buf.writeByte(b0); buf.writeFloat(this.flySpeed); buf.writeFloat(this.walkSpeed); } | /**
* Writes the raw packet data to the data stream.
*/ | Writes the raw packet data to the data stream | writePacketData | {
"repo_name": "Severed-Infinity/technium",
"path": "build/tmp/recompileMc/sources/net/minecraft/network/play/server/SPacketPlayerAbilities.java",
"license": "gpl-3.0",
"size": 3496
} | [
"java.io.IOException",
"net.minecraft.network.PacketBuffer"
] | import java.io.IOException; import net.minecraft.network.PacketBuffer; | import java.io.*; import net.minecraft.network.*; | [
"java.io",
"net.minecraft.network"
] | java.io; net.minecraft.network; | 2,498,622 |
public static void showSingleRowIdentificationDialog(final FeatureListRow row, @NotNull Instant moduleCallDate) {
assert Platform.isFxApplicationThread();
final ParameterSet parameters = new SingleRowIdentificationParameters();
// Set m/z.
parameters.getParameter(SingleRowIdentificationParameters.ION_MASS)
.setValue(row.getAverageMZ());
if (parameters.showSetupDialog(true) == ExitCode.OK) {
int fingerCandidates, siriusCandidates, timer;
timer = parameters.getParameter(SingleRowIdentificationParameters.SIRIUS_TIMEOUT).getValue();
siriusCandidates =
parameters.getParameter(SingleRowIdentificationParameters.SIRIUS_CANDIDATES).getValue();
fingerCandidates =
parameters.getParameter(SingleRowIdentificationParameters.FINGERID_CANDIDATES).getValue();
if (timer <= 0 || siriusCandidates <= 0 || fingerCandidates <= 0) {
MZmineCore.getDesktop().displayErrorMessage("Sirius parameters can't be negative");
}
else { // Run task.
MZmineCore.getTaskController()
.addTask(new SingleRowIdentificationTask(parameters.cloneParameterSet(), row, moduleCallDate));
}
}
} | static void function(final FeatureListRow row, @NotNull Instant moduleCallDate) { assert Platform.isFxApplicationThread(); final ParameterSet parameters = new SingleRowIdentificationParameters(); parameters.getParameter(SingleRowIdentificationParameters.ION_MASS) .setValue(row.getAverageMZ()); if (parameters.showSetupDialog(true) == ExitCode.OK) { int fingerCandidates, siriusCandidates, timer; timer = parameters.getParameter(SingleRowIdentificationParameters.SIRIUS_TIMEOUT).getValue(); siriusCandidates = parameters.getParameter(SingleRowIdentificationParameters.SIRIUS_CANDIDATES).getValue(); fingerCandidates = parameters.getParameter(SingleRowIdentificationParameters.FINGERID_CANDIDATES).getValue(); if (timer <= 0 siriusCandidates <= 0 fingerCandidates <= 0) { MZmineCore.getDesktop().displayErrorMessage(STR); } else { MZmineCore.getTaskController() .addTask(new SingleRowIdentificationTask(parameters.cloneParameterSet(), row, moduleCallDate)); } } } | /**
* Show dialog for identifying a single peak-list row.
*
* @param row the feature list row.
*/ | Show dialog for identifying a single peak-list row | showSingleRowIdentificationDialog | {
"repo_name": "mzmine/mzmine3",
"path": "src/main/java/io/github/mzmine/modules/dataprocessing/id_sirius/SiriusIdentificationModule.java",
"license": "gpl-2.0",
"size": 3952
} | [
"io.github.mzmine.datamodel.features.FeatureListRow",
"io.github.mzmine.main.MZmineCore",
"io.github.mzmine.parameters.ParameterSet",
"io.github.mzmine.util.ExitCode",
"java.time.Instant",
"org.jetbrains.annotations.NotNull"
] | import io.github.mzmine.datamodel.features.FeatureListRow; import io.github.mzmine.main.MZmineCore; import io.github.mzmine.parameters.ParameterSet; import io.github.mzmine.util.ExitCode; import java.time.Instant; import org.jetbrains.annotations.NotNull; | import io.github.mzmine.datamodel.features.*; import io.github.mzmine.main.*; import io.github.mzmine.parameters.*; import io.github.mzmine.util.*; import java.time.*; import org.jetbrains.annotations.*; | [
"io.github.mzmine",
"java.time",
"org.jetbrains.annotations"
] | io.github.mzmine; java.time; org.jetbrains.annotations; | 783,944 |
public GameItemSchema getItemSchema()
throws SteamCondenserException {
if (this.itemSchema == null) {
this.itemSchema = GameItemSchema.create(this.appId, schemaLanguage);
}
return this.itemSchema;
} | GameItemSchema function() throws SteamCondenserException { if (this.itemSchema == null) { this.itemSchema = GameItemSchema.create(this.appId, schemaLanguage); } return this.itemSchema; } | /**
* Returns the item schema
*
* The item schema is fetched first if not done already
*
* @return The item schema for the game this inventory belongs to
* @throws SteamCondenserException if the item schema cannot be fetched
*/ | Returns the item schema The item schema is fetched first if not done already | getItemSchema | {
"repo_name": "JamesGames/steam-condenser-for-rust",
"path": "src/main/java/com/github/koraktor/steamcondenser/steam/community/GameInventory.java",
"license": "bsd-3-clause",
"size": 11849
} | [
"com.github.koraktor.steamcondenser.exceptions.SteamCondenserException"
] | import com.github.koraktor.steamcondenser.exceptions.SteamCondenserException; | import com.github.koraktor.steamcondenser.exceptions.*; | [
"com.github.koraktor"
] | com.github.koraktor; | 949,709 |
public static void addVerticalSmallSpring(Path2D.Float path, int x0, int y1, int y2) {
int springHeight = scale(2);
int springWidth = scale(2);
int distance = Math.abs(y2 - y1);
int numSprings = (distance / (springHeight));
int leftOver = (distance - (numSprings * springHeight)) / 2;
path.lineTo(x0, y1);
path.lineTo(x0, y1 - leftOver);
int count = 0;
if (y1 > y2) {
for (int y = y1 - leftOver; y > y2 + leftOver; y -= springHeight) {
int x = (count % 2 == 0) ? x0 - springWidth : x0 + springWidth;
path.lineTo(x, y);
count++;
}
}
else {
for (int y = y1 + leftOver; y < y2 - leftOver; y += springHeight) {
int x = (count % 2 == 0) ? x0 - springWidth : x0 + springWidth;
path.lineTo(x, y);
count++;
}
}
path.lineTo(x0, y2 + leftOver);
path.lineTo(x0, y2);
} | static void function(Path2D.Float path, int x0, int y1, int y2) { int springHeight = scale(2); int springWidth = scale(2); int distance = Math.abs(y2 - y1); int numSprings = (distance / (springHeight)); int leftOver = (distance - (numSprings * springHeight)) / 2; path.lineTo(x0, y1); path.lineTo(x0, y1 - leftOver); int count = 0; if (y1 > y2) { for (int y = y1 - leftOver; y > y2 + leftOver; y -= springHeight) { int x = (count % 2 == 0) ? x0 - springWidth : x0 + springWidth; path.lineTo(x, y); count++; } } else { for (int y = y1 + leftOver; y < y2 - leftOver; y += springHeight) { int x = (count % 2 == 0) ? x0 - springWidth : x0 + springWidth; path.lineTo(x, y); count++; } } path.lineTo(x0, y2 + leftOver); path.lineTo(x0, y2); } | /**
* Add an vertical spring between (x0, y1) and (x0, y1) to the given path object
*
* @param path the path object we'll add the spring to
* @param x0 the x coordinate of the spring
* @param y1 the y start coordinate
* @param y2 the y end coordiante
*/ | Add an vertical spring between (x0, y1) and (x0, y1) to the given path object | addVerticalSmallSpring | {
"repo_name": "AndroidX/constraintlayout",
"path": "desktop/ConstraintLayoutInspector/app/src/androidx/constraintLayout/desktop/constraintRendering/DrawConnectionUtils.java",
"license": "apache-2.0",
"size": 40239
} | [
"java.awt.geom.Path2D"
] | import java.awt.geom.Path2D; | import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 620,582 |
private void updateCursorsInScene(GVRScene scene, boolean add) {
for (Cursor cursor : cursors) {
if (cursor.isActive()) {
GVRSceneObject object = cursor.getMainSceneObject();
if (add) {
scene.addSceneObject(object);
} else {
scene.removeSceneObject(object);
}
}
}
} | void function(GVRScene scene, boolean add) { for (Cursor cursor : cursors) { if (cursor.isActive()) { GVRSceneObject object = cursor.getMainSceneObject(); if (add) { scene.addSceneObject(object); } else { scene.removeSceneObject(object); } } } } | /**
* Add or remove the active cursors from the provided scene.
*
* @param scene The GVRScene.
* @param add <code>true</code> for add, <code>false</code> to remove
*/ | Add or remove the active cursors from the provided scene | updateCursorsInScene | {
"repo_name": "parthmehta209/GearVRf",
"path": "GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/CursorManager.java",
"license": "apache-2.0",
"size": 33968
} | [
"org.gearvrf.GVRScene",
"org.gearvrf.GVRSceneObject"
] | import org.gearvrf.GVRScene; import org.gearvrf.GVRSceneObject; | import org.gearvrf.*; | [
"org.gearvrf"
] | org.gearvrf; | 711,745 |
@Test
public void chownRecursive() throws IOException, AlluxioException {
clearLoginUser();
FileSystemTestUtils.createByteFile(mFileSystem, "/testDir/testFile", WriteType.MUST_CACHE, 10);
mFsShell.run("chown", "-R", "user1", "/testDir");
String owner = mFileSystem.getStatus(new AlluxioURI("/testDir/testFile")).getOwner();
Assert.assertEquals("user1", owner);
owner = mFileSystem.getStatus(new AlluxioURI("/testDir")).getOwner();
Assert.assertEquals("user1", owner);
mFsShell.run("chown", "-R", "user2", "/testDir");
owner = mFileSystem.getStatus(new AlluxioURI("/testDir/testFile")).getOwner();
Assert.assertEquals("user2", owner);
} | void function() throws IOException, AlluxioException { clearLoginUser(); FileSystemTestUtils.createByteFile(mFileSystem, STR, WriteType.MUST_CACHE, 10); mFsShell.run("chown", "-R", "user1", STR); String owner = mFileSystem.getStatus(new AlluxioURI(STR)).getOwner(); Assert.assertEquals("user1", owner); owner = mFileSystem.getStatus(new AlluxioURI(STR)).getOwner(); Assert.assertEquals("user1", owner); mFsShell.run("chown", "-R", "user2", STR); owner = mFileSystem.getStatus(new AlluxioURI(STR)).getOwner(); Assert.assertEquals("user2", owner); } | /**
* Tests -R option for chown recursively.
*/ | Tests -R option for chown recursively | chownRecursive | {
"repo_name": "yuluo-ding/alluxio",
"path": "tests/src/test/java/alluxio/shell/command/ChownCommandTest.java",
"license": "apache-2.0",
"size": 2191
} | [
"java.io.IOException",
"org.junit.Assert"
] | import java.io.IOException; import org.junit.Assert; | import java.io.*; import org.junit.*; | [
"java.io",
"org.junit"
] | java.io; org.junit; | 1,517,510 |
List<SecurityTeam> getSecurityTeams(PerunSession perunSession) throws PrivilegeException, InternalErrorException; | List<SecurityTeam> getSecurityTeams(PerunSession perunSession) throws PrivilegeException, InternalErrorException; | /**
* Get list of SecurityTeams by access rights
* - PERUNADMIN : all teams
* - SECURITYADMIN : teams where user is admin
*
* @param perunSession
* @return List of SecurityTeams or empty ArrayList<SecurityTeam>
* @throws InternalErrorException
* @throws PrivilegeException
*/ | Get list of SecurityTeams by access rights - PERUNADMIN : all teams - SECURITYADMIN : teams where user is admin | getSecurityTeams | {
"repo_name": "licehammer/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/api/SecurityTeamsManager.java",
"license": "bsd-2-clause",
"size": 12360
} | [
"cz.metacentrum.perun.core.api.exceptions.InternalErrorException",
"cz.metacentrum.perun.core.api.exceptions.PrivilegeException",
"java.util.List"
] | import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import cz.metacentrum.perun.core.api.exceptions.PrivilegeException; import java.util.List; | import cz.metacentrum.perun.core.api.exceptions.*; import java.util.*; | [
"cz.metacentrum.perun",
"java.util"
] | cz.metacentrum.perun; java.util; | 230,841 |
public static int getProcessId() throws Exception {
RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
int pid = Integer.parseInt(runtime.getName().split("@")[0]);
return pid;
} | static int function() throws Exception { RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); int pid = Integer.parseInt(runtime.getName().split("@")[0]); return pid; } | /**
* Get the process id of the current running Java process
*
* @return Process id
*/ | Get the process id of the current running Java process | getProcessId | {
"repo_name": "mohlerm/hotspot",
"path": "test/testlibrary/jdk/test/lib/ProcessTools.java",
"license": "gpl-2.0",
"size": 8278
} | [
"java.lang.management.ManagementFactory",
"java.lang.management.RuntimeMXBean"
] | import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; | import java.lang.management.*; | [
"java.lang"
] | java.lang; | 958,950 |
private void decode(byte[] data, int width, int height) {
Size size = activity.getCameraManager().getPreviewSize();
// 这里需要将获取的data翻转一下,因为相机默认拿的的横屏的数据
byte[] rotatedData = new byte[data.length];
for (int y = 0; y < size.height; y++) {
for (int x = 0; x < size.width; x++)
rotatedData[x * size.height + size.height - y - 1] = data[x + y * size.width];
}
// 宽高也要调整
int tmp = size.width;
size.width = size.height;
size.height = tmp;
Result rawResult = null;
PlanarYUVLuminanceSource source = buildLuminanceSource(rotatedData, size.width, size.height);
if (source != null) {
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
try {
rawResult = multiFormatReader.decodeWithState(bitmap);
} catch (ReaderException re) {
// continue
} finally {
multiFormatReader.reset();
}
}
Handler handler = activity.getHandler();
if (rawResult != null) {
// Don't log the barcode contents for security.
if (handler != null) {
Message message = Message.obtain(handler, R.id.decode_succeeded, rawResult);
Bundle bundle = new Bundle();
bundleThumbnail(source, bundle);
message.setData(bundle);
message.sendToTarget();
}
} else {
if (handler != null) {
Message message = Message.obtain(handler, R.id.decode_failed);
message.sendToTarget();
}
}
} | void function(byte[] data, int width, int height) { Size size = activity.getCameraManager().getPreviewSize(); byte[] rotatedData = new byte[data.length]; for (int y = 0; y < size.height; y++) { for (int x = 0; x < size.width; x++) rotatedData[x * size.height + size.height - y - 1] = data[x + y * size.width]; } int tmp = size.width; size.width = size.height; size.height = tmp; Result rawResult = null; PlanarYUVLuminanceSource source = buildLuminanceSource(rotatedData, size.width, size.height); if (source != null) { BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); try { rawResult = multiFormatReader.decodeWithState(bitmap); } catch (ReaderException re) { } finally { multiFormatReader.reset(); } } Handler handler = activity.getHandler(); if (rawResult != null) { if (handler != null) { Message message = Message.obtain(handler, R.id.decode_succeeded, rawResult); Bundle bundle = new Bundle(); bundleThumbnail(source, bundle); message.setData(bundle); message.sendToTarget(); } } else { if (handler != null) { Message message = Message.obtain(handler, R.id.decode_failed); message.sendToTarget(); } } } | /**
* Decode the data within the viewfinder rectangle, and time how long it
* took. For efficiency, reuse the same reader objects from one decode to
* the next.
*
* @param data The YUV preview frame.
* @param width The width of the preview frame.
* @param height The height of the preview frame.
*/ | Decode the data within the viewfinder rectangle, and time how long it took. For efficiency, reuse the same reader objects from one decode to the next | decode | {
"repo_name": "ludroid/luxing",
"path": "libxing/src/main/java/com/luforn/libxing/decode/DecodeHandler.java",
"license": "apache-2.0",
"size": 5482
} | [
"android.hardware.Camera",
"android.os.Bundle",
"android.os.Handler",
"android.os.Message",
"com.google.zxing.BinaryBitmap",
"com.google.zxing.PlanarYUVLuminanceSource",
"com.google.zxing.ReaderException",
"com.google.zxing.Result",
"com.google.zxing.common.HybridBinarizer"
] | import android.hardware.Camera; import android.os.Bundle; import android.os.Handler; import android.os.Message; import com.google.zxing.BinaryBitmap; import com.google.zxing.PlanarYUVLuminanceSource; import com.google.zxing.ReaderException; import com.google.zxing.Result; import com.google.zxing.common.HybridBinarizer; | import android.hardware.*; import android.os.*; import com.google.zxing.*; import com.google.zxing.common.*; | [
"android.hardware",
"android.os",
"com.google.zxing"
] | android.hardware; android.os; com.google.zxing; | 1,904,460 |
List<RichMember> findRichMembersWithAttributes(PerunSession sess, String searchString); | List<RichMember> findRichMembersWithAttributes(PerunSession sess, String searchString); | /**
* Return list of rich members with attributes by theirs name or login or email
* @param sess
* @param searchString
* @return list of rich members with attributes
* @throws InternalErrorException
*/ | Return list of rich members with attributes by theirs name or login or email | findRichMembersWithAttributes | {
"repo_name": "balcirakpeter/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/bl/MembersManagerBl.java",
"license": "bsd-2-clause",
"size": 74930
} | [
"cz.metacentrum.perun.core.api.PerunSession",
"cz.metacentrum.perun.core.api.RichMember",
"java.util.List"
] | import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.RichMember; import java.util.List; | import cz.metacentrum.perun.core.api.*; import java.util.*; | [
"cz.metacentrum.perun",
"java.util"
] | cz.metacentrum.perun; java.util; | 1,151,339 |
@NotEmpty(message = "org.form.offer.field.publishTime.empty")
@NotNull(message = "org.form.offer.field.publishTime.empty")
@NotBlank(message = "org.form.offer.field.publishTime.empty")
@Pattern(
regexp = "\\d{2}:\\d{2}",
message = "org.form.offer.field.publishTime.invalid")
public String getPublishTime() {
return this.m_numPublishTime;
} | @NotEmpty(message = STR) @NotNull(message = STR) @NotBlank(message = STR) @Pattern( regexp = STR, message = STR) String function() { return this.m_numPublishTime; } | /**
* Gets the publish time.
*
* @return the publish time
*/ | Gets the publish time | getPublishTime | {
"repo_name": "fraunhoferfokus/particity",
"path": "lib_data/src/main/java/de/fraunhofer/fokus/oefit/adhoc/forms/OfferForm.java",
"license": "bsd-3-clause",
"size": 17963
} | [
"javax.validation.constraints.NotNull",
"javax.validation.constraints.Pattern",
"org.hibernate.validator.constraints.NotBlank",
"org.hibernate.validator.constraints.NotEmpty"
] | import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import org.hibernate.validator.constraints.NotBlank; import org.hibernate.validator.constraints.NotEmpty; | import javax.validation.constraints.*; import org.hibernate.validator.constraints.*; | [
"javax.validation",
"org.hibernate.validator"
] | javax.validation; org.hibernate.validator; | 1,031,090 |
public synchronized void setCurfews(SurePetcareDevice device, SurePetcareDeviceCurfewList curfewList)
throws SurePetcareApiException {
// post new JSON control structure to API
SurePetcareDeviceControl control = new SurePetcareDeviceControl();
control.curfewList = curfewList.compact();
String ctrlurl = DEVICE_BASE_URL + "/" + device.id.toString() + "/control";
setDataThroughApi(ctrlurl, HttpMethod.PUT, control);
// now we're fetching the new state back for the cache
String devurl = DEVICE_BASE_URL + "/" + device.id.toString() + "/control";
SurePetcareDeviceControl newControl = SurePetcareConstants.GSON.fromJson(getDataFromApi(devurl),
SurePetcareDeviceControl.class);
if (newControl != null) {
newControl.curfewList = newControl.curfewList.order();
}
device.control = newControl;
} | synchronized void function(SurePetcareDevice device, SurePetcareDeviceCurfewList curfewList) throws SurePetcareApiException { SurePetcareDeviceControl control = new SurePetcareDeviceControl(); control.curfewList = curfewList.compact(); String ctrlurl = DEVICE_BASE_URL + "/" + device.id.toString() + STR; setDataThroughApi(ctrlurl, HttpMethod.PUT, control); String devurl = DEVICE_BASE_URL + "/" + device.id.toString() + STR; SurePetcareDeviceControl newControl = SurePetcareConstants.GSON.fromJson(getDataFromApi(devurl), SurePetcareDeviceControl.class); if (newControl != null) { newControl.curfewList = newControl.curfewList.order(); } device.control = newControl; } | /**
* Updates all curfews through an API call to the Sure Petcare API.
*
* @param device the device
* @param curfewList the list of curfews
* @throws SurePetcareApiException
*/ | Updates all curfews through an API call to the Sure Petcare API | setCurfews | {
"repo_name": "paulianttila/openhab2",
"path": "bundles/org.openhab.binding.surepetcare/src/main/java/org/openhab/binding/surepetcare/internal/SurePetcareAPIHelper.java",
"license": "epl-1.0",
"size": 20282
} | [
"org.eclipse.jetty.http.HttpMethod",
"org.openhab.binding.surepetcare.internal.dto.SurePetcareDevice",
"org.openhab.binding.surepetcare.internal.dto.SurePetcareDeviceControl",
"org.openhab.binding.surepetcare.internal.dto.SurePetcareDeviceCurfewList"
] | import org.eclipse.jetty.http.HttpMethod; import org.openhab.binding.surepetcare.internal.dto.SurePetcareDevice; import org.openhab.binding.surepetcare.internal.dto.SurePetcareDeviceControl; import org.openhab.binding.surepetcare.internal.dto.SurePetcareDeviceCurfewList; | import org.eclipse.jetty.http.*; import org.openhab.binding.surepetcare.internal.dto.*; | [
"org.eclipse.jetty",
"org.openhab.binding"
] | org.eclipse.jetty; org.openhab.binding; | 1,878,010 |
protected void addTicketToRegistry(final Ticket ticket, final TicketGrantingTicket ticketGrantingTicket) {
LOGGER.debug("Adding ticket [{}] to registry", ticket);
this.ticketRegistry.addTicket(ticket);
if (ticketGrantingTicket != null) {
LOGGER.debug("Updating parent ticket-granting ticket [{}]", ticketGrantingTicket);
this.ticketRegistry.updateTicket(ticketGrantingTicket);
}
} | void function(final Ticket ticket, final TicketGrantingTicket ticketGrantingTicket) { LOGGER.debug(STR, ticket); this.ticketRegistry.addTicket(ticket); if (ticketGrantingTicket != null) { LOGGER.debug(STR, ticketGrantingTicket); this.ticketRegistry.updateTicket(ticketGrantingTicket); } } | /**
* Add ticket to registry.
*
* @param ticket the ticket
* @param ticketGrantingTicket the ticket granting ticket
*/ | Add ticket to registry | addTicketToRegistry | {
"repo_name": "leleuj/cas",
"path": "support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/response/accesstoken/OAuth20DefaultTokenGenerator.java",
"license": "apache-2.0",
"size": 14056
} | [
"org.apereo.cas.ticket.Ticket",
"org.apereo.cas.ticket.TicketGrantingTicket"
] | import org.apereo.cas.ticket.Ticket; import org.apereo.cas.ticket.TicketGrantingTicket; | import org.apereo.cas.ticket.*; | [
"org.apereo.cas"
] | org.apereo.cas; | 1,529,785 |
public CashControlDetail getCashControlDetailForPaymentApplicationDocument(PaymentApplicationDocument document);
| CashControlDetail function(PaymentApplicationDocument document); | /**
*
* Retrieves the CashControlDetail line associated with the passed-in PaymentApplication Document.
*
* @param document A valid PaymentApplication Document
* @return The associated CashControlDetail, if exists, or null if not.
*/ | Retrieves the CashControlDetail line associated with the passed-in PaymentApplication Document | getCashControlDetailForPaymentApplicationDocument | {
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "work/src/org/kuali/kfs/module/ar/document/service/PaymentApplicationDocumentService.java",
"license": "agpl-3.0",
"size": 7450
} | [
"org.kuali.kfs.module.ar.businessobject.CashControlDetail",
"org.kuali.kfs.module.ar.document.PaymentApplicationDocument"
] | import org.kuali.kfs.module.ar.businessobject.CashControlDetail; import org.kuali.kfs.module.ar.document.PaymentApplicationDocument; | import org.kuali.kfs.module.ar.businessobject.*; import org.kuali.kfs.module.ar.document.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 2,867,243 |
interface WithNatGateway {
Update withNatGateway(SubResource natGateway);
} | interface WithNatGateway { Update withNatGateway(SubResource natGateway); } | /**
* Specifies natGateway.
* @param natGateway Nat gateway associated with this subnet
* @return the next update stage
*/ | Specifies natGateway | withNatGateway | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_11_01/src/main/java/com/microsoft/azure/management/network/v2019_11_01/Subnet.java",
"license": "mit",
"size": 16679
} | [
"com.microsoft.azure.SubResource"
] | import com.microsoft.azure.SubResource; | import com.microsoft.azure.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 760,835 |
public void testGetTablesForCache() throws Exception {
try {
execute("create table t1(id int primary key, name varchar)");
execute("create table t2(id int primary key, name varchar)");
IgniteH2Indexing h2Idx = (IgniteH2Indexing)grid(0).context().query().getIndexing();
String cacheName = cacheName("T1");
Collection<H2TableDescriptor> col = GridTestUtils.invoke(h2Idx, "tables", cacheName);
assertNotNull(col);
H2TableDescriptor[] tables = col.toArray(new H2TableDescriptor[col.size()]);
assertEquals(1, tables.length);
assertEquals(tables[0].table().getName(), "T1");
}
finally {
execute("drop table t1 if exists");
execute("drop table t2 if exists");
}
} | void function() throws Exception { try { execute(STR); execute(STR); IgniteH2Indexing h2Idx = (IgniteH2Indexing)grid(0).context().query().getIndexing(); String cacheName = cacheName("T1"); Collection<H2TableDescriptor> col = GridTestUtils.invoke(h2Idx, STR, cacheName); assertNotNull(col); H2TableDescriptor[] tables = col.toArray(new H2TableDescriptor[col.size()]); assertEquals(1, tables.length); assertEquals(tables[0].table().getName(), "T1"); } finally { execute(STR); execute(STR); } } | /**
* Test that {@link IgniteH2Indexing#tables(String)} method
* only returns tables belonging to given cache.
*
* @throws Exception if failed.
*/ | Test that <code>IgniteH2Indexing#tables(String)</code> method only returns tables belonging to given cache | testGetTablesForCache | {
"repo_name": "endian675/ignite",
"path": "modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java",
"license": "apache-2.0",
"size": 63690
} | [
"java.util.Collection",
"org.apache.ignite.internal.processors.query.h2.H2TableDescriptor",
"org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing",
"org.apache.ignite.testframework.GridTestUtils"
] | import java.util.Collection; import org.apache.ignite.internal.processors.query.h2.H2TableDescriptor; import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing; import org.apache.ignite.testframework.GridTestUtils; | import java.util.*; import org.apache.ignite.internal.processors.query.h2.*; import org.apache.ignite.testframework.*; | [
"java.util",
"org.apache.ignite"
] | java.util; org.apache.ignite; | 2,132,717 |
@Override
public void generateMethodPrologue(JavaWriter out, HashMap<String,Object> map)
throws IOException
{
_next.generateMethodPrologue(out, map);
} | void function(JavaWriter out, HashMap<String,Object> map) throws IOException { _next.generateMethodPrologue(out, map); } | /**
* Generates the static class prologue
*/ | Generates the static class prologue | generateMethodPrologue | {
"repo_name": "christianchristensen/resin",
"path": "modules/kernel/src/com/caucho/config/gen/AbstractCallChain.java",
"license": "gpl-2.0",
"size": 7992
} | [
"com.caucho.java.JavaWriter",
"java.io.IOException",
"java.util.HashMap"
] | import com.caucho.java.JavaWriter; import java.io.IOException; import java.util.HashMap; | import com.caucho.java.*; import java.io.*; import java.util.*; | [
"com.caucho.java",
"java.io",
"java.util"
] | com.caucho.java; java.io; java.util; | 663,419 |
public static List<String> readLines(Readable r) throws IOException {
List<String> result = new ArrayList<String>();
LineReader lineReader = new LineReader(r);
String line;
while ((line = lineReader.readLine()) != null) {
result.add(line);
}
return result;
}
/**
* Streams lines from a {@link Readable} object, stopping when the processor returns {@code false}
* or all lines have been read and returning the result produced by the processor. Does not close
* {@code readable}. Note that this method may not fully consume the contents of {@code readable} | static List<String> function(Readable r) throws IOException { List<String> result = new ArrayList<String>(); LineReader lineReader = new LineReader(r); String line; while ((line = lineReader.readLine()) != null) { result.add(line); } return result; } /** * Streams lines from a {@link Readable} object, stopping when the processor returns {@code false} * or all lines have been read and returning the result produced by the processor. Does not close * {@code readable}. Note that this method may not fully consume the contents of {@code readable} | /**
* Reads all of the lines from a {@link Readable} object. The lines do not include
* line-termination characters, but do include other leading and trailing whitespace.
*
* <p>Does not close the {@code Readable}. If reading files or resources you should use the
* {@link Files#readLines} and {@link Resources#readLines} methods.
*
* @param r the object to read from
* @return a mutable {@link List} containing all the lines
* @throws IOException if an I/O error occurs
*/ | Reads all of the lines from a <code>Readable</code> object. The lines do not include line-termination characters, but do include other leading and trailing whitespace. Does not close the Readable. If reading files or resources you should use the <code>Files#readLines</code> and <code>Resources#readLines</code> methods | readLines | {
"repo_name": "simonzhangsm/voltdb",
"path": "third_party/java/src/com/google_voltpatches/common/io/CharStreams.java",
"license": "agpl-3.0",
"size": 8230
} | [
"java.io.IOException",
"java.util.ArrayList",
"java.util.List"
] | import java.io.IOException; import java.util.ArrayList; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,745,384 |
@SuppressWarnings("unchecked")
public synchronized Map<String, String> listDatabases() throws IOException {
storage.checkConnection();
final ODocument result = new ODocument();
try {
final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_LIST);
storage.endRequest(network);
try {
storage.beginResponse(network);
result.fromStream(network.readBytes());
} finally {
storage.endResponse(network);
}
} catch (Exception e) {
OLogManager.instance().exception("Cannot retrieve the configuration list", e, OStorageException.class);
storage.close(true);
}
return (Map<String, String>) result.field("databases");
}
| @SuppressWarnings(STR) synchronized Map<String, String> function() throws IOException { storage.checkConnection(); final ODocument result = new ODocument(); try { final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_LIST); storage.endRequest(network); try { storage.beginResponse(network); result.fromStream(network.readBytes()); } finally { storage.endResponse(network); } } catch (Exception e) { OLogManager.instance().exception(STR, e, OStorageException.class); storage.close(true); } return (Map<String, String>) result.field(STR); } | /**
* List the databases on a remote server.
*
* @param iUserName
* Server's user name
* @param iUserPassword
* Server's password for the user name used
* @return The instance itself. Useful to execute method in chain
* @throws IOException
*/ | List the databases on a remote server | listDatabases | {
"repo_name": "vivosys/orientdb",
"path": "client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java",
"license": "apache-2.0",
"size": 15461
} | [
"com.orientechnologies.common.log.OLogManager",
"com.orientechnologies.orient.core.exception.OStorageException",
"com.orientechnologies.orient.core.record.impl.ODocument",
"com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryClient",
"com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryProtocol",
"java.io.IOException",
"java.util.Map"
] | import com.orientechnologies.common.log.OLogManager; import com.orientechnologies.orient.core.exception.OStorageException; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryClient; import com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryProtocol; import java.io.IOException; import java.util.Map; | import com.orientechnologies.common.log.*; import com.orientechnologies.orient.core.exception.*; import com.orientechnologies.orient.core.record.impl.*; import com.orientechnologies.orient.enterprise.channel.binary.*; import java.io.*; import java.util.*; | [
"com.orientechnologies.common",
"com.orientechnologies.orient",
"java.io",
"java.util"
] | com.orientechnologies.common; com.orientechnologies.orient; java.io; java.util; | 1,033,135 |
public Cancellable simulateAsync(SimulatePipelineRequest request,
RequestOptions options,
ActionListener<SimulatePipelineResponse> listener) {
return restHighLevelClient.performRequestAsyncAndParseEntity(request, IngestRequestConverters::simulatePipeline, options,
SimulatePipelineResponse::fromXContent, listener, emptySet());
} | Cancellable function(SimulatePipelineRequest request, RequestOptions options, ActionListener<SimulatePipelineResponse> listener) { return restHighLevelClient.performRequestAsyncAndParseEntity(request, IngestRequestConverters::simulatePipeline, options, SimulatePipelineResponse::fromXContent, listener, emptySet()); } | /**
* Asynchronously simulate a pipeline on a set of documents provided in the request
* <p>
* See
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/simulate-pipeline-api.html">
* Simulate Pipeline API on elastic.co</a>
*
* @param request the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/ | Asynchronously simulate a pipeline on a set of documents provided in the request See Simulate Pipeline API on elastic.co | simulateAsync | {
"repo_name": "ern/elasticsearch",
"path": "client/rest-high-level/src/main/java/org/elasticsearch/client/IngestClient.java",
"license": "apache-2.0",
"size": 9223
} | [
"java.util.Collections",
"org.elasticsearch.action.ActionListener",
"org.elasticsearch.action.ingest.SimulatePipelineRequest",
"org.elasticsearch.action.ingest.SimulatePipelineResponse"
] | import java.util.Collections; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ingest.SimulatePipelineRequest; import org.elasticsearch.action.ingest.SimulatePipelineResponse; | import java.util.*; import org.elasticsearch.action.*; import org.elasticsearch.action.ingest.*; | [
"java.util",
"org.elasticsearch.action"
] | java.util; org.elasticsearch.action; | 2,397,027 |
protected void emptyTag(Element elem) throws BadLocationException, IOException {
if (!inContent && !inPre) {
indent();
}
AttributeSet attr = elem.getAttributes();
closeOutUnwantedEmbeddedTags(attr);
writeEmbeddedTags(attr);
if (matchNameAttribute(attr, HTML.Tag.CONTENT)) {
inContent = true;
text(elem);
}
else if (matchNameAttribute(attr, HTML.Tag.COMMENT)) {
comment(elem);
}
else {
boolean isBlock = isBlockTag(elem.getAttributes());
if (inContent && isBlock) {
writeLineSeparator();
indent();
}
Object nameTag = (attr != null) ? attr.getAttribute(StyleConstants.NameAttribute) : null;
Object endTag = (attr != null) ? attr.getAttribute(HTML.Attribute.ENDTAG) : null;
boolean outputEndTag = false;
// If an instance of an UNKNOWN Tag, or an instance of a
// tag that is only visible during editing
//
if (nameTag != null && endTag != null && (endTag instanceof String) && ((String) endTag).equals("true")) {
outputEndTag = true;
}
if (completeDoc && matchNameAttribute(attr, HTML.Tag.HEAD)) {
if (outputEndTag) {
// Write out any styles.
writeStyles(((HTMLDocument) getDocument()).getStyleSheet());
}
wroteHead = true;
}
write('<');
if (outputEndTag) {
write('/');
}
write(elem.getName());
writeAttributes(attr);
write('>');
if (matchNameAttribute(attr, HTML.Tag.TITLE) && !outputEndTag) {
Document doc = elem.getDocument();
String title = (String) doc.getProperty(Document.TitleProperty);
write(title);
}
else if (!inContent || isBlock) {
writeLineSeparator();
if (isBlock && inContent) {
indent();
}
}
}
} | void function(Element elem) throws BadLocationException, IOException { if (!inContent && !inPre) { indent(); } AttributeSet attr = elem.getAttributes(); closeOutUnwantedEmbeddedTags(attr); writeEmbeddedTags(attr); if (matchNameAttribute(attr, HTML.Tag.CONTENT)) { inContent = true; text(elem); } else if (matchNameAttribute(attr, HTML.Tag.COMMENT)) { comment(elem); } else { boolean isBlock = isBlockTag(elem.getAttributes()); if (inContent && isBlock) { writeLineSeparator(); indent(); } Object nameTag = (attr != null) ? attr.getAttribute(StyleConstants.NameAttribute) : null; Object endTag = (attr != null) ? attr.getAttribute(HTML.Attribute.ENDTAG) : null; boolean outputEndTag = false; outputEndTag = true; } if (completeDoc && matchNameAttribute(attr, HTML.Tag.HEAD)) { if (outputEndTag) { writeStyles(((HTMLDocument) getDocument()).getStyleSheet()); } wroteHead = true; } write('<'); if (outputEndTag) { write('/'); } write(elem.getName()); writeAttributes(attr); write('>'); if (matchNameAttribute(attr, HTML.Tag.TITLE) && !outputEndTag) { Document doc = elem.getDocument(); String title = (String) doc.getProperty(Document.TitleProperty); write(title); } else if (!inContent isBlock) { writeLineSeparator(); if (isBlock && inContent) { indent(); } } } } | /**
* Writes out all empty elements (all tags that have no
* corresponding end tag).
*
* @param elem an Element
* @exception IOException on any I/O error
* @exception BadLocationException if pos represents an invalid
* location within the document.
*/ | Writes out all empty elements (all tags that have no corresponding end tag) | emptyTag | {
"repo_name": "cst316/spring16project-Team-Boston",
"path": "src/net/sf/memoranda/ui/htmleditor/AltHTMLWriter.java",
"license": "gpl-2.0",
"size": 82104
} | [
"java.io.IOException",
"javax.swing.text.AttributeSet",
"javax.swing.text.BadLocationException",
"javax.swing.text.Document",
"javax.swing.text.Element",
"javax.swing.text.StyleConstants",
"javax.swing.text.html.HTMLDocument"
] | import java.io.IOException; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.Element; import javax.swing.text.StyleConstants; import javax.swing.text.html.HTMLDocument; | import java.io.*; import javax.swing.text.*; import javax.swing.text.html.*; | [
"java.io",
"javax.swing"
] | java.io; javax.swing; | 555,335 |
public static AssignmentSolutionsFragment newInstance(String assignmentId) {
AssignmentSolutionsFragment fragment = new AssignmentSolutionsFragment();
Bundle args = new Bundle();
args.putString(ASSIGNMENT_ID, assignmentId);
fragment.setArguments(args);
return fragment;
} | static AssignmentSolutionsFragment function(String assignmentId) { AssignmentSolutionsFragment fragment = new AssignmentSolutionsFragment(); Bundle args = new Bundle(); args.putString(ASSIGNMENT_ID, assignmentId); fragment.setArguments(args); return fragment; } | /**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param assignmentId Parameter 1.
* @return A new instance of fragment AssignmentTextFragment.
*/ | Use this factory method to create a new instance of this fragment using the provided parameters | newInstance | {
"repo_name": "ReCodEx/android-app",
"path": "app/src/main/java/io/github/recodex/android/AssignmentSolutionsFragment.java",
"license": "mit",
"size": 10216
} | [
"android.os.Bundle"
] | import android.os.Bundle; | import android.os.*; | [
"android.os"
] | android.os; | 1,688,419 |
@Override
ResultSet getColumnPrivileges( String catalog,
String schema,
String table,
String columnNamePattern ) throws SQLException; | ResultSet getColumnPrivileges( String catalog, String schema, String table, String columnNamePattern ) throws SQLException; | /**
* <strong>Drill</strong>: Currently, returns an empty (zero-row) result set.
* (Note: Currently, result set might not have the expected columns.)
*/ | Drill: Currently, returns an empty (zero-row) result set. (Note: Currently, result set might not have the expected columns.) | getColumnPrivileges | {
"repo_name": "parthchandra/incubator-drill",
"path": "exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillDatabaseMetaData.java",
"license": "apache-2.0",
"size": 15649
} | [
"java.sql.ResultSet",
"java.sql.SQLException"
] | import java.sql.ResultSet; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 71,312 |
public String getCellRangeListString(
com.sun.star.container.XIndexAccess xRangesIA ) throws RuntimeException, Exception
{
String aStr = "";
int nCount = xRangesIA.getCount();
for (int nIndex = 0; nIndex < nCount; ++nIndex)
{
if (nIndex > 0)
aStr += " ";
Object aRangeObj = xRangesIA.getByIndex( nIndex );
com.sun.star.sheet.XSheetCellRange xCellRange = UnoRuntime.queryInterface( com.sun.star.sheet.XSheetCellRange.class, aRangeObj );
aStr += getCellRangeAddressString( xCellRange, false );
}
return aStr;
} | String function( com.sun.star.container.XIndexAccess xRangesIA ) throws RuntimeException, Exception { String aStr = STR "; Object aRangeObj = xRangesIA.getByIndex( nIndex ); com.sun.star.sheet.XSheetCellRange xCellRange = UnoRuntime.queryInterface( com.sun.star.sheet.XSheetCellRange.class, aRangeObj ); aStr += getCellRangeAddressString( xCellRange, false ); } return aStr; } | /** Returns a list of addresses of all cell ranges contained in the collection.
@param xRangesIA The XIndexAccess interface of the collection.
@return A string containing the cell range address list. */ | Returns a list of addresses of all cell ranges contained in the collection | getCellRangeListString | {
"repo_name": "jvanz/core",
"path": "odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetDocHelper.java",
"license": "gpl-3.0",
"size": 16644
} | [
"com.sun.star.uno.RuntimeException",
"com.sun.star.uno.UnoRuntime"
] | import com.sun.star.uno.RuntimeException; import com.sun.star.uno.UnoRuntime; | import com.sun.star.uno.*; | [
"com.sun.star"
] | com.sun.star; | 1,154,828 |
@Override
public void visit(NormalPetriNetName name) {
saveAs = true;
}
} | void function(NormalPetriNetName name) { saveAs = true; } } | /**
* If the name is a normal name it does not yet have a file representation
* and so a save as is needed
*
* @param name of the file
*/ | If the name is a normal name it does not yet have a file representation and so a save as is needed | visit | {
"repo_name": "sjdayday/PIPE",
"path": "pipe-gui/src/main/java/pipe/actions/gui/SaveAction.java",
"license": "mit",
"size": 4411
} | [
"uk.ac.imperial.pipe.models.petrinet.name.NormalPetriNetName"
] | import uk.ac.imperial.pipe.models.petrinet.name.NormalPetriNetName; | import uk.ac.imperial.pipe.models.petrinet.name.*; | [
"uk.ac.imperial"
] | uk.ac.imperial; | 841,750 |
public void forceChange() {
for (Map.Entry<File, Long> e : fileToTimestamp.entrySet()) {
e.setValue(0l);
}
} | void function() { for (Map.Entry<File, Long> e : fileToTimestamp.entrySet()) { e.setValue(0l); } } | /**
* Needed for testing; changes file timestamps so that a change will be detected by {@link #containsChanges()}.
*/ | Needed for testing; changes file timestamps so that a change will be detected by <code>#containsChanges()</code> | forceChange | {
"repo_name": "allanfish/facetime",
"path": "facetime-utils/src/main/java/com/facetime/core/resource/URLChangeTracker.java",
"license": "mit",
"size": 7384
} | [
"java.io.File",
"java.util.Map"
] | import java.io.File; import java.util.Map; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 445,703 |
private void encryptUsingDOM(
String algorithm,
SecretKey secretKey,
String keyTransportAlgorithm,
Key wrappingKey,
boolean includeWrappingKeyInfo,
Document document,
List<String> localNames,
boolean content
) throws Exception {
XMLCipher cipher = XMLCipher.getInstance(algorithm);
cipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
if (wrappingKey != null) {
XMLCipher newCipher = XMLCipher.getInstance(keyTransportAlgorithm);
newCipher.init(XMLCipher.WRAP_MODE, wrappingKey);
EncryptedKey encryptedKey = newCipher.encryptKey(document, secretKey);
if (includeWrappingKeyInfo && wrappingKey instanceof PublicKey) {
// Create a KeyInfo for the EncryptedKey
KeyInfo encryptedKeyKeyInfo = encryptedKey.getKeyInfo();
if (encryptedKeyKeyInfo == null) {
encryptedKeyKeyInfo = new KeyInfo(document);
encryptedKeyKeyInfo.getElement().setAttributeNS(
"http://www.w3.org/2000/xmlns/", "xmlns:dsig", "http://www.w3.org/2000/09/xmldsig#"
);
encryptedKey.setKeyInfo(encryptedKeyKeyInfo);
}
encryptedKeyKeyInfo.add((PublicKey)wrappingKey);
}
EncryptedData builder = cipher.getEncryptedData();
KeyInfo builderKeyInfo = builder.getKeyInfo();
if (builderKeyInfo == null) {
builderKeyInfo = new KeyInfo(document);
builderKeyInfo.getElement().setAttributeNS(
"http://www.w3.org/2000/xmlns/", "xmlns:dsig", "http://www.w3.org/2000/09/xmldsig#"
);
builder.setKeyInfo(builderKeyInfo);
}
builderKeyInfo.add(encryptedKey);
}
XPathFactory xpf = XPathFactory.newInstance();
XPath xpath = xpf.newXPath();
xpath.setNamespaceContext(new DSNamespaceContext());
for (String localName : localNames) {
String expression = "//*[local-name()='" + localName + "']";
Element elementToEncrypt =
(Element) xpath.evaluate(expression, document, XPathConstants.NODE);
Assert.assertNotNull(elementToEncrypt);
document = cipher.doFinal(document, elementToEncrypt, content);
}
NodeList nodeList = document.getElementsByTagNameNS(
XMLSecurityConstants.TAG_xenc_EncryptedData.getNamespaceURI(),
XMLSecurityConstants.TAG_xenc_EncryptedData.getLocalPart()
);
Assert.assertTrue(nodeList.getLength() > 0);
} | void function( String algorithm, SecretKey secretKey, String keyTransportAlgorithm, Key wrappingKey, boolean includeWrappingKeyInfo, Document document, List<String> localNames, boolean content ) throws Exception { XMLCipher cipher = XMLCipher.getInstance(algorithm); cipher.init(XMLCipher.ENCRYPT_MODE, secretKey); if (wrappingKey != null) { XMLCipher newCipher = XMLCipher.getInstance(keyTransportAlgorithm); newCipher.init(XMLCipher.WRAP_MODE, wrappingKey); EncryptedKey encryptedKey = newCipher.encryptKey(document, secretKey); if (includeWrappingKeyInfo && wrappingKey instanceof PublicKey) { KeyInfo encryptedKeyKeyInfo = encryptedKey.getKeyInfo(); if (encryptedKeyKeyInfo == null) { encryptedKeyKeyInfo = new KeyInfo(document); encryptedKeyKeyInfo.getElement().setAttributeNS( STRhttp: ); builder.setKeyInfo(builderKeyInfo); } builderKeyInfo.add(encryptedKey); } XPathFactory xpf = XPathFactory.newInstance(); XPath xpath = xpf.newXPath(); xpath.setNamespaceContext(new DSNamespaceContext()); for (String localName : localNames) { String expression = " Element elementToEncrypt = (Element) xpath.evaluate(expression, document, XPathConstants.NODE); Assert.assertNotNull(elementToEncrypt); document = cipher.doFinal(document, elementToEncrypt, content); } NodeList nodeList = document.getElementsByTagNameNS( XMLSecurityConstants.TAG_xenc_EncryptedData.getNamespaceURI(), XMLSecurityConstants.TAG_xenc_EncryptedData.getLocalPart() ); Assert.assertTrue(nodeList.getLength() > 0); } | /**
* Encrypt the document using DOM APIs and run some tests on the encrypted Document.
*/ | Encrypt the document using DOM APIs and run some tests on the encrypted Document | encryptUsingDOM | {
"repo_name": "Legostaev/xmlsec-gost",
"path": "src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionVerificationTest.java",
"license": "apache-2.0",
"size": 32854
} | [
"java.security.Key",
"java.security.PublicKey",
"java.util.List",
"javax.crypto.SecretKey",
"javax.xml.xpath.XPath",
"javax.xml.xpath.XPathConstants",
"javax.xml.xpath.XPathFactory",
"org.apache.xml.security.encryption.EncryptedData",
"org.apache.xml.security.encryption.EncryptedKey",
"org.apache.xml.security.encryption.XMLCipher",
"org.apache.xml.security.keys.KeyInfo",
"org.apache.xml.security.stax.ext.XMLSecurityConstants",
"org.apache.xml.security.test.dom.DSNamespaceContext",
"org.junit.Assert",
"org.w3c.dom.Document",
"org.w3c.dom.Element",
"org.w3c.dom.NodeList"
] | import java.security.Key; import java.security.PublicKey; import java.util.List; import javax.crypto.SecretKey; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathFactory; import org.apache.xml.security.encryption.EncryptedData; import org.apache.xml.security.encryption.EncryptedKey; import org.apache.xml.security.encryption.XMLCipher; import org.apache.xml.security.keys.KeyInfo; import org.apache.xml.security.stax.ext.XMLSecurityConstants; import org.apache.xml.security.test.dom.DSNamespaceContext; import org.junit.Assert; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; | import java.security.*; import java.util.*; import javax.crypto.*; import javax.xml.xpath.*; import org.apache.xml.security.encryption.*; import org.apache.xml.security.keys.*; import org.apache.xml.security.stax.ext.*; import org.apache.xml.security.test.dom.*; import org.junit.*; import org.w3c.dom.*; | [
"java.security",
"java.util",
"javax.crypto",
"javax.xml",
"org.apache.xml",
"org.junit",
"org.w3c.dom"
] | java.security; java.util; javax.crypto; javax.xml; org.apache.xml; org.junit; org.w3c.dom; | 2,724,579 |
public static String rewriteToContextRelative(String url, Request request)
{
if (isRelative(url))
{
final String prefix = request.getRelativePathPrefixToContextRoot();
return prefix + url;
}
else
{
return url;
}
}
| static String function(String url, Request request) { if (isRelative(url)) { final String prefix = request.getRelativePathPrefixToContextRoot(); return prefix + url; } else { return url; } } | /**
* Rewrites a relative url to be context relative, leaves absolute urls same.
*
* @param url
* @param request
* @return rewritten url
*/ | Rewrites a relative url to be context relative, leaves absolute urls same | rewriteToContextRelative | {
"repo_name": "astubbs/wicket.get-portals2",
"path": "wicket/src/main/java/org/apache/wicket/util/string/UrlUtils.java",
"license": "apache-2.0",
"size": 1862
} | [
"org.apache.wicket.Request"
] | import org.apache.wicket.Request; | import org.apache.wicket.*; | [
"org.apache.wicket"
] | org.apache.wicket; | 329,550 |
private Map<Integer, Map<String, ConnectionForecastSnapshot>> transformPortolioToSnapshots(
List<ConnectionPortfolioDto> connectionPortfolio, LocalDate period, Integer ptuDuration) {
Map<Integer, Map<String, ConnectionForecastSnapshot>> resultMap = new HashMap<>();
for (ConnectionPortfolioDto connectionPortfolioDto : connectionPortfolio) {
String connectionEntityAddress = connectionPortfolioDto.getConnectionEntityAddress();
populateSnapshotsAtConnectionLevel(resultMap, connectionPortfolioDto, period);
for (UdiPortfolioDto udiPortfolioDto : connectionPortfolioDto.getUdis()) {
populateSnapshotsAtUdiLevel(resultMap, udiPortfolioDto, connectionEntityAddress, period, ptuDuration);
}
}
return resultMap;
} | Map<Integer, Map<String, ConnectionForecastSnapshot>> function( List<ConnectionPortfolioDto> connectionPortfolio, LocalDate period, Integer ptuDuration) { Map<Integer, Map<String, ConnectionForecastSnapshot>> resultMap = new HashMap<>(); for (ConnectionPortfolioDto connectionPortfolioDto : connectionPortfolio) { String connectionEntityAddress = connectionPortfolioDto.getConnectionEntityAddress(); populateSnapshotsAtConnectionLevel(resultMap, connectionPortfolioDto, period); for (UdiPortfolioDto udiPortfolioDto : connectionPortfolioDto.getUdis()) { populateSnapshotsAtUdiLevel(resultMap, udiPortfolioDto, connectionEntityAddress, period, ptuDuration); } } return resultMap; } | /**
* Transforms the Connection Porfolio to a map structure of ConnectionForecastSnapshot.
* The structure is as follows:
* <ol>
* <li>Index of the PTU ({@link Integer})</li>
* <li>Entity Address of the connection ({@link String}) coupled with {@link ConnectionForecastSnapshot}</li>
* </ol>
*
* @param connectionPortfolio the list of {@link ConnectionPortfolioDto} for the period.
* @param period {@link LocalDate} the period for which the portfolio will be transformed to a snaphshot.
* @param ptuDuration {@link Integer} the duration of PTU in minutes.
* @return a {@link Map} with the {@link ConnectionForecastSnapshot} per Connection entity address per PTU index.
*/ | Transforms the Connection Porfolio to a map structure of ConnectionForecastSnapshot. The structure is as follows: Index of the PTU (<code>Integer</code>) Entity Address of the connection (<code>String</code>) coupled with <code>ConnectionForecastSnapshot</code> | transformPortolioToSnapshots | {
"repo_name": "USEF-Foundation/ri.usef.energy",
"path": "usef-build/usef-simulation/usef-simulation-agr/src/main/java/energy/usef/agr/workflow/step/AgrIdentifyChangeInForecastStub.java",
"license": "apache-2.0",
"size": 18703
} | [
"energy.usef.agr.dto.ConnectionPortfolioDto",
"energy.usef.agr.dto.UdiPortfolioDto",
"energy.usef.agr.model.ConnectionForecastSnapshot",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"org.joda.time.LocalDate"
] | import energy.usef.agr.dto.ConnectionPortfolioDto; import energy.usef.agr.dto.UdiPortfolioDto; import energy.usef.agr.model.ConnectionForecastSnapshot; import java.util.HashMap; import java.util.List; import java.util.Map; import org.joda.time.LocalDate; | import energy.usef.agr.dto.*; import energy.usef.agr.model.*; import java.util.*; import org.joda.time.*; | [
"energy.usef.agr",
"java.util",
"org.joda.time"
] | energy.usef.agr; java.util; org.joda.time; | 1,300,764 |
private void handleException(String msg, Exception e) throws AxisFault {
log.error(msg, e);
throw new AxisFault(msg, e);
} | void function(String msg, Exception e) throws AxisFault { log.error(msg, e); throw new AxisFault(msg, e); } | /**
* Logs and wraps the given exception.
*
* @param msg Error message
* @param e Exception
* @throws AxisFault
*/ | Logs and wraps the given exception | handleException | {
"repo_name": "omindu/carbon-identity",
"path": "components/sts/org.wso2.carbon.identity.sts.mgt.ui/src/main/java/org/wso2/carbon/identity/sts/mgt/ui/client/STSAdminServiceClient.java",
"license": "apache-2.0",
"size": 3718
} | [
"org.apache.axis2.AxisFault"
] | import org.apache.axis2.AxisFault; | import org.apache.axis2.*; | [
"org.apache.axis2"
] | org.apache.axis2; | 70,731 |
static boolean isRelative(String child) {
try {
return !URI.create(child).isAbsolute();
} catch (IllegalArgumentException e) {
return false;
}
}
}
private static class FileLoader extends Loader {
private File dir;
private FileLoader(URL url) throws IOException {
super(url);
String path = url.getFile().replace('/', File.separatorChar);
path = ParseUtil.decode(path);
dir = (new File(path)).getCanonicalFile();
} | static boolean isRelative(String child) { try { return !URI.create(child).isAbsolute(); } catch (IllegalArgumentException e) { return false; } } } private static class FileLoader extends Loader { private File dir; private FileLoader(URL url) throws IOException { super(url); String path = url.getFile().replace('/', File.separatorChar); path = ParseUtil.decode(path); dir = (new File(path)).getCanonicalFile(); } | /**
* Returns true if the given input is a relative URI.
*/ | Returns true if the given input is a relative URI | isRelative | {
"repo_name": "md-5/jdk10",
"path": "src/java.base/share/classes/jdk/internal/loader/URLClassPath.java",
"license": "gpl-2.0",
"size": 46584
} | [
"java.io.File",
"java.io.IOException",
"java.net.URI"
] | import java.io.File; import java.io.IOException; import java.net.URI; | import java.io.*; import java.net.*; | [
"java.io",
"java.net"
] | java.io; java.net; | 253,858 |
public void setSipFactory(SipFactory factory) {
m_sipFactory = factory;
} | void function(SipFactory factory) { m_sipFactory = factory; } | /**
* Sets the SIP Factory associated with this SIP App.
*
* @param factory
*/ | Sets the SIP Factory associated with this SIP App | setSipFactory | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.sipcontainer/src/com/ibm/ws/sip/container/parser/SipAppDesc.java",
"license": "epl-1.0",
"size": 54998
} | [
"javax.servlet.sip.SipFactory"
] | import javax.servlet.sip.SipFactory; | import javax.servlet.sip.*; | [
"javax.servlet"
] | javax.servlet; | 2,046,499 |
@Override
public OptimisationSolution getBestSolution() {
Particle bestEntity = Topologies.getBestEntity(topology, new SocialBestFitnessComparator<Particle>());
return new OptimisationSolution(bestEntity.getBestPosition(), bestEntity.getBestFitness());
} | OptimisationSolution function() { Particle bestEntity = Topologies.getBestEntity(topology, new SocialBestFitnessComparator<Particle>()); return new OptimisationSolution(bestEntity.getBestPosition(), bestEntity.getBestFitness()); } | /**
* Get the best current solution. This best solution is determined from the personal bests of the
* particles.
* @return The <code>OptimisationSolution</code> representing the best solution.
*/ | Get the best current solution. This best solution is determined from the personal bests of the particles | getBestSolution | {
"repo_name": "filinep/cilib",
"path": "library/src/main/java/net/sourceforge/cilib/pso/PSO.java",
"license": "gpl-3.0",
"size": 5356
} | [
"net.sourceforge.cilib.entity.Topologies",
"net.sourceforge.cilib.entity.comparator.SocialBestFitnessComparator",
"net.sourceforge.cilib.problem.solution.OptimisationSolution",
"net.sourceforge.cilib.pso.particle.Particle"
] | import net.sourceforge.cilib.entity.Topologies; import net.sourceforge.cilib.entity.comparator.SocialBestFitnessComparator; import net.sourceforge.cilib.problem.solution.OptimisationSolution; import net.sourceforge.cilib.pso.particle.Particle; | import net.sourceforge.cilib.entity.*; import net.sourceforge.cilib.entity.comparator.*; import net.sourceforge.cilib.problem.solution.*; import net.sourceforge.cilib.pso.particle.*; | [
"net.sourceforge.cilib"
] | net.sourceforge.cilib; | 742,463 |
public com.google.cloud.tasks.v2beta2.ListTasksResponse listTasks(
com.google.cloud.tasks.v2beta2.ListTasksRequest request) {
return blockingUnaryCall(getChannel(), getListTasksMethodHelper(), getCallOptions(), request);
} | com.google.cloud.tasks.v2beta2.ListTasksResponse function( com.google.cloud.tasks.v2beta2.ListTasksRequest request) { return blockingUnaryCall(getChannel(), getListTasksMethodHelper(), getCallOptions(), request); } | /**
*
*
* <pre>
* Lists the tasks in a queue.
* By default, only the [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]
* view is retrieved due to performance considerations;
* [response_view][google.cloud.tasks.v2beta2.ListTasksRequest.response_view]
* controls the subset of information which is returned.
* The tasks may be returned in any order. The ordering may change at any
* time.
* </pre>
*/ | <code> Lists the tasks in a queue. By default, only the [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC] view is retrieved due to performance considerations; [response_view][google.cloud.tasks.v2beta2.ListTasksRequest.response_view] controls the subset of information which is returned. The tasks may be returned in any order. The ordering may change at any time. </code> | listTasks | {
"repo_name": "vam-google/google-cloud-java",
"path": "google-api-grpc/grpc-google-cloud-tasks-v2beta2/src/main/java/com/google/cloud/tasks/v2beta2/CloudTasksGrpc.java",
"license": "apache-2.0",
"size": 139467
} | [
"io.grpc.stub.ClientCalls"
] | import io.grpc.stub.ClientCalls; | import io.grpc.stub.*; | [
"io.grpc.stub"
] | io.grpc.stub; | 896,313 |
protected final int getReplaceOffset() {
int start;
if (fContext instanceof DocumentTemplateContext) {
DocumentTemplateContext docContext = (DocumentTemplateContext)fContext;
start= docContext.getStart();
} else {
start= fRegion.getOffset();
}
return start;
} | final int function() { int start; if (fContext instanceof DocumentTemplateContext) { DocumentTemplateContext docContext = (DocumentTemplateContext)fContext; start= docContext.getStart(); } else { start= fRegion.getOffset(); } return start; } | /**
* Returns the offset of the range in the document that will be replaced by
* applying this template.
*
* @return the offset of the range in the document that will be replaced by
* applying this template
*/ | Returns the offset of the range in the document that will be replaced by applying this template | getReplaceOffset | {
"repo_name": "kumattau/JDTPatch",
"path": "org.eclipse.jdt.ui/src/org/eclipse/jdt/internal/ui/text/template/contentassist/TemplateProposal.java",
"license": "epl-1.0",
"size": 19190
} | [
"org.eclipse.jface.text.templates.DocumentTemplateContext"
] | import org.eclipse.jface.text.templates.DocumentTemplateContext; | import org.eclipse.jface.text.templates.*; | [
"org.eclipse.jface"
] | org.eclipse.jface; | 2,213,650 |
private Map<String, PDFont> getFonts(COSDictionary resources, PreflightContext context)
{
Map<String, PDFont> fonts = new HashMap<String, PDFont>();
COSDictionary fontsDictionary = (COSDictionary) resources.getDictionaryObject(COSName.FONT);
if (fontsDictionary == null)
{
fontsDictionary = new COSDictionary();
resources.setItem(COSName.FONT, fontsDictionary);
}
for (COSName fontName : fontsDictionary.keySet())
{
COSBase font = fontsDictionary.getDictionaryObject(fontName);
// data-000174.pdf contains a font that is a COSArray, looks to be an error in the
// PDF, we will just ignore entries that are not dictionaries.
if (font instanceof COSDictionary)
{
PDFont newFont = null;
try
{
newFont = PDFontFactory.createFont((COSDictionary) font);
}
catch (IOException e)
{
addFontError((COSDictionary)font, context);
}
if (newFont != null)
{
fonts.put(fontName.getName(), newFont);
}
}
}
return fonts;
} | Map<String, PDFont> function(COSDictionary resources, PreflightContext context) { Map<String, PDFont> fonts = new HashMap<String, PDFont>(); COSDictionary fontsDictionary = (COSDictionary) resources.getDictionaryObject(COSName.FONT); if (fontsDictionary == null) { fontsDictionary = new COSDictionary(); resources.setItem(COSName.FONT, fontsDictionary); } for (COSName fontName : fontsDictionary.keySet()) { COSBase font = fontsDictionary.getDictionaryObject(fontName); if (font instanceof COSDictionary) { PDFont newFont = null; try { newFont = PDFontFactory.createFont((COSDictionary) font); } catch (IOException e) { addFontError((COSDictionary)font, context); } if (newFont != null) { fonts.put(fontName.getName(), newFont); } } } return fonts; } | /**
* This will get the map of fonts. This will never return null.
*
* @return The map of fonts.
*/ | This will get the map of fonts. This will never return null | getFonts | {
"repo_name": "ChunghwaTelecom/pdfbox",
"path": "preflight/src/main/java/org/apache/pdfbox/preflight/process/reflect/ResourcesValidationProcess.java",
"license": "apache-2.0",
"size": 12467
} | [
"java.io.IOException",
"java.util.HashMap",
"java.util.Map",
"org.apache.pdfbox.cos.COSBase",
"org.apache.pdfbox.cos.COSDictionary",
"org.apache.pdfbox.cos.COSName",
"org.apache.pdfbox.pdmodel.font.PDFont",
"org.apache.pdfbox.pdmodel.font.PDFontFactory",
"org.apache.pdfbox.preflight.PreflightContext"
] | import java.io.IOException; import java.util.HashMap; import java.util.Map; import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.pdmodel.font.PDFont; import org.apache.pdfbox.pdmodel.font.PDFontFactory; import org.apache.pdfbox.preflight.PreflightContext; | import java.io.*; import java.util.*; import org.apache.pdfbox.cos.*; import org.apache.pdfbox.pdmodel.font.*; import org.apache.pdfbox.preflight.*; | [
"java.io",
"java.util",
"org.apache.pdfbox"
] | java.io; java.util; org.apache.pdfbox; | 376,060 |
public void prepareSimulation(ArrayList<Pair<AgentType,Integer>> blues,
ArrayList<Pair<AgentType,Integer>> reds,
long timestep) {
prepare(timestep);
world = new World(this,blues,reds);
start();
} | void function(ArrayList<Pair<AgentType,Integer>> blues, ArrayList<Pair<AgentType,Integer>> reds, long timestep) { prepare(timestep); world = new World(this,blues,reds); start(); } | /**
* method resposible for preparing simulation (populates the world etc.)
* @param blues list of agents of blue side, which we want in the world
* @param reds list of agents of red side which we want in the world
* @param timestep time of every turn (in milliseconds)
*/ | method resposible for preparing simulation (populates the world etc.) | prepareSimulation | {
"repo_name": "fortun13/BattleSimulation",
"path": "src/main/java/agents/ServerAgent.java",
"license": "gpl-2.0",
"size": 12212
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 1,846,751 |
public List<MissingMapping> get()
{
return ImmutableList.copyOf(missing.get(activeContainer.getModId()));
} | List<MissingMapping> function() { return ImmutableList.copyOf(missing.get(activeContainer.getModId())); } | /**
* Get the list of missing mappings for the active mod.
*
* Process the list entries by calling ignore(), warn(), fail() or remap() on each entry.
*
* @return list of missing mappings
*/ | Get the list of missing mappings for the active mod. Process the list entries by calling ignore(), warn(), fail() or remap() on each entry | get | {
"repo_name": "luacs1998/MinecraftForge",
"path": "src/main/java/net/minecraftforge/fml/common/event/FMLMissingMappingsEvent.java",
"license": "lgpl-2.1",
"size": 6313
} | [
"com.google.common.collect.ImmutableList",
"java.util.List"
] | import com.google.common.collect.ImmutableList; import java.util.List; | import com.google.common.collect.*; import java.util.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 76,219 |
public Observable<ServiceResponse<List<TableGetResultsInner>>> listTablesWithServiceResponseAsync(String resourceGroupName, String accountName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (accountName == null) {
throw new IllegalArgumentException("Parameter accountName is required and cannot be null.");
} | Observable<ServiceResponse<List<TableGetResultsInner>>> function(String resourceGroupName, String accountName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (accountName == null) { throw new IllegalArgumentException(STR); } | /**
* Lists the Tables under an existing Azure Cosmos DB database account.
*
* @param resourceGroupName Name of an Azure resource group.
* @param accountName Cosmos DB database account name.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the List<TableGetResultsInner> object
*/ | Lists the Tables under an existing Azure Cosmos DB database account | listTablesWithServiceResponseAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/cosmos/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_03_01/implementation/TableResourcesInner.java",
"license": "mit",
"size": 56548
} | [
"com.microsoft.rest.ServiceResponse",
"java.util.List"
] | import com.microsoft.rest.ServiceResponse; import java.util.List; | import com.microsoft.rest.*; import java.util.*; | [
"com.microsoft.rest",
"java.util"
] | com.microsoft.rest; java.util; | 957,782 |
public HashSet getSelectedCanonicalNamesFromTextArea() {
String textNodes = params.getTextInput();
String[] nodes = textNodes.split("\\s+");
// HashSet for storing the canonical names
HashSet canonicalNameVector = new HashSet();
HashSet<HashSet<String>> mapNames = new HashSet<HashSet<String>>();
// iterate over every node view to get the canonical names.
for (int i = 0; i < nodes.length; i++) {
if (nodes[i] != null && nodes[i].length() != 0 && !canonicalNameVector.contains(nodes[i].toUpperCase())) {
if (mapNames.contains(params.getAlias().get(nodes[i].toUpperCase()))) {
redundantIDs.put(nodes[i].toUpperCase(),
(HashSet<String>) params.getAlias().get(nodes[i].toUpperCase()));
}
// else{
if (params.getAlias().get(nodes[i].toUpperCase()) != null) {
mapNames.add((HashSet<String>) params.getAlias().get(nodes[i].toUpperCase()));
}
canonicalNameVector.add(nodes[i].toUpperCase());
// }
}
}
return canonicalNameVector;
}
| HashSet function() { String textNodes = params.getTextInput(); String[] nodes = textNodes.split("\\s+"); HashSet canonicalNameVector = new HashSet(); HashSet<HashSet<String>> mapNames = new HashSet<HashSet<String>>(); for (int i = 0; i < nodes.length; i++) { if (nodes[i] != null && nodes[i].length() != 0 && !canonicalNameVector.contains(nodes[i].toUpperCase())) { if (mapNames.contains(params.getAlias().get(nodes[i].toUpperCase()))) { redundantIDs.put(nodes[i].toUpperCase(), (HashSet<String>) params.getAlias().get(nodes[i].toUpperCase())); } if (params.getAlias().get(nodes[i].toUpperCase()) != null) { mapNames.add((HashSet<String>) params.getAlias().get(nodes[i].toUpperCase())); } canonicalNameVector.add(nodes[i].toUpperCase()); } } return canonicalNameVector; } | /**
* method that gets the canonical names from text input.
*
* @return HashSet containing the canonical names.
*/ | method that gets the canonical names from text input | getSelectedCanonicalNamesFromTextArea | {
"repo_name": "stmae/bingo",
"path": "src/main/java/bingo/internal/SettingsPanelActionListener.java",
"license": "gpl-2.0",
"size": 45892
} | [
"java.util.HashSet"
] | import java.util.HashSet; | import java.util.*; | [
"java.util"
] | java.util; | 2,683,868 |
public void setLocationOnScreen(int x, int y) {
if (x <= 0 || y <= 0) throw new IllegalArgumentException();
frame.setLocation(x, y);
}
/**
* Sets the default close operation.
*
* @param value the value, typically {@code JFrame.EXIT_ON_CLOSE}
* (close all windows) or {@code JFrame.DISPOSE_ON_CLOSE} | void function(int x, int y) { if (x <= 0 y <= 0) throw new IllegalArgumentException(); frame.setLocation(x, y); } /** * Sets the default close operation. * * @param value the value, typically {@code JFrame.EXIT_ON_CLOSE} * (close all windows) or {@code JFrame.DISPOSE_ON_CLOSE} | /**
* Sets the upper-left hand corner of the drawing window to be (x, y), where (0, 0) is upper left.
*
* @param x the number of pixels from the left
* @param y the number of pixels from the top
* @throws IllegalArgumentException if the width or height is 0 or negative
*/ | Sets the upper-left hand corner of the drawing window to be (x, y), where (0, 0) is upper left | setLocationOnScreen | {
"repo_name": "804206793/algs",
"path": "src/main/java/edu/princeton/cs/algs4/Draw.java",
"license": "gpl-3.0",
"size": 47726
} | [
"javax.swing.JFrame"
] | import javax.swing.JFrame; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 1,242,615 |
@Test
public void testFormatWithInvalidClusterIdOption() throws IOException {
String[] argv = { "-format", "-clusterid", "-force" };
PrintStream origErr = System.err;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream stdErr = new PrintStream(baos);
System.setErr(stdErr);
NameNode.createNameNode(argv, config);
// Check if usage is printed
assertTrue(baos.toString("UTF-8").contains("Usage: hdfs namenode"));
System.setErr(origErr);
// check if the version file does not exists.
File version = new File(hdfsDir, "current/VERSION");
assertFalse("Check version should not exist", version.exists());
} | void function() throws IOException { String[] argv = { STR, STR, STR }; PrintStream origErr = System.err; ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream stdErr = new PrintStream(baos); System.setErr(stdErr); NameNode.createNameNode(argv, config); assertTrue(baos.toString("UTF-8").contains(STR)); System.setErr(origErr); File version = new File(hdfsDir, STR); assertFalse(STR, version.exists()); } | /**
* Test namenode format with -clusterid -force option. Format command should
* fail as no cluster id was provided.
*
* @throws IOException
*/ | Test namenode format with -clusterid -force option. Format command should fail as no cluster id was provided | testFormatWithInvalidClusterIdOption | {
"repo_name": "cnfire/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestClusterId.java",
"license": "apache-2.0",
"size": 14421
} | [
"java.io.ByteArrayOutputStream",
"java.io.File",
"java.io.IOException",
"java.io.PrintStream",
"org.junit.Assert"
] | import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.PrintStream; import org.junit.Assert; | import java.io.*; import org.junit.*; | [
"java.io",
"org.junit"
] | java.io; org.junit; | 445,635 |
List<WorkflowRun> getWorkflowRunsAssociatedWithFiles(List<Integer> fileAccessions, String search_type); | List<WorkflowRun> getWorkflowRunsAssociatedWithFiles(List<Integer> fileAccessions, String search_type); | /**
* Returns the workflow_runs associated with a group of files. Search types are defined as:
*
* @param fileAccessions
* @param search_type
* @return
*/ | Returns the workflow_runs associated with a group of files. Search types are defined as: | getWorkflowRunsAssociatedWithFiles | {
"repo_name": "joansmith/seqware",
"path": "seqware-common/src/main/java/net/sourceforge/seqware/common/metadata/Metadata.java",
"license": "gpl-3.0",
"size": 37180
} | [
"java.util.List",
"net.sourceforge.seqware.common.model.WorkflowRun"
] | import java.util.List; import net.sourceforge.seqware.common.model.WorkflowRun; | import java.util.*; import net.sourceforge.seqware.common.model.*; | [
"java.util",
"net.sourceforge.seqware"
] | java.util; net.sourceforge.seqware; | 2,131,951 |
private void writeRemoteNarrowForAbstract (boolean hasAbstractParent)
{
stream.print (" public static " + helperType + " narrow (java.lang.Object obj)");
stream.println (" {");
stream.println (" if (obj == null)");
stream.println (" return null;");
if (hasAbstractParent)
{
stream.println (" else if (obj instanceof org.omg.CORBA.Object)");
stream.println (" return narrow ((org.omg.CORBA.Object) obj);");
}
else
{
stream.println (" else if (obj instanceof " + helperType + ')');
stream.println (" return (" + helperType + ")obj;");
}
// If hasAbstractParent is false, then THIS entry must be abstract.
// This method is also called in case THIS entry is not abstract, but
// there is an abstract parent. If this entry is not abstract,
// it can never narrow to a CORBA object reference.
if (!hasAbstractParent) { // <d58889>
String stubNameofEntry = stubName ((InterfaceEntry)entry);
stream.println (" else if ((obj instanceof org.omg.CORBA.portable.ObjectImpl) &&");
stream.println (" (((org.omg.CORBA.Object)obj)._is_a (id ()))) {");
stream.println (" org.omg.CORBA.portable.ObjectImpl impl = (org.omg.CORBA.portable.ObjectImpl)obj ;" ) ;
stream.println (" org.omg.CORBA.portable.Delegate delegate = impl._get_delegate() ;" ) ;
stream.println (" " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();");
stream.println (" stub._set_delegate(delegate);");
stream.println (" return stub;" ) ;
stream.println (" }" ) ;
};
// end <d57118 - check for remotable - klr>
stream.println (" throw new org.omg.CORBA.BAD_PARAM ();");
stream.println (" }");
stream.println ();
} // writeRemoteNarrowForAbstract | void function (boolean hasAbstractParent) { stream.print (STR + helperType + STR); stream.println (STR); stream.println (STR); stream.println (STR); if (hasAbstractParent) { stream.println (STR); stream.println (STR); } else { stream.println (STR + helperType + ')'); stream.println (STR + helperType + ")obj;"); } if (!hasAbstractParent) { String stubNameofEntry = stubName ((InterfaceEntry)entry); stream.println (STR); stream.println (STR); stream.println (STR ) ; stream.println (STR ) ; stream.println (" " + stubNameofEntry + STR + stubNameofEntry + STR); stream.println (STR); stream.println (STR ) ; stream.println (STR ) ; }; stream.println (STR); stream.println (STR); stream.println (); } | /**
* Write the narrow() method for abstract interface.
**/ | Write the narrow() method for abstract interface | writeRemoteNarrowForAbstract | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk2/corba/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Helper.java",
"license": "mit",
"size": 23035
} | [
"com.sun.tools.corba.se.idl.InterfaceEntry"
] | import com.sun.tools.corba.se.idl.InterfaceEntry; | import com.sun.tools.corba.se.idl.*; | [
"com.sun.tools"
] | com.sun.tools; | 701,390 |
protected NamedList<NamedList> handleAnalysisRequest(FieldAnalysisRequest request, IndexSchema schema) {
NamedList<NamedList> analysisResults = new SimpleOrderedMap<NamedList>();
NamedList<NamedList> fieldTypeAnalysisResults = new SimpleOrderedMap<NamedList>();
if (request.getFieldTypes() != null) {
for (String fieldTypeName : request.getFieldTypes()) {
FieldType fieldType = schema.getFieldTypes().get(fieldTypeName);
fieldTypeAnalysisResults.add(fieldTypeName, analyzeValues(request, fieldType, null));
}
}
NamedList<NamedList> fieldNameAnalysisResults = new SimpleOrderedMap<NamedList>();
if (request.getFieldNames() != null) {
for (String fieldName : request.getFieldNames()) {
FieldType fieldType = schema.getFieldType(fieldName);
fieldNameAnalysisResults.add(fieldName, analyzeValues(request, fieldType, fieldName));
}
}
analysisResults.add("field_types", fieldTypeAnalysisResults);
analysisResults.add("field_names", fieldNameAnalysisResults);
return analysisResults;
}
/**
* Analyzes the index value (if it exists) and the query value (if it exists) in the given AnalysisRequest, using
* the Analyzers of the given field type.
*
* @param analysisRequest AnalysisRequest from where the index and query values will be taken
* @param fieldType Type of field whose analyzers will be used
* @param fieldName Name of the field to be analyzed. Can be {@code null} | NamedList<NamedList> function(FieldAnalysisRequest request, IndexSchema schema) { NamedList<NamedList> analysisResults = new SimpleOrderedMap<NamedList>(); NamedList<NamedList> fieldTypeAnalysisResults = new SimpleOrderedMap<NamedList>(); if (request.getFieldTypes() != null) { for (String fieldTypeName : request.getFieldTypes()) { FieldType fieldType = schema.getFieldTypes().get(fieldTypeName); fieldTypeAnalysisResults.add(fieldTypeName, analyzeValues(request, fieldType, null)); } } NamedList<NamedList> fieldNameAnalysisResults = new SimpleOrderedMap<NamedList>(); if (request.getFieldNames() != null) { for (String fieldName : request.getFieldNames()) { FieldType fieldType = schema.getFieldType(fieldName); fieldNameAnalysisResults.add(fieldName, analyzeValues(request, fieldType, fieldName)); } } analysisResults.add(STR, fieldTypeAnalysisResults); analysisResults.add(STR, fieldNameAnalysisResults); return analysisResults; } /** * Analyzes the index value (if it exists) and the query value (if it exists) in the given AnalysisRequest, using * the Analyzers of the given field type. * * @param analysisRequest AnalysisRequest from where the index and query values will be taken * @param fieldType Type of field whose analyzers will be used * @param fieldName Name of the field to be analyzed. Can be {@code null} | /**
* Handles the resolved analysis request and returns the analysis breakdown response as a named list.
*
* @param request The request to handle.
* @param schema The index schema.
*
* @return The analysis breakdown as a named list.
*/ | Handles the resolved analysis request and returns the analysis breakdown response as a named list | handleAnalysisRequest | {
"repo_name": "fogbeam/Heceta_solr",
"path": "solr/core/src/java/org/apache/solr/handler/FieldAnalysisRequestHandler.java",
"license": "apache-2.0",
"size": 9193
} | [
"org.apache.solr.client.solrj.request.FieldAnalysisRequest",
"org.apache.solr.common.util.NamedList",
"org.apache.solr.common.util.SimpleOrderedMap",
"org.apache.solr.schema.FieldType",
"org.apache.solr.schema.IndexSchema"
] | import org.apache.solr.client.solrj.request.FieldAnalysisRequest; import org.apache.solr.common.util.NamedList; import org.apache.solr.common.util.SimpleOrderedMap; import org.apache.solr.schema.FieldType; import org.apache.solr.schema.IndexSchema; | import org.apache.solr.client.solrj.request.*; import org.apache.solr.common.util.*; import org.apache.solr.schema.*; | [
"org.apache.solr"
] | org.apache.solr; | 179,390 |
List<OverviewResultItem> getWeeklySalesForItem(long ean, Date weekStart, int numberOfWeeks) throws EntityDoesNotExistException; | List<OverviewResultItem> getWeeklySalesForItem(long ean, Date weekStart, int numberOfWeeks) throws EntityDoesNotExistException; | /**
* Get weekly count of sold items.
*
* @param ean - ean of item to find its sales
* @param weekStart - date of some day from the first week of the overview
* @param numberOfWeeks - number of weeks of the overview
* @return list of 'OverviewResultItem's with timespan one week
* @throws EntityDoesNotExistException if item does not exists
*/ | Get weekly count of sold items | getWeeklySalesForItem | {
"repo_name": "mschvarc/PB138-Inventory-Management",
"path": "backend/src/main/java/pb138/service/overview/OverviewProvider.java",
"license": "mit",
"size": 3505
} | [
"java.util.Date",
"java.util.List"
] | import java.util.Date; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,039,140 |
public void setMinute(int minute) {
this.calendar.set(Calendar.MINUTE, minute);
} | void function(int minute) { this.calendar.set(Calendar.MINUTE, minute); } | /**
* Sets the minute of the time setting.
* @param minute The minute to set
*/ | Sets the minute of the time setting | setMinute | {
"repo_name": "idega/com.idega.core",
"path": "src/java/com/idega/util/IWTimestamp.java",
"license": "gpl-3.0",
"size": 39740
} | [
"java.util.Calendar"
] | import java.util.Calendar; | import java.util.*; | [
"java.util"
] | java.util; | 1,831,921 |
public void readExternal(ObjectInput in)
throws IOException, ClassNotFoundException {
_depth = in.readInt();
int entries = in.readInt();
// prepare array lists
int size = Math.max( entries, OVERFLOW_SIZE );
_keys = new ArrayList( size );
_values = new ArrayList( size );
// read keys
for ( int i=0; i<entries; i++ ) {
_keys.add( in.readObject() );
}
// read values
for ( int i=0; i<entries; i++ ) {
_values.add( in.readObject() );
}
}
| void function(ObjectInput in) throws IOException, ClassNotFoundException { _depth = in.readInt(); int entries = in.readInt(); int size = Math.max( entries, OVERFLOW_SIZE ); _keys = new ArrayList( size ); _values = new ArrayList( size ); for ( int i=0; i<entries; i++ ) { _keys.add( in.readObject() ); } for ( int i=0; i<entries; i++ ) { _values.add( in.readObject() ); } } | /**
* Implement Externalizable interface.
*/ | Implement Externalizable interface | readExternal | {
"repo_name": "kcsl/immutability-benchmark",
"path": "benchmark-applications/reiminfer-oopsla-2012/source/Jdbm/src/jdbm/htree/HashBucket.java",
"license": "mit",
"size": 9460
} | [
"java.io.IOException",
"java.io.ObjectInput",
"java.util.ArrayList"
] | import java.io.IOException; import java.io.ObjectInput; import java.util.ArrayList; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,107,734 |
public Output<T> outputValues() {
return outputValues;
} | Output<T> function() { return outputValues; } | /**
* Gets outputValues.
* 1-D. Non-empty values of the concatenated {@code SparseTensor}.
* @return outputValues.
*/ | Gets outputValues. 1-D. Non-empty values of the concatenated SparseTensor | outputValues | {
"repo_name": "tensorflow/java",
"path": "tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseConcat.java",
"license": "apache-2.0",
"size": 7095
} | [
"org.tensorflow.Output"
] | import org.tensorflow.Output; | import org.tensorflow.*; | [
"org.tensorflow"
] | org.tensorflow; | 1,687,398 |
@Test void testUnparseIn1() {
final Function<RelBuilder, RelNode> relFn = b -> b
.scan("EMP")
.filter(b.in(b.field("DEPTNO"), b.literal(21)))
.build();
final String expectedSql = "SELECT *\n"
+ "FROM \"scott\".\"EMP\"\n"
+ "WHERE \"DEPTNO\" = 21";
relFn(relFn).ok(expectedSql);
} | @Test void testUnparseIn1() { final Function<RelBuilder, RelNode> relFn = b -> b .scan("EMP") .filter(b.in(b.field(STR), b.literal(21))) .build(); final String expectedSql = STR + STRscott\".\"EMP\"\n" + STRDEPTNO\STR; relFn(relFn).ok(expectedSql); } | /**
* Tests that IN can be un-parsed.
*
* <p>This cannot be tested using "sql", because because Calcite's SQL parser
* replaces INs with ORs or sub-queries.
*/ | Tests that IN can be un-parsed. This cannot be tested using "sql", because because Calcite's SQL parser replaces INs with ORs or sub-queries | testUnparseIn1 | {
"repo_name": "jcamachor/calcite",
"path": "core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java",
"license": "apache-2.0",
"size": 255920
} | [
"java.util.function.Function",
"org.apache.calcite.rel.RelNode",
"org.apache.calcite.tools.RelBuilder",
"org.junit.jupiter.api.Test"
] | import java.util.function.Function; import org.apache.calcite.rel.RelNode; import org.apache.calcite.tools.RelBuilder; import org.junit.jupiter.api.Test; | import java.util.function.*; import org.apache.calcite.rel.*; import org.apache.calcite.tools.*; import org.junit.jupiter.api.*; | [
"java.util",
"org.apache.calcite",
"org.junit.jupiter"
] | java.util; org.apache.calcite; org.junit.jupiter; | 2,548,310 |
@Override
public byte[] encrypt(byte[] plainRecord, String recordId, String keyId) throws EncryptionException {
if (plainRecord == null || CryptoUtils.isEmpty(keyId)) {
throw new EncryptionException("The provenance record and key ID cannot be missing");
}
if (keyProvider == null || !keyProvider.keyExists(keyId)) {
throw new EncryptionException("The requested key ID is not available");
} else {
byte[] ivBytes = new byte[IV_LENGTH];
new SecureRandom().nextBytes(ivBytes);
try {
logger.debug("Encrypting provenance record " + recordId + " with key ID " + keyId);
Cipher cipher = initCipher(EncryptionMethod.AES_GCM, Cipher.ENCRYPT_MODE, keyProvider.getKey(keyId), ivBytes);
ivBytes = cipher.getIV();
// Perform the actual encryption
byte[] cipherBytes = cipher.doFinal(plainRecord);
// Serialize and concat encryption details fields (keyId, algo, IV, version, CB length) outside of encryption
EncryptionMetadata metadata = new EncryptionMetadata(keyId, ALGORITHM, ivBytes, VERSION, cipherBytes.length);
byte[] serializedEncryptionMetadata = serializeEncryptionMetadata(metadata);
// Add the sentinel byte of 0x01
logger.debug("Encrypted provenance event record " + recordId + " with key ID " + keyId);
return CryptoUtils.concatByteArrays(SENTINEL, serializedEncryptionMetadata, cipherBytes);
} catch (EncryptionException | BadPaddingException | IllegalBlockSizeException | IOException | KeyManagementException e) {
final String msg = "Encountered an exception encrypting provenance record " + recordId;
logger.error(msg, e);
throw new EncryptionException(msg, e);
}
}
} | byte[] function(byte[] plainRecord, String recordId, String keyId) throws EncryptionException { if (plainRecord == null CryptoUtils.isEmpty(keyId)) { throw new EncryptionException(STR); } if (keyProvider == null !keyProvider.keyExists(keyId)) { throw new EncryptionException(STR); } else { byte[] ivBytes = new byte[IV_LENGTH]; new SecureRandom().nextBytes(ivBytes); try { logger.debug(STR + recordId + STR + keyId); Cipher cipher = initCipher(EncryptionMethod.AES_GCM, Cipher.ENCRYPT_MODE, keyProvider.getKey(keyId), ivBytes); ivBytes = cipher.getIV(); byte[] cipherBytes = cipher.doFinal(plainRecord); EncryptionMetadata metadata = new EncryptionMetadata(keyId, ALGORITHM, ivBytes, VERSION, cipherBytes.length); byte[] serializedEncryptionMetadata = serializeEncryptionMetadata(metadata); logger.debug(STR + recordId + STR + keyId); return CryptoUtils.concatByteArrays(SENTINEL, serializedEncryptionMetadata, cipherBytes); } catch (EncryptionException BadPaddingException IllegalBlockSizeException IOException KeyManagementException e) { final String msg = STR + recordId; logger.error(msg, e); throw new EncryptionException(msg, e); } } } | /**
* Encrypts the provided {@link ProvenanceEventRecord}, serialized to a byte[] by the RecordWriter.
*
* @param plainRecord the plain record, serialized to a byte[]
* @param recordId an identifier for this record (eventId, generated, etc.)
* @param keyId the ID of the key to use
* @return the encrypted record
* @throws EncryptionException if there is an issue encrypting this record
*/ | Encrypts the provided <code>ProvenanceEventRecord</code>, serialized to a byte[] by the RecordWriter | encrypt | {
"repo_name": "mcgilman/nifi",
"path": "nifi-commons/nifi-data-provenance-utils/src/main/java/org/apache/nifi/provenance/AESProvenanceEventEncryptor.java",
"license": "apache-2.0",
"size": 11365
} | [
"java.io.IOException",
"java.security.KeyManagementException",
"java.security.SecureRandom",
"javax.crypto.BadPaddingException",
"javax.crypto.Cipher",
"javax.crypto.IllegalBlockSizeException",
"org.apache.nifi.security.kms.CryptoUtils",
"org.apache.nifi.security.util.EncryptionMethod"
] | import java.io.IOException; import java.security.KeyManagementException; import java.security.SecureRandom; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import org.apache.nifi.security.kms.CryptoUtils; import org.apache.nifi.security.util.EncryptionMethod; | import java.io.*; import java.security.*; import javax.crypto.*; import org.apache.nifi.security.kms.*; import org.apache.nifi.security.util.*; | [
"java.io",
"java.security",
"javax.crypto",
"org.apache.nifi"
] | java.io; java.security; javax.crypto; org.apache.nifi; | 797,564 |
public default GraphTraversal<S, Vertex> outV() {
return this.toV(Direction.OUT);
} | default GraphTraversal<S, Vertex> function() { return this.toV(Direction.OUT); } | /**
* Map the {@link Edge} to its outgoing/tail incident {@link Vertex}.
*
* @return the traversal with an appended {@link EdgeVertexStep}.
*/ | Map the <code>Edge</code> to its outgoing/tail incident <code>Vertex</code> | outV | {
"repo_name": "rmagen/incubator-tinkerpop",
"path": "gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java",
"license": "apache-2.0",
"size": 56488
} | [
"org.apache.tinkerpop.gremlin.structure.Direction",
"org.apache.tinkerpop.gremlin.structure.Vertex"
] | import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Vertex; | import org.apache.tinkerpop.gremlin.structure.*; | [
"org.apache.tinkerpop"
] | org.apache.tinkerpop; | 1,089,441 |
private HBaseRpc MockProbe() throws Exception {
final byte[] probe_key = (byte[])Whitebox.invokeMethod(HBaseClient.class,
"probeKey", KEY);
final HBaseRpc exists = GetRequest.exists(TABLE, probe_key);
PowerMockito.mockStatic(GetRequest.class);
PowerMockito.when(GetRequest.exists(TABLE, probe_key)).thenReturn(exists);
return exists;
} | HBaseRpc function() throws Exception { final byte[] probe_key = (byte[])Whitebox.invokeMethod(HBaseClient.class, STR, KEY); final HBaseRpc exists = GetRequest.exists(TABLE, probe_key); PowerMockito.mockStatic(GetRequest.class); PowerMockito.when(GetRequest.exists(TABLE, probe_key)).thenReturn(exists); return exists; } | /**
* Generates a mock {@code GetRequest.exists()} request for use in these tests
* @return An HBaseRPC to test with
* @throws Exception If mocking failed.
*/ | Generates a mock GetRequest.exists() request for use in these tests | MockProbe | {
"repo_name": "yuzhu712/asynchbase",
"path": "test/TestNSREs.java",
"license": "bsd-3-clause",
"size": 46261
} | [
"org.mockito.Mockito",
"org.powermock.api.mockito.PowerMockito",
"org.powermock.reflect.Whitebox"
] | import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; import org.powermock.reflect.Whitebox; | import org.mockito.*; import org.powermock.api.mockito.*; import org.powermock.reflect.*; | [
"org.mockito",
"org.powermock.api",
"org.powermock.reflect"
] | org.mockito; org.powermock.api; org.powermock.reflect; | 117,872 |
public void setName(String fieldName)
{
WebElement nameInput = getPropertyInput("name");
nameInput.clear();
nameInput.sendKeys(fieldName);
} | void function(String fieldName) { WebElement nameInput = getPropertyInput("name"); nameInput.clear(); nameInput.sendKeys(fieldName); } | /**
* Sets the field name
*
* @param fieldName the new field name
*/ | Sets the field name | setName | {
"repo_name": "pbondoer/xwiki-platform",
"path": "xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test-pageobjects/src/main/java/org/xwiki/appwithinminutes/test/po/ClassFieldEditPane.java",
"license": "lgpl-2.1",
"size": 8729
} | [
"org.openqa.selenium.WebElement"
] | import org.openqa.selenium.WebElement; | import org.openqa.selenium.*; | [
"org.openqa.selenium"
] | org.openqa.selenium; | 883,635 |
public Set<TypeCodesDto> getDoNotShareSensitivityPolicyCodes() {
return doNotShareSensitivityPolicyCodes;
} | Set<TypeCodesDto> function() { return doNotShareSensitivityPolicyCodes; } | /**
* Gets the do not share sensitivity policy codes.
*
* @return the do not share sensitivity policy codes
*/ | Gets the do not share sensitivity policy codes | getDoNotShareSensitivityPolicyCodes | {
"repo_name": "OBHITA/Consent2Share",
"path": "DS4P/consent2share/service/src/main/java/gov/samhsa/consent2share/service/consentexport/ConsentExportDto.java",
"license": "bsd-3-clause",
"size": 13316
} | [
"gov.samhsa.consent.TypeCodesDto",
"java.util.Set"
] | import gov.samhsa.consent.TypeCodesDto; import java.util.Set; | import gov.samhsa.consent.*; import java.util.*; | [
"gov.samhsa.consent",
"java.util"
] | gov.samhsa.consent; java.util; | 312,329 |
@SuppressWarnings("rawtypes")
public static void insertAsNodeModelRecursively(final NodeModel nodeModel, final Enumeration children,
final MapController mapController) {
while (children.hasMoreElements()) {
final DefaultMutableTreeNode child = (DefaultMutableTreeNode) children.nextElement();
final NodeModel newNodeModel = insertAsNodeModel(nodeModel, child, mapController);
if (!child.isLeaf()) {
insertAsNodeModelRecursively(newNodeModel, child.children(), mapController);
}
}
} | @SuppressWarnings(STR) static void function(final NodeModel nodeModel, final Enumeration children, final MapController mapController) { while (children.hasMoreElements()) { final DefaultMutableTreeNode child = (DefaultMutableTreeNode) children.nextElement(); final NodeModel newNodeModel = insertAsNodeModel(nodeModel, child, mapController); if (!child.isLeaf()) { insertAsNodeModelRecursively(newNodeModel, child.children(), mapController); } } } | /** Could be (but currently isn't) used to generate a mindmap representation of the menu.
* @param children Enumeration of DefaultMutableTreeNode from the menu tree. */ | Could be (but currently isn't) used to generate a mindmap representation of the menu | insertAsNodeModelRecursively | {
"repo_name": "joetopshot/freeplane",
"path": "freeplane/src/main/java/org/freeplane/core/util/MenuUtils.java",
"license": "gpl-2.0",
"size": 13020
} | [
"java.util.Enumeration",
"javax.swing.tree.DefaultMutableTreeNode",
"org.freeplane.features.map.MapController",
"org.freeplane.features.map.NodeModel"
] | import java.util.Enumeration; import javax.swing.tree.DefaultMutableTreeNode; import org.freeplane.features.map.MapController; import org.freeplane.features.map.NodeModel; | import java.util.*; import javax.swing.tree.*; import org.freeplane.features.map.*; | [
"java.util",
"javax.swing",
"org.freeplane.features"
] | java.util; javax.swing; org.freeplane.features; | 2,247,168 |
@Override
public E remove(Position<E> p) throws IllegalArgumentException {
Node<E> node = validate(p);
Node<E> predecessor = node.getPrev();
Node<E> successor = node.getNext();
predecessor.setNext(successor);
successor.setPrev(predecessor);
size--;
E answer = node.getElement();
node.setElement(null); // help with garbage collection
node.setNext(null); // and convention for defunct node
node.setPrev(null);
return answer;
}
// support for iterating either positions and elements
//---------------- nested PositionIterator class ----------------
private class PositionIterator implements Iterator<Position<E>> {
private Position<E> cursor = first(); // position of the next element to report
private Position<E> recent = null; // position of last reported element
public boolean hasNext() { return (cursor != null); } | E function(Position<E> p) throws IllegalArgumentException { Node<E> node = validate(p); Node<E> predecessor = node.getPrev(); Node<E> successor = node.getNext(); predecessor.setNext(successor); successor.setPrev(predecessor); size--; E answer = node.getElement(); node.setElement(null); node.setNext(null); node.setPrev(null); return answer; } private class PositionIterator implements Iterator<Position<E>> { private Position<E> cursor = first(); private Position<E> recent = null; public boolean hasNext() { return (cursor != null); } | /**
* Removes the element stored at the given Position and returns it.
* The given position is invalidated as a result.
*
* @param p the Position of the element to be removed
* @return the removed element
* @throws IllegalArgumentException if p is not a valid position for this list
*/ | Removes the element stored at the given Position and returns it. The given position is invalidated as a result | remove | {
"repo_name": "onehao/opensource",
"path": "advancedDS/src/datastructures/LinkedPositionalList.java",
"license": "apache-2.0",
"size": 14641
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 1,162,843 |
public static ims.scheduling.domain.objects.TheatreBooking extractTheatreBooking(ims.domain.ILightweightDomainFactory domainFactory, ims.scheduling.vo.TheatreBookingBaseVo valueObject)
{
return extractTheatreBooking(domainFactory, valueObject, new HashMap());
} | static ims.scheduling.domain.objects.TheatreBooking function(ims.domain.ILightweightDomainFactory domainFactory, ims.scheduling.vo.TheatreBookingBaseVo valueObject) { return extractTheatreBooking(domainFactory, valueObject, new HashMap()); } | /**
* Create the domain object from the value object.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param valueObject - extract the domain object fields from this.
*/ | Create the domain object from the value object | extractTheatreBooking | {
"repo_name": "open-health-hub/openMAXIMS",
"path": "openmaxims_workspace/ValueObjects/src/ims/scheduling/vo/domain/TheatreBookingBaseVoAssembler.java",
"license": "agpl-3.0",
"size": 17471
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 1,359,990 |
public ArrayList<String> getClaimTagNameList() {
ArrayList<String> tagNames = new ArrayList<String>();
ArrayList<Tag> tags = getClaimTagList();
for (Tag tag : tags) {
tagNames.add(tag.getName());
}
return tagNames;
} | ArrayList<String> function() { ArrayList<String> tagNames = new ArrayList<String>(); ArrayList<Tag> tags = getClaimTagList(); for (Tag tag : tags) { tagNames.add(tag.getName()); } return tagNames; } | /**
* Get a list of the names of all the tags attached to the claim
*
* @return
*/ | Get a list of the names of all the tags attached to the claim | getClaimTagNameList | {
"repo_name": "Cdingram/Team1Project",
"path": "Team1TravelExpenseApp/src/ca/ualberta/cs/team1travelexpenseapp/claims/Claim.java",
"license": "apache-2.0",
"size": 12291
} | [
"ca.ualberta.cs.team1travelexpenseapp.Tag",
"java.util.ArrayList"
] | import ca.ualberta.cs.team1travelexpenseapp.Tag; import java.util.ArrayList; | import ca.ualberta.cs.team1travelexpenseapp.*; import java.util.*; | [
"ca.ualberta.cs",
"java.util"
] | ca.ualberta.cs; java.util; | 1,333,035 |
public void doRegisterService(String serviceName, String groupName, Instance instance) throws NacosException {
InstanceRequest request = new InstanceRequest(namespaceId, serviceName, groupName,
NamingRemoteConstants.REGISTER_INSTANCE, instance);
requestToServer(request, Response.class);
redoService.instanceRegistered(serviceName, groupName);
} | void function(String serviceName, String groupName, Instance instance) throws NacosException { InstanceRequest request = new InstanceRequest(namespaceId, serviceName, groupName, NamingRemoteConstants.REGISTER_INSTANCE, instance); requestToServer(request, Response.class); redoService.instanceRegistered(serviceName, groupName); } | /**
* Execute register operation.
*
* @param serviceName name of service
* @param groupName group of service
* @param instance instance to register
* @throws NacosException nacos exception
*/ | Execute register operation | doRegisterService | {
"repo_name": "alibaba/nacos",
"path": "client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/NamingGrpcClientProxy.java",
"license": "apache-2.0",
"size": 13097
} | [
"com.alibaba.nacos.api.exception.NacosException",
"com.alibaba.nacos.api.naming.pojo.Instance",
"com.alibaba.nacos.api.naming.remote.NamingRemoteConstants",
"com.alibaba.nacos.api.naming.remote.request.InstanceRequest",
"com.alibaba.nacos.api.remote.response.Response"
] | import com.alibaba.nacos.api.exception.NacosException; import com.alibaba.nacos.api.naming.pojo.Instance; import com.alibaba.nacos.api.naming.remote.NamingRemoteConstants; import com.alibaba.nacos.api.naming.remote.request.InstanceRequest; import com.alibaba.nacos.api.remote.response.Response; | import com.alibaba.nacos.api.exception.*; import com.alibaba.nacos.api.naming.pojo.*; import com.alibaba.nacos.api.naming.remote.*; import com.alibaba.nacos.api.naming.remote.request.*; import com.alibaba.nacos.api.remote.response.*; | [
"com.alibaba.nacos"
] | com.alibaba.nacos; | 2,342,932 |
@Override
public String getText(Object object) {
String label = ((EtherCATCable)object).getName();
return label == null || label.length() == 0 ?
getString("_UI_EtherCATCable_type") :
getString("_UI_EtherCATCable_type") + " " + label;
}
| String function(Object object) { String label = ((EtherCATCable)object).getName(); return label == null label.length() == 0 ? getString(STR) : getString(STR) + " " + label; } | /**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This returns the label text for the adapted class. | getText | {
"repo_name": "KAMP-Research/KAMP4APS",
"path": "edu.kit.ipd.sdq.kamp4aps.aps.edit/src/edu/kit/ipd/sdq/kamp4aps/model/aPS/BusComponents/provider/EtherCATCableItemProvider.java",
"license": "apache-2.0",
"size": 3654
} | [
"edu.kit.ipd.sdq.kamp4aps.model.aPS.BusComponents"
] | import edu.kit.ipd.sdq.kamp4aps.model.aPS.BusComponents; | import edu.kit.ipd.sdq.kamp4aps.model.*; | [
"edu.kit.ipd"
] | edu.kit.ipd; | 164,498 |
private void hashInputs() throws Exception {
for (int i = 0; i < inputs.size() - 1; i += 2) {
// Compute the index for nodes.
int itemIdx = nodes.length + i;
// Combine inputs[i] and inputs[i + 1]
LOG.trace("Inputs: Combining {} and {}", i, i + 1);
byte[] stepDigest = digestHashStep(hashAlgorithm,
inputs.get(i), inputs.get(i + 1));
// Store the digest as parent of two inputs.
LOG.trace("Storing at {}", parentIdx(itemIdx));
nodes[parentIdx(itemIdx)] = stepDigest;
}
} | void function() throws Exception { for (int i = 0; i < inputs.size() - 1; i += 2) { int itemIdx = nodes.length + i; LOG.trace(STR, i, i + 1); byte[] stepDigest = digestHashStep(hashAlgorithm, inputs.get(i), inputs.get(i + 1)); LOG.trace(STR, parentIdx(itemIdx)); nodes[parentIdx(itemIdx)] = stepDigest; } } | /**
* Walks over pairs of inputs and combines them to create lowest
* level of non-leaf nodes.
*/ | Walks over pairs of inputs and combines them to create lowest level of non-leaf nodes | hashInputs | {
"repo_name": "ria-ee/X-Road",
"path": "src/common-util/src/main/java/ee/ria/xroad/common/hashchain/HashChainBuilder.java",
"license": "mit",
"size": 21749
} | [
"ee.ria.xroad.common.hashchain.DigestList"
] | import ee.ria.xroad.common.hashchain.DigestList; | import ee.ria.xroad.common.hashchain.*; | [
"ee.ria.xroad"
] | ee.ria.xroad; | 251,171 |
private static void verifyOperands(final List<COperandTree> operands) {
for (final IOperandTree operandTree : operands) {
verifyNode(operandTree.getRootNode());
}
} | static void function(final List<COperandTree> operands) { for (final IOperandTree operandTree : operands) { verifyNode(operandTree.getRootNode()); } } | /**
* Verifies the validity of the operand trees.
*
* @param operands The operands of the instruction that must be verified.
*/ | Verifies the validity of the operand trees | verifyOperands | {
"repo_name": "guiquanz/binnavi",
"path": "src/main/java/com/google/security/zynamics/binnavi/disassembly/CInstruction.java",
"license": "apache-2.0",
"size": 12607
} | [
"com.google.security.zynamics.zylib.disassembly.IOperandTree",
"java.util.List"
] | import com.google.security.zynamics.zylib.disassembly.IOperandTree; import java.util.List; | import com.google.security.zynamics.zylib.disassembly.*; import java.util.*; | [
"com.google.security",
"java.util"
] | com.google.security; java.util; | 192,072 |
void destroy(Queue<Packet> results); | void destroy(Queue<Packet> results); | /**
* <code>destroy</code> method is called when the task is being permanently
* deleted. The method should take care of sending notification to all
* subscribed users that the task is being deleted and should also clear
* databases from all task data.
*
* @param results a <code>Queue</code> value with all packets needed to send
* upon task deletion.
*/ | <code>destroy</code> method is called when the task is being permanently deleted. The method should take care of sending notification to all subscribed users that the task is being deleted and should also clear databases from all task data | destroy | {
"repo_name": "wangningbo/tigase-server",
"path": "src/main/java/tigase/server/sreceiver/ReceiverTaskIfc.java",
"license": "agpl-3.0",
"size": 9062
} | [
"java.util.Queue"
] | import java.util.Queue; | import java.util.*; | [
"java.util"
] | java.util; | 2,554,162 |
public List<byte[]> getMetaTableRows() throws IOException {
// TODO: Redo using MetaTableAccessor class
Table t = (HTable) getConnection().getTable(TableName.META_TABLE_NAME);
List<byte[]> rows = new ArrayList<byte[]>();
ResultScanner s = t.getScanner(new Scan());
for (Result result : s) {
LOG.info("getMetaTableRows: row -> " +
Bytes.toStringBinary(result.getRow()));
rows.add(result.getRow());
}
s.close();
t.close();
return rows;
} | List<byte[]> function() throws IOException { Table t = (HTable) getConnection().getTable(TableName.META_TABLE_NAME); List<byte[]> rows = new ArrayList<byte[]>(); ResultScanner s = t.getScanner(new Scan()); for (Result result : s) { LOG.info(STR + Bytes.toStringBinary(result.getRow())); rows.add(result.getRow()); } s.close(); t.close(); return rows; } | /**
* Returns all rows from the hbase:meta table.
*
* @throws IOException When reading the rows fails.
*/ | Returns all rows from the hbase:meta table | getMetaTableRows | {
"repo_name": "toshimasa-nasu/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java",
"license": "apache-2.0",
"size": 134883
} | [
"java.io.IOException",
"java.util.ArrayList",
"java.util.List",
"org.apache.hadoop.hbase.client.HTable",
"org.apache.hadoop.hbase.client.Result",
"org.apache.hadoop.hbase.client.ResultScanner",
"org.apache.hadoop.hbase.client.Scan",
"org.apache.hadoop.hbase.client.Table",
"org.apache.hadoop.hbase.util.Bytes"
] | import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.ResultScanner; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.util.Bytes; | import java.io.*; import java.util.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.util.*; | [
"java.io",
"java.util",
"org.apache.hadoop"
] | java.io; java.util; org.apache.hadoop; | 1,981,138 |
private void checkPreislistePreconditions(
VkPreisfindungPreislisteDto vkPreisfindungPreislisteDto) {
if (vkPreisfindungPreislisteDto == null) {
throw new EJBExceptionLP(EJBExceptionLP.FEHLER_DTO_IS_NULL,
new Exception());
}
} | void function( VkPreisfindungPreislisteDto vkPreisfindungPreislisteDto) { if (vkPreisfindungPreislisteDto == null) { throw new EJBExceptionLP(EJBExceptionLP.FEHLER_DTO_IS_NULL, new Exception()); } } | /**
* Preconditions pruefen.
*
* @param vkPreisfindungPreislisteDto
* VkPreisfindungPreislisteDto
*/ | Preconditions pruefen | checkPreislistePreconditions | {
"repo_name": "erdincay/ejb",
"path": "src/com/lp/server/artikel/ejbfac/VkPreisfindungFacBean.java",
"license": "agpl-3.0",
"size": 161149
} | [
"com.lp.server.artikel.service.VkPreisfindungPreislisteDto",
"com.lp.util.EJBExceptionLP"
] | import com.lp.server.artikel.service.VkPreisfindungPreislisteDto; import com.lp.util.EJBExceptionLP; | import com.lp.server.artikel.service.*; import com.lp.util.*; | [
"com.lp.server",
"com.lp.util"
] | com.lp.server; com.lp.util; | 1,217,163 |
public void validateSectionsAndTeams(List<StudentAttributes> studentList, String courseId) throws EnrollException {
assert studentList != null;
assert courseId != null;
studentsLogic.validateSectionsAndTeams(studentList, courseId);
} | void function(List<StudentAttributes> studentList, String courseId) throws EnrollException { assert studentList != null; assert courseId != null; studentsLogic.validateSectionsAndTeams(studentList, courseId); } | /**
* Validates sections for any limit violations and teams for any team name violations.
*
* <p>Preconditions: <br>
* * All parameters are non-null.
*
* @see StudentsLogic#validateSectionsAndTeams(List, String)
*/ | Validates sections for any limit violations and teams for any team name violations. Preconditions: All parameters are non-null | validateSectionsAndTeams | {
"repo_name": "TEAMMATES/teammates",
"path": "src/main/java/teammates/logic/api/Logic.java",
"license": "gpl-2.0",
"size": 53736
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,144,026 |
public T caseNewObject(NewObject object) {
return null;
} | T function(NewObject object) { return null; } | /**
* Returns the result of interpreting the object as an instance of '<em>New Object</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>New Object</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/ | Returns the result of interpreting the object as an instance of 'New Object'. This implementation returns null; returning a non-null result will terminate the switch. | caseNewObject | {
"repo_name": "tetrabox/minijava",
"path": "plugins/org.tetrabox.minijava.model/src/org/tetrabox/minijava/model/miniJava/util/MiniJavaSwitch.java",
"license": "epl-1.0",
"size": 56459
} | [
"org.tetrabox.minijava.model.miniJava.NewObject"
] | import org.tetrabox.minijava.model.miniJava.NewObject; | import org.tetrabox.minijava.model.*; | [
"org.tetrabox.minijava"
] | org.tetrabox.minijava; | 1,108,288 |
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
processRequest(request, response);
} catch (CerberusException ex) {
LOG.warn(ex);
} catch (JSONException ex) {
LOG.warn(ex);
}
} | void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); } catch (CerberusException ex) { LOG.warn(ex); } catch (JSONException ex) { LOG.warn(ex); } } | /**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/ | Handles the HTTP <code>GET</code> method | doGet | {
"repo_name": "cerberustesting/cerberus-source",
"path": "source/src/main/java/org/cerberus/servlet/crud/countryenvironment/CreateDeployType.java",
"license": "gpl-3.0",
"size": 7020
} | [
"java.io.IOException",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.cerberus.exception.CerberusException",
"org.json.JSONException"
] | import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.cerberus.exception.CerberusException; import org.json.JSONException; | import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import org.cerberus.exception.*; import org.json.*; | [
"java.io",
"javax.servlet",
"org.cerberus.exception",
"org.json"
] | java.io; javax.servlet; org.cerberus.exception; org.json; | 2,328,540 |
public LoggingObjectInterface getParent() {
return parentJob;
} | LoggingObjectInterface function() { return parentJob; } | /**
* Gets the logging object interface's parent
*
* @return the logging object interface's parent
* @see org.pentaho.di.core.logging.LoggingObjectInterface#getParent()
*/ | Gets the logging object interface's parent | getParent | {
"repo_name": "apratkin/pentaho-kettle",
"path": "engine/src/org/pentaho/di/job/entry/JobEntryBase.java",
"license": "apache-2.0",
"size": 41980
} | [
"org.pentaho.di.core.logging.LoggingObjectInterface"
] | import org.pentaho.di.core.logging.LoggingObjectInterface; | import org.pentaho.di.core.logging.*; | [
"org.pentaho.di"
] | org.pentaho.di; | 1,989,436 |
public void testScanAndRealConcurrentFlush() throws Exception {
this.r = createNewHRegion(TESTTABLEDESC, null, null);
HRegionIncommon hri = new HRegionIncommon(r);
try {
LOG.info("Added: " + addContent(hri, Bytes.toString(HConstants.CATALOG_FAMILY),
Bytes.toString(HConstants.REGIONINFO_QUALIFIER)));
int count = count(hri, -1, false);
assertEquals(count, count(hri, 100, true)); // do a true concurrent background thread flush
} catch (Exception e) {
LOG.error("Failed", e);
throw e;
} finally {
HRegion.closeHRegion(this.r);
}
} | void function() throws Exception { this.r = createNewHRegion(TESTTABLEDESC, null, null); HRegionIncommon hri = new HRegionIncommon(r); try { LOG.info(STR + addContent(hri, Bytes.toString(HConstants.CATALOG_FAMILY), Bytes.toString(HConstants.REGIONINFO_QUALIFIER))); int count = count(hri, -1, false); assertEquals(count, count(hri, 100, true)); } catch (Exception e) { LOG.error(STR, e); throw e; } finally { HRegion.closeHRegion(this.r); } } | /**
* Tests to do a concurrent flush (using a 2nd thread) while scanning. This tests both
* the StoreScanner update readers and the transition from memstore -> snapshot -> store file.
*
* @throws Exception
*/ | Tests to do a concurrent flush (using a 2nd thread) while scanning. This tests both the StoreScanner update readers and the transition from memstore -> snapshot -> store file | testScanAndRealConcurrentFlush | {
"repo_name": "daidong/DominoHBase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanner.java",
"license": "apache-2.0",
"size": 18921
} | [
"org.apache.hadoop.hbase.HConstants",
"org.apache.hadoop.hbase.util.Bytes"
] | import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.util.Bytes; | import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.util.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,763,905 |
Set<String> fonts = new HashSet<>();
for(FontData fontData:Display.getCurrent().getFontList(null, true)) {
fonts.add(fontData.getName());
}
for(String name:Arrays.asList("Consolas", "Courier", "Courier New")) {
if(fonts.contains(name)) {
return name;
}
}
return "Monospace";
} | Set<String> fonts = new HashSet<>(); for(FontData fontData:Display.getCurrent().getFontList(null, true)) { fonts.add(fontData.getName()); } for(String name:Arrays.asList(STR, STR, STR)) { if(fonts.contains(name)) { return name; } } return STR; } | /**
* Returns the first found monospace font.
*/ | Returns the first found monospace font | getMonospaceName | {
"repo_name": "dmac100/vm",
"path": "src/frontend/ui/FontList.java",
"license": "gpl-3.0",
"size": 952
} | [
"java.util.Arrays",
"java.util.HashSet",
"java.util.Set",
"org.eclipse.swt.graphics.FontData",
"org.eclipse.swt.widgets.Display"
] | import java.util.Arrays; import java.util.HashSet; import java.util.Set; import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.widgets.Display; | import java.util.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; | [
"java.util",
"org.eclipse.swt"
] | java.util; org.eclipse.swt; | 1,343,867 |
public static AbstractCommandTask createDropinForNodeTask(final DragAndDropTarget target, final NodeMapping mapping, final DDiagramElement droppedDiagramElement, final EObject droppedElement,
final EObject semanticContainer, final boolean moveEdges) {
return new DropinForNodeTaskCommand(target, mapping, droppedDiagramElement, droppedElement, semanticContainer, moveEdges);
} | static AbstractCommandTask function(final DragAndDropTarget target, final NodeMapping mapping, final DDiagramElement droppedDiagramElement, final EObject droppedElement, final EObject semanticContainer, final boolean moveEdges) { return new DropinForNodeTaskCommand(target, mapping, droppedDiagramElement, droppedElement, semanticContainer, moveEdges); } | /**
* Create the drop in task for node.
*
* @param target
* the drop container target
* @param mapping
* the mapping
* @param droppedDiagramElement
* the dropped diagram element
* @param droppedElement
* the semantic dropped element
* @param semanticContainer
* the semantic drop container
* @param moveEdges
* tell whether edges should be moved after dnd
* @return the created task
*/ | Create the drop in task for node | createDropinForNodeTask | {
"repo_name": "FTSRG/iq-sirius-integration",
"path": "host/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/helper/task/DnDTasksOperations.java",
"license": "epl-1.0",
"size": 22507
} | [
"org.eclipse.emf.ecore.EObject",
"org.eclipse.sirius.business.api.helper.task.AbstractCommandTask",
"org.eclipse.sirius.diagram.DDiagramElement",
"org.eclipse.sirius.diagram.DragAndDropTarget",
"org.eclipse.sirius.diagram.description.NodeMapping"
] | import org.eclipse.emf.ecore.EObject; import org.eclipse.sirius.business.api.helper.task.AbstractCommandTask; import org.eclipse.sirius.diagram.DDiagramElement; import org.eclipse.sirius.diagram.DragAndDropTarget; import org.eclipse.sirius.diagram.description.NodeMapping; | import org.eclipse.emf.ecore.*; import org.eclipse.sirius.business.api.helper.task.*; import org.eclipse.sirius.diagram.*; import org.eclipse.sirius.diagram.description.*; | [
"org.eclipse.emf",
"org.eclipse.sirius"
] | org.eclipse.emf; org.eclipse.sirius; | 2,394,266 |
public void setCatalog(String catalog) throws SQLException {
checkClosed();
try {
this.mc.setCatalog(catalog);
} catch (SQLException sqlException) {
checkAndFireConnectionError(sqlException);
}
} | void function(String catalog) throws SQLException { checkClosed(); try { this.mc.setCatalog(catalog); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } } | /**
* Passes call to method on physical connection instance. Notifies listeners
* of any caught exceptions before re-throwing to client.
*
* @see java.sql.Connection#setCatalog()
*/ | Passes call to method on physical connection instance. Notifies listeners of any caught exceptions before re-throwing to client | setCatalog | {
"repo_name": "slockhart/sql-app",
"path": "mysql-connector-java-5.1.34/src/com/mysql/jdbc/jdbc2/optional/ConnectionWrapper.java",
"license": "gpl-2.0",
"size": 85410
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 63,740 |
public String unmatchTransaction(String transactionId)throws Exception
{
String urlString = url+"/"+transactionId+"/unmatch"; //No I18N
String response = ZohoHTTPClient.post(urlString, getQueryMap());
String message = bankTransactionParser.getMessage(response);
return message;
}
| String function(String transactionId)throws Exception { String urlString = url+"/"+transactionId+STR; String response = ZohoHTTPClient.post(urlString, getQueryMap()); String message = bankTransactionParser.getMessage(response); return message; } | /**
* Unmatch a transaction that was previously matched and make it uncategorized.
* Pass the transactionId to unmatch a matched transaction.
* If the transaction has been unmatched it returns the success message.
* The success message is "The transaction has been unmatched."
* @param transactionId ID of the transaction.
* @return Returns the String object.
*/ | Unmatch a transaction that was previously matched and make it uncategorized. Pass the transactionId to unmatch a matched transaction. If the transaction has been unmatched it returns the success message. The success message is "The transaction has been unmatched." | unmatchTransaction | {
"repo_name": "zoho/books-java-wrappers",
"path": "source/com/zoho/books/api/BankTransactionsApi.java",
"license": "mit",
"size": 18879
} | [
"com.zoho.books.util.ZohoHTTPClient"
] | import com.zoho.books.util.ZohoHTTPClient; | import com.zoho.books.util.*; | [
"com.zoho.books"
] | com.zoho.books; | 2,493,579 |
public static Message checkFinancialBalanceTypeCode(LaborTransaction transaction) {
String balanceTypeCode = transaction.getFinancialBalanceTypeCode();
BalanceType balanceType = getAccountingCycleCachingService().getBalanceType(((LaborOriginEntry) transaction).getFinancialBalanceTypeCode());
if (StringUtils.isBlank(balanceTypeCode) || ObjectUtils.isNull(balanceType)) {
return MessageBuilder.buildMessage(KFSKeyConstants.ERROR_BALANCE_TYPE_NOT_FOUND, balanceTypeCode, Message.TYPE_FATAL);
}
return null;
} | static Message function(LaborTransaction transaction) { String balanceTypeCode = transaction.getFinancialBalanceTypeCode(); BalanceType balanceType = getAccountingCycleCachingService().getBalanceType(((LaborOriginEntry) transaction).getFinancialBalanceTypeCode()); if (StringUtils.isBlank(balanceTypeCode) ObjectUtils.isNull(balanceType)) { return MessageBuilder.buildMessage(KFSKeyConstants.ERROR_BALANCE_TYPE_NOT_FOUND, balanceTypeCode, Message.TYPE_FATAL); } return null; } | /**
* Checks if the given transaction contains valid balance type code
*
* @param transaction the given transaction
* @return null if the balance type code is valid; otherwise, return error message
*/ | Checks if the given transaction contains valid balance type code | checkFinancialBalanceTypeCode | {
"repo_name": "ua-eas/kfs-devops-automation-fork",
"path": "kfs-ld/src/main/java/org/kuali/kfs/module/ld/document/validation/impl/TransactionFieldValidator.java",
"license": "agpl-3.0",
"size": 21303
} | [
"org.apache.commons.lang.StringUtils",
"org.kuali.kfs.coa.businessobject.BalanceType",
"org.kuali.kfs.module.ld.businessobject.LaborOriginEntry",
"org.kuali.kfs.module.ld.businessobject.LaborTransaction",
"org.kuali.kfs.sys.KFSKeyConstants",
"org.kuali.kfs.sys.Message",
"org.kuali.kfs.sys.MessageBuilder",
"org.kuali.rice.krad.util.ObjectUtils"
] | import org.apache.commons.lang.StringUtils; import org.kuali.kfs.coa.businessobject.BalanceType; import org.kuali.kfs.module.ld.businessobject.LaborOriginEntry; import org.kuali.kfs.module.ld.businessobject.LaborTransaction; import org.kuali.kfs.sys.KFSKeyConstants; import org.kuali.kfs.sys.Message; import org.kuali.kfs.sys.MessageBuilder; import org.kuali.rice.krad.util.ObjectUtils; | import org.apache.commons.lang.*; import org.kuali.kfs.coa.businessobject.*; import org.kuali.kfs.module.ld.businessobject.*; import org.kuali.kfs.sys.*; import org.kuali.rice.krad.util.*; | [
"org.apache.commons",
"org.kuali.kfs",
"org.kuali.rice"
] | org.apache.commons; org.kuali.kfs; org.kuali.rice; | 511,077 |
public static class Parametric implements ParametricUnivariateFunction {
public double value(double x, double ... param)
throws NullArgumentException,
DimensionMismatchException,
NotStrictlyPositiveException {
validateParameters(param);
return Logistic.value(param[1] - x, param[0],
param[2], param[3],
param[4], 1 / param[5]);
} | static class Parametric implements ParametricUnivariateFunction { public double function(double x, double ... param) throws NullArgumentException, DimensionMismatchException, NotStrictlyPositiveException { validateParameters(param); return Logistic.value(param[1] - x, param[0], param[2], param[3], param[4], 1 / param[5]); } | /**
* Computes the value of the sigmoid at {@code x}.
*
* @param x Value for which the function must be computed.
* @param param Values for {@code k}, {@code m}, {@code b}, {@code q},
* {@code a} and {@code n}.
* @return the value of the function.
* @throws NullArgumentException if {@code param} is {@code null}.
* @throws DimensionMismatchException if the size of {@code param} is
* not 6.
* @throws NotStrictlyPositiveException if {@code param[5] <= 0}.
*/ | Computes the value of the sigmoid at x | value | {
"repo_name": "tbepler/seq-svm",
"path": "src/org/apache/commons/math3/analysis/function/Logistic.java",
"license": "mit",
"size": 9145
} | [
"org.apache.commons.math3.analysis.ParametricUnivariateFunction",
"org.apache.commons.math3.exception.DimensionMismatchException",
"org.apache.commons.math3.exception.NotStrictlyPositiveException",
"org.apache.commons.math3.exception.NullArgumentException"
] | import org.apache.commons.math3.analysis.ParametricUnivariateFunction; import org.apache.commons.math3.exception.DimensionMismatchException; import org.apache.commons.math3.exception.NotStrictlyPositiveException; import org.apache.commons.math3.exception.NullArgumentException; | import org.apache.commons.math3.analysis.*; import org.apache.commons.math3.exception.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,671,607 |
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
{
this.field_186177_b.setBoundingBox(structureBoundingBoxIn);
this.field_186176_a.addBlocksToWorld(worldIn, this.field_186178_c, this.field_186177_b);
Map<BlockPos, String> map = this.field_186176_a.func_186258_a(this.field_186178_c, this.field_186177_b);
for (BlockPos blockpos : map.keySet())
{
String s = (String)map.get(blockpos);
this.func_186175_a(s, blockpos, worldIn, randomIn, structureBoundingBoxIn);
}
return true;
} | boolean function(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) { this.field_186177_b.setBoundingBox(structureBoundingBoxIn); this.field_186176_a.addBlocksToWorld(worldIn, this.field_186178_c, this.field_186177_b); Map<BlockPos, String> map = this.field_186176_a.func_186258_a(this.field_186178_c, this.field_186177_b); for (BlockPos blockpos : map.keySet()) { String s = (String)map.get(blockpos); this.func_186175_a(s, blockpos, worldIn, randomIn, structureBoundingBoxIn); } return true; } | /**
* second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at
* the end, it adds Fences...
*/ | second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at the end, it adds Fences.. | addComponentParts | {
"repo_name": "aebert1/BigTransport",
"path": "build/tmp/recompileMc/sources/net/minecraft/world/gen/structure/StructureComponentTemplate.java",
"license": "gpl-3.0",
"size": 4170
} | [
"java.util.Map",
"java.util.Random",
"net.minecraft.util.math.BlockPos",
"net.minecraft.world.World"
] | import java.util.Map; import java.util.Random; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; | import java.util.*; import net.minecraft.util.math.*; import net.minecraft.world.*; | [
"java.util",
"net.minecraft.util",
"net.minecraft.world"
] | java.util; net.minecraft.util; net.minecraft.world; | 1,705,245 |
public String getSubtype() {
return this.getDictionary().getNameAsString(COSName.SUBTYPE);
} | String function() { return this.getDictionary().getNameAsString(COSName.SUBTYPE); } | /**
* This will retrieve the subtype of the annotation.
*
* @return the subtype
*/ | This will retrieve the subtype of the annotation | getSubtype | {
"repo_name": "sencko/NALB",
"path": "nalb2013/src/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java",
"license": "gpl-2.0",
"size": 16188
} | [
"org.apache.pdfbox.cos.COSName"
] | import org.apache.pdfbox.cos.COSName; | import org.apache.pdfbox.cos.*; | [
"org.apache.pdfbox"
] | org.apache.pdfbox; | 2,195,958 |
@ObjectiveCName("changeNotificationVibrationEnabledWithValue")
public void changeNotificationVibrationEnabled(boolean val) {
modules.getSettingsModule().changeNotificationVibrationEnabled(val);
} | @ObjectiveCName(STR) void function(boolean val) { modules.getSettingsModule().changeNotificationVibrationEnabled(val); } | /**
* Change notification vibration enabled
*
* @param val is notification vibration enabled
*/ | Change notification vibration enabled | changeNotificationVibrationEnabled | {
"repo_name": "luoxiaoshenghustedu/actor-platform",
"path": "actor-apps/core/src/main/java/im/actor/core/Messenger.java",
"license": "mit",
"size": 52564
} | [
"com.google.j2objc.annotations.ObjectiveCName"
] | import com.google.j2objc.annotations.ObjectiveCName; | import com.google.j2objc.annotations.*; | [
"com.google.j2objc"
] | com.google.j2objc; | 48,152 |
protected void engineSetParameter(AlgorithmParameterSpec params)
throws InvalidAlgorithmParameterException
{
throw new UnsupportedOperationException();
} | void function(AlgorithmParameterSpec params) throws InvalidAlgorithmParameterException { throw new UnsupportedOperationException(); } | /**
* Sets the signature engine with the specified {@link AlgorithmParameterSpec}.
*
* <p>This method cannot be abstract for backward compatibility reasons. By
* default it always throws {@link UnsupportedOperationException} unless
* overridden.</p>
*
* @param params
* the parameters.
* @throws InvalidParameterException
* if the parameter is invalid, the parameter is already set and
* cannot be changed, a security exception occured, etc.
*/ | Sets the signature engine with the specified <code>AlgorithmParameterSpec</code>. This method cannot be abstract for backward compatibility reasons. By default it always throws <code>UnsupportedOperationException</code> unless overridden | engineSetParameter | {
"repo_name": "shaotuanchen/sunflower_exp",
"path": "tools/source/gcc-4.2.4/libjava/classpath/java/security/SignatureSpi.java",
"license": "bsd-3-clause",
"size": 10057
} | [
"java.security.spec.AlgorithmParameterSpec"
] | import java.security.spec.AlgorithmParameterSpec; | import java.security.spec.*; | [
"java.security"
] | java.security; | 2,452,344 |
public AdministradorRestaurante buscarAdministradorRestaurantePorId(Long id) throws SQLException, Exception
{
AdministradorRestaurante AdministradorRestaurante = null;
String sql = "SELECT * FROM AdministradorRestaurante_TABLA WHERE CEDULA =" + id;
PreparedStatement prepStmt = conn.prepareStatement(sql);
recursos.add(prepStmt);
ResultSet rs = prepStmt.executeQuery();
if(rs.next()) {
String name2 = rs.getString("Nombre");
int cedula = rs.getInt("CEDULA");
String correo = rs.getString("CORREO");
int restauranteID = rs.getInt("RESTAURANTE_ID");
AdministradorRestaurante =(new AdministradorRestaurante(name2, cedula, restauranteID, correo));
}
return AdministradorRestaurante;
} | AdministradorRestaurante function(Long id) throws SQLException, Exception { AdministradorRestaurante AdministradorRestaurante = null; String sql = STR + id; PreparedStatement prepStmt = conn.prepareStatement(sql); recursos.add(prepStmt); ResultSet rs = prepStmt.executeQuery(); if(rs.next()) { String name2 = rs.getString(STR); int cedula = rs.getInt(STR); String correo = rs.getString(STR); int restauranteID = rs.getInt(STR); AdministradorRestaurante =(new AdministradorRestaurante(name2, cedula, restauranteID, correo)); } return AdministradorRestaurante; } | /**
* Metodo que busca el video con el id que entra como parametro.
* @param name - Id de el video a buscar
* @return Video encontrado
* @throws SQLException - Cualquier error que la base de datos arroje.
* @throws Exception - Cualquier error que no corresponda a la base de datos
*/ | Metodo que busca el video con el id que entra como parametro | buscarAdministradorRestaurantePorId | {
"repo_name": "ssaenz11/iteracion2",
"path": "src/dao/DAOTablaAdministradorRestaurante.java",
"license": "mit",
"size": 8027
} | [
"java.sql.PreparedStatement",
"java.sql.ResultSet",
"java.sql.SQLException"
] | import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,105,043 |
private void loadStoppableInstance() {
try {
Method getInstanceMethod = injectorClassInstance.getClass().getMethod("getInstance", Class.class);
Class stoppableClass = deploymentUnitClassLoader.loadClass("com.flipkart.flux.client.runtime.Stoppable");
stoppableInstance = getInstanceMethod.invoke(injectorClassInstance, stoppableClass);
} catch (Exception e) {
LOGGER.error("Unable to find/load Stoppable instance for deploymentUnit: {}/{}", name, version, e);
}
} | void function() { try { Method getInstanceMethod = injectorClassInstance.getClass().getMethod(STR, Class.class); Class stoppableClass = deploymentUnitClassLoader.loadClass(STR); stoppableInstance = getInstanceMethod.invoke(injectorClassInstance, stoppableClass); } catch (Exception e) { LOGGER.error(STR, name, version, e); } } | /**
* Loads {@link Stoppable} instance using the injector
*/ | Loads <code>Stoppable</code> instance using the injector | loadStoppableInstance | {
"repo_name": "flipkart-incubator/flux",
"path": "runtime/src/main/java/com/flipkart/flux/deploymentunit/DeploymentUnit.java",
"license": "apache-2.0",
"size": 11118
} | [
"java.lang.reflect.Method"
] | import java.lang.reflect.Method; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 1,488,598 |
public static String executeUrl(String httpMethod, String url, Properties httpHeaders, InputStream content,
String contentType, int timeout) {
String proxySet = System.getProperty("http.proxySet");
String proxyHost = null;
int proxyPort = 80;
String proxyUser = null;
String proxyPassword = null;
String nonProxyHosts = null;
if ("true".equalsIgnoreCase(proxySet)) {
proxyHost = System.getProperty("http.proxyHost");
String proxyPortString = System.getProperty("http.proxyPort");
if (StringUtils.isNotBlank(proxyPortString)) {
try {
proxyPort = Integer.valueOf(proxyPortString);
} catch (NumberFormatException e) {
LoggerFactory.getLogger(HttpUtil.class).warn(
"'{}' is not a valid proxy port - using port 80 instead");
}
}
proxyUser = System.getProperty("http.proxyUser");
proxyPassword = System.getProperty("http.proxyPassword");
nonProxyHosts = System.getProperty("http.nonProxyHosts");
}
return executeUrl(httpMethod, url, httpHeaders, content, contentType, timeout, proxyHost, proxyPort, proxyUser,
proxyPassword, nonProxyHosts);
} | static String function(String httpMethod, String url, Properties httpHeaders, InputStream content, String contentType, int timeout) { String proxySet = System.getProperty(STR); String proxyHost = null; int proxyPort = 80; String proxyUser = null; String proxyPassword = null; String nonProxyHosts = null; if ("true".equalsIgnoreCase(proxySet)) { proxyHost = System.getProperty(STR); String proxyPortString = System.getProperty(STR); if (StringUtils.isNotBlank(proxyPortString)) { try { proxyPort = Integer.valueOf(proxyPortString); } catch (NumberFormatException e) { LoggerFactory.getLogger(HttpUtil.class).warn( STR); } } proxyUser = System.getProperty(STR); proxyPassword = System.getProperty(STR); nonProxyHosts = System.getProperty(STR); } return executeUrl(httpMethod, url, httpHeaders, content, contentType, timeout, proxyHost, proxyPort, proxyUser, proxyPassword, nonProxyHosts); } | /**
* Executes the given <code>url</code> with the given <code>httpMethod</code>.
* Furthermore the <code>http.proxyXXX</code> System variables are read and
* set into the {@link HttpClient}.
*
* @param httpMethod the HTTP method to use
* @param url the url to execute (in milliseconds)
* @param httpHeaders optional http request headers which has to be sent within request
* @param content the content to be send to the given <code>url</code> or <code>null</code> if no content should be
* send.
* @param contentType the content type of the given <code>content</code>
* @param timeout the socket timeout to wait for data
*
* @return the response body or <code>NULL</code> when the request went wrong
*/ | Executes the given <code>url</code> with the given <code>httpMethod</code>. Furthermore the <code>http.proxyXXX</code> System variables are read and set into the <code>HttpClient</code> | executeUrl | {
"repo_name": "clinique/smarthome",
"path": "bundles/io/org.eclipse.smarthome.io.net/src/main/java/org/eclipse/smarthome/io/net/http/HttpUtil.java",
"license": "epl-1.0",
"size": 13354
} | [
"java.io.InputStream",
"java.util.Properties",
"org.apache.commons.lang.StringUtils",
"org.slf4j.LoggerFactory"
] | import java.io.InputStream; import java.util.Properties; import org.apache.commons.lang.StringUtils; import org.slf4j.LoggerFactory; | import java.io.*; import java.util.*; import org.apache.commons.lang.*; import org.slf4j.*; | [
"java.io",
"java.util",
"org.apache.commons",
"org.slf4j"
] | java.io; java.util; org.apache.commons; org.slf4j; | 144,784 |
public static String asMatchesPattern(String string) {
return StringUtils.isNotEmpty(string) ? String.format(".*%s.*", string) : string;
} | static String function(String string) { return StringUtils.isNotEmpty(string) ? String.format(STR, string) : string; } | /**
* Returns the string in a form a pattern used for searching with the matches operator.
* @param string The string to search for.
* @return The string in format {@code .*<string>.*} or the string unchanged if it is empty.
*/ | Returns the string in a form a pattern used for searching with the matches operator | asMatchesPattern | {
"repo_name": "frankhuster/motech",
"path": "platform/mds/mds/src/main/java/org/motechproject/mds/query/QueryUtil.java",
"license": "bsd-3-clause",
"size": 5698
} | [
"org.apache.commons.lang.StringUtils"
] | import org.apache.commons.lang.StringUtils; | import org.apache.commons.lang.*; | [
"org.apache.commons"
] | org.apache.commons; | 832,648 |
public java.util.List<fr.lip6.move.pnml.symmetricnet.cyclicEnumerations.hlapi.PredecessorHLAPI> getSubterm_cyclicEnumerations_PredecessorHLAPI(){
java.util.List<fr.lip6.move.pnml.symmetricnet.cyclicEnumerations.hlapi.PredecessorHLAPI> retour = new ArrayList<fr.lip6.move.pnml.symmetricnet.cyclicEnumerations.hlapi.PredecessorHLAPI>();
for (Term elemnt : getSubterm()) {
if(elemnt.getClass().equals(fr.lip6.move.pnml.symmetricnet.cyclicEnumerations.impl.PredecessorImpl.class)){
retour.add(new fr.lip6.move.pnml.symmetricnet.cyclicEnumerations.hlapi.PredecessorHLAPI(
(fr.lip6.move.pnml.symmetricnet.cyclicEnumerations.Predecessor)elemnt
));
}
}
return retour;
}
| java.util.List<fr.lip6.move.pnml.symmetricnet.cyclicEnumerations.hlapi.PredecessorHLAPI> function(){ java.util.List<fr.lip6.move.pnml.symmetricnet.cyclicEnumerations.hlapi.PredecessorHLAPI> retour = new ArrayList<fr.lip6.move.pnml.symmetricnet.cyclicEnumerations.hlapi.PredecessorHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.symmetricnet.cyclicEnumerations.impl.PredecessorImpl.class)){ retour.add(new fr.lip6.move.pnml.symmetricnet.cyclicEnumerations.hlapi.PredecessorHLAPI( (fr.lip6.move.pnml.symmetricnet.cyclicEnumerations.Predecessor)elemnt )); } } return retour; } | /**
* This accessor return a list of encapsulated subelement, only of PredecessorHLAPI kind.
* WARNING : this method can creates a lot of new object in memory.
*/ | This accessor return a list of encapsulated subelement, only of PredecessorHLAPI kind. WARNING : this method can creates a lot of new object in memory | getSubterm_cyclicEnumerations_PredecessorHLAPI | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-SNNet/src/fr/lip6/move/pnml/symmetricnet/finiteIntRanges/hlapi/GreaterThanOrEqualHLAPI.java",
"license": "epl-1.0",
"size": 90341
} | [
"fr.lip6.move.pnml.symmetricnet.terms.Term",
"java.util.ArrayList",
"java.util.List"
] | import fr.lip6.move.pnml.symmetricnet.terms.Term; import java.util.ArrayList; import java.util.List; | import fr.lip6.move.pnml.symmetricnet.terms.*; import java.util.*; | [
"fr.lip6.move",
"java.util"
] | fr.lip6.move; java.util; | 529,897 |
@GET
@Path("{organizationId}/services/{serviceId}/activity")
@Produces(MediaType.APPLICATION_JSON)
public SearchResultsBean<AuditEntryBean> getServiceActivity(
@PathParam("organizationId") String organizationId, @PathParam("serviceId") String serviceId,
@QueryParam("page") int page, @QueryParam("count") int pageSize) throws ServiceNotFoundException,
NotAuthorizedException; | @Path(STR) @Produces(MediaType.APPLICATION_JSON) SearchResultsBean<AuditEntryBean> function( @PathParam(STR) String organizationId, @PathParam(STR) String serviceId, @QueryParam("page") int page, @QueryParam("count") int pageSize) throws ServiceNotFoundException, NotAuthorizedException; | /**
* This endpoint returns audit activity information about the Service.
* @summary Get Service Activity
* @param organizationId The Organization ID.
* @param serviceId The Service ID.
* @param page Which page of activity should be returned.
* @param pageSize The number of entries per page to return.
* @statuscode 200 If the audit information is successfully returned.
* @statuscode 404 If the Organization does not exist.
* @statuscode 404 If the Service does not exist.
* @return A list of audit activity entries.
* @throws ServiceNotFoundException when trying to get, update, or delete an service that does not exist
* @throws NotAuthorizedException when the user attempts to do or see something that they are not authorized (do not have permission) to
*/ | This endpoint returns audit activity information about the Service | getServiceActivity | {
"repo_name": "kunallimaye/apiman",
"path": "manager/api/rest/src/main/java/io/apiman/manager/api/rest/contract/IOrganizationResource.java",
"license": "apache-2.0",
"size": 111368
} | [
"io.apiman.manager.api.beans.audit.AuditEntryBean",
"io.apiman.manager.api.beans.search.SearchResultsBean",
"io.apiman.manager.api.rest.contract.exceptions.NotAuthorizedException",
"io.apiman.manager.api.rest.contract.exceptions.ServiceNotFoundException",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"javax.ws.rs.Produces",
"javax.ws.rs.QueryParam",
"javax.ws.rs.core.MediaType"
] | import io.apiman.manager.api.beans.audit.AuditEntryBean; import io.apiman.manager.api.beans.search.SearchResultsBean; import io.apiman.manager.api.rest.contract.exceptions.NotAuthorizedException; import io.apiman.manager.api.rest.contract.exceptions.ServiceNotFoundException; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; | import io.apiman.manager.api.beans.audit.*; import io.apiman.manager.api.beans.search.*; import io.apiman.manager.api.rest.contract.exceptions.*; import javax.ws.rs.*; import javax.ws.rs.core.*; | [
"io.apiman.manager",
"javax.ws"
] | io.apiman.manager; javax.ws; | 820,425 |
public Iterable<FieldQuery> md5() {
return ListUtil.iterable(this.md5);
} | Iterable<FieldQuery> function() { return ListUtil.iterable(this.md5); } | /**
* Get an iterable over md5 operations.
*
* @return Iterable of {@link FieldQuery} objects.
*/ | Get an iterable over md5 operations | md5 | {
"repo_name": "CitrineInformatics/java-citrination-client",
"path": "src/main/java/io/citrine/jcc/search/pif/query/core/FileReferenceQuery.java",
"license": "apache-2.0",
"size": 16721
} | [
"io.citrine.jcc.util.ListUtil"
] | import io.citrine.jcc.util.ListUtil; | import io.citrine.jcc.util.*; | [
"io.citrine.jcc"
] | io.citrine.jcc; | 2,307,068 |
private static synchronized void initCerts() {
if (ROOT_CA != null) {
return;
}
ROOT_CA = new Builder()
.aliasPrefix("RootCA")
.subject("CN=Test Root Certificate Authority")
.ca(true)
.certificateSerialNumber(BigInteger.valueOf(1))
.build();
INTERMEDIATE_CA_EC = new Builder()
.aliasPrefix("IntermediateCA-EC")
.keyAlgorithms("EC")
.subject("CN=Test Intermediate Certificate Authority ECDSA")
.ca(true)
.signer(ROOT_CA.getPrivateKey("RSA", "RSA"))
.rootCa(ROOT_CA.getRootCertificate("RSA"))
.certificateSerialNumber(BigInteger.valueOf(2))
.build();
INTERMEDIATE_CA = new Builder()
.aliasPrefix("IntermediateCA")
.subject("CN=Test Intermediate Certificate Authority")
.ca(true)
.signer(ROOT_CA.getPrivateKey("RSA", "RSA"))
.rootCa(ROOT_CA.getRootCertificate("RSA"))
.certificateSerialNumber(BigInteger.valueOf(2))
.build();
SERVER = new Builder()
.aliasPrefix("server")
.signer(INTERMEDIATE_CA.getPrivateKey("RSA", "RSA"))
.rootCa(INTERMEDIATE_CA.getRootCertificate("RSA"))
.addSubjectAltName(new GeneralName(GeneralName.dNSName, LOCAL_HOST_NAME))
.certificateSerialNumber(BigInteger.valueOf(3))
.build();
CLIENT = new TestKeyStore(createClient(INTERMEDIATE_CA.keyStore), null, null);
CLIENT_EC_RSA_CERTIFICATE = new Builder()
.aliasPrefix("client-ec")
.keyAlgorithms("EC")
.subject("emailAddress=test-ec@user")
.signer(INTERMEDIATE_CA.getPrivateKey("RSA", "RSA"))
.rootCa(INTERMEDIATE_CA.getRootCertificate("RSA"))
.build();
CLIENT_EC_EC_CERTIFICATE = new Builder()
.aliasPrefix("client-ec")
.keyAlgorithms("EC")
.subject("emailAddress=test-ec@user")
.signer(INTERMEDIATE_CA_EC.getPrivateKey("EC", "RSA"))
.rootCa(INTERMEDIATE_CA_EC.getRootCertificate("RSA"))
.build();
CLIENT_CERTIFICATE = new Builder()
.aliasPrefix("client")
.subject("emailAddress=test@user")
.signer(INTERMEDIATE_CA.getPrivateKey("RSA", "RSA"))
.rootCa(INTERMEDIATE_CA.getRootCertificate("RSA"))
.build();
TestKeyStore rootCa2 = new Builder()
.aliasPrefix("RootCA2")
.subject("CN=Test Root Certificate Authority 2")
.ca(true)
.build();
INTERMEDIATE_CA_2 = new Builder()
.aliasPrefix("IntermediateCA")
.subject("CN=Test Intermediate Certificate Authority")
.ca(true)
.signer(rootCa2.getPrivateKey("RSA", "RSA"))
.rootCa(rootCa2.getRootCertificate("RSA"))
.build();
CLIENT_2 = new TestKeyStore(createClient(rootCa2.keyStore), null, null);
} | static synchronized void function() { if (ROOT_CA != null) { return; } ROOT_CA = new Builder() .aliasPrefix(STR) .subject(STR) .ca(true) .certificateSerialNumber(BigInteger.valueOf(1)) .build(); INTERMEDIATE_CA_EC = new Builder() .aliasPrefix(STR) .keyAlgorithms("EC") .subject(STR) .ca(true) .signer(ROOT_CA.getPrivateKey("RSA", "RSA")) .rootCa(ROOT_CA.getRootCertificate("RSA")) .certificateSerialNumber(BigInteger.valueOf(2)) .build(); INTERMEDIATE_CA = new Builder() .aliasPrefix(STR) .subject(STR) .ca(true) .signer(ROOT_CA.getPrivateKey("RSA", "RSA")) .rootCa(ROOT_CA.getRootCertificate("RSA")) .certificateSerialNumber(BigInteger.valueOf(2)) .build(); SERVER = new Builder() .aliasPrefix(STR) .signer(INTERMEDIATE_CA.getPrivateKey("RSA", "RSA")) .rootCa(INTERMEDIATE_CA.getRootCertificate("RSA")) .addSubjectAltName(new GeneralName(GeneralName.dNSName, LOCAL_HOST_NAME)) .certificateSerialNumber(BigInteger.valueOf(3)) .build(); CLIENT = new TestKeyStore(createClient(INTERMEDIATE_CA.keyStore), null, null); CLIENT_EC_RSA_CERTIFICATE = new Builder() .aliasPrefix(STR) .keyAlgorithms("EC") .subject(STR) .signer(INTERMEDIATE_CA.getPrivateKey("RSA", "RSA")) .rootCa(INTERMEDIATE_CA.getRootCertificate("RSA")) .build(); CLIENT_EC_EC_CERTIFICATE = new Builder() .aliasPrefix(STR) .keyAlgorithms("EC") .subject(STR) .signer(INTERMEDIATE_CA_EC.getPrivateKey("EC", "RSA")) .rootCa(INTERMEDIATE_CA_EC.getRootCertificate("RSA")) .build(); CLIENT_CERTIFICATE = new Builder() .aliasPrefix(STR) .subject(STR) .signer(INTERMEDIATE_CA.getPrivateKey("RSA", "RSA")) .rootCa(INTERMEDIATE_CA.getRootCertificate("RSA")) .build(); TestKeyStore rootCa2 = new Builder() .aliasPrefix(STR) .subject(STR) .ca(true) .build(); INTERMEDIATE_CA_2 = new Builder() .aliasPrefix(STR) .subject(STR) .ca(true) .signer(rootCa2.getPrivateKey("RSA", "RSA")) .rootCa(rootCa2.getRootCertificate("RSA")) .build(); CLIENT_2 = new TestKeyStore(createClient(rootCa2.keyStore), null, null); } | /**
* Lazily create shared test certificates.
*/ | Lazily create shared test certificates | initCerts | {
"repo_name": "google/desugar_jdk_libs",
"path": "jdk11/src/libcore/support/src/test/java/libcore/java/security/TestKeyStore.java",
"license": "gpl-2.0",
"size": 48901
} | [
"java.math.BigInteger",
"org.bouncycastle.asn1.x509.GeneralName"
] | import java.math.BigInteger; import org.bouncycastle.asn1.x509.GeneralName; | import java.math.*; import org.bouncycastle.asn1.x509.*; | [
"java.math",
"org.bouncycastle.asn1"
] | java.math; org.bouncycastle.asn1; | 1,109,528 |
protected int expandCodeToOutputStack(int code, boolean addedUnfinishedEntry)
throws IOException {
for (int entry = code; entry >= 0; entry = prefixes[entry]) {
outputStack[--outputStackLocation] = characters[entry];
}
if (previousCode != -1 && !addedUnfinishedEntry) {
addEntry(previousCode, outputStack[outputStackLocation]);
}
previousCode = code;
return outputStackLocation;
} | int function(int code, boolean addedUnfinishedEntry) throws IOException { for (int entry = code; entry >= 0; entry = prefixes[entry]) { outputStack[--outputStackLocation] = characters[entry]; } if (previousCode != -1 && !addedUnfinishedEntry) { addEntry(previousCode, outputStack[outputStackLocation]); } previousCode = code; return outputStackLocation; } | /**
* Expands the entry with index code to the output stack and may
* create a new entry
*/ | Expands the entry with index code to the output stack and may create a new entry | expandCodeToOutputStack | {
"repo_name": "eugenegardner/tenXMEIPolisher",
"path": "src/org/apache/commons/compress/compressors/z/_internal_/InternalLZWInputStream.java",
"license": "gpl-3.0",
"size": 6366
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,020,926 |
public void open() throws SocketException {
_socket_ = _socketFactory_.createDatagramSocket();
_socket_.setSoTimeout(_timeout_);
_isOpen_ = true;
} | void function() throws SocketException { _socket_ = _socketFactory_.createDatagramSocket(); _socket_.setSoTimeout(_timeout_); _isOpen_ = true; } | /**
* Opens a DatagramSocket on the local host at the first available port.
* Also sets the timeout on the socket to the default timeout set
* by {@link #setDefaultTimeout setDefaultTimeout() }.
* <p/>
* _isOpen_ is set to true after calling this method and _socket_
* is set to the newly opened socket.
* <p/>
*
* @throws java.net.SocketException If the socket could not be opened or the
* timeout could not be set.
* *
*/ | Opens a DatagramSocket on the local host at the first available port. Also sets the timeout on the socket to the default timeout set by <code>#setDefaultTimeout setDefaultTimeout() </code>. _isOpen_ is set to true after calling this method and _socket_ is set to the newly opened socket. | open | {
"repo_name": "taomanwai/a5steak",
"path": "time/src/main/java/com/tommytao/a5steak/time/ext/net/DatagramSocketClient.java",
"license": "mit",
"size": 10504
} | [
"java.net.SocketException"
] | import java.net.SocketException; | import java.net.*; | [
"java.net"
] | java.net; | 1,244,723 |
public void addGenerateBufferListener(ActionListener listener) {
generateButton.addActionListener(listener);
} | void function(ActionListener listener) { generateButton.addActionListener(listener); } | /**
* Add a listener for generating the buffer.
*
* @param listener the ActionListener for generating the buffer
*/ | Add a listener for generating the buffer | addGenerateBufferListener | {
"repo_name": "googleinterns/wifirtt",
"path": "WifiART/src/userinterface/ArtMvcView.java",
"license": "apache-2.0",
"size": 17363
} | [
"java.awt.event.ActionListener"
] | import java.awt.event.ActionListener; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 1,004,992 |
public QName getNext(){
//when position reaches number of elements in the list..
//set the position back to mark, making it a circular linked list.
if(fPosition == fCount){
fPosition = fMark;
}
//store the position of last opened tag at particular depth
//fInt[++fDepth] = fPosition;
if(DEBUG_SKIP_ALGORITHM){
System.out.println("Element at fPosition = " + fPosition + " is " + fElements[fPosition].rawname);
}
//return fElements[fPosition++];
return fElements[fPosition];
} | QName function(){ if(fPosition == fCount){ fPosition = fMark; } if(DEBUG_SKIP_ALGORITHM){ System.out.println(STR + fPosition + STR + fElements[fPosition].rawname); } return fElements[fPosition]; } | /** Note that this function is considerably different than nextElement()
* This function just returns the previously stored elements
*/ | Note that this function is considerably different than nextElement() This function just returns the previously stored elements | getNext | {
"repo_name": "wwahmed/ews-java-api",
"path": "src/main/java/com/sun/xml/stream/XMLDocumentFragmentScannerImpl.java",
"license": "mit",
"size": 126549
} | [
"com.sun.xml.stream.xerces.xni.QName"
] | import com.sun.xml.stream.xerces.xni.QName; | import com.sun.xml.stream.xerces.xni.*; | [
"com.sun.xml"
] | com.sun.xml; | 2,131,490 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.