method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public void setRegionCachePrefetch(final TableName tableName,
final boolean enable); | void function(final TableName tableName, final boolean enable); | /**
* Enable or disable region cache prefetch for the table. It will be
* applied for the given table's all HTable instances within this
* connection. By default, the cache prefetch is enabled.
* @param tableName name of table to configure.
* @param enable Set to true to enable region cache prefetch.
*/ | Enable or disable region cache prefetch for the table. It will be applied for the given table's all HTable instances within this connection. By default, the cache prefetch is enabled | setRegionCachePrefetch | {
"repo_name": "alipayhuber/hack-hbase",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnection.java",
"license": "apache-2.0",
"size": 20468
} | [
"org.apache.hadoop.hbase.TableName"
] | import org.apache.hadoop.hbase.TableName; | import org.apache.hadoop.hbase.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,554,471 |
public void writeEntityToNBT(NBTTagCompound tagCompound)
{
super.writeEntityToNBT(tagCompound);
IBlockState iblockstate = this.getHeldBlockState();
if (iblockstate != null)
{
tagCompound.setShort("carried", (short)Block.getIdFromBlock(iblockstate.getBlock()));
tagCompound.setShort("carriedData", (short)iblockstate.getBlock().getMetaFromState(iblockstate));
}
} | void function(NBTTagCompound tagCompound) { super.writeEntityToNBT(tagCompound); IBlockState iblockstate = this.getHeldBlockState(); if (iblockstate != null) { tagCompound.setShort(STR, (short)Block.getIdFromBlock(iblockstate.getBlock())); tagCompound.setShort(STR, (short)iblockstate.getBlock().getMetaFromState(iblockstate)); } } | /**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/ | (abstract) Protected helper method to write subclass entity data to NBT | writeEntityToNBT | {
"repo_name": "aebert1/BigTransport",
"path": "build/tmp/recompileMc/sources/net/minecraft/entity/monster/EntityEnderman.java",
"license": "gpl-3.0",
"size": 23516
} | [
"net.minecraft.block.Block",
"net.minecraft.block.state.IBlockState",
"net.minecraft.nbt.NBTTagCompound"
] | import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.nbt.NBTTagCompound; | import net.minecraft.block.*; import net.minecraft.block.state.*; import net.minecraft.nbt.*; | [
"net.minecraft.block",
"net.minecraft.nbt"
] | net.minecraft.block; net.minecraft.nbt; | 274,657 |
@Test
public void testcase01() {
AttributesImpl attr = new AttributesImpl();
attr.addAttribute(CAR_URI, CAR_LOCALNAME, CAR_QNAME, CAR_TYPE, CAR_VALUE);
attr.addAttribute(JEEP_URI, JEEP_LOCALNAME, JEEP_QNAME, JEEP_TYPE,
JEEP_VALUE);
assertEquals(attr.getIndex(CAR_QNAME), 0);
assertEquals(attr.getIndex(JEEP_QNAME), 1);
} | void function() { AttributesImpl attr = new AttributesImpl(); attr.addAttribute(CAR_URI, CAR_LOCALNAME, CAR_QNAME, CAR_TYPE, CAR_VALUE); attr.addAttribute(JEEP_URI, JEEP_LOCALNAME, JEEP_QNAME, JEEP_TYPE, JEEP_VALUE); assertEquals(attr.getIndex(CAR_QNAME), 0); assertEquals(attr.getIndex(JEEP_QNAME), 1); } | /**
* Basic test for getIndex(String).
*/ | Basic test for getIndex(String) | testcase01 | {
"repo_name": "md-5/jdk10",
"path": "test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java",
"license": "gpl-2.0",
"size": 7459
} | [
"org.testng.Assert",
"org.xml.sax.helpers.AttributesImpl"
] | import org.testng.Assert; import org.xml.sax.helpers.AttributesImpl; | import org.testng.*; import org.xml.sax.helpers.*; | [
"org.testng",
"org.xml.sax"
] | org.testng; org.xml.sax; | 1,909,841 |
public AlipayObject getBizModel() {
return this.bizModel;
} | AlipayObject function() { return this.bizModel; } | /**
* <p>Getter for the field <code>bizModel</code>.</p>
*
* @return a {@link cn.felord.wepay.ali.sdk.api.AlipayObject} object.
*/ | Getter for the field <code>bizModel</code> | getBizModel | {
"repo_name": "NotFound403/WePay",
"path": "src/main/java/cn/felord/wepay/ali/sdk/api/request/AlipayEcoCplifeCommunityModifyRequest.java",
"license": "apache-2.0",
"size": 4801
} | [
"cn.felord.wepay.ali.sdk.api.AlipayObject"
] | import cn.felord.wepay.ali.sdk.api.AlipayObject; | import cn.felord.wepay.ali.sdk.api.*; | [
"cn.felord.wepay"
] | cn.felord.wepay; | 2,869,978 |
public boolean isReconfigurable() {
return getDatapoint(HmParamsetType.MASTER, HomematicConstants.DATAPOINT_NAME_CHANNEL_FUNCTION) != null;
} | boolean function() { return getDatapoint(HmParamsetType.MASTER, HomematicConstants.DATAPOINT_NAME_CHANNEL_FUNCTION) != null; } | /**
* Returns true, if the channel's datapoint set contains a
* channel function datapoint.
*/ | Returns true, if the channel's datapoint set contains a channel function datapoint | isReconfigurable | {
"repo_name": "paulianttila/openhab2",
"path": "bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/model/HmChannel.java",
"license": "epl-1.0",
"size": 6438
} | [
"org.openhab.binding.homematic.internal.misc.HomematicConstants"
] | import org.openhab.binding.homematic.internal.misc.HomematicConstants; | import org.openhab.binding.homematic.internal.misc.*; | [
"org.openhab.binding"
] | org.openhab.binding; | 1,497,495 |
EClass getFunctionTemplate(); | EClass getFunctionTemplate(); | /**
* Returns the meta object for class '{@link org.fusesource.camel.component.sap.model.rfc.FunctionTemplate <em>Function Template</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Function Template</em>'.
* @see org.fusesource.camel.component.sap.model.rfc.FunctionTemplate
* @generated
*/ | Returns the meta object for class '<code>org.fusesource.camel.component.sap.model.rfc.FunctionTemplate Function Template</code>'. | getFunctionTemplate | {
"repo_name": "janstey/fuse",
"path": "components/camel-sap/org.fusesource.camel.component.sap.model/src/org/fusesource/camel/component/sap/model/rfc/RfcPackage.java",
"license": "apache-2.0",
"size": 158488
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,714,247 |
@Override
public Filter createFilter(List<Expression> parameterList) {
OverlapsImpl filter = null;
if ((parameterList == null) || (parameterList.size() != 2)) {
filter = new OverlapsExtended();
} else {
filter = new OverlapsExtended(parameterList.get(0), parameterList.get(1));
}
return filter;
} | Filter function(List<Expression> parameterList) { OverlapsImpl filter = null; if ((parameterList == null) (parameterList.size() != 2)) { filter = new OverlapsExtended(); } else { filter = new OverlapsExtended(parameterList.get(0), parameterList.get(1)); } return filter; } | /**
* Creates the filter.
*
* @param parameterList the parameter list
* @return the filter
*/ | Creates the filter | createFilter | {
"repo_name": "robward-scisys/sldeditor",
"path": "modules/application/src/main/java/com/sldeditor/filter/v2/function/geometry/Overlaps.java",
"license": "gpl-3.0",
"size": 4398
} | [
"java.util.List",
"org.geotools.filter.spatial.OverlapsImpl",
"org.opengis.filter.Filter",
"org.opengis.filter.expression.Expression"
] | import java.util.List; import org.geotools.filter.spatial.OverlapsImpl; import org.opengis.filter.Filter; import org.opengis.filter.expression.Expression; | import java.util.*; import org.geotools.filter.spatial.*; import org.opengis.filter.*; import org.opengis.filter.expression.*; | [
"java.util",
"org.geotools.filter",
"org.opengis.filter"
] | java.util; org.geotools.filter; org.opengis.filter; | 2,390,514 |
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<AssetFilterInner> createOrUpdateWithResponse(
String resourceGroupName,
String accountName,
String assetName,
String filterName,
AssetFilterInner parameters,
Context context) {
return createOrUpdateWithResponseAsync(
resourceGroupName, accountName, assetName, filterName, parameters, context)
.block();
} | @ServiceMethod(returns = ReturnType.SINGLE) Response<AssetFilterInner> function( String resourceGroupName, String accountName, String assetName, String filterName, AssetFilterInner parameters, Context context) { return createOrUpdateWithResponseAsync( resourceGroupName, accountName, assetName, filterName, parameters, context) .block(); } | /**
* Creates or updates an Asset Filter associated with the specified Asset.
*
* @param resourceGroupName The name of the resource group within the Azure subscription.
* @param accountName The Media Services account name.
* @param assetName The Asset name.
* @param filterName The Asset Filter name.
* @param parameters The request parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an Asset Filter.
*/ | Creates or updates an Asset Filter associated with the specified Asset | createOrUpdateWithResponse | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/mediaservices/azure-resourcemanager-mediaservices/src/main/java/com/azure/resourcemanager/mediaservices/implementation/AssetFiltersClientImpl.java",
"license": "mit",
"size": 56875
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context",
"com.azure.resourcemanager.mediaservices.fluent.models.AssetFilterInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.mediaservices.fluent.models.AssetFilterInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.mediaservices.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 2,655,239 |
protected void fireTransStartedListeners() throws KettleException {
// PDI-5229 sync added
synchronized ( transListeners ) {
for ( TransListener transListener : transListeners ) {
transListener.transStarted( this );
}
}
} | void function() throws KettleException { synchronized ( transListeners ) { for ( TransListener transListener : transListeners ) { transListener.transStarted( this ); } } } | /**
* Fires the start-event listeners (if any are registered).
*
* @throws KettleException if any errors occur during notification
*/ | Fires the start-event listeners (if any are registered) | fireTransStartedListeners | {
"repo_name": "tmcsantos/pentaho-kettle",
"path": "engine/src/main/java/org/pentaho/di/trans/Trans.java",
"license": "apache-2.0",
"size": 199612
} | [
"org.pentaho.di.core.exception.KettleException"
] | import org.pentaho.di.core.exception.KettleException; | import org.pentaho.di.core.exception.*; | [
"org.pentaho.di"
] | org.pentaho.di; | 1,157,848 |
public PyParser getParser() {
return (PyParser) PyParserManager.getPyParserManager(null).getParser(this);
} | PyParser function() { return (PyParser) PyParserManager.getPyParserManager(null).getParser(this); } | /**
* Used to: request a reparse / add listener / remove listener
* @return the parser that is being used in this editor.
*/ | Used to: request a reparse / add listener / remove listener | getParser | {
"repo_name": "rgom/Pydev",
"path": "plugins/org.python.pydev/src/org/python/pydev/editor/PyEdit.java",
"license": "epl-1.0",
"size": 67141
} | [
"org.python.pydev.parser.PyParser",
"org.python.pydev.parser.PyParserManager"
] | import org.python.pydev.parser.PyParser; import org.python.pydev.parser.PyParserManager; | import org.python.pydev.parser.*; | [
"org.python.pydev"
] | org.python.pydev; | 820,725 |
protected Object getKimService(String svcName) throws Exception {
ServiceBus serviceBus = KsbApiServiceLocator.getServiceBus();
List<Endpoint> endpoints = serviceBus.getRemoteEndpoints(new QName(KimApiConstants.Namespaces.KIM_NAMESPACE_2_0, svcName));
if (endpoints.size() > 1) {
fail("Found more than one RemotedServiceHolder for " + svcName);
}
Endpoint endpoint = endpoints.get(0);
return endpoint.getService();
}
| Object function(String svcName) throws Exception { ServiceBus serviceBus = KsbApiServiceLocator.getServiceBus(); List<Endpoint> endpoints = serviceBus.getRemoteEndpoints(new QName(KimApiConstants.Namespaces.KIM_NAMESPACE_2_0, svcName)); if (endpoints.size() > 1) { fail(STR + svcName); } Endpoint endpoint = endpoints.get(0); return endpoint.getService(); } | /**
* This method tries to get a client proxy for the specified KIM service
*
* @param svcName - name of the KIM service desired
* @return the proxy object
* @throws Exception
*/ | This method tries to get a client proxy for the specified KIM service | getKimService | {
"repo_name": "ua-eas/ksd-kc5.2.1-rice2.3.6-ua",
"path": "rice-middleware/it/kim/src/test/java/org/kuali/rice/kim/test/service/GroupServiceRemoteTest.java",
"license": "apache-2.0",
"size": 2440
} | [
"java.util.List",
"javax.xml.namespace.QName",
"org.junit.Assert",
"org.kuali.rice.kim.api.KimApiConstants",
"org.kuali.rice.ksb.api.KsbApiServiceLocator",
"org.kuali.rice.ksb.api.bus.Endpoint",
"org.kuali.rice.ksb.api.bus.ServiceBus"
] | import java.util.List; import javax.xml.namespace.QName; import org.junit.Assert; import org.kuali.rice.kim.api.KimApiConstants; import org.kuali.rice.ksb.api.KsbApiServiceLocator; import org.kuali.rice.ksb.api.bus.Endpoint; import org.kuali.rice.ksb.api.bus.ServiceBus; | import java.util.*; import javax.xml.namespace.*; import org.junit.*; import org.kuali.rice.kim.api.*; import org.kuali.rice.ksb.api.*; import org.kuali.rice.ksb.api.bus.*; | [
"java.util",
"javax.xml",
"org.junit",
"org.kuali.rice"
] | java.util; javax.xml; org.junit; org.kuali.rice; | 487,853 |
protected void startThreadIfNeeded() {
// create and start thread if one doesn't exist
while (executor.get() == null || ! executor.get().isInitialized()) {
if (executor.compareAndSet(null, new ScheduledExecutor())) {
// initialize the executor that we 'won' setting
executor.get().initialize();
}
}
}
static class ScheduledExecutor {
volatile ScheduledThreadPoolExecutor executor;
private volatile boolean initialized; | void function() { while (executor.get() == null ! executor.get().isInitialized()) { if (executor.compareAndSet(null, new ScheduledExecutor())) { executor.get().initialize(); } } } static class ScheduledExecutor { volatile ScheduledThreadPoolExecutor executor; private volatile boolean initialized; | /**
* Since we allow resetting the timer (shutting down the thread) we need to lazily re-start it if it starts being used again.
* <p>
* This does the lazy initialization and start of the thread in a thread-safe manner while having little cost the rest of the time.
*/ | Since we allow resetting the timer (shutting down the thread) we need to lazily re-start it if it starts being used again. This does the lazy initialization and start of the thread in a thread-safe manner while having little cost the rest of the time | startThreadIfNeeded | {
"repo_name": "fluxcapacitor/pipeline",
"path": "predict/dashboard/hystrix-core/src/main/java/com/netflix/hystrix/util/HystrixTimer.java",
"license": "apache-2.0",
"size": 7522
} | [
"java.util.concurrent.ScheduledThreadPoolExecutor"
] | import java.util.concurrent.ScheduledThreadPoolExecutor; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 1,859,405 |
@Test
public void readWithInlineContentEmployeeNullRoomEntry() throws Exception {
EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
InputStream reqContent = createContentAsStream(EMPLOYEE_1_NULL_ROOM_XML);
// execute
XmlEntityConsumer xec = new XmlEntityConsumer();
ODataEntry entry = xec.readEntry(entitySet, reqContent, EntityProviderReadProperties.init().mergeSemantic(true).build());
// validate
assertNotNull(entry);
Map<String, Object> properties = entry.getProperties();
assertEquals("1", properties.get("EmployeeId"));
assertEquals("Walter Winter", properties.get("EmployeeName"));
ODataEntry room = (ODataEntry) properties.get("ne_Room");
assertNull(room);
} | void function() throws Exception { EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet(STR); InputStream reqContent = createContentAsStream(EMPLOYEE_1_NULL_ROOM_XML); XmlEntityConsumer xec = new XmlEntityConsumer(); ODataEntry entry = xec.readEntry(entitySet, reqContent, EntityProviderReadProperties.init().mergeSemantic(true).build()); assertNotNull(entry); Map<String, Object> properties = entry.getProperties(); assertEquals("1", properties.get(STR)); assertEquals(STR, properties.get(STR)); ODataEntry room = (ODataEntry) properties.get(STR); assertNull(room); } | /**
* Reads an employee with inlined but <code>NULL</code> room navigation property
* (which has {@link com.sap.core.odata.api.edm.EdmMultiplicity#ONE EdmMultiplicity#ONE}).
*/ | Reads an employee with inlined but <code>NULL</code> room navigation property (which has <code>com.sap.core.odata.api.edm.EdmMultiplicity#ONE EdmMultiplicity#ONE</code>) | readWithInlineContentEmployeeNullRoomEntry | {
"repo_name": "SAP/cloud-odata-java",
"path": "odata-core/src/test/java/com/sap/core/odata/core/ep/consumer/XmlEntityConsumerTest.java",
"license": "apache-2.0",
"size": 102425
} | [
"com.sap.core.odata.api.edm.EdmEntitySet",
"com.sap.core.odata.api.ep.EntityProviderReadProperties",
"com.sap.core.odata.api.ep.entry.ODataEntry",
"com.sap.core.odata.testutil.mock.MockFacade",
"java.io.InputStream",
"java.util.Map",
"org.junit.Assert"
] | import com.sap.core.odata.api.edm.EdmEntitySet; import com.sap.core.odata.api.ep.EntityProviderReadProperties; import com.sap.core.odata.api.ep.entry.ODataEntry; import com.sap.core.odata.testutil.mock.MockFacade; import java.io.InputStream; import java.util.Map; import org.junit.Assert; | import com.sap.core.odata.api.edm.*; import com.sap.core.odata.api.ep.*; import com.sap.core.odata.api.ep.entry.*; import com.sap.core.odata.testutil.mock.*; import java.io.*; import java.util.*; import org.junit.*; | [
"com.sap.core",
"java.io",
"java.util",
"org.junit"
] | com.sap.core; java.io; java.util; org.junit; | 1,647,848 |
String fileNameWithExt = extension == null ? fileName : fileName + extension;
String path = System.getenv(PATH_ENV);
String[] paths = path.split("" + File.pathSeparatorChar, 0);
List<String> directories = new ArrayList<String>();
for (String p : paths) {
directories.add(p);
}
// ensure /usr/local/bin is included for OS X
if (os == OS.MacOS) {
directories.add("/usr/local/bin");
}
// search for filename in the PATH directories
for (String directory : directories) {
File file = new File(directory, fileNameWithExt);
if (file.exists()) {
return file;
}
}
return which(fileName, os);
}
| String fileNameWithExt = extension == null ? fileName : fileName + extension; String path = System.getenv(PATH_ENV); String[] paths = path.split(STR/usr/local/bin"); } for (String directory : directories) { File file = new File(directory, fileNameWithExt); if (file.exists()) { return file; } } return which(fileName, os); } | /**
* Returns the given filename location.
*
* @param fileName
* @param os
* @param extension
* @return the given filename location
*/ | Returns the given filename location | findLocation | {
"repo_name": "webratio/typescript.java",
"path": "core/ts.core/src/ts/utils/ProcessHelper.java",
"license": "mit",
"size": 3791
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 924,725 |
private void fetchNeighborDataFromCursor(final EnumSkyBlock lightType) {
//only update if curPos was changed
if (this.isNeighborDataValid) {
return;
}
this.isNeighborDataValid = true;
for (int i = 0; i < this.neighborInfos.length; ++i) {
NeighborInfo info = this.neighborInfos[i];
final int bitIdx = i << 3;
final int nPosX = info.blockX = this.curDataX + (byte) (neighborShiftsX >> bitIdx);
final int nPosY = info.blockY = this.curDataY + (byte) (neighborShiftsY >> bitIdx);
final int nPosZ = info.blockZ = this.curDataZ + (byte) (neighborShiftsZ >> bitIdx);
final MutableBlockPos nPos = info.pos.setPos(nPosX, nPosY, nPosZ);
final ICube nCube;
final int nCubeX = blockToCube(nPosX);
final int nCubeY = blockToCube(nPosY);
final int nCubeZ = blockToCube(nPosZ);
if (nCubeX == this.curCubeIdentifierX && nCubeY == this.curCubeIdentifierY && nCubeZ == this.curCubeIdentifierZ) {
nCube = info.cube = this.curCube;
} else {
nCube = info.cube = this.getCube(nPos);
}
if (nCube != null) {
ExtendedBlockStorage nSection = nCube.getStorage();
info.light = getCachedLightFor(nCube, nSection, nPos, lightType);
info.section = nSection;
}
}
} | void function(final EnumSkyBlock lightType) { if (this.isNeighborDataValid) { return; } this.isNeighborDataValid = true; for (int i = 0; i < this.neighborInfos.length; ++i) { NeighborInfo info = this.neighborInfos[i]; final int bitIdx = i << 3; final int nPosX = info.blockX = this.curDataX + (byte) (neighborShiftsX >> bitIdx); final int nPosY = info.blockY = this.curDataY + (byte) (neighborShiftsY >> bitIdx); final int nPosZ = info.blockZ = this.curDataZ + (byte) (neighborShiftsZ >> bitIdx); final MutableBlockPos nPos = info.pos.setPos(nPosX, nPosY, nPosZ); final ICube nCube; final int nCubeX = blockToCube(nPosX); final int nCubeY = blockToCube(nPosY); final int nCubeZ = blockToCube(nPosZ); if (nCubeX == this.curCubeIdentifierX && nCubeY == this.curCubeIdentifierY && nCubeZ == this.curCubeIdentifierZ) { nCube = info.cube = this.curCube; } else { nCube = info.cube = this.getCube(nPos); } if (nCube != null) { ExtendedBlockStorage nSection = nCube.getStorage(); info.light = getCachedLightFor(nCube, nSection, nPos, lightType); info.section = nSection; } } } | /**
* Gets data for neighbors of <code>curPos</code> and saves the results into neighbor state data members. If a neighbor can't be
* accessed/doesn't exist, the corresponding entry in <code>neighborChunks</code> is <code>null</code> - others are not reset
*/ | Gets data for neighbors of <code>curPos</code> and saves the results into neighbor state data members. If a neighbor can't be accessed/doesn't exist, the corresponding entry in <code>neighborChunks</code> is <code>null</code> - others are not reset | fetchNeighborDataFromCursor | {
"repo_name": "OpenCubicChunks/CubicChunks",
"path": "src/main/java/io/github/opencubicchunks/cubicchunks/core/lighting/phosphor/PhosphorLightEngine.java",
"license": "mit",
"size": 25918
} | [
"io.github.opencubicchunks.cubicchunks.api.util.Coords",
"io.github.opencubicchunks.cubicchunks.api.world.ICube",
"net.minecraft.util.math.BlockPos",
"net.minecraft.world.EnumSkyBlock",
"net.minecraft.world.chunk.storage.ExtendedBlockStorage"
] | import io.github.opencubicchunks.cubicchunks.api.util.Coords; import io.github.opencubicchunks.cubicchunks.api.world.ICube; import net.minecraft.util.math.BlockPos; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.chunk.storage.ExtendedBlockStorage; | import io.github.opencubicchunks.cubicchunks.api.util.*; import io.github.opencubicchunks.cubicchunks.api.world.*; import net.minecraft.util.math.*; import net.minecraft.world.*; import net.minecraft.world.chunk.storage.*; | [
"io.github.opencubicchunks",
"net.minecraft.util",
"net.minecraft.world"
] | io.github.opencubicchunks; net.minecraft.util; net.minecraft.world; | 1,578,218 |
public TaxList getTaxes()throws Exception
{
String urlString = url+"/taxes"; //No I18N
String response = ZohoHTTPClient.get(urlString, getQueryMap());
TaxList taxList = settingsParser.getTaxes(response);
return taxList;
}
| TaxList function()throws Exception { String urlString = url+STR; String response = ZohoHTTPClient.get(urlString, getQueryMap()); TaxList taxList = settingsParser.getTaxes(response); return taxList; } | /**
* List of simple tax, compound tax and tax groups with pagination.
* It returns the TaxList object.
* @return Returns the TaxList object.
*/ | List of simple tax, compound tax and tax groups with pagination. It returns the TaxList object | getTaxes | {
"repo_name": "zoho/books-java-wrappers",
"path": "source/com/zoho/books/api/SettingsApi.java",
"license": "mit",
"size": 36415
} | [
"com.zoho.books.model.TaxList",
"com.zoho.books.util.ZohoHTTPClient"
] | import com.zoho.books.model.TaxList; import com.zoho.books.util.ZohoHTTPClient; | import com.zoho.books.model.*; import com.zoho.books.util.*; | [
"com.zoho.books"
] | com.zoho.books; | 566,145 |
public void setProcessOrder2UserPersistence(
ProcessOrder2UserPersistence processOrder2UserPersistence) {
this.processOrder2UserPersistence = processOrder2UserPersistence;
} | void function( ProcessOrder2UserPersistence processOrder2UserPersistence) { this.processOrder2UserPersistence = processOrder2UserPersistence; } | /**
* Sets the process order2 user persistence.
*
* @param processOrder2UserPersistence the process order2 user persistence
*/ | Sets the process order2 user persistence | setProcessOrder2UserPersistence | {
"repo_name": "openegovplatform/OEPv2",
"path": "oep-core-processmgt-portlet/docroot/WEB-INF/src/org/oep/core/processmgt/service/base/DossierStepServiceBaseImpl.java",
"license": "apache-2.0",
"size": 40827
} | [
"org.oep.core.processmgt.service.persistence.ProcessOrder2UserPersistence"
] | import org.oep.core.processmgt.service.persistence.ProcessOrder2UserPersistence; | import org.oep.core.processmgt.service.persistence.*; | [
"org.oep.core"
] | org.oep.core; | 1,825,507 |
protected boolean openJARs() {
if (started && (jarFiles.length > 0)) {
lastJarAccessed = System.currentTimeMillis();
if (jarFiles[0] == null) {
for (int i = 0; i < jarFiles.length; i++) {
try {
jarFiles[i] = new JarFile(jarRealFiles[i]);
} catch (IOException e) {
if (log.isDebugEnabled()) {
log.debug("Failed to open JAR", e);
}
return false;
}
}
}
}
return true;
} | boolean function() { if (started && (jarFiles.length > 0)) { lastJarAccessed = System.currentTimeMillis(); if (jarFiles[0] == null) { for (int i = 0; i < jarFiles.length; i++) { try { jarFiles[i] = new JarFile(jarRealFiles[i]); } catch (IOException e) { if (log.isDebugEnabled()) { log.debug(STR, e); } return false; } } } } return true; } | /**
* Used to periodically signal to the classloader to release JAR resources.
*/ | Used to periodically signal to the classloader to release JAR resources | openJARs | {
"repo_name": "plumer/codana",
"path": "tomcat_files/7.0.0/WebappClassLoader.java",
"license": "mit",
"size": 114209
} | [
"java.io.IOException",
"java.util.jar.JarFile"
] | import java.io.IOException; import java.util.jar.JarFile; | import java.io.*; import java.util.jar.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,981,782 |
private void readConfiguration() {
try {
BufferedReader br = new BufferedReader(new FileReader("config.txt"));
String line = null;
while( (line=br.readLine())!=null ) {
String[] values = line.split("=");
switch(values[0]) {
case "MASTER_NODE":
masterHostName=values[1];
break;
case "DATA_NODES":
String[] nodes = values[1].split(";");
for(String s: nodes) {
alldataNodes.add(s);
if(!s.equals(localHostName)) {
dataHostNames.add(s);
}
}
break;
case "PORT":
this.PORT = Integer.parseInt(values[1]);
break;
case "REGISTRY_PORT":
this.REGISTRY_PORT = Integer.parseInt(values[1]);
break;
case "HDFS_DIR":
this.HDFS_DIR = values[1];
break;
case "NUM_RECORDS_PER_CHUNK":
this.numRecPerChunk = Integer.parseInt(values[1]);
break;
case "REPLICATION_FACTOR" :
this.REPLICATION_FACTOR = Integer.parseInt(values[1]);
break;
case "MAXIMUM_MAPS":
this.MAXIMUM_MAPS = Integer.parseInt(values[1]);
break;
case "MAXIMUM_REDUCES":
this.MAXIMUM_REDUCES = Integer.parseInt(values[1]);
break;
}
}
br.close();
} catch (FileNotFoundException e) {
System.out.println("Could not find configuration file");
} catch (IOException e) {
System.out.println("Could not read from configuration file");
}
} | void function() { try { BufferedReader br = new BufferedReader(new FileReader(STR)); String line = null; while( (line=br.readLine())!=null ) { String[] values = line.split("="); switch(values[0]) { case STR: masterHostName=values[1]; break; case STR: String[] nodes = values[1].split(";"); for(String s: nodes) { alldataNodes.add(s); if(!s.equals(localHostName)) { dataHostNames.add(s); } } break; case "PORT": this.PORT = Integer.parseInt(values[1]); break; case STR: this.REGISTRY_PORT = Integer.parseInt(values[1]); break; case STR: this.HDFS_DIR = values[1]; break; case STR: this.numRecPerChunk = Integer.parseInt(values[1]); break; case STR : this.REPLICATION_FACTOR = Integer.parseInt(values[1]); break; case STR: this.MAXIMUM_MAPS = Integer.parseInt(values[1]); break; case STR: this.MAXIMUM_REDUCES = Integer.parseInt(values[1]); break; } } br.close(); } catch (FileNotFoundException e) { System.out.println(STR); } catch (IOException e) { System.out.println(STR); } } | /**
* readConfiguration: Read the "config.txt" configuration file and initialize fields accordingly
*/ | readConfiguration: Read the "config.txt" configuration file and initialize fields accordingly | readConfiguration | {
"repo_name": "swapnil-pimpale/Map-Reduce-Engine",
"path": "framework-src/Driver.java",
"license": "gpl-2.0",
"size": 5344
} | [
"java.io.BufferedReader",
"java.io.FileNotFoundException",
"java.io.FileReader",
"java.io.IOException"
] | import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,282,425 |
//-----------------------------------------------------------------------
@Override
public ObjectId getTimeSeriesObjectId() {
return _timeSeriesObjectId;
} | ObjectId function() { return _timeSeriesObjectId; } | /**
* Gets the object identifier of the historical time-series data points. This must be separately looked up using the master.
* @return the value of the property
*/ | Gets the object identifier of the historical time-series data points. This must be separately looked up using the master | getTimeSeriesObjectId | {
"repo_name": "McLeodMoores/starling",
"path": "projects/master/src/main/java/com/opengamma/master/historicaltimeseries/ManageableHistoricalTimeSeriesInfo.java",
"license": "apache-2.0",
"size": 24956
} | [
"com.opengamma.id.ObjectId"
] | import com.opengamma.id.ObjectId; | import com.opengamma.id.*; | [
"com.opengamma.id"
] | com.opengamma.id; | 857,370 |
public AccessibleAction getAccessibleAction()
{
return this;
} | AccessibleAction function() { return this; } | /**
* Returns the accessible action associated with this object. For buttons,
* this will be <code>this</code>.
*
* @return <code>this</code>
*/ | Returns the accessible action associated with this object. For buttons, this will be <code>this</code> | getAccessibleAction | {
"repo_name": "taciano-perez/JamVM-PH",
"path": "src/classpath/javax/swing/AbstractButton.java",
"license": "gpl-2.0",
"size": 82806
} | [
"javax.accessibility.AccessibleAction"
] | import javax.accessibility.AccessibleAction; | import javax.accessibility.*; | [
"javax.accessibility"
] | javax.accessibility; | 524,468 |
ServiceResponse<ExportJobMsg> rs;
ExportJobMsg msg;
try {
this.validateRequest(rq);
this.setContext(rq.getContext());
msg = this.resolveExportJob(rq.getRequestMessage());
if ((msg == null)) {
super.getLogger().warning("No response message defined.");
} else {
super.cleanServiceMessage(msg);
}
rs = new ServiceResponse<ExportJobMsg>(rq.getContext());
rs.setResponseMessage(msg);
return rs;
} catch (ResolveException e) {
super.getLogger().error(e);
throw e;
} catch (NabuccoException e) {
super.getLogger().error(e);
ResolveException wrappedException = new ResolveException(e);
throw wrappedException;
} catch (Exception e) {
super.getLogger().error(e);
throw new ResolveException("Error during service invocation.", e);
}
} | ServiceResponse<ExportJobMsg> rs; ExportJobMsg msg; try { this.validateRequest(rq); this.setContext(rq.getContext()); msg = this.resolveExportJob(rq.getRequestMessage()); if ((msg == null)) { super.getLogger().warning(STR); } else { super.cleanServiceMessage(msg); } rs = new ServiceResponse<ExportJobMsg>(rq.getContext()); rs.setResponseMessage(msg); return rs; } catch (ResolveException e) { super.getLogger().error(e); throw e; } catch (NabuccoException e) { super.getLogger().error(e); ResolveException wrappedException = new ResolveException(e); throw wrappedException; } catch (Exception e) { super.getLogger().error(e); throw new ResolveException(STR, e); } } | /**
* Invokes the service handler method.
*
* @param rq the ServiceRequest<ExportJobMsg>.
* @return the ServiceResponse<ExportJobMsg>.
* @throws ResolveException
*/ | Invokes the service handler method | invoke | {
"repo_name": "NABUCCO/org.nabucco.framework.exporting",
"path": "org.nabucco.framework.exporting.impl.service/src/main/gen/org/nabucco/framework/exporting/impl/service/resolve/ResolveExportJobServiceHandler.java",
"license": "epl-1.0",
"size": 3658
} | [
"org.nabucco.framework.base.facade.exception.NabuccoException",
"org.nabucco.framework.base.facade.exception.service.ResolveException",
"org.nabucco.framework.base.facade.message.ServiceResponse",
"org.nabucco.framework.exporting.facade.message.ExportJobMsg"
] | import org.nabucco.framework.base.facade.exception.NabuccoException; import org.nabucco.framework.base.facade.exception.service.ResolveException; import org.nabucco.framework.base.facade.message.ServiceResponse; import org.nabucco.framework.exporting.facade.message.ExportJobMsg; | import org.nabucco.framework.base.facade.exception.*; import org.nabucco.framework.base.facade.exception.service.*; import org.nabucco.framework.base.facade.message.*; import org.nabucco.framework.exporting.facade.message.*; | [
"org.nabucco.framework"
] | org.nabucco.framework; | 2,042,981 |
public Map getHiddenMapping() {
return hiddenMapping;
} | Map function() { return hiddenMapping; } | /**
* Returns the hiddenMapping.
*
* @return Map
*/ | Returns the hiddenMapping | getHiddenMapping | {
"repo_name": "Baltasarq/Gia",
"path": "src/JGraph/src/org/jgraph/graph/GraphLayoutCache.java",
"license": "mit",
"size": 86289
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,143,110 |
public synchronized void restartNameNode(boolean waitSafemodeExit)
throws IOException {
shutdownNameNode();
nameNode = NameNode.createNameNode(new String[] {}, conf);
if (waitSafemodeExit) {
waitClusterUp();
}
System.out.println("Restarted the namenode");
int failedCount = 0;
while (true) {
try {
waitActive();
break;
} catch (IOException e) {
failedCount++;
// Cached RPC connection to namenode, if any, is expected to fail once
if (failedCount > 1) {
System.out.println("Tried waitActive() " + failedCount
+ " time(s) and failed, giving up. "
+ StringUtils.stringifyException(e));
throw e;
}
}
}
System.out.println("Cluster is active");
} | synchronized void function(boolean waitSafemodeExit) throws IOException { shutdownNameNode(); nameNode = NameNode.createNameNode(new String[] {}, conf); if (waitSafemodeExit) { waitClusterUp(); } System.out.println(STR); int failedCount = 0; while (true) { try { waitActive(); break; } catch (IOException e) { failedCount++; if (failedCount > 1) { System.out.println(STR + failedCount + STR + StringUtils.stringifyException(e)); throw e; } } } System.out.println(STR); } | /**
* Restart namenode.
*/ | Restart namenode | restartNameNode | {
"repo_name": "Shmuma/hadoop",
"path": "src/test/org/apache/hadoop/hdfs/MiniDFSCluster.java",
"license": "apache-2.0",
"size": 38292
} | [
"java.io.IOException",
"org.apache.hadoop.hdfs.server.namenode.NameNode",
"org.apache.hadoop.util.StringUtils"
] | import java.io.IOException; import org.apache.hadoop.hdfs.server.namenode.NameNode; import org.apache.hadoop.util.StringUtils; | import java.io.*; import org.apache.hadoop.hdfs.server.namenode.*; import org.apache.hadoop.util.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,601,233 |
public TextMessageBuilder addQuickReply(String title, String payload, String imageUrl) {
if (this.quickReplies == null) {
this.quickReplies = new ArrayList<QuickReply>();
}
this.quickReplies.add(new QuickReply(title, payload, imageUrl));
return this;
} | TextMessageBuilder function(String title, String payload, String imageUrl) { if (this.quickReplies == null) { this.quickReplies = new ArrayList<QuickReply>(); } this.quickReplies.add(new QuickReply(title, payload, imageUrl)); return this; } | /**
* Adds a {@link QuickReply} to the current object.
*
* @param title
* the quick reply button label. It can't be empty.
* @param payload
* the payload sent back when the button is pressed. It can't be
* empty.
* @param imageUrl
* the image to show on the quick reply.
* @return this builder.
* @see <a href=
* "https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies"
* > Facebook's Messenger Platform Quick Replies Documentation</a>
*/ | Adds a <code>QuickReply</code> to the current object | addQuickReply | {
"repo_name": "Aurasphere/facebot",
"path": "src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/TextMessageBuilder.java",
"license": "mit",
"size": 5489
} | [
"co.aurasphere.botmill.fb.model.outcoming.quickreply.QuickReply",
"java.util.ArrayList"
] | import co.aurasphere.botmill.fb.model.outcoming.quickreply.QuickReply; import java.util.ArrayList; | import co.aurasphere.botmill.fb.model.outcoming.quickreply.*; import java.util.*; | [
"co.aurasphere.botmill",
"java.util"
] | co.aurasphere.botmill; java.util; | 1,003,158 |
@Override
public String getTopologyConf(String id) throws NotAliveException,
TException {
String rtn;
try {
Map<Object, Object> topologyConf =
StormConfig.read_nimbus_topology_conf(conf, id);
rtn = JStormUtils.to_json(topologyConf);
} catch (IOException e) {
// TODO Auto-generated catch block
LOG.info("Failed to get configuration of " + id, e);
throw new TException(e);
}
return rtn;
} | String function(String id) throws NotAliveException, TException { String rtn; try { Map<Object, Object> topologyConf = StormConfig.read_nimbus_topology_conf(conf, id); rtn = JStormUtils.to_json(topologyConf); } catch (IOException e) { LOG.info(STR + id, e); throw new TException(e); } return rtn; } | /**
* get topology configuration
*
* @param id String: topology id
* @return String
*/ | get topology configuration | getTopologyConf | {
"repo_name": "edwardchor/jstorm",
"path": "jstorm-core/src/main/java/com/alibaba/jstorm/daemon/nimbus/ServiceHandler.java",
"license": "apache-2.0",
"size": 56644
} | [
"com.alibaba.jstorm.cluster.StormConfig",
"com.alibaba.jstorm.utils.JStormUtils",
"java.io.IOException",
"java.util.Map",
"org.apache.thrift.TException"
] | import com.alibaba.jstorm.cluster.StormConfig; import com.alibaba.jstorm.utils.JStormUtils; import java.io.IOException; import java.util.Map; import org.apache.thrift.TException; | import com.alibaba.jstorm.cluster.*; import com.alibaba.jstorm.utils.*; import java.io.*; import java.util.*; import org.apache.thrift.*; | [
"com.alibaba.jstorm",
"java.io",
"java.util",
"org.apache.thrift"
] | com.alibaba.jstorm; java.io; java.util; org.apache.thrift; | 1,615,261 |
public boolean is3gEnabled() {
if (((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE))
.getNetworkType() >= TelephonyManager.NETWORK_TYPE_UMTS) {
return true;
}
return false;
} | boolean function() { if (((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE)) .getNetworkType() >= TelephonyManager.NETWORK_TYPE_UMTS) { return true; } return false; } | /**
* Checks if the device is currently using a 3G network connection.
*
* @return boolean Returns true if device is using a 3G network connection,
* otherwise it returns false.
*/ | Checks if the device is currently using a 3G network connection | is3gEnabled | {
"repo_name": "saurabh2590/EasyAccess",
"path": "src/org/easyaccess/status/StatusApp.java",
"license": "apache-2.0",
"size": 37410
} | [
"android.content.Context",
"android.telephony.TelephonyManager"
] | import android.content.Context; import android.telephony.TelephonyManager; | import android.content.*; import android.telephony.*; | [
"android.content",
"android.telephony"
] | android.content; android.telephony; | 1,581,856 |
private synchronized void mapOutputLost(String failure
) throws IOException {
if (taskStatus.getRunState() == TaskStatus.State.COMMIT_PENDING ||
taskStatus.getRunState() == TaskStatus.State.SUCCEEDED) {
// change status to failure
LOG.info("Reporting output lost:"+task.getTaskID());
taskStatus.setRunState(TaskStatus.State.FAILED);
taskStatus.setProgress(0.0f);
reportDiagnosticInfo("Map output lost, rescheduling: " +
failure);
runningTasks.put(task.getTaskID(), this);
mapTotal++;
} else {
LOG.warn("Output already reported lost:"+task.getTaskID());
}
} | synchronized void function(String failure ) throws IOException { if (taskStatus.getRunState() == TaskStatus.State.COMMIT_PENDING taskStatus.getRunState() == TaskStatus.State.SUCCEEDED) { LOG.info(STR+task.getTaskID()); taskStatus.setRunState(TaskStatus.State.FAILED); taskStatus.setProgress(0.0f); reportDiagnosticInfo(STR + failure); runningTasks.put(task.getTaskID(), this); mapTotal++; } else { LOG.warn(STR+task.getTaskID()); } } | /**
* The map output has been lost.
*/ | The map output has been lost | mapOutputLost | {
"repo_name": "ryanobjc/hadoop-cloudera",
"path": "src/mapred/org/apache/hadoop/mapred/TaskTracker.java",
"license": "apache-2.0",
"size": 113404
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,935,989 |
protected void addTotalDigitsPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_NumericType_totalDigits_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_NumericType_totalDigits_feature", "_UI_NumericType_type"),
OCCIPackage.Literals.NUMERIC_TYPE__TOTAL_DIGITS,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
} | void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), OCCIPackage.Literals.NUMERIC_TYPE__TOTAL_DIGITS, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } | /**
* This adds a property descriptor for the Total Digits feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds a property descriptor for the Total Digits feature. | addTotalDigitsPropertyDescriptor | {
"repo_name": "occiware/OCCI-Studio",
"path": "plugins/org.eclipse.cmf.occi.core.edit/src-gen/org/eclipse/cmf/occi/core/provider/NumericTypeItemProvider.java",
"license": "epl-1.0",
"size": 8160
} | [
"org.eclipse.cmf.occi.core.OCCIPackage",
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor"
] | import org.eclipse.cmf.occi.core.OCCIPackage; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; | import org.eclipse.cmf.occi.core.*; import org.eclipse.emf.edit.provider.*; | [
"org.eclipse.cmf",
"org.eclipse.emf"
] | org.eclipse.cmf; org.eclipse.emf; | 1,275,519 |
protected static ResourceInformation newDefaultInformation(String name,
String unit, long value) {
ResourceInformation ri = new ResourceInformation();
ri.setName(name);
ri.setValue(value);
ri.setResourceType(ResourceTypes.COUNTABLE);
ri.setUnitsWithoutValidation(unit);
ri.setMinimumAllocation(0);
ri.setMaximumAllocation(Long.MAX_VALUE);
return ri;
} | static ResourceInformation function(String name, String unit, long value) { ResourceInformation ri = new ResourceInformation(); ri.setName(name); ri.setValue(value); ri.setResourceType(ResourceTypes.COUNTABLE); ri.setUnitsWithoutValidation(unit); ri.setMinimumAllocation(0); ri.setMaximumAllocation(Long.MAX_VALUE); return ri; } | /**
* Create ResourceInformation with basic fields.
* @param name Resource Type Name
* @param unit Default unit of provided resource type
* @param value Value associated with giveb resource
* @return ResourceInformation object
*/ | Create ResourceInformation with basic fields | newDefaultInformation | {
"repo_name": "plusplusjiajia/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java",
"license": "apache-2.0",
"size": 17202
} | [
"org.apache.hadoop.yarn.api.protocolrecords.ResourceTypes"
] | import org.apache.hadoop.yarn.api.protocolrecords.ResourceTypes; | import org.apache.hadoop.yarn.api.protocolrecords.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 526,716 |
static String lookUpFactoryClassName(String factoryId,
String propertiesFilename,
String fallbackClassName)
{
SecuritySupport ss = SecuritySupport.getInstance();
// Use the system property first
try {
String systemProp = ss.getSystemProperty(factoryId);
if (systemProp != null) {
debugPrintln("found system property, value=" + systemProp);
return systemProp;
}
} catch (SecurityException se) {
// Ignore and continue w/ next location
}
// Try to read from propertiesFilename, or
// $java.home/lib/xalan.properties
String factoryClassName = null;
// no properties file name specified; use
// $JAVA_HOME/lib/xalan.properties:
if (propertiesFilename == null) {
File propertiesFile = null;
boolean propertiesFileExists = false;
try {
String javah = ss.getSystemProperty("java.home");
propertiesFilename = javah + File.separator +
"lib" + File.separator + DEFAULT_PROPERTIES_FILENAME;
propertiesFile = new File(propertiesFilename);
propertiesFileExists = ss.getFileExists(propertiesFile);
} catch (SecurityException e) {
// try again...
fLastModified = -1;
fXalanProperties = null;
}
synchronized (ObjectFactory.class) {
boolean loadProperties = false;
FileInputStream fis = null;
try {
// file existed last time
if(fLastModified >= 0) {
if(propertiesFileExists &&
(fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) {
loadProperties = true;
} else {
// file has stopped existing...
if(!propertiesFileExists) {
fLastModified = -1;
fXalanProperties = null;
} // else, file wasn't modified!
}
} else {
// file has started to exist:
if(propertiesFileExists) {
loadProperties = true;
fLastModified = ss.getLastModified(propertiesFile);
} // else, nothing's changed
}
if(loadProperties) {
// must never have attempted to read xalan.properties
// before (or it's outdeated)
fXalanProperties = new Properties();
fis = ss.getFileInputStream(propertiesFile);
fXalanProperties.load(fis);
}
} catch (Exception x) {
fXalanProperties = null;
fLastModified = -1;
// assert(x instanceof FileNotFoundException
// || x instanceof SecurityException)
// In both cases, ignore and continue w/ next location
}
finally {
// try to close the input stream if one was opened.
if (fis != null) {
try {
fis.close();
}
// Ignore the exception.
catch (IOException exc) {}
}
}
}
if(fXalanProperties != null) {
factoryClassName = fXalanProperties.getProperty(factoryId);
}
} else {
FileInputStream fis = null;
try {
fis = ss.getFileInputStream(new File(propertiesFilename));
Properties props = new Properties();
props.load(fis);
factoryClassName = props.getProperty(factoryId);
} catch (Exception x) {
// assert(x instanceof FileNotFoundException
// || x instanceof SecurityException)
// In both cases, ignore and continue w/ next location
}
finally {
// try to close the input stream if one was opened.
if (fis != null) {
try {
fis.close();
}
// Ignore the exception.
catch (IOException exc) {}
}
}
}
if (factoryClassName != null) {
debugPrintln("found in " + propertiesFilename + ", value="
+ factoryClassName);
return factoryClassName;
}
// Try Jar Service Provider Mechanism
return findJarServiceProviderName(factoryId);
} // lookUpFactoryClass(String,String):String
//
// Private static methods
//
| static String lookUpFactoryClassName(String factoryId, String propertiesFilename, String fallbackClassName) { SecuritySupport ss = SecuritySupport.getInstance(); try { String systemProp = ss.getSystemProperty(factoryId); if (systemProp != null) { debugPrintln(STR + systemProp); return systemProp; } } catch (SecurityException se) { } String factoryClassName = null; if (propertiesFilename == null) { File propertiesFile = null; boolean propertiesFileExists = false; try { String javah = ss.getSystemProperty(STR); propertiesFilename = javah + File.separator + "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME; propertiesFile = new File(propertiesFilename); propertiesFileExists = ss.getFileExists(propertiesFile); } catch (SecurityException e) { fLastModified = -1; fXalanProperties = null; } synchronized (ObjectFactory.class) { boolean loadProperties = false; FileInputStream fis = null; try { if(fLastModified >= 0) { if(propertiesFileExists && (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) { loadProperties = true; } else { if(!propertiesFileExists) { fLastModified = -1; fXalanProperties = null; } } } else { if(propertiesFileExists) { loadProperties = true; fLastModified = ss.getLastModified(propertiesFile); } } if(loadProperties) { fXalanProperties = new Properties(); fis = ss.getFileInputStream(propertiesFile); fXalanProperties.load(fis); } } catch (Exception x) { fXalanProperties = null; fLastModified = -1; } finally { if (fis != null) { try { fis.close(); } catch (IOException exc) {} } } } if(fXalanProperties != null) { factoryClassName = fXalanProperties.getProperty(factoryId); } } else { FileInputStream fis = null; try { fis = ss.getFileInputStream(new File(propertiesFilename)); Properties props = new Properties(); props.load(fis); factoryClassName = props.getProperty(factoryId); } catch (Exception x) { } finally { if (fis != null) { try { fis.close(); } catch (IOException exc) {} } } } if (factoryClassName != null) { debugPrintln(STR + propertiesFilename + STR + factoryClassName); return factoryClassName; } return findJarServiceProviderName(factoryId); } | /**
* Finds the name of the required implementation class in the specified
* order. The specified order is the following:
* <ol>
* <li>query the system property using <code>System.getProperty</code>
* <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
* <li>read <code>META-INF/services/<i>factoryId</i></code> file
* <li>use fallback classname
* </ol>
*
* @return name of class that provides factory service, never null
*
* @param factoryId Name of the factory to find, same as
* a property name
* @param propertiesFilename The filename in the $java.home/lib directory
* of the properties file. If none specified,
* ${java.home}/lib/xalan.properties will be used.
* @param fallbackClassName Implementation class name, if nothing else
* is found. Use null to mean no fallback.
*
* @exception ObjectFactory.ConfigurationError
*/ | Finds the name of the required implementation class in the specified order. The specified order is the following: query the system property using <code>System.getProperty</code> read <code>$java.home/lib/propertiesFilename</code> file read <code>META-INF/services/factoryId</code> file use fallback classname | lookUpFactoryClassName | {
"repo_name": "kcsl/immutability-benchmark",
"path": "benchmark-applications/reiminfer-oopsla-2012/source/Xalan/src/org/apache/xpath/functions/ObjectFactory.java",
"license": "mit",
"size": 26613
} | [
"java.io.File",
"java.io.FileInputStream",
"java.io.IOException",
"java.util.Properties"
] | import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,908,000 |
public static List<File> traverseFolder(File dirOrFile, DirOrFileExtFilter dirOFileExtFilter) {
ArrayList<File> result = new ArrayList<File>();
if (dirOrFile.isDirectory()) {
File allFiles[] = dirOrFile.listFiles(dirOFileExtFilter);
for (File innerFile : allFiles) {
result.addAll(traverseFolder(innerFile, dirOFileExtFilter));
}
} else if (dirOrFile.isFile()) {
// Only files are added to the results list
result.add(dirOrFile);
}
return result;
}
| static List<File> function(File dirOrFile, DirOrFileExtFilter dirOFileExtFilter) { ArrayList<File> result = new ArrayList<File>(); if (dirOrFile.isDirectory()) { File allFiles[] = dirOrFile.listFiles(dirOFileExtFilter); for (File innerFile : allFiles) { result.addAll(traverseFolder(innerFile, dirOFileExtFilter)); } } else if (dirOrFile.isFile()) { result.add(dirOrFile); } return result; } | /**
* This method recursively traverse a folder and all its descendants, applying to them a FileExtFilter.
* DirOrFileExtFilter was used, to don't filter out the folders, when traversing them. But in the end, only files
* will be returned
*
* @param dirOrFile
* - file or directory that will be traversed and analyzed
* @param dirOFileExtFilter
* - filter that will pass-through all folders and files only with requested extension
* @return a list of files with requested extension
*
* @author Maksym "elmuSSo" Kondej
*/ | This method recursively traverse a folder and all its descendants, applying to them a FileExtFilter. DirOrFileExtFilter was used, to don't filter out the folders, when traversing them. But in the end, only files will be returned | traverseFolder | {
"repo_name": "bh4017/mobac",
"path": "src/main/java/mobac/utilities/Utilities.java",
"license": "gpl-2.0",
"size": 24644
} | [
"java.io.File",
"java.util.ArrayList",
"java.util.List"
] | import java.io.File; import java.util.ArrayList; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,325,131 |
return new DeviceManagementConfiguration();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link DeviceManagementConfiguration }{@code >}} | return new DeviceManagementConfiguration(); } /** * Create an instance of {@link JAXBElement }{@code <}{@link DeviceManagementConfiguration }{@code >}} | /**
* Create an instance of {@link DeviceManagementConfiguration }
*/ | Create an instance of <code>DeviceManagementConfiguration </code> | createDeviceCloudConfig | {
"repo_name": "NuwanSameera/carbon-device-mgt-plugins",
"path": "components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot/src/main/java/org/wso2/carbon/device/mgt/iot/config/server/datasource/ObjectFactory.java",
"license": "apache-2.0",
"size": 2649
} | [
"javax.xml.bind.JAXBElement"
] | import javax.xml.bind.JAXBElement; | import javax.xml.bind.*; | [
"javax.xml"
] | javax.xml; | 1,799,305 |
@Test
public void whenIterateArrayWithEmptyFirstRowThenGetAllElements() {
TwoDimensionArray array = new TwoDimensionArray(new int[][]{{}, {1, 2}, {3, 4}});
Iterator<Integer> it = array.iterator();
int[] result = new int[]{it.next(), it.next(), it.next(), it.next()};
int[] expected = new int[]{1, 2, 3, 4};
assertThat(result, is(expected));
} | void function() { TwoDimensionArray array = new TwoDimensionArray(new int[][]{{}, {1, 2}, {3, 4}}); Iterator<Integer> it = array.iterator(); int[] result = new int[]{it.next(), it.next(), it.next(), it.next()}; int[] expected = new int[]{1, 2, 3, 4}; assertThat(result, is(expected)); } | /**
* Test 2D array of ints with empty first row.
*/ | Test 2D array of ints with empty first row | whenIterateArrayWithEmptyFirstRowThenGetAllElements | {
"repo_name": "dimir2/vivanov",
"path": "part2/ch1/src/test/java/ru/job4j/pro/collections/iterator/TwoDimensionArrayTest.java",
"license": "apache-2.0",
"size": 6439
} | [
"java.util.Iterator",
"org.hamcrest.core.Is",
"org.junit.Assert"
] | import java.util.Iterator; import org.hamcrest.core.Is; import org.junit.Assert; | import java.util.*; import org.hamcrest.core.*; import org.junit.*; | [
"java.util",
"org.hamcrest.core",
"org.junit"
] | java.util; org.hamcrest.core; org.junit; | 410,232 |
public void selectFile(File file) {
try {
FileTreeNode ftn = (FileTreeNode) directory.getModel().getRoot();
ftn = ftn.searchFor(file);
TreePath tp = ftn.getPath();
directory.setSelectionPath(tp);
directory.scrollPathToVisible(tp);
if (file.isDirectory()) {
directory.expandPath(tp);
}
}
catch (NullPointerException e) {
}
} | void function(File file) { try { FileTreeNode ftn = (FileTreeNode) directory.getModel().getRoot(); ftn = ftn.searchFor(file); TreePath tp = ftn.getPath(); directory.setSelectionPath(tp); directory.scrollPathToVisible(tp); if (file.isDirectory()) { directory.expandPath(tp); } } catch (NullPointerException e) { } } | /**
* Programmatically select a file
*
* @param file
* the file to display
*/ | Programmatically select a file | selectFile | {
"repo_name": "onyxbits/FileCast",
"path": "src/main/java/de/onyxbits/filecast/gui/MainWindow.java",
"license": "apache-2.0",
"size": 6185
} | [
"java.io.File",
"javax.swing.tree.TreePath"
] | import java.io.File; import javax.swing.tree.TreePath; | import java.io.*; import javax.swing.tree.*; | [
"java.io",
"javax.swing"
] | java.io; javax.swing; | 2,801,503 |
void broadcastEvent(Event event)
{
Intent intent = new Intent();
intent.setAction(EVENT_RECEIVED);
intent.putExtra(EXTRA_EVENT, event);
BackendService.this.sendBroadcast(intent);
}
} | void broadcastEvent(Event event) { Intent intent = new Intent(); intent.setAction(EVENT_RECEIVED); intent.putExtra(EXTRA_EVENT, event); BackendService.this.sendBroadcast(intent); } } | /**
* Broadcast the specified event
*/ | Broadcast the specified event | broadcastEvent | {
"repo_name": "HueToYou/ChatExchange",
"path": "app/src/main/java/com/huetoyou/chatexchange/backend/BackendService.java",
"license": "mit",
"size": 5054
} | [
"android.content.Intent"
] | import android.content.Intent; | import android.content.*; | [
"android.content"
] | android.content; | 2,138,364 |
public void testRestoreThrottle() {
boolean shardStateHasAllocationId = randomBoolean();
String allocationId = shardStateHasAllocationId ? "some allocId" : null;
long legacyVersion = shardStateHasAllocationId ? ShardStateMetaData.NO_VERSION : 1;
boolean clusterHasActiveAllocationIds = shardStateHasAllocationId ? randomBoolean() : false;
RoutingAllocation allocation = getRestoreRoutingAllocation(throttleAllocationDeciders(), clusterHasActiveAllocationIds);
testAllocator.addData(node1, legacyVersion, allocationId, randomBoolean());
testAllocator.allocateUnassigned(allocation);
assertThat(allocation.routingNodesChanged(), equalTo(true));
assertThat(allocation.routingNodes().unassigned().ignored().isEmpty(), equalTo(false));
assertClusterHealthStatus(allocation, ClusterHealthStatus.YELLOW);
} | void function() { boolean shardStateHasAllocationId = randomBoolean(); String allocationId = shardStateHasAllocationId ? STR : null; long legacyVersion = shardStateHasAllocationId ? ShardStateMetaData.NO_VERSION : 1; boolean clusterHasActiveAllocationIds = shardStateHasAllocationId ? randomBoolean() : false; RoutingAllocation allocation = getRestoreRoutingAllocation(throttleAllocationDeciders(), clusterHasActiveAllocationIds); testAllocator.addData(node1, legacyVersion, allocationId, randomBoolean()); testAllocator.allocateUnassigned(allocation); assertThat(allocation.routingNodesChanged(), equalTo(true)); assertThat(allocation.routingNodes().unassigned().ignored().isEmpty(), equalTo(false)); assertClusterHealthStatus(allocation, ClusterHealthStatus.YELLOW); } | /**
* Tests that when restoring from a snapshot and we find a node with a shard copy and allocation
* deciders say throttle, we add it to ignored shards.
*/ | Tests that when restoring from a snapshot and we find a node with a shard copy and allocation deciders say throttle, we add it to ignored shards | testRestoreThrottle | {
"repo_name": "gmarz/elasticsearch",
"path": "core/src/test/java/org/elasticsearch/gateway/PrimaryShardAllocatorTests.java",
"license": "apache-2.0",
"size": 45105
} | [
"org.elasticsearch.cluster.health.ClusterHealthStatus",
"org.elasticsearch.cluster.routing.allocation.RoutingAllocation",
"org.elasticsearch.index.shard.ShardStateMetaData",
"org.hamcrest.Matchers"
] | import org.elasticsearch.cluster.health.ClusterHealthStatus; import org.elasticsearch.cluster.routing.allocation.RoutingAllocation; import org.elasticsearch.index.shard.ShardStateMetaData; import org.hamcrest.Matchers; | import org.elasticsearch.cluster.health.*; import org.elasticsearch.cluster.routing.allocation.*; import org.elasticsearch.index.shard.*; import org.hamcrest.*; | [
"org.elasticsearch.cluster",
"org.elasticsearch.index",
"org.hamcrest"
] | org.elasticsearch.cluster; org.elasticsearch.index; org.hamcrest; | 1,669,838 |
public DefaultMutableTreeNode getModelInstanceNode(BiochamModel m){
int nmb=BiochamDynamicTree.openedModels.size();
for(int i=0;i<nmb;i++){
if(BiochamDynamicTree.openedModels.get(i).getModelNodeIndex()==m.getModelNodeIndex()){
return (DefaultMutableTreeNode)BiochamDynamicTree.openedNodes.get(i);
}
}
return null;
} | DefaultMutableTreeNode function(BiochamModel m){ int nmb=BiochamDynamicTree.openedModels.size(); for(int i=0;i<nmb;i++){ if(BiochamDynamicTree.openedModels.get(i).getModelNodeIndex()==m.getModelNodeIndex()){ return (DefaultMutableTreeNode)BiochamDynamicTree.openedNodes.get(i); } } return null; } | /**
* Gets a handle of the model depending of the currently selected node in the main explorer tree.
*
*/ | Gets a handle of the model depending of the currently selected node in the main explorer tree | getModelInstanceNode | {
"repo_name": "Thomashuet/Biocham",
"path": "gui/BiochamDynamicTreeActionListener.java",
"license": "gpl-2.0",
"size": 59681
} | [
"javax.swing.tree.DefaultMutableTreeNode"
] | import javax.swing.tree.DefaultMutableTreeNode; | import javax.swing.tree.*; | [
"javax.swing"
] | javax.swing; | 1,032,501 |
@Test
public void testReadingSchemalessIgniteBinaries() throws Exception {
int key = 1;
Person val = new Person(key, "Joe");
try (Ignite srv = Ignition.start(Config.getServerConfiguration())) {
// Add an entry directly to the Ignite server. This stores a schema-less object in the cache and
// does not register schema in the client's metadata cache.
srv.cache(Config.DEFAULT_CACHE_NAME).put(key, val);
try (IgniteClient client = Ignition.startClient(new ClientConfiguration().setAddresses(Config.SERVER))) {
ClientCache<Integer, BinaryObject> cache = client.cache(Config.DEFAULT_CACHE_NAME).withKeepBinary();
BinaryObject cachedVal = cache.get(key);
assertEquals(val.getId(), cachedVal.field("id"));
assertEquals(val.getName(), cachedVal.field("name"));
}
}
} | void function() throws Exception { int key = 1; Person val = new Person(key, "Joe"); try (Ignite srv = Ignition.start(Config.getServerConfiguration())) { srv.cache(Config.DEFAULT_CACHE_NAME).put(key, val); try (IgniteClient client = Ignition.startClient(new ClientConfiguration().setAddresses(Config.SERVER))) { ClientCache<Integer, BinaryObject> cache = client.cache(Config.DEFAULT_CACHE_NAME).withKeepBinary(); BinaryObject cachedVal = cache.get(key); assertEquals(val.getId(), cachedVal.field("id")); assertEquals(val.getName(), cachedVal.field("name")); } } } | /**
* Reading schema-less Ignite Binary object.
*/ | Reading schema-less Ignite Binary object | testReadingSchemalessIgniteBinaries | {
"repo_name": "irudyak/ignite",
"path": "modules/core/src/test/java/org/apache/ignite/client/IgniteBinaryTest.java",
"license": "apache-2.0",
"size": 8569
} | [
"org.apache.ignite.Ignite",
"org.apache.ignite.Ignition",
"org.apache.ignite.binary.BinaryObject",
"org.apache.ignite.client.ClientCache",
"org.apache.ignite.client.Config",
"org.apache.ignite.client.IgniteClient",
"org.apache.ignite.client.Person",
"org.apache.ignite.configuration.ClientConfiguration",
"org.junit.Assert"
] | import org.apache.ignite.Ignite; import org.apache.ignite.Ignition; import org.apache.ignite.binary.BinaryObject; import org.apache.ignite.client.ClientCache; import org.apache.ignite.client.Config; import org.apache.ignite.client.IgniteClient; import org.apache.ignite.client.Person; import org.apache.ignite.configuration.ClientConfiguration; import org.junit.Assert; | import org.apache.ignite.*; import org.apache.ignite.binary.*; import org.apache.ignite.client.*; import org.apache.ignite.configuration.*; import org.junit.*; | [
"org.apache.ignite",
"org.junit"
] | org.apache.ignite; org.junit; | 2,431,479 |
protected boolean haveBoardFreighter(EbRegistration p_registration)
{
if( p_registration.getColor() == EnuColor.None )
{
return false;
}
if( !getAllowedTakeOffTurns().isEmpty()
&& getCurrentTimeStep() < getAllowedTakeOffTurns().get( 0 ) )
{
return true;
}
for( EbToken token : getSetToken() )
{
if( (token.getType() == TokenType.Freighter)
&& (p_registration.getEnuColor().isColored( token.getColor() ))
&& ((token.getLocation() == Location.Board) || (token.getLocation() == Location.Orbit)) )
{
return true;
}
}
return false;
}
| boolean function(EbRegistration p_registration) { if( p_registration.getColor() == EnuColor.None ) { return false; } if( !getAllowedTakeOffTurns().isEmpty() && getCurrentTimeStep() < getAllowedTakeOffTurns().get( 0 ) ) { return true; } for( EbToken token : getSetToken() ) { if( (token.getType() == TokenType.Freighter) && (p_registration.getEnuColor().isColored( token.getColor() )) && ((token.getLocation() == Location.Board) (token.getLocation() == Location.Orbit)) ) { return true; } } return false; } | /**
* count the number of freighter remaining on board this player control
* @param p_registration
* @return true if player have at least one freighter on board or in orbit
*/ | count the number of freighter remaining on board this player control | haveBoardFreighter | {
"repo_name": "kroc702/fullmetalgalaxy",
"path": "src/com/fullmetalgalaxy/model/persist/Game.java",
"license": "agpl-3.0",
"size": 47066
} | [
"com.fullmetalgalaxy.model.EnuColor",
"com.fullmetalgalaxy.model.Location",
"com.fullmetalgalaxy.model.TokenType"
] | import com.fullmetalgalaxy.model.EnuColor; import com.fullmetalgalaxy.model.Location; import com.fullmetalgalaxy.model.TokenType; | import com.fullmetalgalaxy.model.*; | [
"com.fullmetalgalaxy.model"
] | com.fullmetalgalaxy.model; | 2,432,573 |
public void setSchemaManager( SchemaManager schemaManager )
{
this.schemaManager = schemaManager;
} | void function( SchemaManager schemaManager ) { this.schemaManager = schemaManager; } | /**
* Set the SchemaManager instance.
*
* @param schemaManager The server schemaManager
*/ | Set the SchemaManager instance | setSchemaManager | {
"repo_name": "darranl/directory-server",
"path": "core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java",
"license": "apache-2.0",
"size": 73548
} | [
"org.apache.directory.api.ldap.model.schema.SchemaManager"
] | import org.apache.directory.api.ldap.model.schema.SchemaManager; | import org.apache.directory.api.ldap.model.schema.*; | [
"org.apache.directory"
] | org.apache.directory; | 1,664,204 |
public NamedNativeQuery<EntityMappings<T>> createNamedNativeQuery()
{
return new NamedNativeQueryImpl<EntityMappings<T>>(this, "named-native-query", childNode);
} | NamedNativeQuery<EntityMappings<T>> function() { return new NamedNativeQueryImpl<EntityMappings<T>>(this, STR, childNode); } | /**
* Creates a new <code>named-native-query</code> element
* @return the new created instance of <code>NamedNativeQuery<EntityMappings<T>></code>
*/ | Creates a new <code>named-native-query</code> element | createNamedNativeQuery | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/orm20/EntityMappingsImpl.java",
"license": "epl-1.0",
"size": 29628
} | [
"org.jboss.shrinkwrap.descriptor.api.orm20.EntityMappings",
"org.jboss.shrinkwrap.descriptor.api.orm20.NamedNativeQuery"
] | import org.jboss.shrinkwrap.descriptor.api.orm20.EntityMappings; import org.jboss.shrinkwrap.descriptor.api.orm20.NamedNativeQuery; | import org.jboss.shrinkwrap.descriptor.api.orm20.*; | [
"org.jboss.shrinkwrap"
] | org.jboss.shrinkwrap; | 390,315 |
Locale createOverlay(Locale locale) {
String lang = locale.getLanguage();
String country = (locale.getCountry() == null ? "" : locale.getCountry());
String variant = createOverlayKeyForLanguage(locale.getVariant() == null ? "" : locale.getVariant());
Locale overlay = new Locale(lang, country, variant);
return overlay;
} | Locale createOverlay(Locale locale) { String lang = locale.getLanguage(); String country = (locale.getCountry() == null ? STR" : locale.getVariant()); Locale overlay = new Locale(lang, country, variant); return overlay; } | /**
* Create a local that represents the overlay locale for the given locale
*
* @param locale The original locale
* @return The overlay locale
*/ | Create a local that represents the overlay locale for the given locale | createOverlay | {
"repo_name": "RLDevOps/Demo",
"path": "src/main/java/org/olat/core/util/i18n/I18nManager.java",
"license": "apache-2.0",
"size": 82947
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 1,884,557 |
private byte[] generateUserSpecifiedHash(StreamNode node, Hasher hasher) {
hasher.putString(node.getTransformationUID(), Charset.forName("UTF-8"));
return hasher.hash().asBytes();
} | byte[] function(StreamNode node, Hasher hasher) { hasher.putString(node.getTransformationUID(), Charset.forName("UTF-8")); return hasher.hash().asBytes(); } | /**
* Generates a hash from a user-specified ID.
*/ | Generates a hash from a user-specified ID | generateUserSpecifiedHash | {
"repo_name": "WangTaoTheTonic/flink",
"path": "flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphHasherV2.java",
"license": "apache-2.0",
"size": 10798
} | [
"com.google.common.hash.Hasher",
"java.nio.charset.Charset"
] | import com.google.common.hash.Hasher; import java.nio.charset.Charset; | import com.google.common.hash.*; import java.nio.charset.*; | [
"com.google.common",
"java.nio"
] | com.google.common; java.nio; | 1,566,296 |
EdgeExplorer createEdgeExplorer(EdgeFilter filter); | EdgeExplorer createEdgeExplorer(EdgeFilter filter); | /**
* Returns an EdgeExplorer which makes it possible to traverse all filtered edges of a specific
* node. Calling this method might be expensive, so e.g. create an explorer before a for loop!
*/ | Returns an EdgeExplorer which makes it possible to traverse all filtered edges of a specific node. Calling this method might be expensive, so e.g. create an explorer before a for loop | createEdgeExplorer | {
"repo_name": "graphhopper/graphhopper",
"path": "core/src/main/java/com/graphhopper/storage/Graph.java",
"license": "apache-2.0",
"size": 4335
} | [
"com.graphhopper.routing.util.EdgeFilter",
"com.graphhopper.util.EdgeExplorer"
] | import com.graphhopper.routing.util.EdgeFilter; import com.graphhopper.util.EdgeExplorer; | import com.graphhopper.routing.util.*; import com.graphhopper.util.*; | [
"com.graphhopper.routing",
"com.graphhopper.util"
] | com.graphhopper.routing; com.graphhopper.util; | 1,532,212 |
private IndexRoutingTable randomChangeToIndexRoutingTable(IndexRoutingTable original, String[] nodes) {
IndexRoutingTable.Builder builder = IndexRoutingTable.builder(original.getIndex());
for (ObjectCursor<IndexShardRoutingTable> indexShardRoutingTable : original.shards().values()) {
for (ShardRouting shardRouting : indexShardRoutingTable.value.shards()) {
final ShardRouting newShardRouting = new ShardRouting(shardRouting);
randomChange(newShardRouting, nodes);
builder.addShard(indexShardRoutingTable.value, newShardRouting);
}
}
return builder.build();
} | IndexRoutingTable function(IndexRoutingTable original, String[] nodes) { IndexRoutingTable.Builder builder = IndexRoutingTable.builder(original.getIndex()); for (ObjectCursor<IndexShardRoutingTable> indexShardRoutingTable : original.shards().values()) { for (ShardRouting shardRouting : indexShardRoutingTable.value.shards()) { final ShardRouting newShardRouting = new ShardRouting(shardRouting); randomChange(newShardRouting, nodes); builder.addShard(indexShardRoutingTable.value, newShardRouting); } } return builder.build(); } | /**
* Randomly updates index routing table in the cluster state
*/ | Randomly updates index routing table in the cluster state | randomChangeToIndexRoutingTable | {
"repo_name": "mapr/elasticsearch",
"path": "core/src/test/java/org/elasticsearch/cluster/ClusterStateDiffIT.java",
"license": "apache-2.0",
"size": 30452
} | [
"com.carrotsearch.hppc.cursors.ObjectCursor",
"org.elasticsearch.cluster.routing.IndexRoutingTable",
"org.elasticsearch.cluster.routing.IndexShardRoutingTable",
"org.elasticsearch.cluster.routing.RandomShardRoutingMutator",
"org.elasticsearch.cluster.routing.ShardRouting"
] | import com.carrotsearch.hppc.cursors.ObjectCursor; import org.elasticsearch.cluster.routing.IndexRoutingTable; import org.elasticsearch.cluster.routing.IndexShardRoutingTable; import org.elasticsearch.cluster.routing.RandomShardRoutingMutator; import org.elasticsearch.cluster.routing.ShardRouting; | import com.carrotsearch.hppc.cursors.*; import org.elasticsearch.cluster.routing.*; | [
"com.carrotsearch.hppc",
"org.elasticsearch.cluster"
] | com.carrotsearch.hppc; org.elasticsearch.cluster; | 2,822,977 |
public boolean includesKey(Position key) {
return (fetch(key)) != null;
} | boolean function(Position key) { return (fetch(key)) != null; } | /**
* includesKey is used to test for the presence of a key->value pair in the
* table. This routine returns true if there is a value present at the specified
* key, and false otherwise.
* 'table->includesKey(p)' iff 'table->domain()->hasMember(p)'.
*/ | includesKey is used to test for the presence of a key->value pair in the table. This routine returns true if there is a value present at the specified key, and false otherwise. 'table->includesKey(p)' iff 'table->domain()->hasMember(p)' | includesKey | {
"repo_name": "jonesd/abora-white",
"path": "src/main/java/info/dgjones/abora/white/collection/tables/ScruTable.java",
"license": "mit",
"size": 32849
} | [
"info.dgjones.abora.white.spaces.basic.Position"
] | import info.dgjones.abora.white.spaces.basic.Position; | import info.dgjones.abora.white.spaces.basic.*; | [
"info.dgjones.abora"
] | info.dgjones.abora; | 635,423 |
protected FsGetter fsGetter() {
return new FsGetter();
}
static class InnerCache {
private Map<Key, FileSystem> map = new HashMap<>();
private FsGetter fsCreator;
InnerCache(FsGetter fsCreator) {
this.fsCreator = fsCreator;
} | FsGetter function() { return new FsGetter(); } static class InnerCache { private Map<Key, FileSystem> map = new HashMap<>(); private FsGetter fsCreator; InnerCache(FsGetter fsCreator) { this.fsCreator = fsCreator; } | /**
* Gets file system creator instance.
*/ | Gets file system creator instance | fsGetter | {
"repo_name": "plusplusjiajia/hadoop",
"path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java",
"license": "apache-2.0",
"size": 49076
} | [
"java.util.HashMap",
"java.util.Map",
"org.apache.hadoop.fs.FileSystem"
] | import java.util.HashMap; import java.util.Map; import org.apache.hadoop.fs.FileSystem; | import java.util.*; import org.apache.hadoop.fs.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 1,851,552 |
public void setDisplayToFitMapMarkers() {
if (mapMarkerList == null || mapMarkerList.size() == 0)
return;
int x_min = Integer.MAX_VALUE;
int y_min = Integer.MAX_VALUE;
int x_max = Integer.MIN_VALUE;
int y_max = Integer.MIN_VALUE;
int mapZoomMax = tileController.getTileSource().getMaxZoom();
for (MapMarker marker : mapMarkerList) {
int x = OsmMercator.LonToX(marker.getLon(), mapZoomMax);
int y = OsmMercator.LatToY(marker.getLat(), mapZoomMax);
x_max = Math.max(x_max, x);
y_max = Math.max(y_max, y);
x_min = Math.min(x_min, x);
y_min = Math.min(y_min, y);
}
int height = Math.max(0, getHeight());
int width = Math.max(0, getWidth());
// System.out.println(x_min + " < x < " + x_max);
// System.out.println(y_min + " < y < " + y_max);
// System.out.println("tiles: " + width + " " + height);
int newZoom = mapZoomMax;
int x = x_max - x_min;
int y = y_max - y_min;
while (x > width || y > height) {
// System.out.println("zoom: " + zoom + " -> " + x + " " + y);
newZoom--;
x >>= 1;
y >>= 1;
}
x = x_min + (x_max - x_min) / 2;
y = y_min + (y_max - y_min) / 2;
int z = 1 << (mapZoomMax - newZoom);
x /= z;
y /= z;
setDisplayPosition(x, y, newZoom);
} | void function() { if (mapMarkerList == null mapMarkerList.size() == 0) return; int x_min = Integer.MAX_VALUE; int y_min = Integer.MAX_VALUE; int x_max = Integer.MIN_VALUE; int y_max = Integer.MIN_VALUE; int mapZoomMax = tileController.getTileSource().getMaxZoom(); for (MapMarker marker : mapMarkerList) { int x = OsmMercator.LonToX(marker.getLon(), mapZoomMax); int y = OsmMercator.LatToY(marker.getLat(), mapZoomMax); x_max = Math.max(x_max, x); y_max = Math.max(y_max, y); x_min = Math.min(x_min, x); y_min = Math.min(y_min, y); } int height = Math.max(0, getHeight()); int width = Math.max(0, getWidth()); int newZoom = mapZoomMax; int x = x_max - x_min; int y = y_max - y_min; while (x > width y > height) { newZoom--; x >>= 1; y >>= 1; } x = x_min + (x_max - x_min) / 2; y = y_min + (y_max - y_min) / 2; int z = 1 << (mapZoomMax - newZoom); x /= z; y /= z; setDisplayPosition(x, y, newZoom); } | /**
* Sets the displayed map pane and zoom level so that all map markers are
* visible.
*/ | Sets the displayed map pane and zoom level so that all map markers are visible | setDisplayToFitMapMarkers | {
"repo_name": "ifellows/DeducerSpatial",
"path": "JMapViewer/org/org/openstreetmap/gui/jmapviewer/JMapViewer.java",
"license": "gpl-2.0",
"size": 26390
} | [
"org.openstreetmap.gui.jmapviewer.interfaces.MapMarker"
] | import org.openstreetmap.gui.jmapviewer.interfaces.MapMarker; | import org.openstreetmap.gui.jmapviewer.interfaces.*; | [
"org.openstreetmap.gui"
] | org.openstreetmap.gui; | 2,851,820 |
@SuppressWarnings("unchecked")
private List<String> getNumberPlateList(BasicCache<String, Object> carCacheLoc) {
List<String> result = null;
List<String> carNumberList = (List<String>) carCacheLoc.get(CAR_NUMBERS_KEY);
if (carNumberList == null) {
result = new LinkedList<String>();
} else {
result = new LinkedList<String>(carNumberList);
}
return result;
} | @SuppressWarnings(STR) List<String> function(BasicCache<String, Object> carCacheLoc) { List<String> result = null; List<String> carNumberList = (List<String>) carCacheLoc.get(CAR_NUMBERS_KEY); if (carNumberList == null) { result = new LinkedList<String>(); } else { result = new LinkedList<String>(carNumberList); } return result; } | /**
* Operate on a clone of car number list so that we can demonstrate transaction roll-back.
*/ | Operate on a clone of car number list so that we can demonstrate transaction roll-back | getNumberPlateList | {
"repo_name": "wfink/quickstart",
"path": "carmart-tx/src/tomcat/java/org/jboss/as/quickstarts/datagrid/carmart/session/CarManager.java",
"license": "apache-2.0",
"size": 6952
} | [
"java.util.LinkedList",
"java.util.List",
"org.infinispan.api.BasicCache"
] | import java.util.LinkedList; import java.util.List; import org.infinispan.api.BasicCache; | import java.util.*; import org.infinispan.api.*; | [
"java.util",
"org.infinispan.api"
] | java.util; org.infinispan.api; | 873,884 |
public BigDecimal getBOMQty();
public static final String COLUMNNAME_Created = "Created"; | BigDecimal function(); public static final String COLUMNNAME_Created = STR; | /** Get BOM Quantity.
* Bill of Materials Quantity
*/ | Get BOM Quantity. Bill of Materials Quantity | getBOMQty | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.adempiere.adempiere/base/src/main/java-gen/org/compiere/model/I_M_BOMProduct.java",
"license": "gpl-2.0",
"size": 8915
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 429,299 |
private void print(Stack<Integer> stack) {
StringBuilder sb = new StringBuilder();
sb.append(TARGET_SUM).append(" = ");
for (Integer i : stack) {
sb.append(i).append("+");
}
System.out.println(sb.deleteCharAt(sb.length() - 1).toString());
}
private static final int[] DATA = { 1, 3, 4, 5, 6, 2, 7, 8, 9, 10, 11, 13, 14, 15 }; | void function(Stack<Integer> stack) { StringBuilder sb = new StringBuilder(); sb.append(TARGET_SUM).append(STR); for (Integer i : stack) { sb.append(i).append("+"); } System.out.println(sb.deleteCharAt(sb.length() - 1).toString()); } private static final int[] DATA = { 1, 3, 4, 5, 6, 2, 7, 8, 9, 10, 11, 13, 14, 15 }; | /**
* Print satisfied result. i.e. 15 = 4+6+5
*/ | Print satisfied result. i.e. 15 = 4+6+5 | print | {
"repo_name": "gilbertopsantosjr/examples",
"path": "interview-questions/src/GetAllSubsetByStack.java",
"license": "gpl-2.0",
"size": 1549
} | [
"java.util.Stack"
] | import java.util.Stack; | import java.util.*; | [
"java.util"
] | java.util; | 509,028 |
public static void generateSelfForwardingMethod(ClassNode clazz, String name, String forwardname, Type rettype) {
MethodNode method =
new MethodNode(Opcodes.ASM5, Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC, name, "()" + rettype.getDescriptor(), null, null);
populateSelfForwardingMethod(method, forwardname, rettype, Type.getObjectType(clazz.name));
clazz.methods.add(method);
} | static void function(ClassNode clazz, String name, String forwardname, Type rettype) { MethodNode method = new MethodNode(Opcodes.ASM5, Opcodes.ACC_PUBLIC Opcodes.ACC_SYNTHETIC, name, "()" + rettype.getDescriptor(), null, null); populateSelfForwardingMethod(method, forwardname, rettype, Type.getObjectType(clazz.name)); clazz.methods.add(method); } | /**
* Generate a forwarding method of the form
* "T name() { return this.forward(); }".
*
* @param clazz Class to generate new method on
* @param name Name of method to generate
* @param forwardname Name of method to call
* @param rettype Return type of method
*/ | Generate a forwarding method of the form "T name() { return this.forward(); }" | generateSelfForwardingMethod | {
"repo_name": "lorenzoYolo123/lorenzoYolo123",
"path": "src/main/java/org/spongepowered/mod/asm/util/ASMHelper.java",
"license": "mit",
"size": 11321
} | [
"org.objectweb.asm.Opcodes",
"org.objectweb.asm.Type",
"org.objectweb.asm.tree.ClassNode",
"org.objectweb.asm.tree.MethodNode"
] | import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.MethodNode; | import org.objectweb.asm.*; import org.objectweb.asm.tree.*; | [
"org.objectweb.asm"
] | org.objectweb.asm; | 290,130 |
public Code translateCode(CodeId kuntaApiId, VmOpenApiCodeListItem ptvCodeListItem, CodeType codeType) {
if (ptvCodeListItem == null) {
return null;
}
Code result = new Code();
result.setId(kuntaApiId.getId());
result.setCode(ptvCodeListItem.getCode());
result.setExtra(Collections.emptyList());
result.setNames(translateLocalizedItems(ptvCodeListItem.getNames()));
result.setType(codeType.getType());
return result;
} | Code function(CodeId kuntaApiId, VmOpenApiCodeListItem ptvCodeListItem, CodeType codeType) { if (ptvCodeListItem == null) { return null; } Code result = new Code(); result.setId(kuntaApiId.getId()); result.setCode(ptvCodeListItem.getCode()); result.setExtra(Collections.emptyList()); result.setNames(translateLocalizedItems(ptvCodeListItem.getNames())); result.setType(codeType.getType()); return result; } | /**
* Translates PTV code list item into Kunta API code
*
* @param ptvCodeListItem PTV code list item
* @param codeType code type
* @return Kunta API code
*/ | Translates PTV code list item into Kunta API code | translateCode | {
"repo_name": "Metatavu/kunta-api-server",
"path": "src/main/java/fi/metatavu/kuntaapi/server/integrations/ptv/translation/PtvTranslator.java",
"license": "agpl-3.0",
"size": 59838
} | [
"fi.metatavu.kuntaapi.server.id.CodeId",
"fi.metatavu.kuntaapi.server.integrations.ptv.CodeType",
"fi.metatavu.kuntaapi.server.rest.model.Code",
"fi.metatavu.ptv.client.model.VmOpenApiCodeListItem",
"java.util.Collections"
] | import fi.metatavu.kuntaapi.server.id.CodeId; import fi.metatavu.kuntaapi.server.integrations.ptv.CodeType; import fi.metatavu.kuntaapi.server.rest.model.Code; import fi.metatavu.ptv.client.model.VmOpenApiCodeListItem; import java.util.Collections; | import fi.metatavu.kuntaapi.server.id.*; import fi.metatavu.kuntaapi.server.integrations.ptv.*; import fi.metatavu.kuntaapi.server.rest.model.*; import fi.metatavu.ptv.client.model.*; import java.util.*; | [
"fi.metatavu.kuntaapi",
"fi.metatavu.ptv",
"java.util"
] | fi.metatavu.kuntaapi; fi.metatavu.ptv; java.util; | 14,163 |
void runPushAnalysis( int id, TaskId taskId ); | void runPushAnalysis( int id, TaskId taskId ); | /**
* Used to Generate and send reports to all UserGroups assigned to the PushAnalysis,
* using generateHtmlReport to generate the reports for each individual user in the UserGroups.
* @param id of the PushAnalysis
* @param taskId to track process
*/ | Used to Generate and send reports to all UserGroups assigned to the PushAnalysis, using generateHtmlReport to generate the reports for each individual user in the UserGroups | runPushAnalysis | {
"repo_name": "troyel/dhis2-core",
"path": "dhis-2/dhis-api/src/main/java/org/hisp/dhis/pushanalysis/PushAnalysisService.java",
"license": "bsd-3-clause",
"size": 3396
} | [
"org.hisp.dhis.scheduling.TaskId"
] | import org.hisp.dhis.scheduling.TaskId; | import org.hisp.dhis.scheduling.*; | [
"org.hisp.dhis"
] | org.hisp.dhis; | 2,737,433 |
public void setUpperBound(long val) {
setProperty(new LongProperty(UPPER_BOUND, val));
} | void function(long val) { setProperty(new LongProperty(UPPER_BOUND, val)); } | /**
* Sets the highest possible value that the <code>long</code> portion of
* the parameter value may be.
*
* @param val
* the new highest possible parameter value
*/ | Sets the highest possible value that the <code>long</code> portion of the parameter value may be | setUpperBound | {
"repo_name": "Nachiket90/jmeter-sample",
"path": "src/protocol/http/org/apache/jmeter/protocol/http/modifier/ParamMask.java",
"license": "apache-2.0",
"size": 7655
} | [
"org.apache.jmeter.testelement.property.LongProperty"
] | import org.apache.jmeter.testelement.property.LongProperty; | import org.apache.jmeter.testelement.property.*; | [
"org.apache.jmeter"
] | org.apache.jmeter; | 2,718,819 |
private SecurityCredentials credentials(GridRestRequest req) {
Object creds = req.credentials();
if (creds instanceof SecurityCredentials)
return (SecurityCredentials)creds;
if (creds instanceof String) {
String credStr = (String)creds;
int idx = credStr.indexOf(':');
return idx >= 0 && idx < credStr.length() ?
new SecurityCredentials(credStr.substring(0, idx), credStr.substring(idx + 1)) :
new SecurityCredentials(credStr, null);
}
SecurityCredentials cred = new SecurityCredentials();
cred.setUserObject(creds);
return cred;
} | SecurityCredentials function(GridRestRequest req) { Object creds = req.credentials(); if (creds instanceof SecurityCredentials) return (SecurityCredentials)creds; if (creds instanceof String) { String credStr = (String)creds; int idx = credStr.indexOf(':'); return idx >= 0 && idx < credStr.length() ? new SecurityCredentials(credStr.substring(0, idx), credStr.substring(idx + 1)) : new SecurityCredentials(credStr, null); } SecurityCredentials cred = new SecurityCredentials(); cred.setUserObject(creds); return cred; } | /**
* Extract credentials from request.
*
* @param req Request.
* @return Security credentials.
*/ | Extract credentials from request | credentials | {
"repo_name": "daradurvs/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java",
"license": "apache-2.0",
"size": 44415
} | [
"org.apache.ignite.internal.processors.rest.request.GridRestRequest",
"org.apache.ignite.plugin.security.SecurityCredentials"
] | import org.apache.ignite.internal.processors.rest.request.GridRestRequest; import org.apache.ignite.plugin.security.SecurityCredentials; | import org.apache.ignite.internal.processors.rest.request.*; import org.apache.ignite.plugin.security.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 2,697,443 |
@NotNull
PsiAnnotation createAnnotationFromText(@NotNull String annotationText, @Nullable PsiElement context) throws IncorrectOperationException; | PsiAnnotation createAnnotationFromText(@NotNull String annotationText, @Nullable PsiElement context) throws IncorrectOperationException; | /**
* Creates an annotation from the specified text.
*
* @param annotationText the text of the annotation to create.
* @param context the context for resolving references from the annotation.
* @return the created annotation instance.
* @throws IncorrectOperationException if the text does not specify a valid annotation.
*/ | Creates an annotation from the specified text | createAnnotationFromText | {
"repo_name": "ThiagoGarciaAlves/intellij-community",
"path": "java/java-psi-api/src/com/intellij/psi/PsiJavaParserFacade.java",
"license": "apache-2.0",
"size": 11036
} | [
"com.intellij.util.IncorrectOperationException",
"org.jetbrains.annotations.NotNull",
"org.jetbrains.annotations.Nullable"
] | import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; | import com.intellij.util.*; import org.jetbrains.annotations.*; | [
"com.intellij.util",
"org.jetbrains.annotations"
] | com.intellij.util; org.jetbrains.annotations; | 957,098 |
public TaskListAdapter getListAdapter()
{
return adapter;
} | TaskListAdapter function() { return adapter; } | /**
* Returns the listitem adapter
* @return
*/ | Returns the listitem adapter | getListAdapter | {
"repo_name": "CMPUT301F12T04/CMPUT301F12T04",
"path": "src/com/example/cmput301/controller/TaskListController.java",
"license": "gpl-3.0",
"size": 5010
} | [
"com.example.cmput301.controller.MainController"
] | import com.example.cmput301.controller.MainController; | import com.example.cmput301.controller.*; | [
"com.example.cmput301"
] | com.example.cmput301; | 2,895,720 |
public static synchronized String setApplicationDirectory(Class<?> mainClazz)
{
if(appDir == null)
{
String path = getDirectory(mainClazz);
if(path != null)
{
// TODO: remove this hardcoding!
// if path includes "lib" or "bin" then go up one more
if(StringUtils.caseInsensitiveEndsWith(path,"lib") ||
StringUtils.caseInsensitiveEndsWith(path,"bin"))
{
File f = new File(path);
path = f.getParent();
if(path == null)
path = ".";
else
path = FileUtils.uriDecodeFile(path);
}
appDir = path;
}
}
return appDir;
}
| static synchronized String function(Class<?> mainClazz) { if(appDir == null) { String path = getDirectory(mainClazz); if(path != null) { if(StringUtils.caseInsensitiveEndsWith(path,"lib") StringUtils.caseInsensitiveEndsWith(path,"bin")) { File f = new File(path); path = f.getParent(); if(path == null) path = "."; else path = FileUtils.uriDecodeFile(path); } appDir = path; } } return appDir; } | /**
* Sets the application root directory to be that of containing main class.
*
* @param mainClazz the main class
*/ | Sets the application root directory to be that of containing main class | setApplicationDirectory | {
"repo_name": "justinjohn83/utils-java",
"path": "utils/src/main/java/com/gamesalutes/utils/FileUtils.java",
"license": "lgpl-3.0",
"size": 54765
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,543,581 |
public void setNextRoute(Coord nodeLocation, Coord nodeDestination) {
// Find closest stops to current location and destination
List<Coord> allStops = controlSystem.getBusStops();
Coord closestToNode = getClosestCoordinate(allStops, nodeLocation);
Coord closestToDestination = getClosestCoordinate(allStops,
nodeDestination);
// Check if it is shorter to walk than take the bus
double directDistance = nodeLocation.distance(nodeDestination);
double busDistance = nodeLocation.distance(closestToNode) +
nodeDestination.distance(closestToDestination);
if (directDistance < busDistance) {
takeBus = false;
} else {
takeBus = true;
}
this.startBusStop = closestToNode;
this.endBusStop = closestToDestination;
this.latestBusStop = startBusStop.clone();
}
| void function(Coord nodeLocation, Coord nodeDestination) { List<Coord> allStops = controlSystem.getBusStops(); Coord closestToNode = getClosestCoordinate(allStops, nodeLocation); Coord closestToDestination = getClosestCoordinate(allStops, nodeDestination); double directDistance = nodeLocation.distance(nodeDestination); double busDistance = nodeLocation.distance(closestToNode) + nodeDestination.distance(closestToDestination); if (directDistance < busDistance) { takeBus = false; } else { takeBus = true; } this.startBusStop = closestToNode; this.endBusStop = closestToDestination; this.latestBusStop = startBusStop.clone(); } | /**
* Sets the next route for the traveller, so that it can decide wether it
* should take the bus or not.
* @param nodeLocation
* @param nodeDestination
*/ | Sets the next route for the traveller, so that it can decide wether it should take the bus or not | setNextRoute | {
"repo_name": "AlexSussex/Dissertation---ONE",
"path": "src/movement/BusTravellerMovement.java",
"license": "gpl-3.0",
"size": 9164
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 27,765 |
@Override
public Enumeration<Option> listOptions() {
Vector<Option> result = new Vector<>();
WekaOptionUtils.addOption(result, alphaTipText(), "" + getDefaultAlpha(), "alpha");
WekaOptionUtils.add(result, super.listOptions());
return result.elements();
} | Enumeration<Option> function() { Vector<Option> result = new Vector<>(); WekaOptionUtils.addOption(result, alphaTipText(), STRalpha"); WekaOptionUtils.add(result, super.listOptions()); return result.elements(); } | /**
* Gets an enumeration describing the available options.
*
* @return an enumeration of all the available options.
*/ | Gets an enumeration describing the available options | listOptions | {
"repo_name": "waikato-datamining/adams-base",
"path": "adams-weka/src/main/java/weka/filters/supervised/attribute/YGradientGLSW.java",
"license": "gpl-3.0",
"size": 8690
} | [
"java.util.Enumeration",
"java.util.Vector"
] | import java.util.Enumeration; import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 2,609,971 |
public void configureDomainAxes() {
for (ValueAxis axis: this.domainAxes.values()) {
if (axis != null) {
axis.configure();
}
}
} | void function() { for (ValueAxis axis: this.domainAxes.values()) { if (axis != null) { axis.configure(); } } } | /**
* Configures the domain axes.
*/ | Configures the domain axes | configureDomainAxes | {
"repo_name": "GitoMat/jfreechart",
"path": "src/main/java/org/jfree/chart/plot/XYPlot.java",
"license": "lgpl-2.1",
"size": 197216
} | [
"org.jfree.chart.axis.ValueAxis"
] | import org.jfree.chart.axis.ValueAxis; | import org.jfree.chart.axis.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 1,415,336 |
public List<String> extractFrequentNER(Vector<EntityMention> entities,
List<NERSpan> ners) {
Set<Integer> entitiesWithNER = new HashSet<Integer>();
// Get Entity IDs of coref entities with NER mentions.
List<EntityMention> mentionsWithNER = mentionsWithNER(entities, ners);
for( EntityMention mention: mentionsWithNER )
entitiesWithNER.add(mention.entityID());
// Return IDs with highest count.
SortableScore[] scores = new SortableScore[entitiesWithNER.size()];
int i = 0;
for( Integer id : entitiesWithNER ) {
int count = 0;
for( EntityMention mention : entities )
if( mention.entityID() == id ) count++;
scores[i++] = new SortableScore((float)count, entityBestString(id, entities));
}
Arrays.sort(scores);
// Return the sorted objects!
List<String> best = new ArrayList<String>();
for( SortableScore score : scores )
best.add(score.key());
return best;
} | List<String> function(Vector<EntityMention> entities, List<NERSpan> ners) { Set<Integer> entitiesWithNER = new HashSet<Integer>(); List<EntityMention> mentionsWithNER = mentionsWithNER(entities, ners); for( EntityMention mention: mentionsWithNER ) entitiesWithNER.add(mention.entityID()); SortableScore[] scores = new SortableScore[entitiesWithNER.size()]; int i = 0; for( Integer id : entitiesWithNER ) { int count = 0; for( EntityMention mention : entities ) if( mention.entityID() == id ) count++; scores[i++] = new SortableScore((float)count, entityBestString(id, entities)); } Arrays.sort(scores); List<String> best = new ArrayList<String>(); for( SortableScore score : scores ) best.add(score.key()); return best; } | /**
* Get the most frequent NER's, find their coref classes, and order by
* the size of their classes.
*/ | Get the most frequent NER's, find their coref classes, and order by the size of their classes | extractFrequentNER | {
"repo_name": "nchambers/schemas",
"path": "src/main/java/nate/reading/TemplateExtractor.java",
"license": "apache-2.0",
"size": 74750
} | [
"java.util.ArrayList",
"java.util.Arrays",
"java.util.HashSet",
"java.util.List",
"java.util.Set",
"java.util.Vector"
] | import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 977,175 |
public static Modal message(Context context, CharSequence message){
return message(context, message, null);
} | static Modal function(Context context, CharSequence message){ return message(context, message, null); } | /**
* Shows the message dialog.
* No button
*
*
*/ | Shows the message dialog. No button | message | {
"repo_name": "bingzer/Butler",
"path": "Library/Core/src/main/java/com/bingzer/android/Modal.java",
"license": "apache-2.0",
"size": 28649
} | [
"android.content.Context"
] | import android.content.Context; | import android.content.*; | [
"android.content"
] | android.content; | 478,580 |
public void setRecTime(Date recTime) {
this.recTime = recTime;
}
| void function(Date recTime) { this.recTime = recTime; } | /**
* This method was generated by MyBatis Generator. This method sets the value of the database column iqm_dataset.rec_time
* @param recTime the value for iqm_dataset.rec_time
* @mbggenerated Wed Oct 15 12:30:42 ICT 2014
*/ | This method was generated by MyBatis Generator. This method sets the value of the database column iqm_dataset.rec_time | setRecTime | {
"repo_name": "punyararj/his-interface-core",
"path": "Server/src/com/healthcare/db/model/IqmDataset.java",
"license": "gpl-3.0",
"size": 12378
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 882,301 |
public void finalizeBlock(ExtendedBlock b) throws IOException; | void function(ExtendedBlock b) throws IOException; | /**
* Finalizes the block previously opened for writing using writeToBlock.
* The block size is what is in the parameter b and it must match the amount
* of data written
* @throws IOException
* @throws ReplicaNotFoundException if the replica can not be found when the
* block is been finalized. For instance, the block resides on an HDFS volume
* that has been removed.
*/ | Finalizes the block previously opened for writing using writeToBlock. The block size is what is in the parameter b and it must match the amount of data written | finalizeBlock | {
"repo_name": "wankunde/cloudera_hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/FsDatasetSpi.java",
"license": "apache-2.0",
"size": 19723
} | [
"java.io.IOException",
"org.apache.hadoop.hdfs.protocol.ExtendedBlock"
] | import java.io.IOException; import org.apache.hadoop.hdfs.protocol.ExtendedBlock; | import java.io.*; import org.apache.hadoop.hdfs.protocol.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,468,742 |
public static final QueryRewriteIndex retrieve(Context context) {
QueryRewriteIndex queryRewriteIndex = (QueryRewriteIndex) context.get(QUERY_REWRITE_INDEX_SYMBOL, null);
if (queryRewriteIndex == null) {
queryRewriteIndex = createDefault();
context.set(QUERY_REWRITE_INDEX_SYMBOL, queryRewriteIndex);
}
return queryRewriteIndex;
} | static final QueryRewriteIndex function(Context context) { QueryRewriteIndex queryRewriteIndex = (QueryRewriteIndex) context.get(QUERY_REWRITE_INDEX_SYMBOL, null); if (queryRewriteIndex == null) { queryRewriteIndex = createDefault(); context.set(QUERY_REWRITE_INDEX_SYMBOL, queryRewriteIndex); } return queryRewriteIndex; } | /**
* Retrieve the QueryRewriteIndex from the Dataset Context.<br>
* If no index has been setup then QueryRewriteIndex is created.
*
* @param context
* @return QueryRewriteIndex contained in the Context.
*/ | Retrieve the QueryRewriteIndex from the Dataset Context. If no index has been setup then QueryRewriteIndex is created | retrieve | {
"repo_name": "apache/jena",
"path": "jena-geosparql/src/main/java/org/apache/jena/geosparql/implementation/index/QueryRewriteIndex.java",
"license": "apache-2.0",
"size": 10099
} | [
"org.apache.jena.sparql.util.Context"
] | import org.apache.jena.sparql.util.Context; | import org.apache.jena.sparql.util.*; | [
"org.apache.jena"
] | org.apache.jena; | 2,825,804 |
public boolean callDelete(final String sparqlEndPointUrl, final String whereClause) {
String query = buildDeleteQueryConstruct(whereClause);
//logger.debug("url " + sparqlEndPointUrl + "?query=" + query , " (Before encoding");
String encodedQuery = encodeUrl(query);
String url = sparqlEndPointUrl + "?query=" + encodedQuery;
try {
delete(url);
} catch (HttpException e) {
logger.error("call delete", e);
return false;
} catch (IOException e) {
logger.error("call delete", e);
return false;
}
return true;
}
| boolean function(final String sparqlEndPointUrl, final String whereClause) { String query = buildDeleteQueryConstruct(whereClause); String encodedQuery = encodeUrl(query); String url = sparqlEndPointUrl + STR + encodedQuery; try { delete(url); } catch (HttpException e) { logger.error(STR, e); return false; } catch (IOException e) { logger.error(STR, e); return false; } return true; } | /**
* build query, encode query parameter, build url and call rest API
* @param sparqlEndPointUrl
* @param whereClause
*/ | build query, encode query parameter, build url and call rest API | callDelete | {
"repo_name": "atcult/aliada-tool",
"path": "aliada/aliada-rdfizer/src/main/java/eu/aliada/rdfizer/delta/Delta.java",
"license": "gpl-3.0",
"size": 20172
} | [
"java.io.IOException",
"org.apache.commons.httpclient.HttpException"
] | import java.io.IOException; import org.apache.commons.httpclient.HttpException; | import java.io.*; import org.apache.commons.httpclient.*; | [
"java.io",
"org.apache.commons"
] | java.io; org.apache.commons; | 982,181 |
@WebMethod(operationName = "CheckTextBody")
@WebResult(name = "DocumentSummary", targetNamespace = "http://ws.cdyne.com/", partName = "Body")
public DocumentSummary checkTextBody(
@WebParam(name = "string", targetNamespace = "http://www.w3.org/2001/XMLSchema", partName = "BodyText")
String bodyText,
@WebParam(name = "string", targetNamespace = "http://www.w3.org/2001/XMLSchema", partName = "LicenseKey")
String licenseKey); | @WebMethod(operationName = STR) @WebResult(name = STR, targetNamespace = STRstringSTRhttp: String bodyText, @WebParam(name = "stringSTRhttp: String licenseKey); | /**
* Depreciated. Do not use.
*
* @param bodyText
* @param licenseKey
* @return
* returns com.cdyne.ws.DocumentSummary
*/ | Depreciated. Do not use | checkTextBody | {
"repo_name": "JunSoftware109/Java_Exercises",
"path": "Lab 5 Web Services/SpellCheckService/build/generated/jax-wsCache/check/com/cdyne/ws/CheckHttpGet.java",
"license": "apache-2.0",
"size": 1692
} | [
"javax.jws.WebMethod",
"javax.jws.WebParam",
"javax.jws.WebResult"
] | import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; | import javax.jws.*; | [
"javax.jws"
] | javax.jws; | 2,186,278 |
T time(Matcher<Long> matcher, TimeUnit timeUnit); | T time(Matcher<Long> matcher, TimeUnit timeUnit); | /**
* Validate that the response time matches the supplied <code>matcher</code> and time unit. For example:
* <p/>
* <pre>
* when().
* get("/something").
* then().
* time(lessThan(2), TimeUnit.SECONDS);
* </pre>
* <p/>
* where <code>lessThan</code> is a Hamcrest matcher
*
* @return The {@link ValidatableResponse} instance.
*/ | Validate that the response time matches the supplied <code>matcher</code> and time unit. For example: <code> when(). get("/something"). then(). time(lessThan(2), TimeUnit.SECONDS); </code> where <code>lessThan</code> is a Hamcrest matcher | time | {
"repo_name": "BenSeverson/rest-assured",
"path": "rest-assured/src/main/java/io/restassured/response/ValidatableResponseOptions.java",
"license": "apache-2.0",
"size": 54236
} | [
"java.util.concurrent.TimeUnit",
"org.hamcrest.Matcher"
] | import java.util.concurrent.TimeUnit; import org.hamcrest.Matcher; | import java.util.concurrent.*; import org.hamcrest.*; | [
"java.util",
"org.hamcrest"
] | java.util; org.hamcrest; | 2,440,626 |
public void setAltitudeCallbackPeriod(long period) throws TimeoutException, NotConnectedException {
byte options = 0;
boolean isResponseExpected = getResponseExpected(FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD);
if(isResponseExpected) {
options = 8;
}
ByteBuffer bb = ipcon.createRequestBuffer(uid, (byte)12, FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, options, (byte)(0));
bb.putInt((int)period);
if(isResponseExpected) {
byte[] response = sendRequestExpectResponse(bb.array(), FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD);
bb = ByteBuffer.wrap(response, 8, response.length - 8);
bb.order(ByteOrder.LITTLE_ENDIAN);
} else {
sendRequestNoResponse(bb.array());
}
} | void function(long period) throws TimeoutException, NotConnectedException { byte options = 0; boolean isResponseExpected = getResponseExpected(FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD); if(isResponseExpected) { options = 8; } ByteBuffer bb = ipcon.createRequestBuffer(uid, (byte)12, FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, options, (byte)(0)); bb.putInt((int)period); if(isResponseExpected) { byte[] response = sendRequestExpectResponse(bb.array(), FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD); bb = ByteBuffer.wrap(response, 8, response.length - 8); bb.order(ByteOrder.LITTLE_ENDIAN); } else { sendRequestNoResponse(bb.array()); } } | /**
* Sets the period in ms with which the {@link com.tinkerforge.BrickletGPS.AltitudeListener} listener is triggered
* periodically. A value of 0 turns the listener off.
*
* {@link com.tinkerforge.BrickletGPS.AltitudeListener} is only triggered if the altitude changed since the
* last triggering.
*
* The default value is 0.
*/ | Sets the period in ms with which the <code>com.tinkerforge.BrickletGPS.AltitudeListener</code> listener is triggered periodically. A value of 0 turns the listener off. <code>com.tinkerforge.BrickletGPS.AltitudeListener</code> is only triggered if the altitude changed since the last triggering. The default value is 0 | setAltitudeCallbackPeriod | {
"repo_name": "ezeeb/pipes-tinkerforge",
"path": "src/main/java/com/tinkerforge/BrickletGPS.java",
"license": "apache-2.0",
"size": 30755
} | [
"java.nio.ByteBuffer",
"java.nio.ByteOrder"
] | import java.nio.ByteBuffer; import java.nio.ByteOrder; | import java.nio.*; | [
"java.nio"
] | java.nio; | 176,064 |
public CoinfloorExchangeEvent getBalances() {
return doNewRequest(new RequestFactory.GetBalancesRequest(), ExchangeEventType.USER_WALLET);
} | CoinfloorExchangeEvent function() { return doNewRequest(new RequestFactory.GetBalancesRequest(), ExchangeEventType.USER_WALLET); } | /**
* Get user's balances Upon receipt of response, a CoinfloorExchangeEvent with payload Map<String, Object>, consisting of: > A raw object of type
* CoinfloorBalances (key "raw") > A generic object of type AccountInfo (key "generic")
*/ | Get user's balances Upon receipt of response, a CoinfloorExchangeEvent with payload Map, consisting of: > A raw object of type CoinfloorBalances (key "raw") > A generic object of type AccountInfo (key "generic") | getBalances | {
"repo_name": "okazia/XChange",
"path": "xchange-coinfloor/src/main/java/com/xeiam/xchange/coinfloor/streaming/CoinfloorStreamingExchangeService.java",
"license": "mit",
"size": 12950
} | [
"com.xeiam.xchange.coinfloor.dto.streaming.CoinfloorExchangeEvent",
"com.xeiam.xchange.service.streaming.ExchangeEventType"
] | import com.xeiam.xchange.coinfloor.dto.streaming.CoinfloorExchangeEvent; import com.xeiam.xchange.service.streaming.ExchangeEventType; | import com.xeiam.xchange.coinfloor.dto.streaming.*; import com.xeiam.xchange.service.streaming.*; | [
"com.xeiam.xchange"
] | com.xeiam.xchange; | 263,612 |
@Override
public void canOpenURL(String url, Promise promise) {
if (url == null || url.isEmpty()) {
promise.reject(new JSApplicationIllegalArgumentException("Invalid URL: " + url));
return;
}
try {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
// We need Intent.FLAG_ACTIVITY_NEW_TASK since getReactApplicationContext() returns
// the ApplicationContext instead of the Activity context.
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
boolean canOpen =
intent.resolveActivity(getReactApplicationContext().getPackageManager()) != null;
promise.resolve(canOpen);
} catch (Exception e) {
promise.reject(
new JSApplicationIllegalArgumentException(
"Could not check if URL '" + url + "' can be opened: " + e.getMessage()));
}
} | void function(String url, Promise promise) { if (url == null url.isEmpty()) { promise.reject(new JSApplicationIllegalArgumentException(STR + url)); return; } try { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); boolean canOpen = intent.resolveActivity(getReactApplicationContext().getPackageManager()) != null; promise.resolve(canOpen); } catch (Exception e) { promise.reject( new JSApplicationIllegalArgumentException( STR + url + STR + e.getMessage())); } } | /**
* Determine whether or not an installed app can handle a given URL.
*
* @param url the URL to open
* @param promise a promise that is always resolved with a boolean argument
*/ | Determine whether or not an installed app can handle a given URL | canOpenURL | {
"repo_name": "exponent/exponent",
"path": "android/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java",
"license": "bsd-3-clause",
"size": 8361
} | [
"android.content.Intent",
"android.net.Uri",
"com.facebook.react.bridge.JSApplicationIllegalArgumentException",
"com.facebook.react.bridge.Promise"
] | import android.content.Intent; import android.net.Uri; import com.facebook.react.bridge.JSApplicationIllegalArgumentException; import com.facebook.react.bridge.Promise; | import android.content.*; import android.net.*; import com.facebook.react.bridge.*; | [
"android.content",
"android.net",
"com.facebook.react"
] | android.content; android.net; com.facebook.react; | 1,411,109 |
public static <T> void filterListToMap(final Map<String, T> destinationMap, final String[] nameMapping,
final List<? extends T> sourceList) {
if( destinationMap == null ) {
throw new NullPointerException("destinationMap should not be null");
} else if( nameMapping == null ) {
throw new NullPointerException("nameMapping should not be null");
} else if( sourceList == null ) {
throw new NullPointerException("sourceList should not be null");
} else if( nameMapping.length != sourceList.size() ) {
throw new SuperCsvException(
String
.format(
"the nameMapping array and the sourceList should be the same size (nameMapping length = %d, sourceList size = %d)",
nameMapping.length, sourceList.size()));
}
destinationMap.clear();
for( int i = 0; i < nameMapping.length; i++ ) {
final String key = nameMapping[i];
if( key == null ) {
continue; // null's in the name mapping means skip column
}
// no duplicates allowed
if( destinationMap.containsKey(key) ) {
throw new SuperCsvException(String.format("duplicate nameMapping '%s' at index %d", key, i));
}
destinationMap.put(key, sourceList.get(i));
}
}
| static <T> void function(final Map<String, T> destinationMap, final String[] nameMapping, final List<? extends T> sourceList) { if( destinationMap == null ) { throw new NullPointerException(STR); } else if( nameMapping == null ) { throw new NullPointerException(STR); } else if( sourceList == null ) { throw new NullPointerException(STR); } else if( nameMapping.length != sourceList.size() ) { throw new SuperCsvException( String .format( STR, nameMapping.length, sourceList.size())); } destinationMap.clear(); for( int i = 0; i < nameMapping.length; i++ ) { final String key = nameMapping[i]; if( key == null ) { continue; } if( destinationMap.containsKey(key) ) { throw new SuperCsvException(String.format(STR, key, i)); } destinationMap.put(key, sourceList.get(i)); } } | /**
* Converts a List to a Map using the elements of the nameMapping array as the keys of the Map.
*
* @param destinationMap
* the destination Map (which is cleared before it's populated)
* @param nameMapping
* the keys of the Map (corresponding with the elements in the sourceList). Cannot contain duplicates.
* @param sourceList
* the List to convert
* @param <T>
* the type of the values in the map
* @throws NullPointerException
* if destinationMap, nameMapping or sourceList is null
* @throws SuperCsvException
* if nameMapping and sourceList are not the same size
*/ | Converts a List to a Map using the elements of the nameMapping array as the keys of the Map | filterListToMap | {
"repo_name": "ZioberMichal/super-csv",
"path": "super-csv/src/main/java/org/supercsv/util/Util.java",
"license": "apache-2.0",
"size": 8886
} | [
"java.util.List",
"java.util.Map",
"org.supercsv.exception.SuperCsvException"
] | import java.util.List; import java.util.Map; import org.supercsv.exception.SuperCsvException; | import java.util.*; import org.supercsv.exception.*; | [
"java.util",
"org.supercsv.exception"
] | java.util; org.supercsv.exception; | 2,539,927 |
public Expression getInstance() {
final XYZSeriesCollectorFunction fn = (XYZSeriesCollectorFunction) super.getInstance();
fn.zValueColumns = (ArrayList) zValueColumns.clone();
fn.maxZValue = 1.0; // Reset this to the default value as it's a calculated value.
return fn;
} | Expression function() { final XYZSeriesCollectorFunction fn = (XYZSeriesCollectorFunction) super.getInstance(); fn.zValueColumns = (ArrayList) zValueColumns.clone(); fn.maxZValue = 1.0; return fn; } | /**
* Return a completly separated copy of this function. The copy no longer shares any changeable objects with the
* original function. Also from Thomas: Should retain data from the report definition, but clear calculated data.
*
* @return a copy of this function.
*/ | Return a completly separated copy of this function. The copy no longer shares any changeable objects with the original function. Also from Thomas: Should retain data from the report definition, but clear calculated data | getInstance | {
"repo_name": "mbatchelor/pentaho-reporting",
"path": "engine/legacy-charts/src/main/java/org/pentaho/plugin/jfreereport/reportcharts/XYZSeriesCollectorFunction.java",
"license": "lgpl-2.1",
"size": 4955
} | [
"java.util.ArrayList",
"org.pentaho.reporting.engine.classic.core.function.Expression"
] | import java.util.ArrayList; import org.pentaho.reporting.engine.classic.core.function.Expression; | import java.util.*; import org.pentaho.reporting.engine.classic.core.function.*; | [
"java.util",
"org.pentaho.reporting"
] | java.util; org.pentaho.reporting; | 1,649,909 |
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
} | static ImageDescriptor function(String path) { return imageDescriptorFromPlugin(PLUGIN_ID, path); } | /**
* Returns an image descriptor for the image file at the given
* plug-in relative path
*
* @param path the path
* @return the image descriptor
*/ | Returns an image descriptor for the image file at the given plug-in relative path | getImageDescriptor | {
"repo_name": "sohaniwso2/devstudio-tooling-esb",
"path": "plugins/org.wso2.developerstudio.eclipse.artifact.mediator/src/org/wso2/developerstudio/eclipse/artifact/mediator/Activator.java",
"license": "apache-2.0",
"size": 2063
} | [
"org.eclipse.jface.resource.ImageDescriptor"
] | import org.eclipse.jface.resource.ImageDescriptor; | import org.eclipse.jface.resource.*; | [
"org.eclipse.jface"
] | org.eclipse.jface; | 876,014 |
public String getCurrentAgentBundle(AuthzSubject subject, AppdefEntityID aid) throws PermissionException,
AgentNotFoundException, AgentRemoteException, AgentConnectionException; | String function(AuthzSubject subject, AppdefEntityID aid) throws PermissionException, AgentNotFoundException, AgentRemoteException, AgentConnectionException; | /**
* Return the bundle that is currently running on a give agent. The returned
* bundle name may be parsed to retrieve the current agent version.
* @param subject The subject issuing the request.
* @param aid The agent id.
* @return The bundle name currently running.
* @throws PermissionException if the subject does not have proper
* permissions to issue the query.
* @throws AgentNotFoundException if no agent exists with the given agent
* id.
* @throws AgentRemoteException if an exception occurs on the remote agent
* side.
* @throws AgentConnectionException if the connection to the agent fails.
*/ | Return the bundle that is currently running on a give agent. The returned bundle name may be parsed to retrieve the current agent version | getCurrentAgentBundle | {
"repo_name": "cc14514/hq6",
"path": "hq-server/src/main/java/org/hyperic/hq/appdef/shared/AgentManager.java",
"license": "unlicense",
"size": 24936
} | [
"org.hyperic.hq.agent.AgentConnectionException",
"org.hyperic.hq.agent.AgentRemoteException",
"org.hyperic.hq.authz.server.session.AuthzSubject",
"org.hyperic.hq.authz.shared.PermissionException"
] | import org.hyperic.hq.agent.AgentConnectionException; import org.hyperic.hq.agent.AgentRemoteException; import org.hyperic.hq.authz.server.session.AuthzSubject; import org.hyperic.hq.authz.shared.PermissionException; | import org.hyperic.hq.agent.*; import org.hyperic.hq.authz.server.session.*; import org.hyperic.hq.authz.shared.*; | [
"org.hyperic.hq"
] | org.hyperic.hq; | 747,100 |
public List<String> getSpeech() {
return this.speech;
} | List<String> function() { return this.speech; } | /**
* Get agent's text replies.
*/ | Get agent's text replies | getSpeech | {
"repo_name": "api-ai/apiai-java-sdk",
"path": "libai/src/main/java/ai/api/model/ResponseMessage.java",
"license": "apache-2.0",
"size": 10601
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,700,444 |
Status addFlowAsync(Node node, Flow flow); | Status addFlowAsync(Node node, Flow flow); | /**
* Asynchronously add a flow to the network node
*
* @param node
* The target network node
* @param flow
* The flow to install
* @return The status of this request containing the unique request id
*/ | Asynchronously add a flow to the network node | addFlowAsync | {
"repo_name": "xiaohanz/softcontroller",
"path": "opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/IFlowProgrammerService.java",
"license": "epl-1.0",
"size": 4223
} | [
"org.opendaylight.controller.sal.core.Node",
"org.opendaylight.controller.sal.utils.Status"
] | import org.opendaylight.controller.sal.core.Node; import org.opendaylight.controller.sal.utils.Status; | import org.opendaylight.controller.sal.core.*; import org.opendaylight.controller.sal.utils.*; | [
"org.opendaylight.controller"
] | org.opendaylight.controller; | 1,542,070 |
public void assertDocsAndPositionsEnum(DocsAndPositionsEnum leftDocs, DocsAndPositionsEnum rightDocs) throws Exception {
if (leftDocs == null || rightDocs == null) {
assertNull(leftDocs);
assertNull(rightDocs);
return;
}
assertTrue(leftDocs.docID() == -1 || leftDocs.docID() == DocIdSetIterator.NO_MORE_DOCS);
assertTrue(rightDocs.docID() == -1 || rightDocs.docID() == DocIdSetIterator.NO_MORE_DOCS);
int docid;
while ((docid = leftDocs.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
assertEquals(docid, rightDocs.nextDoc());
int freq = leftDocs.freq();
assertEquals(freq, rightDocs.freq());
for (int i = 0; i < freq; i++) {
assertEquals(leftDocs.nextPosition(), rightDocs.nextPosition());
// we don't assert offsets/payloads, they are allowed to be different
}
}
assertEquals(DocIdSetIterator.NO_MORE_DOCS, rightDocs.nextDoc());
} | void function(DocsAndPositionsEnum leftDocs, DocsAndPositionsEnum rightDocs) throws Exception { if (leftDocs == null rightDocs == null) { assertNull(leftDocs); assertNull(rightDocs); return; } assertTrue(leftDocs.docID() == -1 leftDocs.docID() == DocIdSetIterator.NO_MORE_DOCS); assertTrue(rightDocs.docID() == -1 rightDocs.docID() == DocIdSetIterator.NO_MORE_DOCS); int docid; while ((docid = leftDocs.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) { assertEquals(docid, rightDocs.nextDoc()); int freq = leftDocs.freq(); assertEquals(freq, rightDocs.freq()); for (int i = 0; i < freq; i++) { assertEquals(leftDocs.nextPosition(), rightDocs.nextPosition()); } } assertEquals(DocIdSetIterator.NO_MORE_DOCS, rightDocs.nextDoc()); } | /**
* checks docs + freqs + positions + payloads, sequentially
*/ | checks docs + freqs + positions + payloads, sequentially | assertDocsAndPositionsEnum | {
"repo_name": "pkarmstr/NYBC",
"path": "solr-4.2.1/lucene/core/src/test/org/apache/lucene/codecs/lucene41/TestBlockPostingsFormat3.java",
"license": "apache-2.0",
"size": 23709
} | [
"org.apache.lucene.index.DocsAndPositionsEnum",
"org.apache.lucene.search.DocIdSetIterator"
] | import org.apache.lucene.index.DocsAndPositionsEnum; import org.apache.lucene.search.DocIdSetIterator; | import org.apache.lucene.index.*; import org.apache.lucene.search.*; | [
"org.apache.lucene"
] | org.apache.lucene; | 2,594,022 |
public StringBuilder execCommandLineVCS(String prefix, String execFromDir, String command, List<String> args, List<String> envList, String vcsIgnoreMessages) throws CompositeException;
| StringBuilder function(String prefix, String execFromDir, String command, List<String> args, List<String> envList, String vcsIgnoreMessages) throws CompositeException; | /**
* Execute a VCS command line
* @param prefix - the prefix is a message modifier such as the invoking method name that gets prefixed to log messages
* @param execFromDir - execute the command from this directory
* @param command - command to execute e.g. svn,p4,cvs
* @param args - argument list
* @param envList - environment variable list
* @param vcsIgnoreMessages - comma separate list of error messages to ignore upon command execution
* @throws CompositeException
*/ | Execute a VCS command line | execCommandLineVCS | {
"repo_name": "dvbu-test/PDTool",
"path": "src/com/cisco/dvbu/ps/deploytool/dao/VCSDAO.java",
"license": "bsd-3-clause",
"size": 4423
} | [
"com.cisco.dvbu.ps.common.exception.CompositeException",
"java.util.List"
] | import com.cisco.dvbu.ps.common.exception.CompositeException; import java.util.List; | import com.cisco.dvbu.ps.common.exception.*; import java.util.*; | [
"com.cisco.dvbu",
"java.util"
] | com.cisco.dvbu; java.util; | 1,655,162 |
@Override
public boolean isSourceModified(Resource resource)
{
String rootPath = servletContext.getRealPath("/");
if (rootPath == null)
{
// rootPath is null if the servlet container cannot translate the
// virtual path to a real path for any reason (such as when the
// content is being made available from a .war archive)
return false;
}
// first, try getting the previously found file
String fileName = resource.getName();
File cachedFile = getCachedFile(rootPath, fileName);
if (!cachedFile.exists())
{
return true;
}
File currentFile = null;
for (int i = 0; i < paths.length; i++)
{
currentFile = new File(rootPath + paths[i], fileName);
if (currentFile.canRead())
{
break;
}
}
if (cachedFile.equals(currentFile) && cachedFile.canRead())
{
return (cachedFile.lastModified() != resource.getLastModified());
}
else
{
return true;
}
} | boolean function(Resource resource) { String rootPath = servletContext.getRealPath("/"); if (rootPath == null) { return false; } String fileName = resource.getName(); File cachedFile = getCachedFile(rootPath, fileName); if (!cachedFile.exists()) { return true; } File currentFile = null; for (int i = 0; i < paths.length; i++) { currentFile = new File(rootPath + paths[i], fileName); if (currentFile.canRead()) { break; } } if (cachedFile.equals(currentFile) && cachedFile.canRead()) { return (cachedFile.lastModified() != resource.getLastModified()); } else { return true; } } | /**
* Checks to see if a resource has been deleted, moved or modified.
*
* @param resource
* Resource The resource to check for modification
* @return boolean True if the resource has been modified
*/ | Checks to see if a resource has been deleted, moved or modified | isSourceModified | {
"repo_name": "marktriggs/nyu-sakai-10.4",
"path": "login/login-render-engine-impl/impl/src/java/org/sakaiproject/login/impl/velocity/WebappLoader.java",
"license": "apache-2.0",
"size": 8198
} | [
"java.io.File",
"org.apache.velocity.runtime.resource.Resource"
] | import java.io.File; import org.apache.velocity.runtime.resource.Resource; | import java.io.*; import org.apache.velocity.runtime.resource.*; | [
"java.io",
"org.apache.velocity"
] | java.io; org.apache.velocity; | 111,676 |
private void applyDelegateRelationship(
DelegateRelationship delegateRelationship) {
ObjectType delegatorObject = ObjectType.cast(
typeRegistry.getType(delegateRelationship.delegator));
ObjectType delegateBaseObject = ObjectType.cast(
typeRegistry.getType(delegateRelationship.delegateBase));
ObjectType delegateSuperObject = ObjectType.cast(
typeRegistry.getType(codingConvention.getDelegateSuperclassName()));
if (delegatorObject != null &&
delegateBaseObject != null &&
delegateSuperObject != null) {
FunctionType delegatorCtor = delegatorObject.getConstructor();
FunctionType delegateBaseCtor = delegateBaseObject.getConstructor();
FunctionType delegateSuperCtor = delegateSuperObject.getConstructor();
if (delegatorCtor != null && delegateBaseCtor != null &&
delegateSuperCtor != null) {
FunctionParamBuilder functionParamBuilder =
new FunctionParamBuilder(typeRegistry);
functionParamBuilder.addRequiredParams(
getNativeType(U2U_CONSTRUCTOR_TYPE));
FunctionType findDelegate = typeRegistry.createFunctionType(
typeRegistry.createDefaultObjectUnion(delegateBaseObject),
functionParamBuilder.build());
FunctionType delegateProxy = typeRegistry.createConstructorType(
delegateBaseObject.getReferenceName() + DELEGATE_PROXY_SUFFIX,
null, null, null, null);
delegateProxy.setPrototypeBasedOn(delegateBaseObject);
codingConvention.applyDelegateRelationship(
delegateSuperObject, delegateBaseObject, delegatorObject,
delegateProxy, findDelegate);
delegateProxyPrototypes.add(delegateProxy.getPrototype());
}
}
} | void function( DelegateRelationship delegateRelationship) { ObjectType delegatorObject = ObjectType.cast( typeRegistry.getType(delegateRelationship.delegator)); ObjectType delegateBaseObject = ObjectType.cast( typeRegistry.getType(delegateRelationship.delegateBase)); ObjectType delegateSuperObject = ObjectType.cast( typeRegistry.getType(codingConvention.getDelegateSuperclassName())); if (delegatorObject != null && delegateBaseObject != null && delegateSuperObject != null) { FunctionType delegatorCtor = delegatorObject.getConstructor(); FunctionType delegateBaseCtor = delegateBaseObject.getConstructor(); FunctionType delegateSuperCtor = delegateSuperObject.getConstructor(); if (delegatorCtor != null && delegateBaseCtor != null && delegateSuperCtor != null) { FunctionParamBuilder functionParamBuilder = new FunctionParamBuilder(typeRegistry); functionParamBuilder.addRequiredParams( getNativeType(U2U_CONSTRUCTOR_TYPE)); FunctionType findDelegate = typeRegistry.createFunctionType( typeRegistry.createDefaultObjectUnion(delegateBaseObject), functionParamBuilder.build()); FunctionType delegateProxy = typeRegistry.createConstructorType( delegateBaseObject.getReferenceName() + DELEGATE_PROXY_SUFFIX, null, null, null, null); delegateProxy.setPrototypeBasedOn(delegateBaseObject); codingConvention.applyDelegateRelationship( delegateSuperObject, delegateBaseObject, delegatorObject, delegateProxy, findDelegate); delegateProxyPrototypes.add(delegateProxy.getPrototype()); } } } | /**
* Apply special properties that only apply to delegates.
*/ | Apply special properties that only apply to delegates | applyDelegateRelationship | {
"repo_name": "rintaro/closure-compiler",
"path": "src/com/google/javascript/jscomp/TypedScopeCreator.java",
"license": "apache-2.0",
"size": 81918
} | [
"com.google.javascript.jscomp.CodingConvention",
"com.google.javascript.rhino.jstype.FunctionParamBuilder",
"com.google.javascript.rhino.jstype.FunctionType",
"com.google.javascript.rhino.jstype.ObjectType"
] | import com.google.javascript.jscomp.CodingConvention; import com.google.javascript.rhino.jstype.FunctionParamBuilder; import com.google.javascript.rhino.jstype.FunctionType; import com.google.javascript.rhino.jstype.ObjectType; | import com.google.javascript.jscomp.*; import com.google.javascript.rhino.jstype.*; | [
"com.google.javascript"
] | com.google.javascript; | 1,274,372 |
@Override
public void close() {
try {
gCtx.cudaFreeHelper(outPointer, true);
} catch (DMLRuntimeException e) {
throw new RuntimeException(e);
}
} | void function() { try { gCtx.cudaFreeHelper(outPointer, true); } catch (DMLRuntimeException e) { throw new RuntimeException(e); } } | /**
* Deallocates temporary pointer
*/ | Deallocates temporary pointer | close | {
"repo_name": "dusenberrymw/systemml",
"path": "src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixCuDNNInputRowFetcher.java",
"license": "apache-2.0",
"size": 3605
} | [
"org.apache.sysml.runtime.DMLRuntimeException"
] | import org.apache.sysml.runtime.DMLRuntimeException; | import org.apache.sysml.runtime.*; | [
"org.apache.sysml"
] | org.apache.sysml; | 2,095,895 |
public synchronized void update() {
try {
ClientStatus updatedStatus = Monitor.getClientStatus();
// update notification, only after change in status
if (clientNotification.mOldComputingStatus == -1
|| updatedStatus.computingStatus.intValue() != clientNotification.mOldComputingStatus
|| (updatedStatus.computingStatus == ClientStatus.COMPUTING_STATUS_SUSPENDED
&& updatedStatus.computingSuspendReason != clientNotification.mOldSuspendReason)) {
buildNotification(updatedStatus);
// update notification
if(foreground || Monitor.getAppPrefs().getShowNotification()) nm.notify(notificationId, n);
// save status for comparison next time
clientNotification.mOldComputingStatus = updatedStatus.computingStatus;
clientNotification.mOldSuspendReason = updatedStatus.computingSuspendReason;
}
} catch (Exception e) {if(Logging.WARNING) Log.d(Logging.TAG, "ClientNotification.update failed.");}
}
| synchronized void function() { try { ClientStatus updatedStatus = Monitor.getClientStatus(); if (clientNotification.mOldComputingStatus == -1 updatedStatus.computingStatus.intValue() != clientNotification.mOldComputingStatus (updatedStatus.computingStatus == ClientStatus.COMPUTING_STATUS_SUSPENDED && updatedStatus.computingSuspendReason != clientNotification.mOldSuspendReason)) { buildNotification(updatedStatus); if(foreground Monitor.getAppPrefs().getShowNotification()) nm.notify(notificationId, n); clientNotification.mOldComputingStatus = updatedStatus.computingStatus; clientNotification.mOldSuspendReason = updatedStatus.computingSuspendReason; } } catch (Exception e) {if(Logging.WARNING) Log.d(Logging.TAG, STR);} } | /**
* Updates notification with client's current status
*/ | Updates notification with client's current status | update | {
"repo_name": "xiaobozi/boinc",
"path": "android/BOINC/src/edu/berkeley/boinc/client/ClientNotification.java",
"license": "gpl-3.0",
"size": 5104
} | [
"android.util.Log",
"edu.berkeley.boinc.utils.Logging"
] | import android.util.Log; import edu.berkeley.boinc.utils.Logging; | import android.util.*; import edu.berkeley.boinc.utils.*; | [
"android.util",
"edu.berkeley.boinc"
] | android.util; edu.berkeley.boinc; | 1,867,242 |
public boolean removeMember(final UUID uuid) {
if (this.members == null) {
return false;
}
if (uuid == DBFunc.everyone) {
boolean result = false;
for (final UUID other : new HashSet<>(this.members)) {
result = result || rmvMember(other);
}
return result;
}
return rmvMember(uuid);
} | boolean function(final UUID uuid) { if (this.members == null) { return false; } if (uuid == DBFunc.everyone) { boolean result = false; for (final UUID other : new HashSet<>(this.members)) { result = result rmvMember(other); } return result; } return rmvMember(uuid); } | /**
* Remove a trusted user (use DBFunc as well)<br>
* Using the * uuid will remove all users
* @param uuid
*/ | Remove a trusted user (use DBFunc as well) Using the * uuid will remove all users | removeMember | {
"repo_name": "SilverCory/PlotSquared",
"path": "Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java",
"license": "gpl-3.0",
"size": 98015
} | [
"com.intellectualcrafters.plot.database.DBFunc",
"java.util.HashSet"
] | import com.intellectualcrafters.plot.database.DBFunc; import java.util.HashSet; | import com.intellectualcrafters.plot.database.*; import java.util.*; | [
"com.intellectualcrafters.plot",
"java.util"
] | com.intellectualcrafters.plot; java.util; | 1,262,032 |
public void close() {
if (task != null) {
task.suspend();
task.prepareCommit();
task.postCommit(true);
task.closeClean();
}
if (globalStateTask != null) {
try {
globalStateTask.close(false);
} catch (final IOException e) {
// ignore
}
}
completeAllProcessableWork();
if (task != null && task.hasRecordsQueued()) {
log.warn("Found some records that cannot be processed due to the" +
" {} configuration during TopologyTestDriver#close().",
StreamsConfig.MAX_TASK_IDLE_MS_CONFIG);
}
if (processingMode == AT_LEAST_ONCE) {
producer.close();
}
stateDirectory.clean();
}
static class MockChangelogRegister implements ChangelogRegister {
private final Set<TopicPartition> restoringPartitions = new HashSet<>(); | void function() { if (task != null) { task.suspend(); task.prepareCommit(); task.postCommit(true); task.closeClean(); } if (globalStateTask != null) { try { globalStateTask.close(false); } catch (final IOException e) { } } completeAllProcessableWork(); if (task != null && task.hasRecordsQueued()) { log.warn(STR + STR, StreamsConfig.MAX_TASK_IDLE_MS_CONFIG); } if (processingMode == AT_LEAST_ONCE) { producer.close(); } stateDirectory.clean(); } static class MockChangelogRegister implements ChangelogRegister { private final Set<TopicPartition> restoringPartitions = new HashSet<>(); | /**
* Close the driver, its topology, and all processors.
*/ | Close the driver, its topology, and all processors | close | {
"repo_name": "TiVo/kafka",
"path": "streams/test-utils/src/main/java/org/apache/kafka/streams/TopologyTestDriver.java",
"license": "apache-2.0",
"size": 62007
} | [
"java.io.IOException",
"java.util.HashSet",
"java.util.Set",
"org.apache.kafka.common.TopicPartition",
"org.apache.kafka.streams.processor.internals.ChangelogRegister"
] | import java.io.IOException; import java.util.HashSet; import java.util.Set; import org.apache.kafka.common.TopicPartition; import org.apache.kafka.streams.processor.internals.ChangelogRegister; | import java.io.*; import java.util.*; import org.apache.kafka.common.*; import org.apache.kafka.streams.processor.internals.*; | [
"java.io",
"java.util",
"org.apache.kafka"
] | java.io; java.util; org.apache.kafka; | 1,229,863 |
public void setDateModified(Timestamp value) {
set(3, value);
} | void function(Timestamp value) { set(3, value); } | /**
* Setter for <code>sugarcrm_4_12.ss_customer_invoices.date_modified</code>.
*/ | Setter for <code>sugarcrm_4_12.ss_customer_invoices.date_modified</code> | setDateModified | {
"repo_name": "SmartMedicalServices/SpringJOOQ",
"path": "src/main/java/com/sms/sis/db/tables/records/SsCustomerInvoicesRecord.java",
"license": "gpl-3.0",
"size": 15000
} | [
"java.sql.Timestamp"
] | import java.sql.Timestamp; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,075,951 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<ApplicationInsightsComponentBillingFeaturesInner>> getWithResponseAsync(
String resourceGroupName, String resourceName) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
final String apiVersion = "2015-05-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.get(
this.client.getEndpoint(),
resourceGroupName,
apiVersion,
this.client.getSubscriptionId(),
resourceName,
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<ApplicationInsightsComponentBillingFeaturesInner>> function( String resourceGroupName, String resourceName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceName == null) { return Mono.error(new IllegalArgumentException(STR)); } final String apiVersion = STR; final String accept = STR; return FluxUtil .withContext( context -> service .get( this.client.getEndpoint(), resourceGroupName, apiVersion, this.client.getSubscriptionId(), resourceName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } | /**
* Returns current billing features for an Application Insights component.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param resourceName The name of the Application Insights component resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an Application Insights component billing features along with {@link Response} on successful completion
* of {@link Mono}.
*/ | Returns current billing features for an Application Insights component | getWithResponseAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/ComponentCurrentBillingFeaturesClientImpl.java",
"license": "mit",
"size": 22402
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.FluxUtil",
"com.azure.resourcemanager.applicationinsights.fluent.models.ApplicationInsightsComponentBillingFeaturesInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.applicationinsights.fluent.models.ApplicationInsightsComponentBillingFeaturesInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.applicationinsights.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 374,460 |
protected Validator getValidator() {
return null;
} | Validator function() { return null; } | /**
* Override this method to provide a custom {@link Validator}.
*/ | Override this method to provide a custom <code>Validator</code> | getValidator | {
"repo_name": "qobel/esoguproject",
"path": "spring-framework/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java",
"license": "apache-2.0",
"size": 35035
} | [
"org.springframework.validation.Validator"
] | import org.springframework.validation.Validator; | import org.springframework.validation.*; | [
"org.springframework.validation"
] | org.springframework.validation; | 1,135,400 |
protected void removeNeighborFromOrdering(TrustGraphNodeId neighbor) {
ListIterator<TrustGraphNodeId> i = orderedNeighbors.listIterator();
while (i.hasNext()) {
TrustGraphNodeId cur = i.next();
if (cur.equals(neighbor)) {
i.remove();
}
}
} | void function(TrustGraphNodeId neighbor) { ListIterator<TrustGraphNodeId> i = orderedNeighbors.listIterator(); while (i.hasNext()) { TrustGraphNodeId cur = i.next(); if (cur.equals(neighbor)) { i.remove(); } } } | /**
* Internal helper method.
*
* Implements the policy for removing a neighbor from the random
* ordering. By default, this just removes the neighbor.
*
* This method assumes that any necessary locking is performed externally.
*/ | Internal helper method. Implements the policy for removing a neighbor from the random ordering. By default, this just removes the neighbor. This method assumes that any necessary locking is performed externally | removeNeighborFromOrdering | {
"repo_name": "getlantern/kaleidoscope",
"path": "src/main/java/org/kaleidoscope/BasicRandomRoutingTable.java",
"license": "mit",
"size": 28084
} | [
"java.util.ListIterator"
] | import java.util.ListIterator; | import java.util.*; | [
"java.util"
] | java.util; | 1,531,397 |
@NotNull
@Override
public List<DefaultTemplateChainProviderTemplate<GlobalTemplateContext>> retrieveTemplates(
@NotNull final QueryJCommand parameters)
throws QueryJBuildException
{
@NotNull final List<DefaultTemplateChainProviderTemplate<GlobalTemplateContext>> result;
@Nullable final List<DefaultTemplateChainProviderTemplate<GlobalTemplateContext>> aux =
new QueryJCommandWrapper<DefaultTemplateChainProviderTemplate<GlobalTemplateContext>>(parameters)
.getListSetting(DEFAULT_TEMPLATE_CHAIN_PROVIDER_TEMPLATE);
if (aux == null)
{
throw new MissingTemplatesException("default-template-chain-provider");
}
else
{
result = aux;
}
return result;
} | List<DefaultTemplateChainProviderTemplate<GlobalTemplateContext>> function( @NotNull final QueryJCommand parameters) throws QueryJBuildException { @NotNull final List<DefaultTemplateChainProviderTemplate<GlobalTemplateContext>> result; @Nullable final List<DefaultTemplateChainProviderTemplate<GlobalTemplateContext>> aux = new QueryJCommandWrapper<DefaultTemplateChainProviderTemplate<GlobalTemplateContext>>(parameters) .getListSetting(DEFAULT_TEMPLATE_CHAIN_PROVIDER_TEMPLATE); if (aux == null) { throw new MissingTemplatesException(STR); } else { result = aux; } return result; } | /**
* Retrieves the templates from the command.
* @param parameters the parameters.
* @return the template.
*/ | Retrieves the templates from the command | retrieveTemplates | {
"repo_name": "rydnr/queryj-rt",
"path": "queryj-template-packaging/src/main/java/org/acmsl/queryj/templates/packaging/handlers/DefaultTemplateChainProviderTemplateWritingHandler.java",
"license": "gpl-2.0",
"size": 4363
} | [
"java.util.List",
"org.acmsl.queryj.QueryJCommand",
"org.acmsl.queryj.QueryJCommandWrapper",
"org.acmsl.queryj.api.exceptions.QueryJBuildException",
"org.acmsl.queryj.templates.packaging.DefaultTemplateChainProviderTemplate",
"org.acmsl.queryj.templates.packaging.GlobalTemplateContext",
"org.acmsl.queryj.templates.packaging.exceptions.MissingTemplatesException",
"org.jetbrains.annotations.NotNull",
"org.jetbrains.annotations.Nullable"
] | import java.util.List; import org.acmsl.queryj.QueryJCommand; import org.acmsl.queryj.QueryJCommandWrapper; import org.acmsl.queryj.api.exceptions.QueryJBuildException; import org.acmsl.queryj.templates.packaging.DefaultTemplateChainProviderTemplate; import org.acmsl.queryj.templates.packaging.GlobalTemplateContext; import org.acmsl.queryj.templates.packaging.exceptions.MissingTemplatesException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; | import java.util.*; import org.acmsl.queryj.*; import org.acmsl.queryj.api.exceptions.*; import org.acmsl.queryj.templates.packaging.*; import org.acmsl.queryj.templates.packaging.exceptions.*; import org.jetbrains.annotations.*; | [
"java.util",
"org.acmsl.queryj",
"org.jetbrains.annotations"
] | java.util; org.acmsl.queryj; org.jetbrains.annotations; | 606,998 |
public void create(String homeName, Object obj)
throws SQLException
{
// ejb/0g22 exception handling
try {
createInternal(homeName, obj);
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new EJBExceptionWrapper(e);
}
} | void function(String homeName, Object obj) throws SQLException { try { createInternal(homeName, obj); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new EJBExceptionWrapper(e); } } | /**
* Saves the object.
*
* @param obj the object to create
*/ | Saves the object | create | {
"repo_name": "dlitz/resin",
"path": "modules/resin/src/com/caucho/amber/manager/AmberConnection.java",
"license": "gpl-2.0",
"size": 89822
} | [
"com.caucho.ejb.EJBExceptionWrapper",
"java.sql.SQLException"
] | import com.caucho.ejb.EJBExceptionWrapper; import java.sql.SQLException; | import com.caucho.ejb.*; import java.sql.*; | [
"com.caucho.ejb",
"java.sql"
] | com.caucho.ejb; java.sql; | 2,310,803 |
private PlatformEventFilterListener localFilter(long hnd) {
return platformCtx.createLocalEventFilter(hnd);
}
private static class EventResultWriter implements PlatformFutureUtils.Writer {
private final PlatformContext platformCtx;
public EventResultWriter(PlatformContext platformCtx) {
assert platformCtx != null;
this.platformCtx = platformCtx;
} | PlatformEventFilterListener function(long hnd) { return platformCtx.createLocalEventFilter(hnd); } private static class EventResultWriter implements PlatformFutureUtils.Writer { private final PlatformContext platformCtx; public EventResultWriter(PlatformContext platformCtx) { assert platformCtx != null; this.platformCtx = platformCtx; } | /**
* Creates an interop filter from handle.
*
* @param hnd Handle.
* @return Interop filter.
*/ | Creates an interop filter from handle | localFilter | {
"repo_name": "ilantukh/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/platform/events/PlatformEvents.java",
"license": "apache-2.0",
"size": 13594
} | [
"org.apache.ignite.internal.processors.platform.PlatformContext",
"org.apache.ignite.internal.processors.platform.PlatformEventFilterListener",
"org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils"
] | import org.apache.ignite.internal.processors.platform.PlatformContext; import org.apache.ignite.internal.processors.platform.PlatformEventFilterListener; import org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils; | import org.apache.ignite.internal.processors.platform.*; import org.apache.ignite.internal.processors.platform.utils.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 2,789,619 |
public double getDouble( String columnName ) throws SQLException {
return getDouble( findColumn( columnName ) );
} | double function( String columnName ) throws SQLException { return getDouble( findColumn( columnName ) ); } | /**
* Retrieves the value of the designated column in the current row
* of this <code>ResultSet</code> object as
* a <code>double</code> in the Java programming language.
*
* @param columnName the SQL name of the column
* @return the column value; if the value is SQL <code>NULL</code>, the
* value returned is <code>0</code>
* @exception SQLException if a database access error occurs
*/ | Retrieves the value of the designated column in the current row of this <code>ResultSet</code> object as a <code>double</code> in the Java programming language | getDouble | {
"repo_name": "OpenBD/openbd-core",
"path": "src/com/naryx/tagfusion/cfm/engine/cfQueryResultData.java",
"license": "gpl-3.0",
"size": 154192
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 720,202 |
public List<ApplicationResourceInner> value() {
return this.value;
} | List<ApplicationResourceInner> function() { return this.value; } | /**
* Get the value property: The value property.
*
* @return the value value.
*/ | Get the value property: The value property | value | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/servicefabric/azure-resourcemanager-servicefabric/src/main/java/com/azure/resourcemanager/servicefabric/fluent/models/ApplicationResourceListInner.java",
"license": "mit",
"size": 1983
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,733,300 |
public void rowReadEvent( final RowMetaInterface rowMeta, final Object[] row ) throws KettleStepException {
} | void function( final RowMetaInterface rowMeta, final Object[] row ) throws KettleStepException { } | /**
* This method is called when a row is read from another step
*
* @param rowMeta the metadata of the row
* @param row the data of the row
* @throws KettleStepException an exception that can be thrown to hard stop the step
*/ | This method is called when a row is read from another step | rowReadEvent | {
"repo_name": "davidmsantos90/cda",
"path": "pentaho/src/main/java/pt/webdetails/cda/dataaccess/CdaPentahoKettleTransFromFileProducer.java",
"license": "mpl-2.0",
"size": 15839
} | [
"org.pentaho.di.core.exception.KettleStepException",
"org.pentaho.di.core.row.RowMetaInterface"
] | import org.pentaho.di.core.exception.KettleStepException; import org.pentaho.di.core.row.RowMetaInterface; | import org.pentaho.di.core.exception.*; import org.pentaho.di.core.row.*; | [
"org.pentaho.di"
] | org.pentaho.di; | 2,018,601 |
protected static String parseZone(URL url) {
String path = url.getPath();
path = StringUtils.removeStart(path, "/");
path = StringUtils.removeEnd(path, "/");
String zone = path;
if (path != null && StringUtils.countMatches(path, "/") == 1) {
String[] paths = path.split("/");
zone = paths[0];
}
return zone;
}
| static String function(URL url) { String path = url.getPath(); path = StringUtils.removeStart(path, "/"); path = StringUtils.removeEnd(path, "/"); String zone = path; if (path != null && StringUtils.countMatches(path, "/") == 1) { String[] paths = path.split("/"); zone = paths[0]; } return zone; } | /**
* Zone should be the first path entity
*
* dns://<host>/<zone>[/<foreign source>][/<?expression=<regex>>
*
* @param url a {@link java.net.URL} object.
* @return a {@link java.lang.String} object.
*/ | Zone should be the first path entity dns:///[/][/> | parseZone | {
"repo_name": "bugcy013/opennms-tmp-tools",
"path": "opennms-provision/opennms-provisiond/src/main/java/org/opennms/netmgt/provision/service/dns/DnsRequisitionUrlConnection.java",
"license": "gpl-2.0",
"size": 21855
} | [
"org.apache.commons.lang.StringUtils"
] | import org.apache.commons.lang.StringUtils; | import org.apache.commons.lang.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,127,222 |
@Nullable
private NeeoBrainServlet getServletByUrl(String servletUrl) {
NeeoUtil.requireNotEmpty(servletUrl, "ServletURL cannot be empty");
for (NeeoBrainServlet servlet : servlets) {
if (StringUtils.equalsIgnoreCase(servletUrl, servlet.getServletUrl())) {
return servlet;
}
}
return null;
} | NeeoBrainServlet function(String servletUrl) { NeeoUtil.requireNotEmpty(servletUrl, STR); for (NeeoBrainServlet servlet : servlets) { if (StringUtils.equalsIgnoreCase(servletUrl, servlet.getServletUrl())) { return servlet; } } return null; } | /**
* Helper method to get a servlet by it's URL
*
* @param servletUrl a non-null, non-empty servlet URL
* @return the servlet for the URL or null if not found
*/ | Helper method to get a servlet by it's URL | getServletByUrl | {
"repo_name": "MikeJMajor/openhab2-addons-dlinksmarthome",
"path": "bundles/org.openhab.io.neeo/src/main/java/org/openhab/io/neeo/NeeoService.java",
"license": "epl-1.0",
"size": 18104
} | [
"org.apache.commons.lang.StringUtils",
"org.openhab.io.neeo.internal.NeeoBrainServlet",
"org.openhab.io.neeo.internal.NeeoUtil"
] | import org.apache.commons.lang.StringUtils; import org.openhab.io.neeo.internal.NeeoBrainServlet; import org.openhab.io.neeo.internal.NeeoUtil; | import org.apache.commons.lang.*; import org.openhab.io.neeo.internal.*; | [
"org.apache.commons",
"org.openhab.io"
] | org.apache.commons; org.openhab.io; | 2,351,406 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.